SBSurface#

This class describes a renderable surface that stores the triangle geometry of a mesh.

Surfaces are typically obtained from a mesh, but they can also be constructed explicitly from geometry arrays when building custom visual data in Python.

class samson.SBSurface(self: samson.SBSurface, numberOfTriangles: SupportsInt | SupportsIndex, numberOfPositions: SupportsInt | SupportsIndex, indexData: collections.abc.Sequence[SupportsInt | SupportsIndex], positionData: collections.abc.Sequence[SupportsFloat | SupportsIndex], normalData: collections.abc.Sequence[SupportsFloat | SupportsIndex], colorData: collections.abc.Sequence[SupportsFloat | SupportsIndex], flagData: collections.abc.Sequence[SupportsInt | SupportsIndex], nodeIndexData: collections.abc.Sequence[SupportsInt | SupportsIndex], textureCoordinateData: collections.abc.Sequence[SupportsFloat | SupportsIndex], diffuseTexture: SBMVisualModelTexture = None)#

Bases: pybind11_object

This class describes a surface.

Construct a surface from explicit geometry arrays.

Parameters:
  • numberOfTriangles (int) – Number of triangles described by indexData.

  • numberOfPositions (int) – Number of vertex positions described by the per-vertex arrays.

  • indexData (list[int]) – Triangle index buffer. The list must contain exactly 3 * numberOfTriangles elements.

  • positionData (list[float]) – Flattened XYZ position buffer. The list must contain exactly 3 * numberOfPositions elements.

  • normalData (list[float]) – Flattened XYZ normal buffer. The list must contain exactly 3 * numberOfPositions elements.

  • colorData (list[float]) – Flattened RGBA color buffer. The list must contain exactly 4 * numberOfPositions elements.

  • flagData (list[int]) – Per-vertex flag values. The list must contain exactly numberOfPositions elements.

  • nodeIndexData (list[int]) – Per-vertex node indices. The list must contain exactly numberOfPositions elements.

  • textureCoordinateData (list[float]) – Flattened UV texture-coordinate buffer. The list must contain exactly 2 * numberOfPositions elements.

  • diffuseTexture (samson.SBTexture or None, optional) – Diffuse texture associated with the surface. The default is None.

Raises:

RuntimeError – If any array length does not match the expected size for the provided triangle or position count.

getColorData(self: samson.SBSurface) list[float]#

Return the vertex color buffer.

Returns:

Flattened RGBA colors with length 4 * numberOfPositions.

Return type:

list[float]

getDiffuseTexture(self: samson.SBSurface) SBMVisualModelTexture#

Returns the diffuse texture

getFlagData(self: samson.SBSurface) list[int]#

Return the per-vertex flag buffer.

Returns:

Flag values with length numberOfPositions.

Return type:

list[int]

getIndexData(self: samson.SBSurface) list[int]#

Return the triangle index buffer.

Returns:

Flattened triangle indices with length 3 * numberOfTriangles.

Return type:

list[int]

getNodeIndexData(self: samson.SBSurface) list[int]#

Return the per-vertex node-index buffer.

Returns:

Node indices with length numberOfPositions.

Return type:

list[int]

getNormalData(self: samson.SBSurface) list[float]#

Return the vertex normal buffer.

Returns:

Flattened XYZ normals with length 3 * numberOfPositions.

Return type:

list[float]

getPositionData(self: samson.SBSurface) list[float]#

Return the vertex position buffer.

Returns:

Flattened XYZ positions with length 3 * numberOfPositions.

Return type:

list[float]

getTextureCoordinateData(self: samson.SBSurface) list[float]#

Return the texture-coordinate buffer.

Returns:

Flattened UV coordinates with length 2 * numberOfPositions.

Return type:

list[float]

setColorData(self: samson.SBSurface, data: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None#

Set the vertex color buffer.

Parameters:

data (list[float]) – Flattened RGBA colors. The expected length is 4 * numberOfPositions.

setDiffuseTexture(self: samson.SBSurface, texture: SBMVisualModelTexture) None#

Sets the diffuse texture

setFlagData(self: samson.SBSurface, data: collections.abc.Sequence[SupportsInt | SupportsIndex]) None#

Set the per-vertex flag buffer.

Parameters:

data (list[int]) – Flag values. The expected length is numberOfPositions.

setIndexData(self: samson.SBSurface, data: collections.abc.Sequence[SupportsInt | SupportsIndex]) None#

Set the triangle index buffer.

Parameters:

data (list[int]) – Flattened triangle indices. The expected length is 3 * numberOfTriangles.

setNodeIndexData(self: samson.SBSurface, data: collections.abc.Sequence[SupportsInt | SupportsIndex]) None#

Set the per-vertex node-index buffer.

Parameters:

data (list[int]) – Node indices. The expected length is numberOfPositions.

setNormalData(self: samson.SBSurface, data: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None#

Set the vertex normal buffer.

Parameters:

data (list[float]) – Flattened XYZ normals. The expected length is 3 * numberOfPositions.

setPositionData(self: samson.SBSurface, data: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None#

Set the vertex position buffer.

Parameters:

data (list[float]) – Flattened XYZ positions. The expected length is 3 * numberOfPositions.

setTextureCoordinateData(self: samson.SBSurface, data: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None#

Set the texture-coordinate buffer.

Parameters:

data (list[float]) – Flattened UV coordinates. The expected length is 2 * numberOfPositions.

property numberOfPositions#

Number of vertex positions in the surface.

property numberOfTriangles#

Number of triangles in the surface.