{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://arx-tools.github.io/schemas/llf.schema.json",
  "title": "LLF",
  "description": "LLF (Level Lighting File) format of Arx Fatalis interpreted as JSON by arx-convert",
  "x-generatedBy": "arx-convert@14.0.1",
  "$defs": {
    "uint8": {
      "type": "integer",
      "minimum": 0,
      "maximum": 255
    },
    "positiveInt32": {
      "type": "integer",
      "minimum": 0,
      "maximum": 2147483647
    },
    "float32": {
      "description": "IEEE-754 single precision (32-bit) floating point number, exactly as it is stored in the binary format. JSON has no float32 type, so it is written as a 64-bit double using the shortest decimal representation which parses back to a value rounding to the very same float32 (`Math.fround(value)` gives back the original). In JavaScript a float32 can be decoded with `DataView#getFloat32` and encoded with `DataView#setFloat32` (or rounded to one with `Math.fround`) - see `BinaryIO.readFloat32Array` / `BinaryIO.writeFloat32Array` in arx-convert. Fields with the `integer` type are never float32.",
      "type": "number"
    },
    "vector3": {
      "type": "object",
      "properties": {
        "x": {
          "$ref": "#/$defs/float32"
        },
        "y": {
          "$ref": "#/$defs/float32"
        },
        "z": {
          "$ref": "#/$defs/float32"
        }
      },
      "required": [
        "x",
        "y",
        "z"
      ]
    },
    "color": {
      "type": "object",
      "properties": {
        "r": {
          "$ref": "#/$defs/uint8"
        },
        "g": {
          "$ref": "#/$defs/uint8"
        },
        "b": {
          "$ref": "#/$defs/uint8"
        },
        "a": {
          "description": "0.0 = fully transparent, 1.0 = fully opaque",
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "required": [
        "r",
        "g",
        "b",
        "a"
      ]
    }
  },
  "type": "object",
  "properties": {
    "header": {
      "type": "object",
      "properties": {
        "lastModifiedBy": {
          "type": "string",
          "maxLength": 256
        },
        "lastModifiedAt": {
          "description": "Unix timestamp in seconds",
          "$ref": "#/$defs/positiveInt32"
        },
        "numberOfPolygonsInFTS": {
          "$ref": "#/$defs/positiveInt32"
        }
      },
      "required": [
        "lastModifiedBy",
        "lastModifiedAt",
        "numberOfPolygonsInFTS"
      ]
    },
    "lights": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "position": {
            "$ref": "#/$defs/vector3"
          },
          "color": {
            "$ref": "#/$defs/color"
          },
          "fallStart": {
            "description": "The radius of a sphere around `position` in which the light is at full intensity.",
            "type": "number"
          },
          "fallEnd": {
            "description": "The radius of a sphere around `position` where the light's intensity gradually fades to 0.",
            "type": "number"
          },
          "intensity": {
            "description": "How bright the light is.",
            "type": "number"
          },
          "exFlicker": {
            "description": "This color periodically overrides `color`. The frequency of the flicker cannot be changed. Subtractive color mixing is used, the color will get subtracted from `color` resulting in a negative color",
            "$ref": "#/$defs/color"
          },
          "exRadius": {
            "description": "Determines the spread of the smoke and fire particles: creates a circle around the center of the light with a radius of `exRadius`. When `ArxLightFlags.SpawnFire` is set, then it also sets the radius of the spheare around the light's center which harms the NPCs and the player with fire damage when getting in contact.",
            "type": "number"
          },
          "exFrequency": {
            "description": "How frequently should the light source spawn flame particles when `flags` has `ArxLightFlags.SpawnFire` set, or smoke particle when `ArxLightFlags.SpawnSmoke` is set. The range is between 0.0 and 1.0 where 0.0 completely stops fire from spawning.",
            "type": "number"
          },
          "exSize": {
            "description": "Size of the fire/smoke particles if `ArxLightFlags.SpawnFire` or `ArxLightFlags.SpawnSmoke` is set. The value is supposed to be set between 0.0 and 1.0, but it can go over 1.0 for extreme effect.",
            "type": "number"
          },
          "exSpeed": {
            "description": "How far the fire/smoke particles go during the time they are alive. A larger number will make the particles shoot up like a fountain, positive values closer to 0.0 will make all of them stay in one place. The value is supposed to be set between 0.0 and 1.0, but it can go outside that boundary for extreme effect. Negative values will make flame particles never despawn, so after a bit new flame particles will cease to spawn.",
            "type": "number"
          },
          "exFlareSize": {
            "description": "The radius of the flare/halo when `ArxLightFlags.Flare` is set. The value of `exFlareSize` is ignored when `ArxLightFlags.FixFlareSize` is set. Danae only allows setting it to a maximum of 200, but there isn't any limitiations in the game.",
            "type": "number"
          },
          "flags": {
            "description": "See ArxLightFlags for values",
            "$ref": "#/$defs/positiveInt32"
          }
        },
        "required": [
          "position",
          "color",
          "fallStart",
          "fallEnd",
          "intensity",
          "exFlicker",
          "exRadius",
          "exFrequency",
          "exSize",
          "exSpeed",
          "exFlareSize",
          "flags"
        ]
      }
    },
    "colors": {
      "description": "pre-computed vertex light colors for FTS.polygons",
      "type": "array",
      "items": {
        "$ref": "#/$defs/color"
      }
    }
  },
  "required": [
    "header",
    "lights",
    "colors"
  ]
}
