Skip to content

Commit

Permalink
Merge branch 'v2-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Dec 4, 2021
2 parents 402e3c3 + c00d288 commit 64035e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Components/Hlms/Pbs/include/OgreHlmsPbs.h
Expand Up @@ -493,6 +493,7 @@ namespace Ogre
static const IdString NumTextures;
static const IdString NumSamplers;
static const IdString DiffuseMapGrayscale;
static const IdString EmissiveMapGrayscale;
static const char *DiffuseMap;
static const char *NormalMapTex;
static const char *SpecularMap;
Expand Down
11 changes: 11 additions & 0 deletions Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Expand Up @@ -98,6 +98,7 @@ namespace Ogre
const IdString PbsProperty::NumTextures = IdString( "num_textures" );
const IdString PbsProperty::NumSamplers = IdString( "num_samplers" );
const IdString PbsProperty::DiffuseMapGrayscale = IdString( "diffuse_map_grayscale" );
const IdString PbsProperty::EmissiveMapGrayscale= IdString( "emissive_map_grayscale" );
const char *PbsProperty::DiffuseMap = "diffuse_map";
const char *PbsProperty::NormalMapTex = "normal_map_tex";
const char *PbsProperty::SpecularMap = "specular_map";
Expand Down Expand Up @@ -832,6 +833,16 @@ namespace Ogre
setProperty( PbsProperty::DiffuseMapGrayscale, 1 );
}

if( datablock->getTexture( PBSM_EMISSIVE ) && getProperty( PbsProperty::EmissiveMap ) )
{
TextureGpu *emissiveTexture = datablock->getTexture( PBSM_EMISSIVE );
if( PixelFormatGpuUtils::getNumberOfComponents( emissiveTexture->getPixelFormat() ) ==
1u )
{
setProperty( PbsProperty::EmissiveMapGrayscale, 1 );
}
}

//Save the name of the cubemap for hazard prevention
//(don't sample the cubemap and render to it at the same time).
const TextureGpu *reflectionTexture = datablock->getTexture( PBSM_REFLECTION );
Expand Down
Expand Up @@ -92,7 +92,7 @@
#define SampleRoughness( tex, sampler, uv, arrayIdx ) OGRE_SampleArray2D( tex, sampler, uv, arrayIdx )
@end
@property( emissive_map )
#define SampleEmissive( tex, sampler, uv, arrayIdx ) OGRE_SampleArray2D( tex, sampler, uv, arrayIdx )
#define SampleEmissive( tex, sampler, uv, arrayIdx ) OGRE_SampleArray2D( tex, sampler, uv, arrayIdx ) @property( emissive_map_grayscale ).rrr@end
@end
@property( use_envprobe_map )
#define SampleEnvProbe( tex, sampler, uv, lod ) OGRE_SampleLevel( tex, sampler, uv, lod )
Expand Down

0 comments on commit 64035e3

Please sign in to comment.