Skip to content

Commit

Permalink
#5585: Start exposing VFP methods
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Apr 11, 2021
1 parent 8df08bc commit 5861f18
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/ishaderlayer.h
Expand Up @@ -320,7 +320,7 @@ class IShaderLayer
virtual const shaders::IShaderExpression::Ptr& getConditionExpression() const = 0;

/**
* Returns the name of this stage's fragment program.
* Returns the name of this stage's vertex program.
*/
virtual const std::string& getVertexProgram()const = 0;

Expand Down
3 changes: 3 additions & 0 deletions install/scripts/materialtest.py
Expand Up @@ -99,6 +99,9 @@
print('Stage render map size: {0}'.format(stage.getRenderMapSize()))
print('Stage alpha test expression: {0}'.format(stage.getAlphaTestExpressionString()))
print('Stage condition expression: {0}'.format(stage.getConditionExpressionString()))
print('Stage vertex program: {0}'.format(stage.getVertexProgram()))
print('Stage fragment program: {0}'.format(stage.getFragmentProgram()))
print('Stage has {0} vertex parameters and {1} fragment maps'.format(stage.getNumVertexParms(), stage.getNumFragmentMaps()))

for transform in stage.getTransformations():
print('Stage transform type: {0}'.format(transform.type))
Expand Down
4 changes: 4 additions & 0 deletions plugins/script/interfaces/ShaderSystemInterface.cpp
Expand Up @@ -358,6 +358,10 @@ void ShaderSystemInterface::registerInterface(py::module& scope, py::dict& globa
stage.def("getRenderMapSize", &ScriptMaterialStage::getRenderMapSize);
stage.def("getAlphaTestExpressionString", &ScriptMaterialStage::getAlphaTestExpressionString);
stage.def("getConditionExpressionString", &ScriptMaterialStage::getConditionExpressionString);
stage.def("getVertexProgram", &ScriptMaterialStage::getVertexProgram);
stage.def("getFragmentProgram", &ScriptMaterialStage::getFragmentProgram);
stage.def("getNumVertexParms", &ScriptMaterialStage::getNumVertexParms);
stage.def("getNumFragmentMaps", &ScriptMaterialStage::getNumFragmentMaps);

// Expose the MaterialVisitor interface

Expand Down
20 changes: 20 additions & 0 deletions plugins/script/interfaces/ShaderSystemInterface.h
Expand Up @@ -108,6 +108,26 @@ class ScriptMaterialStage
return _layer && _layer->getConditionExpression() ?
_layer->getConditionExpression()->getExpressionString() : std::string();
}

std::string getVertexProgram()
{
return _layer ? _layer->getVertexProgram() : std::string();
}

std::string getFragmentProgram()
{
return _layer ? _layer->getFragmentProgram() : std::string();
}

int getNumVertexParms()
{
return _layer ? _layer->getNumVertexParms() : 0;
}

int getNumFragmentMaps()
{
return _layer ? _layer->getNumFragmentMaps() : 0;
}
};

/**
Expand Down

0 comments on commit 5861f18

Please sign in to comment.