mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
begun adding uniform hooks
This commit is contained in:
parent
512c4515fc
commit
5019478aad
|
|
@ -485,6 +485,8 @@ void Material::initPersistFields()
|
|||
|
||||
addProtectedField("customShaderFeature", TypeRealString, NULL, &protectedSetCustomShaderFeature, &defaultProtectedGetFn,
|
||||
"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();
|
||||
}
|
||||
|
|
@ -516,6 +518,29 @@ bool Material::protectedSetCustomShaderFeature(void *object, const char *index,
|
|||
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()
|
||||
{
|
||||
if (Parent::onAdd() == false)
|
||||
|
|
|
|||
|
|
@ -386,6 +386,7 @@ public:
|
|||
virtual bool writeField( StringTableEntry fieldname, const char *value );
|
||||
|
||||
static bool protectedSetCustomShaderFeature(void *object, const char *index, const char *data);
|
||||
static bool protectedSetCustomShaderFeatureUniforms(void *object, const char *index, const char *data);
|
||||
|
||||
//
|
||||
// ConsoleObject interface
|
||||
|
|
|
|||
|
|
@ -37,6 +37,41 @@ class Frustum;
|
|||
class LightQuery;
|
||||
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.
|
||||
///
|
||||
/// @section TSRenderState_intro Introduction
|
||||
|
|
@ -115,10 +150,10 @@ protected:
|
|||
/// Count of matrices in the mNodeTransforms list
|
||||
U32 mNodeTransformCount;
|
||||
|
||||
//Custom Shader data
|
||||
Vector<CustomShaderBindingData> mCustomShaderData;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
TSRenderState();
|
||||
TSRenderState( const TSRenderState &state );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue