Skip to content

Commit

Permalink
Merge pull request #611 from paroj/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
paroj authored Dec 29, 2017
2 parents e83bee4 + 6736168 commit 4bba03c
Show file tree
Hide file tree
Showing 55 changed files with 944 additions and 574 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ matrix:
script:
- cmake -P ci-build.cmake
- BUILD_CMD="cmake --build ."
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then BUILD_CMD="$BUILD_CMD -- -k" ; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then BUILD_CMD="$BUILD_CMD -- -k -j 2" ; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then BUILD_CMD="set -o pipefail && $BUILD_CMD | xcpretty" ; fi
- echo $BUILD_CMD && eval $BUILD_CMD
# run unit tests
Expand Down
4 changes: 3 additions & 1 deletion CMake/Templates/Android_resources.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ APKFileSystem=/fonts
APKFileSystem=/materials/programs
APKFileSystem=/materials/scripts
APKFileSystem=/materials/textures
APKFileSystem=/materials/textures/glTF2_IBL
APKFileSystem=/materials/textures/nvidia
APKFileSystem=/models
APKFileSystem=/particle
Expand All @@ -26,6 +27,7 @@ APKZip=/packs/ogretestmap.zip
APKZip=/packs/ogredance.zip
APKZip=/packs/Sinbad.zip
APKZip=/packs/skybox.zip
APKZip=/packs/DamagedHelmet.zip


APKFileSystem=/PBR
APKFileSystem=/HLMS
4 changes: 4 additions & 0 deletions CMake/Templates/resources.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Zip=@OGRE_MEDIA_DIR_REL@/packs/Sinbad.zip
Zip=@OGRE_MEDIA_DIR_REL@/packs/skybox.zip
Zip=@OGRE_MEDIA_DIR_REL@/volumeTerrain/volumeTerrainBig.zip

FileSystem=@OGRE_MEDIA_DIR_REL@/PBR
FileSystem=@OGRE_MEDIA_DIR_REL@/materials/textures/glTF2_IBL
Zip=@OGRE_MEDIA_DIR_REL@/packs/DamagedHelmet.zip

FileSystem=@OGRE_MEDIA_DIR_REL@/HLMS

# Materials for visual tests
Expand Down
1 change: 1 addition & 0 deletions CMake/Templates/samples.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SamplePlugin=Sample_NewInstancing
SamplePlugin=Sample_Ocean
SamplePlugin=Sample_ParticleGS
SamplePlugin=Sample_ParticleFX
SamplePlugin=Sample_PBR
@OGRE_COMMENT_COMPONENT_RTSHADERSYSTEM@SamplePlugin=Sample_ShaderSystem
@OGRE_COMMENT_COMPONENT_RTSHADERSYSTEM@SamplePlugin=Sample_ShaderSystemMultiLight
@OGRE_COMMENT_COMPONENT_RTSHADERSYSTEM@SamplePlugin=Sample_ShaderSystemTexturedFog
Expand Down
3 changes: 2 additions & 1 deletion CMake/Utils/AndroidMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ macro(copy_assets_to_android_proj)
file(COPY "${CMAKE_SOURCE_DIR}/Samples/Media/packs" DESTINATION "${NDKOUT}/assets")
file(COPY "${CMAKE_SOURCE_DIR}/Samples/Media/materials" DESTINATION "${NDKOUT}/assets")
file(COPY "${CMAKE_SOURCE_DIR}/Samples/Media/HLMS" DESTINATION "${NDKOUT}/assets")

file(COPY "${CMAKE_SOURCE_DIR}/Samples/Media/PBR" DESTINATION "${NDKOUT}/assets")

file(COPY "${CMAKE_SOURCE_DIR}/SDK/Android/drawable-hdpi" DESTINATION "${NDKOUT}/res")
file(COPY "${CMAKE_SOURCE_DIR}/SDK/Android/drawable-ldpi" DESTINATION "${NDKOUT}/res")
file(COPY "${CMAKE_SOURCE_DIR}/SDK/Android/drawable-mdpi" DESTINATION "${NDKOUT}/res")
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@ option(OGRE_CONFIG_MEMTRACK_DEBUG "Enable Ogre's memory tracker in debug mode" F
option(OGRE_CONFIG_MEMTRACK_RELEASE "Enable Ogre's memory tracker in release mode" FALSE)
# determine threading options
include(PrepareThreadingOptions)
cmake_dependent_option(OGRE_CONFIG_ENABLE_FREEIMAGE "Build FreeImage codec." TRUE "FreeImage_FOUND" FALSE)
cmake_dependent_option(OGRE_CONFIG_ENABLE_FREEIMAGE "Build FreeImage codec." FALSE "FreeImage_FOUND" FALSE)
cmake_dependent_option(OGRE_BUILD_PLUGIN_EXRCODEC "Build EXR Codec plugin" TRUE "OPENEXR_FOUND;NOT OGRE_CONFIG_ENABLE_FREEIMAGE" FALSE)
cmake_dependent_option(OGRE_CONFIG_ENABLE_STBI "Enable STBI image codec." TRUE "NOT OGRE_CONFIG_ENABLE_FREEIMAGE" FALSE)
option(OGRE_CONFIG_ENABLE_MESHLOD "Enable Mesh Lod." TRUE)
option(OGRE_CONFIG_ENABLE_DDS "Build DDS codec." TRUE)
option(OGRE_CONFIG_ENABLE_PVRTC "Build PVRTC codec." FALSE)
option(OGRE_CONFIG_ENABLE_ETC "Build ETC codec." FALSE)
option(OGRE_CONFIG_ENABLE_ETC "Build ETC codec." TRUE)
option(OGRE_CONFIG_ENABLE_ASTC "Build ASTC codec." FALSE)
option(OGRE_CONFIG_ENABLE_QUAD_BUFFER_STEREO "Enable stereoscopic 3D support" FALSE)
cmake_dependent_option(OGRE_CONFIG_ENABLE_ZIP "Build ZIP archive support. If you disable this option, you cannot use ZIP archives resource locations. The samples won't work." TRUE "ZZip_FOUND" FALSE)
Expand Down
9 changes: 6 additions & 3 deletions Components/Bites/include/OgreAdvancedRenderControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ParamsPanel;
/**
- F: Toggle frame rate stats on/off
- G: Toggle advanced frame stats on/off
- P Toggle profiler window on/ off (if compiled with OGRE_PROFILING)
- R: Render mode
- Wireframe
- Points
Expand All @@ -52,9 +53,11 @@ class ParamsPanel;
- Trilinear
- Anisotropic(8)
- None
- F2: Set the main viewport material scheme to default material manager scheme.
- F3: Toggle default shader generator lighting model from per vertex to per pixel.
- F4: Switch vertex shader outputs compaction policy.
- F2: RTSS: Set the main viewport material scheme to default material manager scheme.
- F3: RTSS: Toggle default shader generator lighting model from per vertex to per pixel.
- F4: RTSS: Switch vertex shader outputs compaction policy.
- F5: Reload all textures
- F6: Take a screenshot
*/
class _OgreBitesExport AdvancedRenderControls : public InputListener {
public:
Expand Down
34 changes: 19 additions & 15 deletions Components/Bites/src/OgreApplicationContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,18 @@ void ApplicationContext::locateResources()
# endif
type = genLocs.front()->archive->getType();

#ifdef OGRE_BUILD_PLUGIN_CG
bool use_HLSL_Cg_shared = true;
#else
bool use_HLSL_Cg_shared = Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("hlsl");
#endif
bool hasCgPlugin = false;
const Ogre::Root::PluginInstanceList& plugins = getRoot()->getInstalledPlugins();
for(size_t i = 0; i < plugins.size(); i++)
{
if(plugins[i]->getName() == "Cg Program Manager")
{
hasCgPlugin = true;
break;
}
}

bool use_HLSL_Cg_shared = hasCgPlugin || Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("hlsl");

// Add locations for supported shader languages
if(Ogre::GpuProgramManager::getSingleton().isSyntaxSupported("glsles"))
Expand Down Expand Up @@ -638,13 +645,11 @@ void ApplicationContext::locateResources()
{
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch + "/materials/programs/HLSL", type, sec);
}
#ifdef OGRE_BUILD_PLUGIN_CG
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch + "/materials/programs/Cg", type, sec);
#endif

if(hasCgPlugin)
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch + "/materials/programs/Cg", type, sec);
if (use_HLSL_Cg_shared)
{
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch + "/materials/programs/HLSL_Cg", type, sec);
}

#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
mRTShaderLibPath = arch + "/RTShaderLib";
Expand All @@ -663,13 +668,12 @@ void ApplicationContext::locateResources()
{
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(mRTShaderLibPath + "/HLSL", type, sec);
}
# ifdef OGRE_BUILD_PLUGIN_CG
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(mRTShaderLibPath + "/Cg", type, sec);
# endif

if(hasCgPlugin)
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(mRTShaderLibPath + "/Cg", type, sec);
if (use_HLSL_Cg_shared)
{
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(mRTShaderLibPath + "/HLSL_Cg", type, sec);
}

#endif /* OGRE_BUILD_COMPONENT_RTSHADERSYSTEM */
#endif /* OGRE_PLATFORM == OGRE_PLATFORM_NACL */
}
Expand Down
6 changes: 3 additions & 3 deletions Components/HLMS/include/OgreHlmsPbsMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ namespace Ogre
Real getLightRoughnessOffset(){ return mLightRoughnessOffset; }
void setLightRoughnessOffset(Real val){ mLightRoughnessOffset = val; }

void setAlbedoTexture(MapSlot mapSlot, TexturePtr tex, TextureAddressing textureAddressing = TextureAddressing(), BlendFunction blendFunc = BF_ALPHA, float blendFactor = 0);
void setAlbedoTexture(MapSlot mapSlot, TexturePtr tex, TextureAddressing textureAddressing = TextureAddressing(), BlendFunction blendFunc = BF_ALPHA, float blendFactor = 1);
/// set texture containing normals and roughness
void setNormalRTexture(MapSlot mapSlot, TexturePtr tex, TextureAddressing textureAddressing = TextureAddressing(), float normalBlendFactor = 0, float rBlendFactor = 0);
void setF0Texture(MapSlot mapSlot, TexturePtr tex, TextureAddressing textureAddressing = TextureAddressing(), BlendFunction blendFunc = BF_ALPHA, float blendFactor = 0);
void setNormalRTexture(MapSlot mapSlot, TexturePtr tex, TextureAddressing textureAddressing = TextureAddressing(), float normalBlendFactor = 1, float rBlendFactor = 0);
void setF0Texture(MapSlot mapSlot, TexturePtr tex, TextureAddressing textureAddressing = TextureAddressing(), BlendFunction blendFunc = BF_ALPHA, float blendFactor = 1);
void setOffsetAndScale(MapSlot mapSlot, Vector2 offset, Vector2 scale);
void setUvSetIndex(MapSlot mapSlot, uint index);

Expand Down
12 changes: 6 additions & 6 deletions Components/HLMS/src/OgreHlmsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace Ogre
Any hlmsMatBindingAny = rend->getUserObjectBindings().getUserAny(HLMS_KEY);

// this check should not fail
if (hlmsMatBindingAny.isEmpty())
if (!hlmsMatBindingAny.has_value())
continue;

HlmsMatBindingMap* hlmsMatBindingMap = any_cast<HlmsMatBindingMap*>(hlmsMatBindingAny);
Expand All @@ -85,7 +85,7 @@ namespace Ogre
Any hlmsMatBindingAny = rend->getUserObjectBindings().getUserAny(HLMS_KEY);

// this check should not fail
if (hlmsMatBindingAny.isEmpty())
if (!hlmsMatBindingAny.has_value())
continue;

HlmsMatBindingMap* hlmsMatBindingMap = any_cast<HlmsMatBindingMap*>(hlmsMatBindingAny);
Expand Down Expand Up @@ -171,7 +171,7 @@ namespace Ogre
{
// check if the renderable has bounded hlmsMaterials
Any hlmsMatBindingAny = rend->getUserObjectBindings().getUserAny(HLMS_KEY);
if (hlmsMatBindingAny.isEmpty())
if (!hlmsMatBindingAny.has_value())
return;

// get the bounded material for the current pass
Expand All @@ -189,7 +189,7 @@ namespace Ogre
void HlmsManager::bind(Renderable* rend, HlmsMaterialBase* material, const String& passName)
{
HlmsMatBindingMap* hlmsMatMap;
if (rend->getUserObjectBindings().getUserAny(HLMS_KEY).isEmpty())
if (!rend->getUserObjectBindings().getUserAny(HLMS_KEY).has_value())
{
hlmsMatMap = new HlmsMatBindingMap();
rend->getUserObjectBindings().setUserAny(HLMS_KEY, Any(hlmsMatMap));
Expand All @@ -209,7 +209,7 @@ namespace Ogre
//-----------------------------------------------------------------------------------
void HlmsManager::unbind(Renderable* rend, const String& passName)
{
if (!rend->getUserObjectBindings().getUserAny(HLMS_KEY).isEmpty())
if (rend->getUserObjectBindings().getUserAny(HLMS_KEY).has_value())
{
HlmsMatBindingMap* hlmsMatMap = any_cast<HlmsMatBindingMap*>(rend->getUserObjectBindings().getUserAny(HLMS_KEY));
hlmsMatMap->erase(passName);
Expand Down Expand Up @@ -250,7 +250,7 @@ namespace Ogre
//-----------------------------------------------------------------------------------
bool HlmsManager::hasBinding(Renderable* rend, const String& passName)
{
if (!rend->getUserObjectBindings().getUserAny(HLMS_KEY).isEmpty())
if (rend->getUserObjectBindings().getUserAny(HLMS_KEY).has_value())
{
HlmsMatBindingMap* hlmsMatMap = any_cast<HlmsMatBindingMap*>(rend->getUserObjectBindings().getUserAny(HLMS_KEY));
return hlmsMatMap->find(passName) != hlmsMatMap->end();
Expand Down
1 change: 1 addition & 0 deletions Components/HLMS/src/OgreHlmsPbsMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ namespace Ogre
s.blendFunc = blendFunc;
s.blendFactor1 = blendFactor1;
s.blendFactor2 = blendFactor2;
s.hasBlendFactor1 = s.hasBlendFactor2 = true;

s.intensity = intensityFactor;
s.mipmapCount = !tex ? 0.0f : tex->getNumMipmaps();
Expand Down
2 changes: 2 additions & 0 deletions Components/HLMS/src/OgreHlmsShaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,8 @@ namespace Ogre
PiecesMap::const_iterator it = pieces.find(pieceName);
if (it != pieces.end())
outBuffer += it->second;
else
LogManager::getSingleton().logError("Piece not found: "+argValues[0]);
}
else
{
Expand Down
10 changes: 1 addition & 9 deletions Components/HLMS/src/OgreHlmsShaderTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,7 @@ namespace Ogre
{
if (mTemplateFileName.empty()) return;

DataStreamPtr logoCornersFile;
try
{
logoCornersFile = ResourceGroupManager::getSingletonPtr()->openResource(mTemplateFileName);
}
catch (FileNotFoundException&)
{
return;
}
DataStreamPtr logoCornersFile = ResourceGroupManager::getSingletonPtr()->openResource(mTemplateFileName);

mTemplate = logoCornersFile->getAsString();
mHash = calcHash(mTemplate);
Expand Down
Loading

0 comments on commit 4bba03c

Please sign in to comment.