30const ShaderParameter EntityShaderParameters::getShaderParameter(
const string& parameterName)
const {
31 auto shaderParameterIt =
parameters.find(parameterName);
35 auto& shaderParameter = shaderParameterIt->second;
36 return shaderParameter;
42 Console::println(
"EntityShaderParameters::setShaderParameter(): no parameter for shader registered with id: " +
shaderId +
", and parameter name: " + parameterName);
45 if (currentShaderParameter.getType() != parameterValue.
getType()) {
46 Console::println(
"EntityShaderParameters::setShaderParameter(): parameter type mismatch for shader registered with id: " +
shaderId +
", and parameter name: " + parameterName);
55 Console::println(
"EntityShaderParameters::setShaderParameter(): no parameter for shader registered with id: " +
shaderId +
", and parameter name: " + parameterName);
59 switch(currentShaderParameter.getType()) {
63 parameterValue =
ShaderParameter(StringTools::toLowerCase(StringTools::trim(parameterValueString)) ==
"true");
66 parameterValue =
ShaderParameter(Integer::parse(StringTools::trim(parameterValueString)));
69 parameterValue =
ShaderParameter(Float::parse(StringTools::trim(parameterValueString)));
73 auto parameterValueStringArray = StringTools::tokenize(parameterValueString,
",");
74 if (parameterValueStringArray.size() != 2)
break;
77 Float::parse(StringTools::trim(parameterValueStringArray[0])),
78 Float::parse(StringTools::trim(parameterValueStringArray[1]))
85 auto parameterValueStringArray = StringTools::tokenize(parameterValueString,
",");
86 if (parameterValueStringArray.size() != 3)
break;
89 Float::parse(StringTools::trim(parameterValueStringArray[0])),
90 Float::parse(StringTools::trim(parameterValueStringArray[1])),
91 Float::parse(StringTools::trim(parameterValueStringArray[2]))
99 if (currentShaderParameter.getType() != parameterValue.
getType()) {
100 Console::println(
"EntityShaderParameters::setShaderParameter(): parameter type mismatch for shader registered with id: " +
shaderId +
", and parameter name: " + parameterName);
static const ShaderParameter getDefaultShaderParameter(const string &shaderId, const string ¶meterName)
Returns shader parameter default value for given shader id and parameter name.
TDME2 engine entity shader parameters.
map< string, ShaderParameter > parameters
void setShaderParameter(const string ¶meterName, const ShaderParameter ¶meterValue)
Set shader parameter for given parameter name.
const ShaderParameter getShaderParameter(const string ¶meterName) const
Returns shader parameter for given parameter name, if the value does not exist, the default will be r...
Shader parameter model class.