mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
Merge pull request #1260 from Azaezel/alpha41/dynamicReflectionRevisions
fix dynamicCubemaps on objects
This commit is contained in:
commit
29ba0439b7
5 changed files with 15 additions and 13 deletions
|
|
@ -329,7 +329,8 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
||||||
if (String::compare(LIGHTMGR->getId(), "BLM") == 0)
|
if (String::compare(LIGHTMGR->getId(), "BLM") == 0)
|
||||||
{
|
{
|
||||||
fd.features.addFeature(MFT_ForwardShading);
|
fd.features.addFeature(MFT_ForwardShading);
|
||||||
fd.features.addFeature(MFT_ReflectionProbes);
|
if (!mMaterial->mDynamicCubemap)
|
||||||
|
fd.features.addFeature(MFT_ReflectionProbes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabling the InterlacedDeferred feature for now. It is not ready for prime-time
|
// Disabling the InterlacedDeferred feature for now. It is not ready for prime-time
|
||||||
|
|
@ -357,7 +358,8 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
||||||
if (mMaterial->isTranslucent())
|
if (mMaterial->isTranslucent())
|
||||||
{
|
{
|
||||||
fd.features.addFeature(MFT_RTLighting);
|
fd.features.addFeature(MFT_RTLighting);
|
||||||
fd.features.addFeature(MFT_ReflectionProbes);
|
if (!mMaterial->mDynamicCubemap)
|
||||||
|
fd.features.addFeature(MFT_ReflectionProbes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mMaterial->mAnimFlags[stageNum] )
|
if ( mMaterial->mAnimFlags[stageNum] )
|
||||||
|
|
@ -369,7 +371,7 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
||||||
// cubemaps only available on stage 0 for now - bramage
|
// cubemaps only available on stage 0 for now - bramage
|
||||||
if ( stageNum < 1 && mMaterial->isTranslucent() &&
|
if ( stageNum < 1 && mMaterial->isTranslucent() &&
|
||||||
( ( mMaterial->mCubemapData && mMaterial->mCubemapData->mCubemap ) ||
|
( ( mMaterial->mCubemapData && mMaterial->mCubemapData->mCubemap ) ||
|
||||||
mMaterial->mDynamicCubemap ) && !features.hasFeature(MFT_ReflectionProbes))
|
mMaterial->mDynamicCubemap ) /*&& !features.hasFeature(MFT_ReflectionProbes) */ )
|
||||||
{
|
{
|
||||||
fd.features.addFeature( MFT_CubeMap );
|
fd.features.addFeature( MFT_CubeMap );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,7 @@ F32 PlaneReflector::calcScore( const ReflectParams ¶ms )
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaneReflector::updateReflection( const ReflectParams ¶ms )
|
void PlaneReflector::updateReflection( const ReflectParams ¶ms, Point3F explicitPostion)
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE(PlaneReflector_updateReflection);
|
PROFILE_SCOPE(PlaneReflector_updateReflection);
|
||||||
GFXDEBUGEVENT_SCOPE( PlaneReflector_updateReflection, ColorI::WHITE );
|
GFXDEBUGEVENT_SCOPE( PlaneReflector_updateReflection, ColorI::WHITE );
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public:
|
||||||
|
|
||||||
virtual void unregisterReflector();
|
virtual void unregisterReflector();
|
||||||
virtual F32 calcScore( const ReflectParams ¶ms );
|
virtual F32 calcScore( const ReflectParams ¶ms );
|
||||||
virtual void updateReflection( const ReflectParams ¶ms ) {}
|
virtual void updateReflection( const ReflectParams ¶ms, Point3F explicitPostion = Point3F::Max) {}
|
||||||
|
|
||||||
GFXOcclusionQuery* getOcclusionQuery() const { return mOcclusionQuery; }
|
GFXOcclusionQuery* getOcclusionQuery() const { return mOcclusionQuery; }
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ public:
|
||||||
ReflectorDesc *inDesc );
|
ReflectorDesc *inDesc );
|
||||||
|
|
||||||
void unregisterReflector() override;
|
void unregisterReflector() override;
|
||||||
virtual void updateReflection( const ReflectParams ¶ms, Point3F explicitPostion = Point3F::Max);
|
void updateReflection( const ReflectParams ¶ms, Point3F explicitPostion = Point3F::Max) override;
|
||||||
|
|
||||||
GFXCubemap* getCubemap() const { return mCubemap; }
|
GFXCubemap* getCubemap() const { return mCubemap; }
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ protected:
|
||||||
U32 faceIdx;
|
U32 faceIdx;
|
||||||
CubeReflector *cube;
|
CubeReflector *cube;
|
||||||
|
|
||||||
void updateReflection( const ReflectParams ¶ms ) override { cube->updateFace( params, faceIdx ); }
|
void updateReflection( const ReflectParams ¶ms, Point3F explicitPostion = Point3F::Max) override { cube->updateFace( params, faceIdx ); }
|
||||||
F32 calcScore( const ReflectParams ¶ms ) override;
|
F32 calcScore( const ReflectParams ¶ms ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ public:
|
||||||
ReflectorDesc *inDesc );
|
ReflectorDesc *inDesc );
|
||||||
|
|
||||||
F32 calcScore( const ReflectParams ¶ms ) override;
|
F32 calcScore( const ReflectParams ¶ms ) override;
|
||||||
void updateReflection( const ReflectParams ¶ms ) override;
|
void updateReflection( const ReflectParams ¶ms, Point3F explicitPostion = Point3F::Max) override;
|
||||||
|
|
||||||
/// Set up the GFX matrices
|
/// Set up the GFX matrices
|
||||||
void setGFXMatrices( const MatrixF &camTrans );
|
void setGFXMatrices( const MatrixF &camTrans );
|
||||||
|
|
@ -233,4 +233,4 @@ public:
|
||||||
bool objectSpace;
|
bool objectSpace;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _REFLECTOR_H_
|
#endif // _REFLECTOR_H_
|
||||||
|
|
|
||||||
|
|
@ -1922,9 +1922,9 @@ void ReflectCubeFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
Var* matinfo = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget2) );
|
Var* matinfo = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget2) );
|
||||||
Var *roughness = (Var*)LangElement::find("roughness");
|
Var *roughness = (Var*)LangElement::find("roughness");
|
||||||
if (roughness) //try to grab roughness directly
|
if (roughness) //try to grab roughness directly
|
||||||
texCube = new GenOp("textureLod( @, @, min((1.0 - @)*@ + 1.0, @))", cubeMap, reflectVec, roughness, cubeMips, cubeMips);
|
texCube = new GenOp("textureLod( @, @, min(@*@ + 1.0, @))", cubeMap, reflectVec, roughness, cubeMips, cubeMips);
|
||||||
else if (glossColor) //failing that, try and find color data
|
else if (glossColor) //failing that, try and find color data
|
||||||
texCube = new GenOp("textureLod( @, @, min((1.0 - @.b)*@ + 1.0, @))", cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
|
texCube = new GenOp("textureLod( @, @, min(@.b*@ + 1.0, @))", cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
|
||||||
else //failing *that*, just draw the cubemap
|
else //failing *that*, just draw the cubemap
|
||||||
texCube = new GenOp("texture( @, @)", cubeMap, reflectVec);
|
texCube = new GenOp("texture( @, @)", cubeMap, reflectVec);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1987,11 +1987,11 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||||
|
|
||||||
if (roughness) //try to grab roughness directly
|
if (roughness) //try to grab roughness directly
|
||||||
{
|
{
|
||||||
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min((1.0 - @)*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, roughness, cubeMips, cubeMips);
|
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min(@*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, roughness, cubeMips, cubeMips);
|
||||||
}
|
}
|
||||||
else if (glossColor)//failing that, try and find color data
|
else if (glossColor)//failing that, try and find color data
|
||||||
{
|
{
|
||||||
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min((1.0 - @.b)*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
|
texCube = new GenOp("@.SampleLevel( @, float3(@).rgb, min(@.b*@ + 1.0, @))", cubeMapTex, cubeMap, reflectVec, glossColor, cubeMips, cubeMips);
|
||||||
}
|
}
|
||||||
else //failing *that*, just draw the cubemap
|
else //failing *that*, just draw the cubemap
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue