Returns the Nth material from an sfmesh object by zero-based index.
Syntax
material ST_MaterialN(sfmesh sfmeshObject, int4 index)Parameters
| Parameter | Description |
|---|---|
sfmeshObject | The sfmesh object to query. |
index | The zero-based index of the material to retrieve. The first material is at index 0. |
Usage notes
The
indexparameter is zero-based: the first material is at index0, not1.
Example
Retrieve the first material (index 0) from an sfmesh object that references a material stored in a database table:
SELECT ST_MaterialN(
'{
"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"}}],
"primitives": [{"meshgeom": 0, "material": 0}],
"nodes": [{"primitive": 0}]
}'::sfmesh,
0
);Output:
010102FFDDEEAA该文章对您有帮助吗?