Skip to content

Scene State Format

angelxuanchang edited this page Dec 4, 2023 · 2 revisions

The scene-state format specifies the set of 3D model assets used in the scene together with their transforms.

There can be a arch field that specifies the architecture. The architecture can either be a reference to another json file or directly embedded.

To specify the arch by reference, use the ref field to specify the architecture id:

  "arch": { "ref": "arch.00001" }

The transform is a 4x4 matrix in column order. In newer versions of the format, the scene-state can also include the rotation, translation and scale as vectors. The rotation vector is a quaternion in [x,y,z,w] order.

The model ids specify the asset source together with the asset id.

Example of scene-state file:

{
  "format": "sceneState",
  "scene": {
    "version": "scene@1.0.2",
    "id": "wssScenes.scene00096",
    "up": {
      "x": 0,
      "y": 0,
      "z": 1
    },
    "front": {
      "x": 0,
      "y": -1,
      "z": 0
    },
    "unit": 0.0254,
    "assetSource": [
      "wss"
    ],
    "object": [
      {
        "id": "0",                                     // String id of the object instance 
        "modelId": "wss.room15",                       // Indicate what model to use (room15 from wss asset set)
        "index": 0,                                    // Index of this object instance in this array 
        "parentIndex": -1,                             // Whether there is a support parent 
                                                       // Alternative is to specify the "parentId" which can point to architecture elements as well
        "transform": {                                 // Transform matrix in column-order 
          "rows": 4,
          "cols": 4,
          "data": [ 
            1, 
            0, 
            0, 
            0,
            0,
            1,
            0,
            0,
            0,
            0,
            1,
            0,
            0,
            0,
            0,
            1
          ]
        }
      },
      {
        "id": "1",
        "modelId": "wss.c04fd0df2310b7653321831d2245cf06",
        "index": 1,
        "parentIndex": 0,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            -2.1147500000000004,
            1.848769997997997E-7,
            -6.531228274167956E-24,
            0,
            -1.848769997997997E-7,
            -2.1147500000000004,
            6.531229503231712E-24,
            0,
            -6.531227700709197E-24,
            6.5312299962697776E-24,
            2.11475,
            0,
            92.77729999999998,
            43.5621,
            94.9695,
            1
          ]
        }
      },
      {
        "id": "2",
        "modelId": "wss.24de2766872efc6c188b3228ae423298",
        "index": 2,
        "parentIndex": 0,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            9.344391926902064E-16,
            4.208340000000001,
            -1.9721522630525295E-31,
            0,
            -4.208340000000001,
            9.344391926902064E-16,
            -3.514966202000622E-32,
            0,
            0,
            1.9721522630525295E-31,
            4.208340000000001,
            0,
            117.578,
            43.562100000000015,
            52.317,
            1
          ]
        }
      },
      {
        "id": "3",
        "modelId": "wss.c24783f8dae6f779f11c3739edd52fa3",
        "index": 3,
        "parentIndex": 0,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            2.05285,
            -4.558242672203505E-16,
            -5.060665966509231E-32,
            0,
            4.558242672203505E-16,
            2.05285,
            -9.860761315262648E-32,
            0,
            5.060665966509231E-32,
            9.860761315262648E-32,
            2.05285,
            0,
            115.185,
            59.04529999999998,
            8.132759999999992,
            1
          ]
        }
      },
      {
        "id": "4",
        "modelId": "wss.612502d1b88031d38223339ec998b50b",
        "index": 4,
        "parentIndex": 0,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            -1.5840400000000003,
            1.384809998431363E-7,
            5.590116132182207E-24,
            0,
            -1.384809998431363E-7,
            -1.5840400000000003,
            4.8921830758281974E-24,
            0,
            5.5901165617278024E-24,
            4.892182582790132E-24,
            1.5840400000000003,
            0,
            100.49899999999998,
            43.56209999999998,
            42.93769999999999,
            1
          ]
        }
      },
      {
        "id": "5",
        "modelId": "wss.3ee02ae42082a4d376a2788017b16c37",
        "index": 5,
        "parentIndex": 0,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            -1.6873,
            -3.7465586189000533E-16,
            4.159515641810665E-32,
            0,
            3.7465586189000533E-16,
            -1.6873,
            0,
            0,
            4.1595156418106664E-32,
            0,
            1.6873,
            0,
            308.74799999999993,
            127.97999999999999,
            8.124020000000002,
            1
          ]
        }
      },
      {
        "id": "6",
        "modelId": "wss.ff0880acb7e82c205af86d34b0df5f90",
        "index": 6,
        "parentIndex": 5,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            -1.1854699999999998,
            -7.065960026322724E-8,
            -3.922382096854397E-24,
            0,
            7.065960026322722E-8,
            -1.1854699999999998,
            3.4512664603419266E-31,
            0,
            -3.9223820968544105E-24,
            1.9721522630525295E-31,
            1.18547,
            0,
            248.108,
            94.48549999999996,
            53.37009999999999,
            1
          ]
        }
      },
      {
        "id": "7",
        "modelId": "wss.acc67510dd228d01d7cbb1f9251b6139",
        "index": 7,
        "parentIndex": 5,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            1.1490808304870368E-15,
            -2.5874999999999995,
            2.9582283945787943E-31,
            0,
            2.5874999999999995,
            1.1490808304870372E-15,
            1.338287773387369E-31,
            0,
            -1.2131842169368415E-31,
            1.9721522630525295E-31,
            2.5874999999999995,
            0,
            -670.8930000000003,
            298.43899999999974,
            52.2437,
            1
          ]
        }
      },
      {
        "id": "8",
        "modelId": "wss.acc67510dd228d01d7cbb1f9251b6139",
        "index": 8,
        "parentIndex": 5,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            1.1490808304870368E-15,
            -2.5874999999999995,
            2.9582283945787943E-31,
            0,
            2.5874999999999995,
            1.1490808304870372E-15,
            1.338287773387369E-31,
            0,
            -1.2131842169368415E-31,
            1.9721522630525295E-31,
            2.5874999999999995,
            0,
            -679.3880000000003,
            300.47299999999973,
            52.24369999999999,
            1
          ]
        }
      },
      {
        "id": "9",
        "modelId": "wss.acc67510dd228d01d7cbb1f9251b6139",
        "index": 9,
        "parentIndex": 5,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            1.1490808304870368E-15,
            -2.5874999999999995,
            2.9582283945787943E-31,
            0,
            2.5874999999999995,
            1.1490808304870372E-15,
            1.338287773387369E-31,
            0,
            -1.2131842169368415E-31,
            1.9721522630525295E-31,
            2.5874999999999995,
            0,
            -688.4870000000001,
            301.19399999999973,
            52.24369999999999,
            1
          ]
        }
      },
      {
        "id": "10",
        "modelId": "wss.4e300f10506f23f86e57243d49772ed8",
        "index": 10,
        "parentIndex": 5,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            1.8198154094761775E-17,
            -0.0409786,
            1.5407439555097887E-33,
            0,
            0.0409786,
            1.8198154094761775E-17,
            2.145201597372404E-33,
            0,
            0,
            1.5407439555097887E-33,
            0.0409786,
            0,
            130.93399999999997,
            98.53519999999995,
            52.24369999999997,
            1
          ]
        }
      },
      {
        "id": "11",
        "modelId": "wss.1e5abf0465d97d826118a17db9de8c0",
        "index": 11,
        "parentIndex": 5,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            6.331113411306432E-18,
            -0.014256399999999999,
            1.1555579666323415E-33,
            0,
            0.014256399999999999,
            6.331113411306434E-18,
            9.318894914081506E-34,
            0,
            -4.739000847409537E-34,
            1.1555579666323415E-33,
            0.014256399999999999,
            0,
            178.58099999999996,
            84.55859999999993,
            52.24369999999999,
            1
          ]
        }
      },
      {
        "id": "12",
        "modelId": "wss.ceb01f7d013e1660e82b1dc57ebca27",
        "index": 12,
        "parentIndex": 5,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            -0.10132799999999999,
            -0.05850170000000003,
            -1.3456309751153964E-17,
            0,
            0.05850170000000003,
            -0.10132799999999999,
            -5.021965140211728E-17,
            0,
            1.3456362455700244E-17,
            -5.0219880123743596E-17,
            0.11700400000000004,
            0,
            165.9,
            89.32009999999995,
            52.2437,
            1
          ]
        }
      },
      {
        "id": "13",
        "modelId": "wss.6354f7b41a25f49eb637980f6f06104",
        "index": 13,
        "parentIndex": 0,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            -1.7024000000000001,
            3.780087354243747E-16,
            -1.4882899999999996E-7,
            0,
            3.78008702377697E-16,
            1.702400000000001,
            -3.78008724158837E-16,
            0,
            1.48829E-7,
            -3.780087466899128E-16,
            -1.7024000000000001,
            0,
            126.40800000000004,
            96.20900000000005,
            106.04900000000005,
            1
          ]
        }
      },
      {
        "id": "14",
        "modelId": "wss.9603f67e3d3cc8793580f756624326f1",
        "index": 14,
        "parentIndex": 0,
        "transform": {
          "rows": 4,
          "cols": 4,
          "data": [
            -1.54147,
            1.347590000606496E-7,
            5.439932200039141E-24,
            0,
            -1.347590000606496E-7,
            -1.54147,
            -5.439930716128283E-24,
            0,
            5.439931763037186E-24,
            -5.439930864039703E-24,
            1.5414700000000003,
            0,
            142.229,
            43.562099999999994,
            77.62879999999998,
            1
          ]
        }
      }
    ],
    "camera": [
      {
        "up": {
          "x": 0,
          "y": 0,
          "z": 1
        },
        "position": {
          "x": -325.714179314805,
          "y": 26.90886447531276,
          "z": 371.0709396283615
        },
        "target": {
          "x": 133.85850524902344,
          "y": 216.53550720214844,
          "z": 57.08649826049799
        },
        "isOrtho": false,
        "name": "current"
      }
    ]
  },
  "selected": []
}