This topic describes the ST_AsGlb function. This function converts an object from the sfmesh type to the GLB format. GLB is the binary format of the GL Transmission Format (glTF).
Syntax
bytea ST_AsGlb(sfmesh sfmeshObject);Parameters
Parameter | Description |
sfmeshObject | The sfmesh object. |
options | The glTF options that are in JSON format. The following list describes the involved fields:
|
Description
This function converts an object from the sfmesh type to the binary format of glTF 2.0. If the conversion fails, NULL is returned.
Examples
select ST_AsGlb(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}]}'));
------------------------------------------------------------------------------
\x676c54460200000028040000a40300004a534f4e7b226163636573736f7273223a5 ......
-- Draco compression
select ST_Asglb(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}]}'),'{"draco_compress":true, "with_geometry":true}');
---------------------------------
\x676c544602000000840300000c0300004a534f4e7b226173736574223a7b2276657273696f6e223a22322e3 ...