Collection of tags associated with this object
StaticcurrentCurrent maximum object count for UID generation
Static ReadonlyInvalidInvalid object UID constant
Gets the vertex handles associated with this primitive for GPU resources.
The vertex handles if they exist, otherwise undefined
Gets the axis-aligned bounding box for this primitive. The AABB is calculated from position data and cached until positions change.
The bounding box containing all vertices
Gets all vertex attribute accessors for this primitive.
An array of all attribute accessors
Gets the component types of all vertex attributes.
An array of component types (Float, UnsignedByte, etc.)
Gets the composition types of all vertex attributes.
An array of composition types (Vec2, Vec3, Vec4, Scalar, etc.)
Gets an iterator for all attribute entries (semantic, accessor pairs).
An iterator over attribute map entries
Gets all vertex attribute semantic identifiers.
An array of all attribute semantic strings
Gets the index accessor for this primitive.
The index accessor if indices are used, otherwise undefined
Sets the material for this primitive and updates rendering sort keys. The sort key is updated based on material properties for efficient rendering order.
The material to assign to this primitive
Gets the mesh that this primitive belongs to.
The parent mesh if it exists, otherwise undefined
Gets the unique object identifier
The object's UID
Gets the version number of the position accessor. Used to track when position data has been updated.
The current position accessor version
Gets the primitive rendering mode.
The primitive mode enum (Triangles, TriangleStrip, etc.)
Gets the unique identifier for this primitive.
The primitive's UID
Gets the unique name of this object
The unique name string
Gets the GPU resource handles for this primitive.
The vertex handles for GPU resources, or undefined if not created
StaticvariantGets the current count of material variant updates across all primitives. This counter is incremented whenever material variants are modified.
The number of material variant updates since application start
InternalCreates a backup of the current material for later restoration. Used internally for material switching operations.
InternalAssociates this primitive with a parent mesh. This establishes the hierarchical relationship between mesh and primitive.
The mesh that this primitive belongs to
InternalCopies tag data from another RnObject instance to this object
The source RnObject to copy tags from
Gets the cached fingerprint string of the primitive.
The fingerprint string used for primitive identification
InternalRestores the previously backed-up material if it still exists. Used internally for reverting material changes.
Applies a previously registered material variant by its name. Changes the current material to the variant if it exists.
The name of the variant to apply
Calculates a unique fingerprint string for the primitive based on its properties. The fingerprint includes mode, indices, targets, and attributes configuration. This is used for efficient primitive comparison and caching.
Performs ray casting against this primitive's geometry. Tests intersection between a ray and the triangles of this primitive.
The origin point of the ray
The direction vector of the ray (should be normalized)
Whether front-facing triangles can be hit
Whether back-facing triangles can be hit
Threshold for determining front/back face orientation
Whether to use face normals for culling
Ray casting result with intersection data or failure indication
Converts this indexed primitive to non-indexed geometry. Expands vertex data by duplicating vertices according to indices. This can increase memory usage but simplifies some rendering operations.
Copies vertex data from a descriptor into this primitive. Creates appropriate buffers and accessors for the provided data.
Descriptor containing arrays of vertex data and configuration
Creates GPU vertex and index buffers for this primitive. This prepares the primitive for rendering by uploading data to the GPU.
True if buffers were created, false if they already exist
Deletes the GPU vertex and index buffers for this primitive. Frees GPU memory when the primitive is no longer needed.
True if buffers were deleted, false if no buffers exist
Generates a cube primitive with specified parameters
Creates a cube geometry with 24 vertices (4 per face) and 12 triangles (2 per face). The cube is centered at the origin and extends in both positive and negative directions along each axis based on the width vector.
The cube descriptor containing generation parameters
Descriptor interface for creating a cube primitive
Optionalcolor?: IColorRgbacolor
Optionalmaterial?: Materialattach a rhodonite material to this plane(the default material is the classicUberMaterial
Optionalphysics?: PhysicsPropertyOptionalwidthVector?: IVector3three width (width, height, depth) in (x, y, z)
Gets a specific vertex attribute by its semantic meaning.
The semantic identifier for the attribute
The accessor for the attribute, or undefined if not found
Gets a copy of the blend shape targets for this primitive.
A copy of the morph target array
Gets the name of the currently applied material variant.
The name of the active variant, or an empty string if no variant is active
Retrieves a complete tag object (name and value) for the specified tag name
The name of the tag to retrieve
A Tag object containing the name and value
Retrieves the value associated with a specific tag name
The name of the tag whose value to retrieve
The tag value, or undefined if the tag doesn't exist
Calculates the triangle count for indexed primitives. The count depends on the primitive mode (triangles, triangle strip, etc.).
The number of triangles that will be rendered with indices
Calculates the triangle count for non-indexed primitives. The count depends on the primitive mode and vertex count.
The number of triangles that will be rendered from vertices
Gets the material associated with a specific variant name.
The name of the variant to look up
The material for the variant, or undefined if the variant doesn't exist
Gets all registered variant names for this primitive.
An array containing all variant names
Gets the vertex count for indexed primitives. For indexed rendering, this returns the number of indices.
The number of indices if indexed, otherwise the vertex count
Gets the vertex count based on vertex buffer data.
The number of vertices in the vertex buffers
Checks if this primitive uses index-based rendering.
True if the primitive has an index buffer, false otherwise
Checks whether this object has a tag with the specified name
The name of the tag to check for
True if the tag exists (value is not null/undefined), false otherwise
Checks if this primitive uses blending (transparency) for rendering.
True if the material has blending enabled, false otherwise
Checks if this primitive is opaque (not transparent).
True if the primitive is opaque, false if it uses blending
Checks if this object has a tag with the specified name and value
The tag name to match
The tag value to match
True if the object has a matching tag, false otherwise
Checks if this object has all the specified tags with exactly matching values
Object containing tag names as keys and expected values
True if all specified tags exist with matching values, false otherwise
Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.
Array of strings that must all be present in the combined tag string
True if all strings are found in the combined tag string, false otherwise
Notifies the primitive that its position accessor has been updated. This triggers recalculation of bounding boxes and mesh updates.
The new version number of the updated accessor
Removes the index buffer from this primitive, converting it to non-indexed rendering.
Removes a tag from this object
The name of the tag to remove
Sets blend shape (morph) targets for this primitive. Blend shapes allow vertex animation by interpolating between target positions.
Array of attribute maps representing morph targets
Sets the vertex and index data for this primitive. This is the main method for configuring primitive geometry and rendering properties.
Map of vertex attributes with their semantic meanings
The primitive rendering mode (triangles, triangle strip, etc.)
Optionalmaterial: MaterialOptional material to assign (uses default if not provided)
OptionalindicesAccessor: AccessorOptional index accessor for indexed rendering
Sets the index buffer for this primitive, enabling indexed rendering.
The accessor containing index data
Registers a material variant for this primitive with a specific name. Material variants allow switching between different materials at runtime.
The unique name for this material variant
The material to associate with the variant name
Sets the render queue value of this primitive. Higher values draw later within the same translucency bucket. The queue is encoded into the viewport-layer bits of the sort key.
Value between 0 and 2^3-1 representing relative draw order
Updates the sort key by setting a specific bit range with a value. Sort keys are used to optimize rendering order for transparency and material batching.
The bit offset position where to start writing
The number of bits to write
The value to encode in the specified bit range
Sets or updates a vertex attribute for this primitive.
The accessor containing the attribute data
The semantic meaning of the attribute
Attempts to set a tag on this object. If the tag already exists, it will be replaced.
The tag object containing the name and value to set
True if the tag was successfully set, false if the tag name contains invalid characters
Attempts to set a unique name for this object
The desired unique name
If true, appends UID to make name unique when conflicts occur; if false, fails on conflict
True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false
Unregisters this object from all tracking collections. Should be called when the object is being destroyed.
Updates the GPU vertex and index buffers with current data. Used when vertex data has been modified and needs to be re-uploaded.
True if buffers were updated, false if no buffers exist
Validates that a tag string contains only allowed characters (alphanumeric and underscore)
The string to validate
True if the string contains only valid characters, false if it contains invalid characters
Static_InternalResets all static object tracking data. Used primarily for testing.
StaticcreateCreates a new primitive from a descriptor containing vertex data. This is a factory method that creates and initializes a primitive in one step.
The primitive descriptor with vertex data and configuration
A new primitive instance with the specified data
StaticgetStaticgetStaticgetRetrieves a primitive instance by its unique identifier.
The unique identifier of the primitive to find
The primitive if found and still exists, otherwise undefined
StaticgetGets the total number of primitives created in the application.
The total count of primitives
StaticgetStaticgetGets a primitive with morph targets by its index.
The index of the primitive in the morph targets collection
The primitive if found and still exists, otherwise undefined
StaticgetGets the index of a primitive with morph targets by its UID.
The unique identifier of the primitive
The index if the primitive has morph targets, otherwise undefined
StaticgetRetrieves an RnObject instance by its unique identifier
The unique identifier of the object to retrieve
The RnObject instance or undefined if not found or garbage collected
StaticgetRetrieves an RnObject instance by its unique name
The unique name of the object to retrieve
The RnObject instance or undefined if not found or garbage collected
StaticsearchSearches for the first object that has a specific tag with the given value
The tag name to search for
The tag value to match
WeakRef to the first matching object, or undefined if not found
The Cube Primitive class for generating 3D cube geometry
This class provides functionality to create cube primitives with customizable dimensions, colors, and materials. The cube is generated with proper vertex attributes including positions, normals, texture coordinates, and optional colors.