Primitive

class pyrender.Primitive(positions, normals=None, tangents=None, texcoord_0=None, texcoord_1=None, color_0=None, joints_0=None, weights_0=None, indices=None, material=None, mode=None, targets=None, poses=None)[source]

Bases: object

A primitive object which can be rendered.

Parameters:
  • positions ((n, 3) float) – XYZ vertex positions.
  • normals ((n, 3) float) – Normalized XYZ vertex normals.
  • tangents ((n, 4) float) – XYZW vertex tangents where the w component is a sign value (either +1 or -1) indicating the handedness of the tangent basis.
  • texcoord_0 ((n, 2) float) – The first set of UV texture coordinates.
  • texcoord_1 ((n, 2) float) – The second set of UV texture coordinates.
  • color_0 ((n, 4) float) – RGBA vertex colors.
  • joints_0 ((n, 4) float) – Joint information.
  • weights_0 ((n, 4) float) – Weight information for morphing.
  • indices ((m, 3) int) – Face indices for triangle meshes or fans.
  • material (Material) – The material to apply to this primitive when rendering.
  • mode (int) –

    The type of primitives to render, one of the following:

    • 0: POINTS
    • 1: LINES
    • 2: LINE_LOOP
    • 3: LINE_STRIP
    • 4: TRIANGLES
    • 5: TRIANGLES_STRIP
    • 6: TRIANGLES_FAN
  • targets ((k,) int) – Morph target indices.
  • poses ((x,4,4), float) – Array of 4x4 transformation matrices for instancing this object.

Attributes Summary

bounds
buf_flags The flags for the render buffer.
centroid The centroid of the primitive’s AABB.
color_0 RGBA vertex colors.
extents The lengths of the axes of the primitive’s AABB.
indices Face indices for triangle meshes or fans.
is_transparent If True, the mesh is partially-transparent.
joints_0 Joint information.
material The material for this primitive.
mode The type of primitive to render.
normals Normalized XYZ vertex normals.
poses Homogenous transforms for instancing this primitive.
positions XYZ vertex positions.
scale The length of the diagonal of the primitive’s AABB.
tangents XYZW vertex tangents.
targets Morph target indices.
texcoord_0 The first set of UV texture coordinates.
texcoord_1 The second set of UV texture coordinates.
weights_0 Weight information for morphing.

Methods Summary

delete()

Attributes Documentation

bounds
buf_flags

The flags for the render buffer.

Type:int
centroid

The centroid of the primitive’s AABB.

Type:(3,) float
color_0

RGBA vertex colors.

Type:(n,4) float
extents

The lengths of the axes of the primitive’s AABB.

Type:(3,) float
indices

Face indices for triangle meshes or fans.

Type:(m,3) int
is_transparent

If True, the mesh is partially-transparent.

Type:bool
joints_0

Joint information.

Type:(n,4) float
material

The material for this primitive.

Type:Material
mode

The type of primitive to render.

Type:int
normals

Normalized XYZ vertex normals.

Type:(n,3) float
poses

Homogenous transforms for instancing this primitive.

Type:(x,4,4) float
positions

XYZ vertex positions.

Type:(n,3) float
scale

The length of the diagonal of the primitive’s AABB.

Type:(3,) float
tangents

XYZW vertex tangents.

Type:(n,4) float
targets

Morph target indices.

Type:(k,) int
texcoord_0

The first set of UV texture coordinates.

Type:(n,2) float
texcoord_1

The second set of UV texture coordinates.

Type:(n,2) float
weights_0

Weight information for morphing.

Type:(n,4) float

Methods Documentation

delete()[source]