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
| Parameter | Description |
|---|---|
sfmeshObject | The sfmesh object to convert. |
rawGeometry | Specifies whether to convert the referenced geometry to a RAW object. Defaults to true. |
rawMesh | Specifies whether to convert the referenced sfmesh to a RAW object. Defaults to true. |
rawMaterial | Specifies whether to convert the referenced material to a RAW object. Defaults to true. |
rawTexture | Specifies whether to convert the referenced texture to a RAW object. Defaults to true. |
meshgeom overload
| Parameter | Description |
|---|---|
meshgeom | The meshgeom object to convert. |
texture overload
| Parameter | Description |
|---|---|
texture | The texture object to convert. |
material overload
| Parameter | Description |
|---|---|
material | The 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}}该文章对您有帮助吗?