Loading an Aesel Scene

Once registered to a Scene, a device needs to actually load all of the data that comprises this full 3-D Environment. This can contain an enormous amount of different types of data, such as (but not limited to):

  • Mesh Data (.obj)
  • Animation Data (.fbx)
  • Shader Data (.glsl)
  • Texture Data (.png)

These are just a few examples of the multitude of types of information that may be present, and we boil these all down to one term: ‘Assets’.

Assets may be present for the Scene (such as a reference image or map/level data), as well as for individual objects (which also have an associated location, rotation, and scale within the scene). So, our process of loading a scene boils down to a few simple steps:

  • Load Scene
  • Load Scene Assets
  • Load Scene Objects
  • Load Object Assets

Loading Scenes

Loading a Scene can be done either with a Scene Retreival:

http

GET /v1/scene/key HTTP/1.1
Host: localhost:5885

curl

curl -i http://localhost:5885/v1/scene/key

response

HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene/key
Content-Type: application/json

{
    "msg_type": 2,
    "err_code": 100,
    "num_records": 1,
    "start_record": 0,
    "scenes": [
        {
            "key": "123",
            "name": "testScene",
            "region": "us-ga",
            "latitude": 100,
            "active": true,
            "longitude": 100,
            "distance": 0,
            "assets": [
                "asset1"
            ],
            "tags": [
                "tag1"
            ],
            "devices": []
        }
    ]
}

or, we can find Scenes with a Scene Query:

http

POST /v1/scene/query HTTP/1.1
Host: localhost:5885
Content-Type: application/json

{
  "scenes":[
    {
      "name":"test",
      "region":"US-MD",
      "latitude":124,
      "longitude":122,
      "assets":["TestAsset10"],
      "tags":["Testing2"]
    }
  ]
}

curl

curl -i -X POST http://localhost:5885/v1/scene/query -H 'Content-Type: application/json' --data-raw '{"scenes": [{"name": "test", "tags": ["Testing2"], "region": "US-MD", "longitude": 122, "latitude": 124, "assets": ["TestAsset10"]}]}'

response

HTTP/1.1 200 OK
Location: http://localhost:5885/v1/scene/query
Content-Type: application/json

{
"num_records":1,
  "scenes":[
    {
    "key":"jklmnop",
    "name":"TestScene10",
    "region":"US-MD",
    "latitude":124.0,
    "longitude":122.0,
    "tags":["test","test2"],
    "asset_ids":["asset1","asset2"]
    }
  ]
}

Loading Scene Assets

Now that we have our scene, We query for Assets related to the scene:

http

GET /v1/relationship?type=scene&related=123 HTTP/1.1
Host: localhost:8080

curl

curl -i 'http://localhost:8080/v1/relationship?type=scene&related=123'

response

HTTP/1.1 200 OK
Location: http://localhost:8080/v1/relationship?type=scene&related=123

[
    {
        "id": "5bbd6ea100bd75575fb32caa",
        "assetId": "5bbd6ea100bd75575fb32ca8",
        "assetSubId": "meshName",
        "relationshipType": "object",
        "relationshipSubtype": "mesh",
        "relatedId": "5bbd6da600bd75575fb32ca5"
    }
]

we issue an Asset Retrieval Message for each asset listed in the response:

http

GET /v1/asset/key HTTP/1.1
Host: localhost:8080

curl

curl -i http://localhost:8080/v1/asset/key

Loading Scene Objects

We can issue an Object Query to pull the Objects in a Scene, and if all parameters are left out of the request, than all Objects in the scene will be returned:

http

POST /v1/scene/scene-key/object/query HTTP/1.1
Host: localhost:8080
Content-Type: application/json

{
"name": "Test Object 123464",
"type": "Curve",
"subtype": "Sphere",
"owner": "456",
"timestamp": 123456789,
"translation": [0, 0, 1],
"quaternion_rotation": [0, 1, 0, 0],
"euler_rotation": [0, 0, 0],
"scale": [1, 1, 2],
"assets": ["Asset_5"]
}

curl

curl -i -X POST http://localhost:8080/v1/scene/scene-key/object/query -H 'Content-Type: application/json' --data-raw '{"assets": ["Asset_5"], "euler_rotation": [0, 0, 0], "name": "Test Object 123464", "owner": "456", "quaternion_rotation": [0, 1, 0, 0], "scale": [1, 1, 2], "subtype": "Sphere", "timestamp": 123456789, "translation": [0, 0, 1], "type": "Curve"}'

response

HTTP/1.1 200 OK
Location: http://localhost:8080/v1/scene/scene-key/object/query
Content-Type: application/json

{
  "num_records":1,
  "objects":[
    {
    "key":"5951dd759af59c00015b1409",
    "name":"123",
    "scene":"DEFGHIJ123463",
    "type":"Mesh",
    "subtype":"Cube",
    "owner":"456",
    "transform":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
    "assets": ["Asset_5"]
    }
  ]
}

Loading Object Assets

Loading Object Assets follows exactly the same process as retrieving Scene Assets, only we query the Asset Relationship API with relationship-type=object, instead of ‘scene’.