﻿{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.mpai.community/OSD/V1.4/data/TextureMap.json",
  "title": "TextureMap",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "Header": {
      "type": "string",
      "pattern": "^OSD-TEM-V[0-9]{1,2}[.][0-9]{1,2}$"
    },
    "MInstanceID": {
      "type": "string"
    },
    "TextureMapID": {
      "type": "string"
    },
    "TextureMap": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "BumpMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          }
        },
        "DisplacementMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          }
        },
        "AmbientOcclusionMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number"
              }
            }
          }
        },
        "RoughnessMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        },
        "DiffuseMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "R": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "G": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "B": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": [
                  "R",
                  "G",
                  "B"
                ]
              }
            }
          }
        },
        "ColourMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "R": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "G": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "B": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": [
                  "R",
                  "G",
                  "B"
                ]
              }
            }
          }
        },
        "ReflectionMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "R": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "G": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "B": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": [
                  "R",
                  "G",
                  "B"
                ]
              }
            }
          }
        },
        "SpecularMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "R": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "G": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "B": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        }
                      },
                      "required": [
                        "R",
                        "G",
                        "B"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "Intensity": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        }
                      },
                      "required": [
                        "Intensity"
                      ]
                    }
                  ]
                }
              }
            }
          }
        },
        "NormalMap": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "alpha": {
                          "type": "number"
                        },
                        "beta": {
                          "type": "number"
                        },
                        "gamma": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "alpha",
                        "beta",
                        "gamma"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "R": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "G": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "B": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        }
                      },
                      "required": [
                        "R",
                        "G",
                        "B"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "DescrMetadata": {
      "type": "string",
      "maxLength": 2048
    }
  },
  "required": [
    "Header",
    "TextureMapID",
    "TextureMap"
  ]
}