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

Function compile_fog

src/resource/unit_compiler.cpp:449–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449static s32 compile_fog(Buffer &output, UnitCompiler &compiler, FlatJsonObject &obj, CompileOptions &opts)
450{
451 CE_UNUSED_2(compiler, opts);
452
453 TempAllocator4096 ta;
454
455 FogDesc fd;
456 fd.color = RETURN_IF_ERROR(sjson::parse_vector3(flat_json_object::get(obj, "data.color")));
457 fd.density = RETURN_IF_ERROR(sjson::parse_float(flat_json_object::get(obj, "data.density")));
458 fd.range_min = RETURN_IF_ERROR(sjson::parse_float(flat_json_object::get(obj, "data.range_min")));
459 fd.range_max = RETURN_IF_ERROR(sjson::parse_float(flat_json_object::get(obj, "data.range_max")));
460 fd.sun_blend = RETURN_IF_ERROR(sjson::parse_float(flat_json_object::get(obj, "data.sun_blend")));
461 fd.enabled = (f32)RETURN_IF_ERROR(sjson::parse_bool(flat_json_object::get(obj, "data.enabled")));
462
463 FileBuffer fb(output);
464 BinaryWriter bw(fb);
465 bw.write(fd.color);
466 bw.write(fd.density);
467 bw.write(fd.range_min);
468 bw.write(fd.range_max);
469 bw.write(fd.sun_blend);
470 bw.write(fd.enabled);
471 return 0;
472}
473
474static s32 compile_global_lighting(Buffer &output, UnitCompiler &compiler, FlatJsonObject &obj, CompileOptions &opts)
475{

Callers

nothing calls this directly

Calls 5

parse_vector3Function · 0.85
getFunction · 0.85
parse_floatFunction · 0.50
parse_boolFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected