Class TMeshBuffer

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TMeshBuffer = class(TReferenceCounted)

Description

Struct for holding a mesh with a single material.
A part of a TMesh which has the same material on each face of that group. Logical groups of an TMesh need not be put into separate mesh buffers, but can be. Separately animated parts of the mesh must be put into separate mesh buffers. Some mesh buffer implementations have limitations on the number of vertices the buffer can hold. In that case, logical grouping can help. Moreover, the number of vertices should be optimized for the GPU upload, which often depends on the type of gfx card. Typial figures are 1000-10000 vertices per buffer.
Since meshbuffers are used for drawing, and hence will be exposed to the driver, chances are high that they are Grab()'ed from somewhere. It's therefore required to dynamically allocate meshbuffers which are passed to a video driver and only drop the buffer once it's not used in the current code block anymore.

Hierarchy

Overview

Methods

Public procedure Append(Vertices: Pointer; NumVertices: LongWord; Indices: PWord; NumIndices: LongWord); overload; inline;
Public procedure Append(Other: TMeshBuffer); overload; inline;
Public procedure RecalculateBoundingBox; inline;
Public procedure SetDirty(Buffer: TBufferType); inline;
Public procedure SetHardwareMappingHint(Hint: THardwareMappingHint; Buffer: TBufferType); inline;

Properties

Public property BoundingBox: TBoundingBox read GetBoundingBox write SetBoundingBox;
Public property IndexChangeID: LongWord read GetIndexChangeID;
Public property IndexCount: LongWord read GetIndexCount;
Public property IndexHardwareMappingHint: THardwareMappingHint read GetIndexHardwareMappingHint;
Public property IndexType: TIndexType read GetIndexType;
Public property Indices: PWord read GetIndices;
Public property Material: PMaterial read GetMaterial;
Public property Normals[Index: LongWord]: TVector3D read GetNormal write SetNormal;
Public property Positions[Index: LongWord]: TVector3D read GetPosition write SetPosition;
Public property TCoords[Index: LongWord]: TVector2D read GetTCoords write SetTCoords;
Public property VertexChangeID: LongWord read GetVertexChangeID;
Public property VertexCount: LongWord read GetVertexCount;
Public property VertexHardwareMappingHint: THardwareMappingHint read GetVertexHardwareMappingHint;
Public property VertexType: TVertexType read GetVertexType;
Public property Vertices: Pointer read GetVertices;

Description

Methods

Public procedure Append(Vertices: Pointer; NumVertices: LongWord; Indices: PWord; NumIndices: LongWord); overload; inline;

Append the vertices and indices to the current buffer.
Only works for compatible vertex types.

Parameters
Vertices
Pointer to a vertex array.
NumVertices
Number of vertices in the array.
Indices
Pointer to index array.
NumIndices
Number of indices in array.
Public procedure Append(Other: TMeshBuffer); overload; inline;

Append the meshbuffer to the current buffer.
Only works for compatible vertex types.

Parameters
Other
Buffer to append to this one.
Public procedure RecalculateBoundingBox; inline;

Recalculates the bounding box. Should be called if the mesh changed.

Public procedure SetDirty(Buffer: TBufferType); inline;

Flags the meshbuffer as changed, reloads hardware buffers.

Public procedure SetHardwareMappingHint(Hint: THardwareMappingHint; Buffer: TBufferType); inline;

Sets the hardware mapping hint for the video driver.

Properties

Public property BoundingBox: TBoundingBox read GetBoundingBox write SetBoundingBox;

The axis aligned bounding box of this meshbuffer.

Public property IndexChangeID: LongWord read GetIndexChangeID;

Get the currently used ID for identification of changes.
This shouldn't be used for anything outside the VideoDriver.

Public property IndexCount: LongWord read GetIndexCount;

The number of indices in the buffer.

Public property IndexHardwareMappingHint: THardwareMappingHint read GetIndexHardwareMappingHint;

The current hardware mapping hint.

Public property IndexType: TIndexType read GetIndexType;

The type of index data.

Public property Indices: PWord read GetIndices;

Provides a pointer to the index data.

Public property Material: PMaterial read GetMaterial;

The mesh buffer's material.

Public property Normals[Index: LongWord]: TVector3D read GetNormal write SetNormal;

Provides access to the normal vector of each vertex.

Public property Positions[Index: LongWord]: TVector3D read GetPosition write SetPosition;

Provides access to the position of each vertex.

Public property TCoords[Index: LongWord]: TVector2D read GetTCoords write SetTCoords;

Provides access to the texture coordinates of each vertex.

Public property VertexChangeID: LongWord read GetVertexChangeID;

Get the currently used ID for identification of changes.
This shouldn't be used for anything outside the VideoDriver.

Public property VertexCount: LongWord read GetVertexCount;

The number of vertices in the buffer.

Public property VertexHardwareMappingHint: THardwareMappingHint read GetVertexHardwareMappingHint;

The current hardware mapping hint.

Public property VertexType: TVertexType read GetVertexType;

The type of vertex stored in this buffer.

Public property Vertices: Pointer read GetVertices;

Provides a pointer to the vertex data.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22