| 447 | } |
| 448 | |
| 449 | static 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 | |
| 474 | static s32 compile_global_lighting(Buffer &output, UnitCompiler &compiler, FlatJsonObject &obj, CompileOptions &opts) |
| 475 | { |
nothing calls this directly
no test coverage detected