-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from xissburg/refactor
Refactor
- Loading branch information
Showing
44 changed files
with
743 additions
and
689 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ Doxygen/ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
# VSCode | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
function(Ogre_glTF_config_sample PROJECTNAME) | ||
file(GLOB SOURCES ./*.cpp ./*.hpp ./include/*.hpp) | ||
|
||
add_executable(${PROJECTNAME} WIN32 MACOSX_BUNDLE ${SAMPLES_COMMON_HEADER_FILES} ${SAMPLES_COMMON_SOURCE_FILES} ${SOURCES}) | ||
add_dependencies(${PROJECTNAME} Ogre_glTF) | ||
|
||
target_include_directories( ${PROJECTNAME} PUBLIC | ||
#Ogre and the physics based high level material system | ||
${OGRE_INCLUDE_DIRS} | ||
${OGRE_HlmsPbs_INCLUDE_DIRS} | ||
${OGRE_INCLUDE_DIR}/Hlms/Common | ||
${CMAKE_SOURCE_DIR}/Samples/Common | ||
) | ||
|
||
target_link_libraries(${PROJECTNAME} | ||
${OGRE_LIBRARIES} | ||
${OGRE_HlmsPbs_LIBRARIES} | ||
Ogre_glTF | ||
) | ||
|
||
if (Ogre_glTF_STATIC AND UNIX) | ||
target_link_libraries(${PROJECTNAME} | ||
${OGRE_RenderSystem_GL3Plus_LIBRARIES} | ||
) | ||
|
||
if (NOT APPLE) | ||
target_link_libraries(${PROJECTNAME} | ||
dl | ||
pthread | ||
Xt | ||
X11 | ||
Xaw | ||
Xrandr | ||
) | ||
endif () | ||
endif () | ||
|
||
set_target_properties(${PROJECTNAME} PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) | ||
set_property(TARGET ${PROJECTNAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
endfunction(Ogre_glTF_config_sample) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
add_subdirectory(Common) | ||
add_subdirectory(LoadMesh) | ||
add_subdirectory(SkinnedMesh) | ||
|
||
add_custom_target(CopyHLMS ALL | ||
${CMAKE_COMMAND} -E copy_directory ${OGRE_MEDIA_DIR}/Hlms ${PROJECT_BINARY_DIR}/Media/Hlms | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set(SAMPLES_COMMON_HEADER_FILES SamplesCommon.h) | ||
set(SAMPLES_COMMON_SOURCE_FILES SamplesCommon.cpp) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#include <Ogre.h> | ||
//To create workspace definitions and workspaces | ||
#include <Compositor/OgreCompositorManager2.h> | ||
//To use the hlms | ||
#include <Hlms/Pbs/OgreHlmsPbs.h> | ||
#include <OgreHlms.h> | ||
//To load Hlms | ||
#include <OgreArchive.h> | ||
//To use objects | ||
#include <OgreItem.h> | ||
#include <OgreMesh2.h> | ||
#include <OgreSubMesh2.h> | ||
#include <Hlms/Pbs/OgreHlmsPbsDatablock.h> | ||
//To play animations | ||
#include <Animation/OgreSkeletonAnimation.h> | ||
//To use smart pointers | ||
#include <memory> | ||
|
||
//The library we are trying out in this program | ||
#include <Ogre_glTF.hpp> | ||
|
||
#ifdef _DEBUG | ||
const char GL_RENDER_PLUGIN[] = "RenderSystem_GL3Plus_d"; | ||
#else | ||
const char GL_RENDER_PLUGIN[] = "RenderSystem_GL3Plus"; | ||
#endif | ||
|
||
#ifdef _WIN32 | ||
#ifdef _DEBUG | ||
const char D3D11_RENDER_PLUGIN[] = "RenderSystem_Direct3D11_d"; | ||
#else | ||
const char D3D11_RENDER_PLUGIN[] = "RenderSystem_Direct3D11"; | ||
#endif | ||
#endif | ||
|
||
#ifdef Ogre_glTF_STATIC | ||
#include <RenderSystems/GL3Plus/OgreGL3PlusPlugin.h> | ||
#endif | ||
|
||
#ifdef _WIN32 | ||
#define NOMINMAX | ||
#include <windows.h> | ||
#define main() WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT) | ||
#else | ||
#define main() main(int argc, char* argv[]) | ||
#endif | ||
|
||
void DeclareHlmsLibrary(Ogre::String dataFolder) | ||
{ | ||
//Make sure the string we got is a valid path | ||
if(dataFolder.empty()) | ||
dataFolder = "./"; | ||
else if(dataFolder[dataFolder.size() - 1] != '/') | ||
dataFolder += '/'; | ||
|
||
//For retrieval of the paths to the different folders needed | ||
Ogre::String dataFolderPath; | ||
Ogre::StringVector libraryFoldersPaths; | ||
|
||
#ifdef USE_UNLIT //We are loading materials based on physics | ||
//Get the path to all the subdirectories used by HlmsUnlit | ||
Ogre::HlmsUnlit::getDefaultPaths(dataFolderPath, libraryFoldersPaths); | ||
|
||
//Create the Ogre::Archive objects needed | ||
Ogre::Archive* archiveUnlit = Ogre::ArchiveManager::getSingletonPtr()->load(dataFolder + dataFolderPath, "FileSystem", true); | ||
Ogre::ArchiveVec archiveUnlitLibraryFolders; | ||
for(const auto& libraryFolderPath : libraryFoldersPaths) | ||
{ | ||
Ogre::Archive* archiveLibrary = Ogre::ArchiveManager::getSingletonPtr()->load(dataFolder + libraryFolderPath, "FileSystem", true); | ||
archiveUnlitLibraryFolders.push_back(archiveLibrary); | ||
} | ||
|
||
//Create and register the unlit Hlms | ||
Ogre::HlmsUnlit* hlmsUnlit = OGRE_NEW Ogre::HlmsUnlit(archiveUnlit, &archiveUnlitLibraryFolders); | ||
Ogre::Root::getSingleton().getHlmsManager()->registerHlms(hlmsUnlit); | ||
hlmsUnlit->setDebugOutputPath(false, false); | ||
#endif | ||
|
||
//Do the same for HlmsPbs: | ||
Ogre::HlmsPbs::getDefaultPaths(dataFolderPath, libraryFoldersPaths); | ||
Ogre::Archive* archivePbs = Ogre::ArchiveManager::getSingletonPtr()->load(dataFolder + dataFolderPath, "FileSystem", true); | ||
|
||
//Get the library archive(s) | ||
Ogre::ArchiveVec archivePbsLibraryFolders; | ||
for(const auto& libraryFolderPath : libraryFoldersPaths) | ||
{ | ||
Ogre::Archive* archiveLibrary = Ogre::ArchiveManager::getSingletonPtr()->load(dataFolder + libraryFolderPath, "FileSystem", true); | ||
archivePbsLibraryFolders.push_back(archiveLibrary); | ||
} | ||
|
||
//Create and register | ||
Ogre::HlmsPbs* hlmsPbs = OGRE_NEW Ogre::HlmsPbs(archivePbs, &archivePbsLibraryFolders); | ||
Ogre::Root::getSingleton().getHlmsManager()->registerHlms(hlmsPbs); | ||
hlmsPbs->setDebugOutputPath(false, false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Ogre_glTF_config_sample(LoadMesh) |
Oops, something went wrong.