mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Ground work for node editor
Added ability to shader features and shaderGen to create multiple instances of the same feature with the option of calling a static creation function that can take arguments in the form of a struct. FEATUREMGR now has createFeature to take advantage of this. The node editor requires this ability as the same node could be used multiple times with different arguments so in its update function we will be calling ```FEATUREMGR->registerFeature(feature_type, (optional default constructor), createFunction);``` then adding it to the feature set with the required arguments to build the shader feature. ```FeatureSet->add(feature_type, index, ParameterStruct);```
This commit is contained in:
parent
f1cf4147a8
commit
8c7ddb7cf1
6 changed files with 102 additions and 16 deletions
|
|
@ -257,7 +257,13 @@ void ShaderGen::_processVertFeatures( Vector<GFXShaderMacro> ¯os, bool macro
|
|||
{
|
||||
S32 index;
|
||||
const FeatureType &type = features.getAt( i, &index );
|
||||
ShaderFeature* feature = FEATUREMGR->getByType( type );
|
||||
void* args = features.getArguments(i);
|
||||
ShaderFeature* feature = nullptr;
|
||||
if(args)
|
||||
feature = FEATUREMGR->createFeature(type, args);
|
||||
else
|
||||
feature = FEATUREMGR->getByType( type );
|
||||
|
||||
if ( feature )
|
||||
{
|
||||
feature->setProcessIndex( index );
|
||||
|
|
@ -300,7 +306,12 @@ void ShaderGen::_processPixFeatures( Vector<GFXShaderMacro> ¯os, bool macros
|
|||
{
|
||||
S32 index;
|
||||
const FeatureType &type = features.getAt( i, &index );
|
||||
ShaderFeature* feature = FEATUREMGR->getByType( type );
|
||||
void* args = features.getArguments(i);
|
||||
ShaderFeature* feature = nullptr;
|
||||
if (args)
|
||||
feature = FEATUREMGR->createFeature(type, args);
|
||||
else
|
||||
feature = FEATUREMGR->getByType(type);
|
||||
if ( feature )
|
||||
{
|
||||
feature->setProcessIndex( index );
|
||||
|
|
@ -342,7 +353,12 @@ void ShaderGen::_printFeatureList(Stream &stream)
|
|||
{
|
||||
S32 index;
|
||||
const FeatureType &type = features.getAt( i, &index );
|
||||
ShaderFeature* feature = FEATUREMGR->getByType( type );
|
||||
void* args = features.getArguments(i);
|
||||
ShaderFeature* feature = nullptr;
|
||||
if (args)
|
||||
feature = FEATUREMGR->createFeature(type, args);
|
||||
else
|
||||
feature = FEATUREMGR->getByType(type);
|
||||
if ( feature )
|
||||
{
|
||||
String line;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue