This topic describes the ST_AsGltf function. This function converts an object from the sfmesh type to the GL Transmission Format (glTF) type. Data of the glTF type is well suited to web browsers.
Syntax
text ST_AsGltf(sfmesh sfmeshObject);
text ST_AsGltf(sfmesh mesh, cstring optins);
Parameter
Parameter | Description |
sfmeshObject | The sfmesh object. |
options | The glTF options that are in the JSON format. The following list describes the involved fields:
|
Description
This function converts an object from the sfmesh type to the text format of glTF 2.0. If the conversion fails, NULL is returned.
Example:
select ST_AsGltf(ST_MeshFromText('{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}'));
------------------------------------------------------------------------------
{"accessors":[{"bufferView":0,"componentType":5121,"count":6,"max" ....
-- Parameter
select ST_AsGltf(ST_MeshFromText('{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}'), '{"with_geometry":false}');
-------------
{"asset":{"generator":"ganos","version":"2.0"},"nodes":[{}]}