forked from OGRECave/ogre
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start migrating custom HLMS version for Ogre 1.10 (documentation / pb…
…s shader / sample will follow) Backported a few things from 2.1 which is needed like Threading / Hashing / IdString
- Loading branch information
1 parent
b4336ef
commit c4bc172
Showing
43 changed files
with
5,346 additions
and
4 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 |
---|---|---|
|
@@ -27,4 +27,5 @@ AndroidBuild/ | |
AndroidDependencies/ | ||
Build/ | ||
EmscriptenDependencies | ||
EmscriptenBuild | ||
EmscriptenBuild | ||
buildx64 |
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
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,42 @@ | ||
#------------------------------------------------------------------- | ||
# This file is part of the CMake build system for OGRE | ||
# (Object-oriented Graphics Rendering Engine) | ||
# For the latest info, see http://www.ogre3d.org/ | ||
# | ||
# The contents of this file are placed in the public domain. Feel | ||
# free to make use of it in any way you like. | ||
#------------------------------------------------------------------- | ||
|
||
############################################################ | ||
# HLMS optional component | ||
############################################################ | ||
|
||
PROJECT(OgreHLMS) | ||
|
||
# define header and source files for the library | ||
file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") | ||
file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") | ||
|
||
# Add needed definitions | ||
add_definitions(-DOGRE_HLMS_EXPORTS -D_MT -D_USRDLL) | ||
|
||
# include headers | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
include_directories(${OGRE_SOURCE_DIR}/OgreMain/include) | ||
|
||
# setup target | ||
ogre_add_library(OgreHLMS ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES}) | ||
set_target_properties(OgreHLMS PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION}) | ||
target_link_libraries(OgreHLMS OgreMain) | ||
if (OGRE_CONFIG_THREADS) | ||
target_link_libraries(OgreHLMS ${OGRE_THREAD_LIBRARIES}) | ||
endif () | ||
|
||
# install | ||
ogre_config_framework(OgreHLMS) | ||
ogre_config_component(OgreHLMS) | ||
|
||
install(FILES ${HEADER_FILES} | ||
DESTINATION include/OGRE/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,75 @@ | ||
/* | ||
----------------------------------------------------------------------------- | ||
This source file is part of OGRE | ||
(Object-oriented Graphics Rendering Engine) | ||
For the latest info, see http://www.ogre3d.org/ | ||
Copyright (c) 2000-2015 Torus Knot Software Ltd | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
----------------------------------------------------------------------------- | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Ogre.h" | ||
#include "OgreHlmsPrerequisites.h" | ||
#include "OgreHlmsPropertyMap.h" | ||
#include "OgreHlmsShaderTemplate.h" | ||
|
||
namespace Ogre | ||
{ | ||
/** \addtogroup Component | ||
* @{ | ||
*/ | ||
/** \addtogroup Hlms | ||
* @{ | ||
*/ | ||
class _OgreHlmsExport HlmsDatablock | ||
{ | ||
public: | ||
HlmsDatablock(Ogre::GpuProgramType type, PropertyMap* propertyMap); | ||
|
||
PropertyMap* getPropertyMap(){ return mPropertyMap; } | ||
|
||
Ogre::GpuProgramType getShaderType(){ return mShaderType; } | ||
const Ogre::String& getLanguarge(){ return mLanguarge; } | ||
ShaderTemplate* getTemplate(); | ||
const Ogre::StringVector& getProfileList(){ return mProfilesList; } | ||
|
||
void setLanguarge(const Ogre::String& languarge); | ||
void setTemplateName(const Ogre::String& tamplateName); | ||
void addProfile(const Ogre::String& profile); | ||
|
||
Ogre::uint32 getHash(); | ||
|
||
protected: | ||
ShaderTemplate mTemplate; | ||
Ogre::String mTamplateName; | ||
Ogre::String mLanguarge; | ||
Ogre::GpuProgramType mShaderType; | ||
PropertyMap* mPropertyMap; | ||
Ogre::StringVector mProfilesList; // vs_2_0, fs_3_0, ... | ||
|
||
Ogre::uint32 mHash; | ||
|
||
void reload(); | ||
}; | ||
} | ||
|
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,72 @@ | ||
/* | ||
----------------------------------------------------------------------------- | ||
This source file is part of OGRE | ||
(Object-oriented Graphics Rendering Engine) | ||
For the latest info, see http://www.ogre3d.org/ | ||
Copyright (c) 2000-2015 Torus Knot Software Ltd | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
----------------------------------------------------------------------------- | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Ogre.h" | ||
#include "OgreHlmsPrerequisites.h" | ||
#include "OgreHlmsShaderManager.h" | ||
#include "Threading/OgreThreadHeaders.h" | ||
|
||
namespace Ogre | ||
{ | ||
class HlmsMaterialBase; | ||
|
||
/** \addtogroup Component | ||
* @{ | ||
*/ | ||
/** \addtogroup Hlms | ||
* @{ | ||
*/ | ||
class _OgreHlmsExport HlmsManager : public Ogre::RenderObjectListener, public Ogre::Camera::Listener | ||
{ | ||
public: | ||
HlmsManager(Ogre::Camera* camera); | ||
virtual ~HlmsManager(); | ||
|
||
virtual void cameraPreRenderScene(Ogre::Camera* cam); | ||
|
||
virtual void notifyRenderSingleObject( | ||
Ogre::Renderable* rend, | ||
const Ogre::Pass* pass, | ||
const Ogre::AutoParamDataSource* source, | ||
const Ogre::LightList* pLightList, | ||
bool suppressRenderStateChanges); | ||
|
||
void bind(Ogre::Renderable* rend, HlmsMaterialBase* material); | ||
|
||
protected: | ||
Ogre::Camera* mCamera; | ||
Ogre::SceneManager* mSceneManager; | ||
|
||
ShaderManager mShaderManager; | ||
|
||
std::unordered_map<Ogre::Renderable*, HlmsMaterialBase*> mBindedMaterials; | ||
}; | ||
} | ||
|
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,65 @@ | ||
/* | ||
----------------------------------------------------------------------------- | ||
This source file is part of OGRE | ||
(Object-oriented Graphics Rendering Engine) | ||
For the latest info, see http://www.ogre3d.org/ | ||
Copyright (c) 2000-2015 Torus Knot Software Ltd | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
----------------------------------------------------------------------------- | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Ogre.h" | ||
#include "OgreHlmsPrerequisites.h" | ||
#include "OgreHlmsPropertyMap.h" | ||
#include "OgreHlmsDatablock.h" | ||
|
||
namespace Ogre | ||
{ | ||
/** \addtogroup Component | ||
* @{ | ||
*/ | ||
/** \addtogroup Hlms | ||
* @{ | ||
*/ | ||
class _OgreHlmsExport HlmsMaterialBase | ||
{ | ||
public: | ||
HlmsMaterialBase(); | ||
virtual ~HlmsMaterialBase(); | ||
|
||
HlmsDatablock* getVertexDatablock(){ return &mVertexDatablock; } | ||
HlmsDatablock* getFragmentDatablock(){ return &mFragmentDatablock; } | ||
|
||
PropertyMap& getPropertyMap(){ return mPropertyMap; } | ||
|
||
virtual void updatePropertyMap(Ogre::Camera* camera, const Ogre::LightList* pLightList){} | ||
virtual void updateUniforms(Ogre::Camera* camera, Ogre::Pass* pass, const Ogre::AutoParamDataSource* source, const Ogre::LightList* pLightList, bool shaderHasChanged) {} | ||
|
||
protected: | ||
HlmsDatablock mVertexDatablock; | ||
HlmsDatablock mFragmentDatablock; | ||
|
||
PropertyMap mPropertyMap; | ||
}; | ||
} | ||
|
Oops, something went wrong.