105 xml+=
" <selectbox-option image=\"resources/engine/images/rendering.png\" text=\"Rendering\" value=\"rendering\" />\n";
110 "<template id=\"details_rendering\" src=\"resources/engine/gui/template_details_rendering.xml\" />\n"
115 for (
auto& shader: Engine::getRegisteredShader(Engine::ShaderType::SHADERTYPE_OBJECT3D)) {
118 "<dropdown-option text=\"" +
119 GUIParser::escapeQuotes(shader) +
121 GUIParser::escapeQuotes(shader) +
123 (shader ==
"default"?
"selected=\"true\" " :
"") +
130 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"details_rendering"))->getActiveConditions().add(
"open");
131 if (prototype->
getType() == Prototype_Type::MODEL) required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"details_rendering"))->getActiveConditions().add(
"shader");
134 required_dynamic_cast<GUIParentNode*>(
screenNode->
getInnerNodeById(
"rendering_distance_shader"))->replaceSubNodes(shaderXML,
true);
144 Console::println(
string(
"PrototypeDisplaySubController::setDisplayDetails(): An error occurred: ") + exception.what());
159 prototype->
setShader(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"rendering_shader"))->getController()->getValue().getString());
166 Console::println(
string(
"PrototypeDisplaySubController::applyDisplayDetails(): An error occurred: ") + exception.what());
174 auto defaultShaderParameters = Engine::getShaderParameterDefaults(shader);
175 if (defaultShaderParameters.empty() ==
false) {
176 for (
auto& parameterIt: defaultShaderParameters) {
177 auto& parameterName = parameterIt.first;
179 auto parameterValue = parameter.
toString();
180 auto parameterType =
"string";
181 switch (parameter.getType()) {
182 case ShaderParameter::TYPE_FLOAT:
183 xml+=
"<template name=\"" + GUIParser::escapeQuotes(parameterName) +
"\" id=\"" + GUIParser::escapeQuotes(shaderParameterPrefix + parameterName) +
"\" src=\"resources/engine/gui/template_details_rendering_shader_float.xml\" value=\"" + parameterValue +
"\" />\n";
185 case ShaderParameter::TYPE_INTEGER:
186 xml+=
"<template name=\"" + GUIParser::escapeQuotes(parameterName) +
"\" id=\"" + GUIParser::escapeQuotes(shaderParameterPrefix + parameterName) +
"\" src=\"resources/engine/gui/template_details_rendering_shader_int.xml\" value=\"" + parameterValue +
"\" />\n";
188 case ShaderParameter::TYPE_BOOLEAN:
189 xml+=
"<template name=\"" + GUIParser::escapeQuotes(parameterName) +
"\" id=\"" + GUIParser::escapeQuotes(shaderParameterPrefix + parameterName) +
"\" src=\"resources/engine/gui/template_details_rendering_shader_bool.xml\" value=\"" + parameterValue +
"\" />\n";
191 case ShaderParameter::TYPE_VECTOR2:
193 auto vec2 = parameter.getVector2Value();
194 xml+=
"<template name=\"" + GUIParser::escapeQuotes(parameterName) +
"\" id=\"" + GUIParser::escapeQuotes(shaderParameterPrefix + parameterName) +
"\" src=\"resources/engine/gui/template_details_rendering_shader_vector2.xml\" value_x=\"" + to_string(vec2.getX()) +
"\" value_y=\"" + to_string(vec2.getY()) +
"\" />\n";
197 case ShaderParameter::TYPE_VECTOR3:
199 auto vec3 = parameter.getVector3Value();
200 xml+=
"<template name=\"" + GUIParser::escapeQuotes(parameterName) +
"\" id=\"" + GUIParser::escapeQuotes(shaderParameterPrefix + parameterName) +
"\" src=\"resources/engine/gui/template_details_rendering_shader_vector3.xml\" value_x=\"" + to_string(vec3.getX()) +
"\" value_y=\"" + to_string(vec3.getY()) +
"\" value_z=\"" + to_string(vec3.getZ()) +
"\" />\n";
203 case ShaderParameter::TYPE_VECTOR4:
205 auto vec4 = parameter.getVector4Value();
206 xml+=
"<template name=\"" + GUIParser::escapeQuotes(parameterName) +
"\" id=\"" + GUIParser::escapeQuotes(shaderParameterPrefix + parameterName) +
"\" src=\"resources/engine/gui/template_details_rendering_shader_vector4.xml\" value_x=\"" + to_string(vec4.getX()) +
"\" value_y=\"" + to_string(vec4.getY()) +
"\" value_z=\"" + to_string(vec4.getZ()) +
"\" value_w=\"" + to_string(vec4.getW()) +
"\" />\n";
209 case ShaderParameter::TYPE_NONE:
214 if (xml.empty() ==
false) {
216 string(
"<space height=\"5\" />") + string(
"\n") +
217 string(
"<menu-separator />") + string(
"\n") +
218 string(
"<space height=\"5\" />") + string(
"\n");
227 required_dynamic_cast<GUIParentNode*>(
screenNode->
getNodeById(
"rendering_shader_details"))->replaceSubNodes(xml,
false);
229 Console::println(
string(
"PrototypeDisplaySubController::setDisplayShaderDetails(): An error occurred: ") + exception.what());
238 required_dynamic_cast<GUIParentNode*>(
screenNode->
getNodeById(
"rendering_distanceshader_details"))->replaceSubNodes(xml,
false);
240 Console::println(
string(
"PrototypeDisplaySubController::setDisplayDistanceShaderDetails(): An error occurred: ") + exception.what());
248 switch (parameter.getType()) {
249 case ShaderParameter::TYPE_FLOAT:
253 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName))->getController()->getValue().getString())
257 case ShaderParameter::TYPE_INTEGER:
261 Integer::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName))->getController()->getValue().getString())
265 case ShaderParameter::TYPE_BOOLEAN:
269 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName))->getController()->getValue().getString() ==
"1"
273 case ShaderParameter::TYPE_VECTOR2:
278 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_x"))->getController()->getValue().getString()),
279 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_y"))->getController()->getValue().getString())
284 case ShaderParameter::TYPE_VECTOR3:
289 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_x"))->getController()->getValue().getString()),
290 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_y"))->getController()->getValue().getString()),
291 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_z"))->getController()->getValue().getString())
296 case ShaderParameter::TYPE_VECTOR4:
301 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_x"))->getController()->getValue().getString()),
302 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_y"))->getController()->getValue().getString()),
303 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_z"))->getController()->getValue().getString()),
304 Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(shaderParameterPrefix + parameterName +
"_w"))->getController()->getValue().getString())
309 case ShaderParameter::TYPE_NONE:
313 Console::println(
string(
"PrototypeDisplaySubController::applyDisplayShaderDetails(): An error occurred: ") + exception.what());
320 if (node->
getId() == applyDisplayNode) {
326 if (node->
getId() == applyDisplayUpdateRenderingNode) {
331 if (StringTools::startsWith(node->
getId(),
"rendering.shader.") ==
true) {
333 applyDisplayShaderDetails(prototype,
"rendering.shader.", StringTools::substring(node->
getId(),
string(
"rendering.shader.").size(), node->
getId().size()), shaderParameters);
337 if (StringTools::startsWith(node->
getId(),
"rendering.distanceshader.") ==
true) {
339 applyDisplayShaderDetails(prototype,
"rendering.distanceshader.", StringTools::substring(node->
getId(),
string(
"rendering.distanceshader.").size(), node->
getId().size()), distanceShaderParameters);
TDME2 engine entity shader 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.
const string toString(float value) const
void setContributesShadows(bool contributesShadows)
Enable/disable contributes shadows.
void setShader(const string &id)
Set shader.
void setDistanceShaderParameters(const EntityShaderParameters ¶meters)
Set distance shader parameters.
const string & getShader()
Get shader.
float getDistanceShaderDistance()
Get distance shader distance.
bool isRenderGroups()
Is using render groups.
bool isContributesShadows()
const string & getDistanceShader()
Get distance shader.
void setDistanceShaderDistance(float distance)
Set distance shader distance.
void setDistanceShader(const string &id)
Set distance shader.
const EntityShaderParameters & getDistanceShaderParameters()
Get distance shader parameters.
void setShaderParameters(EntityShaderParameters ¶meters)
Set shader parameters.
void setRenderGroups(bool renderGroups)
Set using render groups.
const EntityShaderParameters & getShaderParameters()
Get shader parameters.
void setReceivesShadows(bool receivesShadows)
Enable/disable receives shadows.
Prototype_Type * getType()
GUI node controller base class.
virtual const MutableString & getValue()=0
GUINodeController * getController()
GUI screen node that represents a screen that can be rendered via GUI system.
GUINode * getNodeById(const string &nodeId)
Get GUI node by id.
GUINode * getInnerNodeById(const string &nodeId)
Get inner GUI node by id.
bool equals(const string &s2) const
Equals.
std::exception Exception
Exception base class.