mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +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
3 changed files with 11 additions and 4 deletions
|
|
@ -39,6 +39,7 @@
|
||||||
#include "console/simFieldDictionary.h"
|
#include "console/simFieldDictionary.h"
|
||||||
#include "console/propertyParsing.h"
|
#include "console/propertyParsing.h"
|
||||||
#include "gfx/util/screenspace.h"
|
#include "gfx/util/screenspace.h"
|
||||||
|
#include "scene/reflectionManager.h"
|
||||||
|
|
||||||
|
|
||||||
ProcessedCustomMaterial::ProcessedCustomMaterial(Material &mat)
|
ProcessedCustomMaterial::ProcessedCustomMaterial(Material &mat)
|
||||||
|
|
@ -346,7 +347,13 @@ void ProcessedCustomMaterial::setTextureStages( SceneRenderState *state, const S
|
||||||
}
|
}
|
||||||
case Material::BackBuff:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case Material::ReflectBuff:
|
case Material::ReflectBuff:
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ GFXTexHandle ReflectionManager::allocRenderTarget( const Point2I &size )
|
||||||
avar("%s() - mReflectTex (line %d)", __FUNCTION__, __LINE__) );
|
avar("%s() - mReflectTex (line %d)", __FUNCTION__, __LINE__) );
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXTextureObject* ReflectionManager::getRefractTex()
|
GFXTextureObject* ReflectionManager::getRefractTex( bool forceUpdate )
|
||||||
{
|
{
|
||||||
GFXTarget *target = GFX->getActiveRenderTarget();
|
GFXTarget *target = GFX->getActiveRenderTarget();
|
||||||
GFXFormat targetFormat = target->getFormat();
|
GFXFormat targetFormat = target->getFormat();
|
||||||
|
|
@ -261,7 +261,7 @@ GFXTextureObject* ReflectionManager::getRefractTex()
|
||||||
mUpdateRefract = true;
|
mUpdateRefract = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mUpdateRefract )
|
if ( forceUpdate || mUpdateRefract )
|
||||||
{
|
{
|
||||||
target->resolveTo( mRefractTex );
|
target->resolveTo( mRefractTex );
|
||||||
mUpdateRefract = false;
|
mUpdateRefract = false;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public:
|
||||||
|
|
||||||
GFXTexHandle allocRenderTarget( const Point2I &size );
|
GFXTexHandle allocRenderTarget( const Point2I &size );
|
||||||
|
|
||||||
GFXTextureObject* getRefractTex();
|
GFXTextureObject* getRefractTex( bool forceUpdate = false );
|
||||||
|
|
||||||
BaseMatInstance* getReflectionMaterial( BaseMatInstance *inMat ) const;
|
BaseMatInstance* getReflectionMaterial( BaseMatInstance *inMat ) const;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue