This topic describes the ST_SceneFromGLTF function. This function constructs a scene object from the input GL Transmission Format (glTF) string.
Syntax
scene ST_SceneFromGltf(cstring gltf,
integer srid default 0,
integer lod default 0);
scene ST_SceneFromGltf(cstring gltf,
integer srid,
integer lod,
float8[] affine);
Parameters
Parameter | Description |
---|---|
gltf | The glTF string from which this function constructs the scene object. |
srid | The spatial reference identifier. Default value: 0. |
lod | The LOD level. Default value: 0. |
affine | An array of affine transformations. The number of fields in the affine parameter must be 12 or 16. If the affine parameter contains 16 fields, the last four fields are ignored. |
Description
This function constructs a scene object from the input glTF string.
Affine transformation matrix Affine:
/ p[1] p[2] p[3] p[4] \
| p[5] p[6] p[7] p[8] |
\ p[9] p[10] p[11] p[12] /
Each coordinate is transformed:
x' = p[1]*x + p[2]*y + p[3]*z + p[4]
y' = p[5]*x + p[6]*y + p[7]*z + p[8]
z' = p[9]*x + p[10]*y + p[11]*z + p[12]
Examples
- Example 1:
SELECT ST_AsText(ST_sceneFromGLTF('{"accessors": ... }')); -------------- {"type" : "gltf", "content" : {"accessors":...}}
- Example 2:
SELECT ST_AsText(ST_sceneFromGLTF('{"accessors": ... }', 4326)); -------------- {"type" : "gltf", "srid" : 4326, "content" : {"accessors":...}}
- Example 3:
SELECT ST_AsText(ST_sceneFromGLTF('{"accessors": ... }', 4326, 1)); -------------- {"type" : "gltf", "srid" : 4326, "lod" : 1, "content" : {"accessors":...}}
- Example 4:
SELECT ST_AsText(ST_sceneFromGLTF('{"accessors": ... }', 4326, 1,ARRAY[0.5, 0, 0, 1, 0, 0.5, 0, 1, 0, 0, 0.5, 1]::float8[])); -------------- {"type" : "gltf", "srid" : 4326, "lod" : 1, "affine" : [0.5,0,0,1,0,0.5,0,1,0,0,0.5,1,0,0,0,1], "content" : {"accessors":...}}