MCPcopy Create free account
hub / github.com/crownengine/crown / parse_textures

Function parse_textures

src/resource/material_resource.cpp:222–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 }
221
222 static s32 parse_textures(Data &data, const char *json, CompileOptions &opts)
223 {
224 TempAllocator4096 ta;
225 JsonObject obj(ta);
226 RETURN_IF_ERROR(sjson::parse(obj, json));
227
228 auto cur = json_object::begin(obj);
229 auto end = json_object::end(obj);
230 for (; cur != end; ++cur) {
231 JSON_OBJECT_SKIP_HOLE(obj, cur);
232
233 const StringView key = cur->first;
234 const char *value = cur->second;
235
236 DynamicString texture(ta);
237 RETURN_IF_ERROR(sjson::parse_string(texture, value));
238 WARN_IF_MISSING(MATERIAL_RESOURCE, "texture", texture.c_str(), opts);
239 opts.add_requirement("texture", texture.c_str());
240
241 data.add_texture(key, StringId64(texture.c_str()));
242 }
243
244 return 0;
245 }
246
247 static s32 parse_uniforms(Data &data, const char *json, CompileOptions &opts)
248 {

Callers 1

compileFunction · 0.85

Calls 8

add_requirementMethod · 0.80
add_textureMethod · 0.80
parseFunction · 0.70
beginFunction · 0.50
endFunction · 0.50
parse_stringFunction · 0.50
StringId64Class · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected