ST_TextureN

更新时间:
复制 MD 格式

Returns the Nth texture in an sfmesh object.

Syntax

texture ST_TextureN(sfmesh sfmeshObject, int4 index);

Parameters

ParameterDescription
sfmeshObjectThe sfmesh object to query.
indexThe zero-based index of the texture to retrieve.
The index parameter is 0-based. To retrieve the first texture, pass 0; to retrieve the second, pass 1, and so on.

Description

ST_TextureN returns the texture at the specified index position in an sfmesh object.

Example

SELECT ST_TextureN(
  '{
    "meshgeoms": ["MESHGEOM(PATCH(TRIANGLESTRIP(0 0,0 10,10 10,10 0)))"],
    "materials": [{"type": "db", "attributes": {"schema": "public", "table": "t_material", "column": "the_material", "key": "num=1"}}],
    "textures": [{"compressionType": "None", "format": "JPEG", "wrap": "Wrap", "type": "DB", "depth": 3, "width": 256, "height": 256, "name": "texture_name3", "size": 72, "data": {"schema": "public", "table": "test", "column": "the_texture", "key": "num=1"}}],
    "primitives": [{"meshgeom": 0, "material": 0}],
    "nodes": [{"primitive": 0}]
  }'::sfmesh,
  0
);

The output is the binary representation of the returned texture object:

------------------------------
01010001010303000100000001000005000000123456FFFF