Regular API function

simGetShapeViz / sim.getShapeViz

Description Retrieves a shape's visual information.
C/C++
synopsis
simInt simGetShapeViz(simInt shapeHandle,simInt index,struct SShapeVizInfo* info)
C/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, relative to the shape's reference frame. 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, relative to the shape's reference frame. There are 3*indicesSize normals, i.e. 3 normals per triangle. 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. There are 3*indicesSize texture coordinates, i.e. 3 coordinates per triangle. 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
bit3 set (8): wireframe
C/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
table data=sim.getShapeViz(int shapeHandle,int 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, relative to the shape's reference frame
data.indices: array containing the indices
data.normals: array containing the normals, relative to the shape's reference frame
data.colors: array containing the colors: RGB for ambient-diffuse, specular, and emission.
data.shadingAngle: the gouraud shading angle
data.transparency: 1=transparent, 0= opaque
data.options: bit-coded:
bit0 set (1): backface culling
bit1 set (2): wireframe

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
Python
synopsis
dict data=sim.getShapeViz(int shapeHandle,int index)