Declaration
Gltf_Light :: struct @json(rename_all=camelCase) {
name: string; @json(default,skip_serializing_if=empty) color: [3] float32 = .[1, 1, 1]; @json(default) intensity: float32 = 1.0; @json(default) type: Gltf_Light_Type; @json(rename_all=lowercase) range: float32 = 0.0; @json(default) spot: *Gltf_Light_Spot; @json(default,skip_serializing_if=null) extras: Json_Value; @json(default,skip_serializing_if=null)}One light of KHR_lights_punctual. A range of zero means unlimited, as the glTF default of no
range; spot is set only for spot lights.
#import "Extensions/Json";
asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"extensionsUsed\":[\"KHR_lights_punctual\"],\"extensions\":{\"KHR_lights_punctual\":{\"lights\":[{\"type\":\"spot\",\"intensity\":3,\"spot\":{\"outerConeAngle\":0.5}}]}}}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
lights, found, _ := gltf_extension(*asset.document.extensions, "KHR_lights_punctual", Gltf_Lights);
assert(found);
light := lights.lights[0];
assert(light.type == .SPOT && light.intensity == 3 && light.color[0] == 1 && light.spot.outer_cone_angle == 0.5);
free_json(*lights);