Class TTesselator
Unit
C2Visual
Declaration
type TTesselator = class(TReferencedItem)
Description
Performs triangulation of visible itemsVisible items are different - GUI elements, 3D meshes, procedural models, etc. [b]TTesselator[/b] contains methods to convert an item to its triangulated representation.
Hierarchy
TReferencedItemFields
Methods
Overview
 | constructor Create; virtual; |
 | procedure AddProperties(const Result: Props.TProperties; const PropNamePrefix: TNameString); virtual; |
 | procedure BeginLighting; virtual; abstract; |
 | function CalculateLighting(const ALight: TLight; const ALightToItem: TMatrix4s): Boolean; virtual; abstract; |
 | procedure DoManualRender(Item: TItem); virtual; |
 | function GetBoundingBox: TBoundingBox; virtual; |
 | function GetIndex(AOffset: Integer; AIBuf: Pointer): Integer; |
 | function GetMaxAmount(Buffer: TTesselationBuffer): Integer; |
 | function GetMaxIndices: Integer; virtual; |
 | function GetMaxVertices: Integer; virtual; |
 | function GetUpdatedElements(Buffer: TTesselationBuffer; const Params: TTesselationParameters): Integer; virtual; |
 | function GetVertexDataC(AIndex: Integer; AVBuf: Pointer): TVector3s; |
 | procedure Init; virtual; |
 | procedure InitVertexFormat(Format: Cardinal); virtual; |
 | procedure Invalidate(ABuffer: TTesselationBufferSet; EntireBuffer: Boolean); |
 | procedure InvalidateBoundingBox; |
 | procedure SetIndex(AValue, AOffset: Integer; AIBuf: Pointer); |
 | function SetIndices(IBPTR: Pointer): Integer; virtual; |
 | procedure SetProperties(Properties: Props.TProperties; const PropNamePrefix: TNameString); virtual; |
 | procedure SetVertexData2UV(u, v: Single; Index: Integer; VBuf: Pointer); |
 | procedure SetVertexDataC(x, y, z: Single; Index: Integer; VBuf: Pointer); overload; |
 | procedure SetVertexDataC(const Vec: TVector3s; Index: Integer; VBuf: Pointer); overload; |
 | procedure SetVertexDataCRHW(x, y, z, RHW: Single; Index: Integer; VBuf: Pointer); |
 | procedure SetVertexDataD(Color: TColor; Index: Integer; VBuf: Pointer); |
 | procedure SetVertexDataN(nx, ny, nz: Single; Index: Integer; VBuf: Pointer); overload; |
 | procedure SetVertexDataN(const Vec: TVector3s; Index: Integer; VBuf: Pointer); overload; |
 | procedure SetVertexDataS(Color: TColor; Index: Integer; VBuf: Pointer); |
 | procedure SetVertexDataUV(u, v: Single; Index: Integer; VBuf: Pointer); |
 | procedure SetVertexDataUV3(u, v, w: Single; Index: Integer; VBuf: Pointer); |
 | procedure SetVertexDataW(w: Single; Index: Integer; VBuf: Pointer); |
 | function Tesselate(const Params: TTesselationParameters; VBPTR: Pointer): Integer; virtual; |
 | function Validate: Boolean; virtual; |
Description
{$IFDEF DEBUGMODE} LastMaxVertices: Integer; {$ENDIF} // Used only for debugging
Can be overridden to add some properties in addition to ones of a visible item which uses the tesselator. Called from AddProperties of TVisible. Object links can not be used or resolved here.
Manual lighting begin
Perform manual lighting
Performs render manually if ManualRender is True. Default implementation does nothing so the method should be overridden if manual render needed.
Returns an index from index buffer
Returns maximum amount of elements in the specified buffer type
Should return a maximum possible amount of indices for the tesselator object to reserve place in buffers.
For rarely updated tesselators which still can have a variable number of indices it's reasonable to use a static tesselator with GetMaxVertices the maximum amount of indices. The return value of this function can vary but its change should be indicated with the tsMaxSizeChanged teselation status and will cause discarding of a buffer which may cause performance penalty at lest for static buffers.
Should return a maximum possible amount of vertices for the tesselator object to reserve place in buffers.
For rarely updated tesselators which still can have a variable number of vertices it's reasonable to use a static tesselator with GetMaxVertices the maximum amount of vertices. The return value of this function can vary but its change should be indicated with the tsMaxSizeChanged teselation status and will cause discarding of a buffer which may cause performance penalty at lest for static buffers.
Returns number of elements in the specified buffer type which needs to be updated in an API buffers. This function called by engine static buffers management routine to determine if lock/fill/unlock procedure needed for each tesselator. If the function returns 0 no update needed.
Get a coordinate set from vertex buffer. [b]AIndex[/b] - element index, [b]AVBuf[/b] - pointer to vertex buffer.
Init internal variables for the specified vertex format
Invalidates contents of buffers used by the tesselator at the API side. If EntireBuffer is True entire API buffer will become invalid so use only if necessary.
Informs engine core about bounding box change
Sets an index in index buffer
Can be overridden to set some properties in addition to ones of a visible item which uses the tesselator. Called from SetProperties of TVisible. Object links can not be used or resolved here.
Set second 2D-texture coordinates set in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a coordinate set in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a coordinate set in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a transformed coordinate set in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a diffuse color (color 1) in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a normal in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a normal in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a specular color (color 2) in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set first 2D-texture coordinates set in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set first 3D-texture coordinates set in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Set a weight in vertex buffer. [b]Index[/b] - element index, [b]VBuf[/b] - pointer to vertex buffer. Should be called from Tesselate only
Returns True if mesh is valid. The basic implemetation simply tests all indices to point within correct vertices range.
Properties
Overview
Description
Output format of vertices
Size of each vertex
|
Last modified: Jan 6, 2010
Copyright (C) 2006-2010, casteng.com
|