ST_AsRaw

更新时间:
复制 MD 格式

ST_AsRaw converts an object in an external store to a RAW object in an internal store.

Syntax

sfmesh ST_AsRaw(sfmesh sfmeshObject,
                boolean rawGeometry default true,
                boolean rawMesh default true,
                boolean rawMaterial default true,
                boolean rawTexture default true);

meshgeom ST_AsRaw(meshgeom meshgeom);

texture ST_AsRaw(texture texture);

material ST_AsRaw(material material);

Parameters

The function has four overloads. Parameters differ by overload.

sfmesh overload

ParameterDescription
sfmeshObjectThe sfmesh object to convert.
rawGeometrySpecifies whether to convert the referenced geometry to a RAW object. Defaults to true.
rawMeshSpecifies whether to convert the referenced sfmesh to a RAW object. Defaults to true.
rawMaterialSpecifies whether to convert the referenced material to a RAW object. Defaults to true.
rawTextureSpecifies whether to convert the referenced texture to a RAW object. Defaults to true.

meshgeom overload

ParameterDescription
meshgeomThe meshgeom object to convert.

texture overload

ParameterDescription
textureThe texture object to convert.

material overload

ParameterDescription
materialThe material object to convert.

Examples

Example 1: Convert a texture object

-- texture
SELECT ST_AsText(ST_AsRaw(ST_MakeTexture(225,225,'/home/example.jpeg'::cstring, false)));

Output:

{"compressionType" : "None", "format" : "JPEG", "wrap" : "Wrap", "type" : "Raw", "depth" : 3, "width" : 225, "height" : 225, "size" : 7921, "data" : "FFD8FFE0001...."}

Example 2: Convert a material object

-- Material
SELECT ST_AsText(ST_AsRaw(ST_MakeMaterial('t_material'::text,
    'the_material'::text,
    'num=1'::text)));

Output:

{"type":"raw", "attributes":  "ambient":"#FFDDEEAA", "diffuse" :"#FFDDEEAA","specular":"#FFDDEEAA","shininess":30,"transparency":70,"texture":2}}