mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Merge branch 'CustomShaderFeaturesPR' of https://github.com/Areloch/Torque3D into alpha40Macwork
# Conflicts: # Engine/source/materials/materialDefinition.cpp # Engine/source/materials/processedFFMaterial.h # Engine/source/materials/processedShaderMaterial.cpp # Engine/source/renderInstance/renderBinManager.cpp # Engine/source/renderInstance/renderGlowMgr.cpp # Engine/source/renderInstance/renderMeshMgr.cpp # Engine/source/renderInstance/renderPassManager.h # Engine/source/renderInstance/renderTranslucentMgr.cpp # Engine/source/shaderGen/customShaderFeature.cpp # Engine/source/shaderGen/customShaderFeature.h
This commit is contained in:
commit
afa52850c3
12 changed files with 110 additions and 72 deletions
|
|
@ -543,11 +543,6 @@ bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char
|
||||||
{
|
{
|
||||||
Material *material = static_cast< Material* >(object);
|
Material *material = static_cast< Material* >(object);
|
||||||
|
|
||||||
//CustomShaderFeatureData* customFeature;
|
|
||||||
//if (!Sim::findObject(data, customFeature))
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
//material->mCustomShaderFeatures.push_back(customFeature);
|
|
||||||
if (index != NULL)
|
if (index != NULL)
|
||||||
{
|
{
|
||||||
char featureName[256] = { 0 };
|
char featureName[256] = { 0 };
|
||||||
|
|
@ -555,8 +550,6 @@ bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char
|
||||||
dSscanf(index, "%s_%i", featureName, id);
|
dSscanf(index, "%s_%i", featureName, id);
|
||||||
|
|
||||||
String uniformName = data;
|
String uniformName = data;
|
||||||
|
|
||||||
bool tmp = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
virtual void setTransforms(const MatrixSet &matrixSet, SceneRenderState *state, const U32 pass);
|
virtual void setTransforms(const MatrixSet &matrixSet, SceneRenderState *state, const U32 pass);
|
||||||
virtual void setNodeTransforms(const MatrixF *address, const U32 numTransforms, const U32 pass) {;}
|
virtual void setNodeTransforms(const MatrixF *address, const U32 numTransforms, const U32 pass) {;}
|
||||||
virtual void setCustomShaderData(Vector<CustomShaderBindingData> &shaderData, const U32 pass) {;} //-JR
|
virtual void setCustomShaderData(Vector<CustomShaderBindingData> &shaderData, const U32 pass) {;}
|
||||||
|
|
||||||
virtual void setSceneInfo(SceneRenderState *, const SceneData& sgData, U32 pass);
|
virtual void setSceneInfo(SceneRenderState *, const SceneData& sgData, U32 pass);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ void ShaderConstHandles::init( GFXShader *shader, Vector<CustomShaderFeatureData
|
||||||
newSC.handleName = customFeatureData[f]->mAddedShaderConstants[i];
|
newSC.handleName = customFeatureData[f]->mAddedShaderConstants[i];
|
||||||
|
|
||||||
mCustomHandles.push_back(newSC);
|
mCustomHandles.push_back(newSC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,33 +153,30 @@ S32 FN_CDECL RenderBinManager::cmpKeyFunc(const void* p1, const void* p2)
|
||||||
|
|
||||||
void RenderBinManager::setupSGData(MeshRenderInst *ri, SceneData &data)
|
void RenderBinManager::setupSGData(MeshRenderInst *ri, SceneData &data)
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE(RenderBinManager_setupSGData);
|
PROFILE_SCOPE( RenderBinManager_setupSGData );
|
||||||
|
|
||||||
// NOTE: We do not reset or clear the scene state
|
// NOTE: We do not reset or clear the scene state
|
||||||
// here as the caller has initialized non-RI members
|
// here as the caller has initialized non-RI members
|
||||||
// himself and we must preserve them.
|
// himself and we must preserve them.
|
||||||
//
|
//
|
||||||
// It also saves a bunch of CPU as this is called for
|
// It also saves a bunch of CPU as this is called for
|
||||||
// every MeshRenderInst in every pass.
|
// every MeshRenderInst in every pass.
|
||||||
|
|
||||||
dMemcpy(data.lights, ri->lights, sizeof(data.lights));
|
dMemcpy( data.lights, ri->lights, sizeof( data.lights ) );
|
||||||
data.objTrans = ri->objectToWorld;
|
data.objTrans = ri->objectToWorld;
|
||||||
data.backBuffTex = ri->backBuffTex;
|
data.backBuffTex = ri->backBuffTex;
|
||||||
data.cubemap = ri->cubemap;
|
data.cubemap = ri->cubemap;
|
||||||
data.miscTex = ri->miscTex;
|
data.miscTex = ri->miscTex;
|
||||||
data.reflectTex = ri->reflectTex;
|
data.reflectTex = ri->reflectTex;
|
||||||
data.accuTex = ri->accuTex;
|
data.accuTex = ri->accuTex;
|
||||||
data.lightmap = ri->lightmap;
|
data.lightmap = ri->lightmap;
|
||||||
data.visibility = ri->visibility;
|
data.visibility = ri->visibility;
|
||||||
data.materialHint = ri->materialHint;
|
data.materialHint = ri->materialHint;
|
||||||
|
data.customShaderData.clear();
|
||||||
data.customShaderData.clear();
|
for (U32 i = 0; i < ri->mCustomShaderData.size(); i++)
|
||||||
for (U32 i = 0; i < ri->mCustomShaderData.size(); i++)
|
{
|
||||||
{
|
data.customShaderData.push_back(&ri->mCustomShaderData[i]);
|
||||||
data.customShaderData.push_back(&ri->mCustomShaderData[i]);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool bl = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( RenderBinManager, getBinType, const char*, (),,
|
DefineEngineMethod( RenderBinManager, getBinType, const char*, (),,
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,6 @@ void RenderGlowMgr::render( SceneRenderState *state )
|
||||||
glowMat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
glowMat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-JR
|
|
||||||
//push along any overriden fields that are instance-specific as well
|
//push along any overriden fields that are instance-specific as well
|
||||||
if (passRI->mCustomShaderData.size() > 0)
|
if (passRI->mCustomShaderData.size() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,6 @@ void RenderMeshMgr::render(SceneRenderState * state)
|
||||||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-JR
|
|
||||||
//push along any overriden fields that are instance-specific as well
|
//push along any overriden fields that are instance-specific as well
|
||||||
if (passRI->mCustomShaderData.size() > 0)
|
if (passRI->mCustomShaderData.size() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ class LightInfo;
|
||||||
struct RenderInst;
|
struct RenderInst;
|
||||||
class MatrixSet;
|
class MatrixSet;
|
||||||
class GFXPrimitiveBufferHandle;
|
class GFXPrimitiveBufferHandle;
|
||||||
class CubemapData;
|
|
||||||
|
|
||||||
class CustomShaderBindingData;
|
class CustomShaderBindingData;
|
||||||
|
|
||||||
/// A RenderInstType hash value.
|
/// A RenderInstType hash value.
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,6 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
|
||||||
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
mat->setNodeTransforms(passRI->mNodeTransforms, passRI->mNodeTransformCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-JR
|
|
||||||
//push along any overriden fields that are instance-specific as well
|
//push along any overriden fields that are instance-specific as well
|
||||||
if (passRI->mCustomShaderData.size() > 0)
|
if (passRI->mCustomShaderData.size() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,13 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "shadergen/CustomShaderFeature.h"
|
#include "shadergen/CustomShaderFeature.h"
|
||||||
|
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
#include "shaderGen/HLSL/customFeatureHLSL.h"
|
#include "shaderGen/HLSL/customFeatureHLSL.h"
|
||||||
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
#include "shaderGen/GLSL/customFeatureGLSL.h"
|
#include "shaderGen/GLSL/customFeatureGLSL.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "math/mathIO.h"
|
#include "math/mathIO.h"
|
||||||
#include "scene/sceneRenderState.h"
|
#include "scene/sceneRenderState.h"
|
||||||
|
|
@ -36,16 +41,10 @@
|
||||||
IMPLEMENT_CONOBJECT(CustomShaderFeatureData);
|
IMPLEMENT_CONOBJECT(CustomShaderFeatureData);
|
||||||
|
|
||||||
ConsoleDocClass(CustomShaderFeatureData,
|
ConsoleDocClass(CustomShaderFeatureData,
|
||||||
"@brief An example scene object which renders using a callback.\n\n"
|
"@brief A Shader Feature with custom definitions.\n\n"
|
||||||
"This class implements a basic SceneObject that can exist in the world at a "
|
"This class allows for the creation and implementation of a ShaderGen ShaderFeature "
|
||||||
"3D position and render itself. Note that CustomShaderFeatureData handles its own "
|
"Implemented either engine side or script, and facilitates passing along of per-instance "
|
||||||
"rendering by submitting itself as an ObjectRenderInst (see "
|
"ShaderData. "
|
||||||
"renderInstance\renderPassmanager.h) along with a delegate for its render() "
|
|
||||||
"function. However, the preffered rendering method in the engine is to submit "
|
|
||||||
"a MeshRenderInst along with a Material, vertex buffer, primitive buffer, and "
|
|
||||||
"transform and allow the RenderMeshMgr handle the actual rendering. You can "
|
|
||||||
"see this implemented in RenderMeshExample.\n\n"
|
|
||||||
"See the C++ code for implementation details.\n\n"
|
|
||||||
"@ingroup Examples\n");
|
"@ingroup Examples\n");
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -53,6 +52,12 @@ ConsoleDocClass(CustomShaderFeatureData,
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
CustomShaderFeatureData::CustomShaderFeatureData()
|
CustomShaderFeatureData::CustomShaderFeatureData()
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
|
mFeatureHLSL = nullptr;
|
||||||
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
mFeatureGLSL = nullptr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomShaderFeatureData::~CustomShaderFeatureData()
|
CustomShaderFeatureData::~CustomShaderFeatureData()
|
||||||
|
|
@ -73,16 +78,21 @@ bool CustomShaderFeatureData::onAdd()
|
||||||
if (!Parent::onAdd())
|
if (!Parent::onAdd())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
{
|
{
|
||||||
mFeatureHLSL = new CustomFeatureHLSL();
|
mFeatureHLSL = new CustomFeatureHLSL();
|
||||||
mFeatureHLSL->mOwner = this;
|
mFeatureHLSL->mOwner = this;
|
||||||
}
|
}
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
{
|
{
|
||||||
mFeatureGLSL = new CustomFeatureGLSL();
|
mFeatureGLSL = new CustomFeatureGLSL();
|
||||||
mFeatureGLSL->mOwner = this;
|
mFeatureGLSL->mOwner = this;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -95,66 +105,98 @@ void CustomShaderFeatureData::onRemove()
|
||||||
//Shadergen setup functions
|
//Shadergen setup functions
|
||||||
void CustomShaderFeatureData::addVariable(String name, String type, String defaultValue)
|
void CustomShaderFeatureData::addVariable(String name, String type, String defaultValue)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
mFeatureHLSL->addVariable(name, type, defaultValue);
|
mFeatureHLSL->addVariable(name, type, defaultValue);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
mFeatureGLSL->addVariable(name, type, defaultValue);
|
mFeatureGLSL->addVariable(name, type, defaultValue);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderFeatureData::addUniform(String name, String type, String defaultValue, U32 arraySize)
|
void CustomShaderFeatureData::addUniform(String name, String type, String defaultValue, U32 arraySize)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
mFeatureHLSL->addUniform(name, type, defaultValue, arraySize);
|
mFeatureHLSL->addUniform(name, type, defaultValue, arraySize);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
mFeatureGLSL->addUniform(name, type, defaultValue, arraySize);
|
mFeatureGLSL->addUniform(name, type, defaultValue, arraySize);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderFeatureData::addSampler(String name, String type, U32 arraySize)
|
void CustomShaderFeatureData::addSampler(String name, String type, U32 arraySize)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
mFeatureHLSL->addSampler(name, type, arraySize);
|
mFeatureHLSL->addSampler(name, type, arraySize);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
mFeatureGLSL->addSampler(name, type, arraySize);
|
mFeatureGLSL->addSampler(name, type, arraySize);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderFeatureData::addTexture(String name, String type, String samplerState, U32 arraySize)
|
void CustomShaderFeatureData::addTexture(String name, String type, String samplerState, U32 arraySize)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
mFeatureHLSL->addTexture(name, type, samplerState, arraySize);
|
mFeatureHLSL->addTexture(name, type, samplerState, arraySize);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
mFeatureGLSL->addTexture(name, type, samplerState, arraySize);
|
mFeatureGLSL->addTexture(name, type, samplerState, arraySize);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderFeatureData::addConnector(String name, String type, String elementName)
|
void CustomShaderFeatureData::addConnector(String name, String type, String elementName)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
mFeatureHLSL->addConnector(name, type, elementName);
|
mFeatureHLSL->addConnector(name, type, elementName);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
mFeatureGLSL->addConnector(name, type, elementName);
|
mFeatureGLSL->addConnector(name, type, elementName);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderFeatureData::addVertTexCoord(String name)
|
void CustomShaderFeatureData::addVertTexCoord(String name)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
mFeatureHLSL->addVertTexCoord(name);
|
mFeatureHLSL->addVertTexCoord(name);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
mFeatureGLSL->addVertTexCoord(name);
|
mFeatureGLSL->addVertTexCoord(name);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CustomShaderFeatureData::hasFeature(String name)
|
bool CustomShaderFeatureData::hasFeature(String name)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
return mFeatureHLSL->hasFeature(name);
|
return mFeatureHLSL->hasFeature(name);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
return mFeatureGLSL->hasFeature(name);
|
return mFeatureGLSL->hasFeature(name);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef* argv)
|
void CustomShaderFeatureData::writeLine(String format, S32 argc, ConsoleValueRef* argv)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
mFeatureHLSL->writeLine(format, argc, argv);
|
mFeatureHLSL->writeLine(format, argc, argv);
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
mFeatureGLSL->writeLine(format, argc, argv);
|
mFeatureGLSL->writeLine(format, argc, argv);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod(CustomShaderFeatureData, addVariable, void, (String name, String type, String defaultValue), ("", "", ""), "")
|
DefineEngineMethod(CustomShaderFeatureData, addVariable, void, (String name, String type, String defaultValue), ("", "", ""), "")
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,24 @@
|
||||||
#include "console/simObject.h"
|
#include "console/simObject.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
class CustomFeatureHLSL;
|
class CustomFeatureHLSL;
|
||||||
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
class CustomFeatureGLSL;
|
class CustomFeatureGLSL;
|
||||||
|
#endif
|
||||||
|
|
||||||
class CustomShaderFeatureData : public SimObject
|
class CustomShaderFeatureData : public SimObject
|
||||||
{
|
{
|
||||||
typedef SimObject Parent;
|
typedef SimObject Parent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
CustomFeatureHLSL* mFeatureHLSL;
|
CustomFeatureHLSL* mFeatureHLSL;
|
||||||
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
CustomFeatureGLSL* mFeatureGLSL;
|
CustomFeatureGLSL* mFeatureGLSL;
|
||||||
|
#endif
|
||||||
|
|
||||||
Vector<StringTableEntry> mAddedShaderConstants;
|
Vector<StringTableEntry> mAddedShaderConstants;
|
||||||
|
|
||||||
|
|
@ -71,16 +79,6 @@ public:
|
||||||
bool hasFeature(String name);
|
bool hasFeature(String name);
|
||||||
|
|
||||||
void writeLine(String format, S32 argc, ConsoleValueRef *argv);
|
void writeLine(String format, S32 argc, ConsoleValueRef *argv);
|
||||||
|
|
||||||
//shader generation
|
|
||||||
/*void CustomShaderFeatureData::processVert(Vector<ShaderComponent*> &componentList,
|
|
||||||
const MaterialFeatureData &fd);
|
|
||||||
void CustomShaderFeatureData::processPix(Vector<ShaderComponent*> &componentList,
|
|
||||||
const MaterialFeatureData &fd);
|
|
||||||
void CustomShaderFeatureData::setTexData(Material::StageData &stageDat,
|
|
||||||
const MaterialFeatureData &fd,
|
|
||||||
RenderPassData &passData,
|
|
||||||
U32 &texIndex);*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,12 @@
|
||||||
#include "core/memVolume.h"
|
#include "core/memVolume.h"
|
||||||
#include "core/module.h"
|
#include "core/module.h"
|
||||||
|
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
#include "shaderGen/HLSL/customFeatureHLSL.h"
|
#include "shaderGen/HLSL/customFeatureHLSL.h"
|
||||||
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
#include "shaderGen/GLSL/customFeatureGLSL.h"
|
#include "shaderGen/GLSL/customFeatureGLSL.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
MODULE_BEGIN( ShaderGen )
|
MODULE_BEGIN( ShaderGen )
|
||||||
|
|
||||||
|
|
@ -291,6 +295,7 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> ¯os, bool macro
|
||||||
{
|
{
|
||||||
for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
|
for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
{
|
{
|
||||||
mCustomFeaturesData[i]->mFeatureHLSL->processVert(mComponents, mFeatureData);
|
mCustomFeaturesData[i]->mFeatureHLSL->processVert(mComponents, mFeatureData);
|
||||||
|
|
@ -304,7 +309,9 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> ¯os, bool macro
|
||||||
mCustomFeaturesData[i]->mFeatureHLSL->reset();
|
mCustomFeaturesData[i]->mFeatureHLSL->reset();
|
||||||
mOutput->addStatement(new GenOp(" \r\n"));
|
mOutput->addStatement(new GenOp(" \r\n"));
|
||||||
}
|
}
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
{
|
{
|
||||||
mCustomFeaturesData[i]->mFeatureGLSL->processVert(mComponents, mFeatureData);
|
mCustomFeaturesData[i]->mFeatureGLSL->processVert(mComponents, mFeatureData);
|
||||||
|
|
||||||
|
|
@ -317,6 +324,7 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> ¯os, bool macro
|
||||||
mCustomFeaturesData[i]->mFeatureGLSL->reset();
|
mCustomFeaturesData[i]->mFeatureGLSL->reset();
|
||||||
mOutput->addStatement(new GenOp(" \r\n"));
|
mOutput->addStatement(new GenOp(" \r\n"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -365,6 +373,7 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> ¯os, bool macros
|
||||||
{
|
{
|
||||||
for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
|
for (U32 i = 0; i < mCustomFeaturesData.size(); ++i)
|
||||||
{
|
{
|
||||||
|
#ifdef TORQUE_D3D11
|
||||||
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
if (GFX->getAdapterType() == GFXAdapterType::Direct3D11)
|
||||||
{
|
{
|
||||||
mCustomFeaturesData[i]->mFeatureHLSL->processPix(mComponents, mFeatureData);
|
mCustomFeaturesData[i]->mFeatureHLSL->processPix(mComponents, mFeatureData);
|
||||||
|
|
@ -378,7 +387,9 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> ¯os, bool macros
|
||||||
mCustomFeaturesData[i]->mFeatureHLSL->reset();
|
mCustomFeaturesData[i]->mFeatureHLSL->reset();
|
||||||
mOutput->addStatement(new GenOp(" \r\n"));
|
mOutput->addStatement(new GenOp(" \r\n"));
|
||||||
}
|
}
|
||||||
else if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
#endif
|
||||||
|
#ifdef TORQUE_OPENGL
|
||||||
|
if (GFX->getAdapterType() == GFXAdapterType::OpenGL)
|
||||||
{
|
{
|
||||||
mCustomFeaturesData[i]->mFeatureGLSL->processPix(mComponents, mFeatureData);
|
mCustomFeaturesData[i]->mFeatureGLSL->processPix(mComponents, mFeatureData);
|
||||||
|
|
||||||
|
|
@ -391,6 +402,7 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> ¯os, bool macros
|
||||||
mCustomFeaturesData[i]->mFeatureGLSL->reset();
|
mCustomFeaturesData[i]->mFeatureGLSL->reset();
|
||||||
mOutput->addStatement(new GenOp(" \r\n"));
|
mOutput->addStatement(new GenOp(" \r\n"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,8 @@ endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
option(TORQUE_D3D11 "Allow Direct3D 11 render" ON)
|
option(TORQUE_D3D11 "Allow Direct3D 11 render" ON)
|
||||||
|
|
||||||
|
addDef(TORQUE_D3D11)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(TORQUE_DEDICATED "Torque dedicated" OFF)
|
option(TORQUE_DEDICATED "Torque dedicated" OFF)
|
||||||
|
|
@ -314,7 +316,6 @@ addPath("${srcDir}/scene")
|
||||||
addPath("${srcDir}/scene/culling")
|
addPath("${srcDir}/scene/culling")
|
||||||
addPath("${srcDir}/scene/zones")
|
addPath("${srcDir}/scene/zones")
|
||||||
addPath("${srcDir}/scene/mixin")
|
addPath("${srcDir}/scene/mixin")
|
||||||
addPath("${srcDir}/shaderGen")
|
|
||||||
addPath("${srcDir}/terrain")
|
addPath("${srcDir}/terrain")
|
||||||
addPath("${srcDir}/environment")
|
addPath("${srcDir}/environment")
|
||||||
addPath("${srcDir}/forest")
|
addPath("${srcDir}/forest")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue