148 {
149 if (!node.IsSequence() || node.size() != 2)
150 {
151 std::stringstream ss;
152 ss << "YAML::convert<Spices::Material::ConstantParam>: bad node size, current size is" << node.size() << ", required 4";
153
154 SPICES_CORE_WARN(ss.str())
155 return false;
156 }
157
158 param.paramType = node[0].as<
std::
string>();
159
160 if (param.paramType == "float4") param.paramValue = node[1].as<glm::vec4>();
161 else if(param.paramType == "float3") param.paramValue = node[1].as<glm::vec3>();
162 else if(param.paramType == "float2") param.paramValue = node[1].as<glm::vec2>();
163 else if(param.paramType == "float") param.paramValue = node[1].as<float>();
164 else if(param.paramType == "int") param.paramValue = node[1].as<int>();
165 else if(param.paramType == "bool") param.paramValue = node[1].as<bool>();
166 else
167 {
168 std::stringstream ss;
169 ss <<
"YAML::convert<Spices::Material::ConstantParam>: not supported paramType: " << param.
paramType;
170
171 SPICES_CORE_WARN(ss.str())
172 }
173
174 return true;
175 }