mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Merge pull request #125 from DavidWyand-GG/issue124-CustomMaterialRefraction
Fix for Issue #124 for CustomMaterial Refraction
This commit is contained in:
commit
2291451b8e
|
|
@ -39,6 +39,7 @@
|
|||
#include "console/simFieldDictionary.h"
|
||||
#include "console/propertyParsing.h"
|
||||
#include "gfx/util/screenspace.h"
|
||||
#include "scene/reflectionManager.h"
|
||||
|
||||
|
||||
ProcessedCustomMaterial::ProcessedCustomMaterial(Material &mat)
|
||||
|
|
@ -346,7 +347,13 @@ void ProcessedCustomMaterial::setTextureStages( SceneRenderState *state, const S
|
|||
}
|
||||
case Material::BackBuff:
|
||||
{
|
||||
GFX->setTexture( samplerRegister, sgData.backBuffTex );
|
||||
if ( sgData.reflectTex )
|
||||
GFX->setTexture( samplerRegister, sgData.reflectTex );
|
||||
else
|
||||
{
|
||||
GFXTextureObject *refractTex = REFLECTMGR->getRefractTex( true );
|
||||
GFX->setTexture( samplerRegister, refractTex );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Material::ReflectBuff:
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ GFXTexHandle ReflectionManager::allocRenderTarget( const Point2I &size )
|
|||
avar("%s() - mReflectTex (line %d)", __FUNCTION__, __LINE__) );
|
||||
}
|
||||
|
||||
GFXTextureObject* ReflectionManager::getRefractTex()
|
||||
GFXTextureObject* ReflectionManager::getRefractTex( bool forceUpdate )
|
||||
{
|
||||
GFXTarget *target = GFX->getActiveRenderTarget();
|
||||
GFXFormat targetFormat = target->getFormat();
|
||||
|
|
@ -261,7 +261,7 @@ GFXTextureObject* ReflectionManager::getRefractTex()
|
|||
mUpdateRefract = true;
|
||||
}
|
||||
|
||||
if ( mUpdateRefract )
|
||||
if ( forceUpdate || mUpdateRefract )
|
||||
{
|
||||
target->resolveTo( mRefractTex );
|
||||
mUpdateRefract = false;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
GFXTexHandle allocRenderTarget( const Point2I &size );
|
||||
|
||||
GFXTextureObject* getRefractTex();
|
||||
GFXTextureObject* getRefractTex( bool forceUpdate = false );
|
||||
|
||||
BaseMatInstance* getReflectionMaterial( BaseMatInstance *inMat ) const;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue