mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
begun adding uniform hooks
This commit is contained in:
parent
1dca9958a1
commit
a28914e695
3 changed files with 64 additions and 3 deletions
|
|
@ -485,6 +485,8 @@ void Material::initPersistFields()
|
||||||
|
|
||||||
addProtectedField("customShaderFeature", TypeRealString, NULL, &protectedSetCustomShaderFeature, &defaultProtectedGetFn,
|
addProtectedField("customShaderFeature", TypeRealString, NULL, &protectedSetCustomShaderFeature, &defaultProtectedGetFn,
|
||||||
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors);
|
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors);
|
||||||
|
addProtectedField("CustomShaderFeatureUniforms", TypeRealString, NULL, &protectedSetCustomShaderFeatureUniforms, &defaultProtectedGetFn,
|
||||||
|
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors);
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
|
@ -516,6 +518,29 @@ bool Material::protectedSetCustomShaderFeature(void *object, const char *index,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Material::protectedSetCustomShaderFeatureUniforms(void *object, const char *index, const char *data)
|
||||||
|
{
|
||||||
|
Material *material = static_cast< Material* >(object);
|
||||||
|
|
||||||
|
//CustomShaderFeatureData* customFeature;
|
||||||
|
//if (!Sim::findObject(data, customFeature))
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
//material->mCustomShaderFeatures.push_back(customFeature);
|
||||||
|
if (index != NULL)
|
||||||
|
{
|
||||||
|
char featureName[256] = { 0 };
|
||||||
|
U32 id = 0;
|
||||||
|
dSscanf(index, "%s_%i", featureName, id);
|
||||||
|
|
||||||
|
String uniformName = data;
|
||||||
|
|
||||||
|
bool tmp = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Material::onAdd()
|
bool Material::onAdd()
|
||||||
{
|
{
|
||||||
if (Parent::onAdd() == false)
|
if (Parent::onAdd() == false)
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,7 @@ public:
|
||||||
virtual bool writeField( StringTableEntry fieldname, const char *value );
|
virtual bool writeField( StringTableEntry fieldname, const char *value );
|
||||||
|
|
||||||
static bool protectedSetCustomShaderFeature(void *object, const char *index, const char *data);
|
static bool protectedSetCustomShaderFeature(void *object, const char *index, const char *data);
|
||||||
|
static bool protectedSetCustomShaderFeatureUniforms(void *object, const char *index, const char *data);
|
||||||
|
|
||||||
//
|
//
|
||||||
// ConsoleObject interface
|
// ConsoleObject interface
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,41 @@ class Frustum;
|
||||||
class LightQuery;
|
class LightQuery;
|
||||||
class TSShape;
|
class TSShape;
|
||||||
|
|
||||||
|
struct CustomShaderBindingData
|
||||||
|
{
|
||||||
|
enum UniformType
|
||||||
|
{
|
||||||
|
Float = 0,
|
||||||
|
Float2,
|
||||||
|
Float3,
|
||||||
|
Float4,
|
||||||
|
Texture2D,
|
||||||
|
Texture3D,
|
||||||
|
Cubemap,
|
||||||
|
Matrix2x2,
|
||||||
|
Matrix2x3,
|
||||||
|
Matrix2x4,
|
||||||
|
Matrix3x2,
|
||||||
|
Matrix3x3,
|
||||||
|
Matrix3x4,
|
||||||
|
Matrix4x2,
|
||||||
|
Matrix4x3,
|
||||||
|
Matrix4x4
|
||||||
|
};
|
||||||
|
|
||||||
|
String targetedUniformName;
|
||||||
|
|
||||||
|
//ShaderConstHandles shaderConstHandle;
|
||||||
|
|
||||||
|
UniformType type;
|
||||||
|
|
||||||
|
void* data; //for numeric data
|
||||||
|
|
||||||
|
//Image stuff
|
||||||
|
GFXTexHandle texture;
|
||||||
|
GFXSamplerStateDesc samplerState;
|
||||||
|
};
|
||||||
|
|
||||||
/// A simple class for passing render state through the pre-render pipeline.
|
/// A simple class for passing render state through the pre-render pipeline.
|
||||||
///
|
///
|
||||||
/// @section TSRenderState_intro Introduction
|
/// @section TSRenderState_intro Introduction
|
||||||
|
|
@ -115,10 +150,10 @@ protected:
|
||||||
/// Count of matrices in the mNodeTransforms list
|
/// Count of matrices in the mNodeTransforms list
|
||||||
U32 mNodeTransformCount;
|
U32 mNodeTransformCount;
|
||||||
|
|
||||||
|
//Custom Shader data
|
||||||
|
Vector<CustomShaderBindingData> mCustomShaderData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TSRenderState();
|
TSRenderState();
|
||||||
TSRenderState( const TSRenderState &state );
|
TSRenderState( const TSRenderState &state );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue