MCPcopy Create free account
hub / github.com/OGRECave/ogre / safeSetConstant

Function safeSetConstant

OgreMain/src/OgreScriptTranslator.cpp:3641–3665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3639 //-------------------------------------------------------------------------
3640 template <typename T, typename It>
3641 static void safeSetConstant(const GpuProgramParametersPtr& params, const String& name, size_t index, It arrayStart,
3642 It arrayEnd, size_t count, PropertyAbstractNode* prop, ScriptCompiler* compiler)
3643 {
3644 int roundedCount = (count + 3) / 4; // integer ceil
3645 roundedCount *= 4;
3646
3647 std::vector<T> vals;
3648 if (!_getVector(arrayStart, arrayEnd, vals, roundedCount))
3649 {
3650 compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line);
3651 return;
3652 }
3653
3654 try
3655 {
3656 if (!name.empty())
3657 params->setNamedConstant(name, vals.data(), count, 1);
3658 else
3659 params->setConstant(index, vals.data(), roundedCount / 4);
3660 }
3661 catch (Exception& e)
3662 {
3663 compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, e.getDescription());
3664 }
3665 }
3666
3667 void GpuProgramTranslator::translateProgramParameters(ScriptCompiler *compiler, const GpuProgramParametersSharedPtr& params, ObjectAbstractNode *obj)
3668 {

Callers

nothing calls this directly

Calls 7

_getVectorFunction · 0.85
addErrorMethod · 0.80
setNamedConstantMethod · 0.80
setConstantMethod · 0.80
emptyMethod · 0.45
dataMethod · 0.45
getDescriptionMethod · 0.45

Tested by

no test coverage detected