C# Class Axiom.Core.PatchSurface

A surface which is defined by curves of some kind to form a patch, e.g. a Bezier patch.
This object will take a list of control points with various assorted data, and will subdivide it into a patch mesh. Currently only Bezier curves are supported for defining the surface, but other techniques such as NURBS would follow the same basic approach.
Datei anzeigen Open project: WolfgangSt/axiom Class Usage Examples

Protected Properties

Property Type Description
aabb Axiom.MathLib.AxisAlignedBox
boundingSphereRadius float
controlCount int
controlHeight int
controlPointBuffer System.IntPtr
controlPoints List
controlWidth int
currentIndexCount int
declaration Axiom.Graphics.VertexDeclaration
indexBuffer Axiom.Graphics.HardwareIndexBuffer
indexOffset int
maxULevel int
maxVLevel int
meshHeight int
meshWidth int
requiredIndexCount int
requiredVertexCount int
side VisibleSide
subdivisionFactor float
type PatchSurfaceType
uLevel int
vLevel int
vertexBuffer Axiom.Graphics.HardwareVertexBuffer
vertexOffset int

Public Methods

Method Description
Build ( HardwareVertexBuffer destVertexBuffer, int vertexStart, HardwareIndexBuffer destIndexBuffer, int indexStart ) : void

Tells the system to build the mesh relating to the surface into externally created buffers.

The VertexDeclaration of the vertex buffer must be identical to the one passed into DefineSurface(Array, VertexDeclaration, int, int). In addition, there must be enough space in the buffer to accommodate the patch at full detail level; you should check RequiredVertexCount and RequiredIndexCount to determine this. This method does not create an internal mesh for this patch and so GetMesh will return null if you call it after building the patch this way.

DefineSurface ( Array controlPointArray, Axiom.Graphics.VertexDeclaration decl, int width, int height ) : void

Sets up the surface by defining it's control points, type and initial subdivision level.

This method initializes the surface by passing it a set of control points. The type of curves to be used are also defined here, although the only supported option currently is a bezier patch. You can also specify a global subdivision level here if you like, although it is recommended that the parameter is left as AUTO_LEVEL, which means the system decides how much subdivision is required (based on the curvature of the surface).

DefineSurface ( Array controlPointArray, Axiom.Graphics.VertexDeclaration declaration, int width, int height, PatchSurfaceType type, int uMaxSubdivisionLevel, int vMaxSubdivisionLevel, VisibleSide visibleSide ) : void

Sets up the surface by defining it's control points, type and initial subdivision level.

This method initialises the surface by passing it a set of control points. The type of curves to be used are also defined here, although the only supported option currently is a bezier patch. You can also specify a global subdivision level here if you like, although it is recommended that the parameter is left as AUTO_LEVEL, which means the system decides how much subdivision is required (based on the curvature of the surface).

PatchSurface ( ) : System

Default contructor.

Protected Methods

Method Description
DistributeControlPoints ( IntPtr lockedBuffer ) : void

FindLevel ( Vector3 &a, Vector3 &b, Vector3 &c ) : int

Internal method for finding the subdivision level given 3 control points.

GetAutoULevel ( ) : int

GetAutoULevel ( bool forMax ) : int

GetAutoVLevel ( ) : int

GetAutoVLevel ( bool forMax ) : int

InterpolateVertexData ( IntPtr lockedBuffer, int leftIndex, int rightIndex, int destIndex ) : void

LevelWidth ( int level ) : int
MakeTriangles ( ) : void

SubdivideCurve ( IntPtr lockedBuffer, int startIdx, int stepSize, int numSteps, int iterations ) : void

Method Details

Build() public method

Tells the system to build the mesh relating to the surface into externally created buffers.
The VertexDeclaration of the vertex buffer must be identical to the one passed into DefineSurface(Array, VertexDeclaration, int, int). In addition, there must be enough space in the buffer to accommodate the patch at full detail level; you should check RequiredVertexCount and RequiredIndexCount to determine this. This method does not create an internal mesh for this patch and so GetMesh will return null if you call it after building the patch this way.
public Build ( HardwareVertexBuffer destVertexBuffer, int vertexStart, HardwareIndexBuffer destIndexBuffer, int indexStart ) : void
destVertexBuffer Axiom.Graphics.HardwareVertexBuffer The destination vertex buffer in which to build the patch.
vertexStart int The offset at which to start writing vertices for this patch.
destIndexBuffer Axiom.Graphics.HardwareIndexBuffer The destination index buffer in which to build the patch.
indexStart int The offset at which to start writing indexes for this patch.
return void

DefineSurface() public method

Sets up the surface by defining it's control points, type and initial subdivision level.
This method initializes the surface by passing it a set of control points. The type of curves to be used are also defined here, although the only supported option currently is a bezier patch. You can also specify a global subdivision level here if you like, although it is recommended that the parameter is left as AUTO_LEVEL, which means the system decides how much subdivision is required (based on the curvature of the surface).
public DefineSurface ( Array controlPointArray, Axiom.Graphics.VertexDeclaration decl, int width, int height ) : void
controlPointArray System.Array /// An array containing the vertex data which define control points of the curves /// rather than actual vertices. Note that you are expected to provide not /// just position information, but potentially normals and texture coordinates too. /// The array is internally treated as a contiguous memory buffer without any gaps between the elements. /// The format of the buffer is defined in the VertexDeclaration parameter. ///
decl Axiom.Graphics.VertexDeclaration /// VertexDeclaration describing the contents of the buffer. /// Note this declaration must _only_ draw on buffer source 0! ///
width int Specifies the width of the patch in control points.
height int Specifies the height of the patch in control points.
return void

DefineSurface() public method

Sets up the surface by defining it's control points, type and initial subdivision level.
This method initialises the surface by passing it a set of control points. The type of curves to be used are also defined here, although the only supported option currently is a bezier patch. You can also specify a global subdivision level here if you like, although it is recommended that the parameter is left as AUTO_LEVEL, which means the system decides how much subdivision is required (based on the curvature of the surface).
public DefineSurface ( Array controlPointArray, Axiom.Graphics.VertexDeclaration declaration, int width, int height, PatchSurfaceType type, int uMaxSubdivisionLevel, int vMaxSubdivisionLevel, VisibleSide visibleSide ) : void
controlPointArray System.Array /// An array containing the vertex data which define control points of the curves /// rather than actual vertices. Note that you are expected to provide not /// just position information, but potentially normals and texture coordinates too. /// The array is internally treated as a contiguous memory buffer without any gaps between the elements. /// The format of the buffer is defined in the VertexDeclaration parameter. ///
declaration Axiom.Graphics.VertexDeclaration /// VertexDeclaration describing the contents of the buffer. /// Note this declaration must _only_ draw on buffer source 0! ///
width int Specifies the width of the patch in control points.
height int Specifies the height of the patch in control points.
type PatchSurfaceType The type of surface.
uMaxSubdivisionLevel int /// If you want to manually set the top level of subdivision, /// do it here, otherwise let the system decide. ///
vMaxSubdivisionLevel int /// If you want to manually set the top level of subdivision, /// do it here, otherwise let the system decide. ///
visibleSide VisibleSide Determines which side of the patch (or both) triangles are generated for.
return void

DistributeControlPoints() protected method

protected DistributeControlPoints ( IntPtr lockedBuffer ) : void
lockedBuffer System.IntPtr
return void

FindLevel() protected method

Internal method for finding the subdivision level given 3 control points.
protected FindLevel ( Vector3 &a, Vector3 &b, Vector3 &c ) : int
a Vector3 First control point.
b Vector3 Second control point.
c Vector3 Third control point.
return int

GetAutoULevel() protected method

protected GetAutoULevel ( ) : int
return int

GetAutoULevel() protected method

protected GetAutoULevel ( bool forMax ) : int
forMax bool
return int

GetAutoVLevel() protected method

protected GetAutoVLevel ( ) : int
return int

GetAutoVLevel() protected method

protected GetAutoVLevel ( bool forMax ) : int
forMax bool
return int

InterpolateVertexData() protected method

protected InterpolateVertexData ( IntPtr lockedBuffer, int leftIndex, int rightIndex, int destIndex ) : void
lockedBuffer System.IntPtr
leftIndex int
rightIndex int
destIndex int
return void

LevelWidth() protected method

protected LevelWidth ( int level ) : int
level int
return int

MakeTriangles() protected method

protected MakeTriangles ( ) : void
return void

PatchSurface() public method

Default contructor.
public PatchSurface ( ) : System
return System

SubdivideCurve() protected method

protected SubdivideCurve ( IntPtr lockedBuffer, int startIdx, int stepSize, int numSteps, int iterations ) : void
lockedBuffer System.IntPtr
startIdx int
stepSize int
numSteps int
iterations int
return void

Property Details

aabb protected_oe property

protected AxisAlignedBox,Axiom.MathLib aabb
return Axiom.MathLib.AxisAlignedBox

boundingSphereRadius protected_oe property

protected float boundingSphereRadius
return float

controlCount protected_oe property

Total number of control level.
protected int controlCount
return int

controlHeight protected_oe property

Height in control points.
protected int controlHeight
return int

controlPointBuffer protected_oe property

Buffer containing the system-memory control points.
protected IntPtr,System controlPointBuffer
return System.IntPtr

controlPoints protected_oe property

List of control points.
protected List controlPoints
return List

controlWidth protected_oe property

Width in control points.
protected int controlWidth
return int

currentIndexCount protected_oe property

protected int currentIndexCount
return int

declaration protected_oe property

Vertex declaration describing the control point buffer.
protected VertexDeclaration,Axiom.Graphics declaration
return Axiom.Graphics.VertexDeclaration

indexBuffer protected_oe property

protected HardwareIndexBuffer,Axiom.Graphics indexBuffer
return Axiom.Graphics.HardwareIndexBuffer

indexOffset protected_oe property

protected int indexOffset
return int

maxULevel protected_oe property

Max U subdivision level.
protected int maxULevel
return int

maxVLevel protected_oe property

Max V subdivision level.
protected int maxVLevel
return int

meshHeight protected_oe property

Height of the subdivided mesh (big enough for max level).
protected int meshHeight
return int

meshWidth protected_oe property

Width of the subdivided mesh (big enough for max level).
protected int meshWidth
return int

requiredIndexCount protected_oe property

protected int requiredIndexCount
return int

requiredVertexCount protected_oe property

protected int requiredVertexCount
return int

side protected_oe property

Which side is visible.
protected VisibleSide side
return VisibleSide

subdivisionFactor protected_oe property

Mesh subdivision factor.
protected float subdivisionFactor
return float

type protected_oe property

Type of surface.
protected PatchSurfaceType type
return PatchSurfaceType

uLevel protected_oe property

U-direction subdivision level.
protected int uLevel
return int

vLevel protected_oe property

V-direction subdivision level.
protected int vLevel
return int

vertexBuffer protected_oe property

protected HardwareVertexBuffer,Axiom.Graphics vertexBuffer
return Axiom.Graphics.HardwareVertexBuffer

vertexOffset protected_oe property

protected int vertexOffset
return int