Regular API function

simGetShapeViz / sim.getShapeViz

Description Retrieves a shape's visual information.
C synopsis simInt simGetShapeViz(simInt shapeHandle,simInt index,struct SShapeVizInfo* info)
C parameters
shapeHandle: handle of the shape
index: 0-based index of the shape element to retrieve (compound shapes contain more than one shape element)
info: visual information about the shape:

vertices: array of vertices. The user is in charge of releasing this buffer with simReleaseBuffer if the return value is > 0.
verticesSize: the size of the vertices array
indices: array of indices. The user is in charge of releasing this buffer with simReleaseBuffer if the return value is > 0.
indicesSize: the size of the indices array
normals: array of normals. The user is in charge of releasing this buffer with simReleaseBuffer if the return value is > 0.
shadingAngle: the gouraud shading angle
colors[9]: array of colors: RGB for ambient-diffuse, specular, and emission.
texture: the RGBA texture (32bit/pixel). The user is in charge of releasing this buffer with simReleaseBuffer if the return value is > 1.
textureId: a texture id (to identify textures shared among several shapes)
textureRes[2]: the resolution of the texture
textureCoords: the texture coordinates. The user is in charge of releasing this buffer with simReleaseBuffer if the return value is > 1.
textureApplyMode: 0=modulate, 1=decal, 2=add
textureOptions: bit-coded:
bit0 set (1): repeat U
bit1 set (2): repeat V
bit2 set (4): interpolate colors
C return value
-1 if operation was not successful, 0 if there is no shape element at the given indexm, 1 if the shape element does not contain any texture, 2 if the shape element contains a texture
Lua synopsis map data=sim.getShapeViz(number shapeHandle,number index)
Lua parameters
shapeHandle: handle of the shape.
index: 0-based index of the shape element to retrieve (compound shapes contain more than one shape element)
Lua return values
In case of success, data contains following fields:
data.vertices: array containing the vertices
data.indices: array containing the indices
data.normals: array containing the normals
data.colors: array containing the colors: RGB for ambient-diffuse, specular, and emission.
data.shadingAngle: the gouraud shading angle

Additionally, if the shape element contains a texture, data contains following additional fields:
data.texture.texture: the string-coded RGBA texture. See also sim.transformBuffer
data.texture.id: a texture id (to identify textures shared among several shapes)
data.texture.resolution: the resolution of the texture
data.texture.coordinates: the texture coordinates
data.texture.applyMode: 0=modulate, 1=decal, 2=add
data.texture.options: bit-coded:
bit0 set (1): repeat U
bit1 set (2): repeat V
bit2 set (4): interpolate colors

All regular API functions on one page