Sets the material at a specified index position in an sfmesh object.
Syntax
sfmesh ST_SetMaterial(sfmesh sfmeshObject, int4 index, material materialObject);Parameters
| Parameter | Description |
|---|---|
sfmeshObject | The sfmesh object. |
index | The zero-based index of the material to set. |
materialObject | The material object. |
Example
The following example updates the material at index 0 in an sfmesh object, replacing it with a material that references row num=10 in the t_material table.
SELECT ST_SetMaterial(
'{"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,
'{"type":"db","attributes":{"schema":"public","table":"t_material","column":"the_material","key":"num=10"}}'
);