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);

Parameters

ParameterDescription
sfmeshObjectThe sfmesh object.

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.

Examples

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" ....}]}