Package WildMagic.LibGraphics.SceneGraph
Class StandardMesh
- java.lang.Object
-
- WildMagic.LibGraphics.SceneGraph.StandardMesh
-
- All Implemented Interfaces:
java.io.Serializable
public class StandardMesh extends java.lang.Object implements java.io.Serializable- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleanm_bInsideInside mesh, or Outside mesh.private Attributesm_kAttrMesh Attributes.private ColorRGBAm_kColorConstant per-vertex colorprivate Transformationm_kXFrmMesh Transformationprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description StandardMesh(Attributes rkAttr)Create a StandardMesh with the input attributes.StandardMesh(Attributes rkAttr, boolean bInside, Transformation pkXFrm)Create a StandardMesh with the input attributes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TriMeshBox(float fXExtent, float fYExtent, float fZExtent)Standard meshes.TriMeshCone(int iAxisSamples, int iRadialSamples, float fRadius, float fHeight, boolean bOpen)private voidCreatePlatonicNormals(VertexBuffer pkVBuffer)Create Platonic normalsprivate voidCreatePlatonicUVs(VertexBuffer pkVBuffer)Create Platonic u,v texture-coordinates.TriMeshCylinder(int iAxisSamples, int iRadialSamples, float fRadius, float fHeight, boolean bOpen)Standard meshes.TriMeshDisk(int iShellSamples, int iRadialSamples, float fRadius)Standard meshes.voiddispose()Delete memory.TriMeshDodecahedron()Platonic solids, inscribed in a unit sphere centered at (0,0,0).TriMeshEllipsoid(int iZSamples, int iRadialSamples, float fXRadius, float fYRadius, float fZRadius)Standard meshes.TransformationGetTransformation()Get mesh transformation.TriMeshHexahedron()Platonic solids, inscribed in a unit sphere centered at (0,0,0).TriMeshIcosahedron()Platonic solids, inscribed in a unit sphere centered at (0,0,0).TriMeshOctahedron()Platonic solids, inscribed in a unit sphere centered at (0,0,0).TriMeshRectangle(int iXSamples, int iYSamples, float fXExtent, float fYExtent)Standard meshes.static voidReverseTriangleOrder(int iTQuantity, int[] aiIndex)Reverse triangle order of a mesh.voidSetColor(ColorRGBA kColor)Set the constant per-vertex color for standard objects.voidSetInside(boolean bInside)voidSetTransformation(Transformation rkXFrm)Set mesh transformation.TriMeshSphere(int iSubdivisions)Standard meshes.TriMeshSphere(int iZSamples, int iRadialSamples, float fRadius)Standard meshes.private static voidsubDivide(Vector3f p0, Vector3f p1, Vector3f p2, java.util.Vector<Vector3f> newPositions, float maxEdgeLength)static TriMeshSubDivide(TriMesh mesh, float maxEdgeLength)TriMeshTetrahedron()Platonic solids, inscribed in a unit sphere centered at (0,0,0).TriMeshTorus(int iCircleSamples, int iRadialSamples, float fOuterRadius, float fInnerRadius)Standard meshes.static voidTransformData(Transformation kXFrm, VertexBuffer pkVB)Transform data in VertexBufferstatic voidTransformData(Transformation kXFrm, VertexBuffer pkVB, boolean bForward)Transform data in VertexBufferprivate voidTransformData(VertexBuffer pkVB)Transform data in VertexBufferTriMeshTube(int iAxisSamples, int iRadialSamples, float fRadius, float fHeight, Polyline polyline)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_kAttr
private Attributes m_kAttr
Mesh Attributes.
-
m_kXFrm
private Transformation m_kXFrm
Mesh Transformation
-
m_bInside
private boolean m_bInside
Inside mesh, or Outside mesh.
-
m_kColor
private ColorRGBA m_kColor
Constant per-vertex color
-
-
Constructor Detail
-
StandardMesh
public StandardMesh(Attributes rkAttr)
Create a StandardMesh with the input attributes.- Parameters:
rkAttr- attributes to apply to the mesh.
-
StandardMesh
public StandardMesh(Attributes rkAttr, boolean bInside, Transformation pkXFrm)
Create a StandardMesh with the input attributes.- Parameters:
rkAttr- attributes to apply to the mesh.bInside- true if view point is inside mesh.pkXFrm- Transformation to apply to mesh.
-
-
Method Detail
-
ReverseTriangleOrder
public static void ReverseTriangleOrder(int iTQuantity, int[] aiIndex)Reverse triangle order of a mesh.- Parameters:
iTQuantity- number of triangles.aiIndex- index array to modify.
-
Box
public TriMesh Box(float fXExtent, float fYExtent, float fZExtent)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary.- Parameters:
fXExtent- x-extent of box.fYExtent- y-extent of box.fZExtent- z-extent of box.- Returns:
- Box TriMesh.
-
Cone
public TriMesh Cone(int iAxisSamples, int iRadialSamples, float fRadius, float fHeight, boolean bOpen)
-
Cylinder
public TriMesh Cylinder(int iAxisSamples, int iRadialSamples, float fRadius, float fHeight, boolean bOpen)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary.- Parameters:
iAxisSamples- number of axis samples.iRadialSamples- number of radial samples.fRadius- cylinder radius.fHeight- cylinder height.bOpen- true = open cylinder, false = closed cylinder.- Returns:
- Cylinder TriMesh.
-
Disk
public TriMesh Disk(int iShellSamples, int iRadialSamples, float fRadius)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary.- Parameters:
iShellSamples- number of shell samples in mesh.iRadialSamples- number of radial samples.fRadius- radius of the Disk.- Returns:
- Disk TriMesh.
-
dispose
public void dispose()
Delete memory.
-
Dodecahedron
public TriMesh Dodecahedron()
Platonic solids, inscribed in a unit sphere centered at (0,0,0).- Returns:
- dodecahedron TriMesh.
-
Ellipsoid
public TriMesh Ellipsoid(int iZSamples, int iRadialSamples, float fXRadius, float fYRadius, float fZRadius)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary.- Parameters:
iZSamples- number of z-samples.iRadialSamples- number of radial samples.fRadius- sphere radius.- Returns:
- Ellipsoid TriMesh.
-
GetTransformation
public Transformation GetTransformation()
Get mesh transformation.- Returns:
- mesh transformation.
-
Hexahedron
public TriMesh Hexahedron()
Platonic solids, inscribed in a unit sphere centered at (0,0,0).- Returns:
- hexahedron TriMesh.
-
Icosahedron
public TriMesh Icosahedron()
Platonic solids, inscribed in a unit sphere centered at (0,0,0).- Returns:
- icosahedron TriMesh.
-
Octahedron
public TriMesh Octahedron()
Platonic solids, inscribed in a unit sphere centered at (0,0,0).- Returns:
- octahedron TriMesh.
-
Rectangle
public TriMesh Rectangle(int iXSamples, int iYSamples, float fXExtent, float fYExtent)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary.- Parameters:
iXSamples- number of x-samples in mesh.iYSamples- number of y-samples in mesh.fXExtent- x-extent of rectangle.fYExtent- y-extent of rectangle.- Returns:
- Rectangle TriMesh.
-
SetColor
public void SetColor(ColorRGBA kColor)
Set the constant per-vertex color for standard objects.- Parameters:
kColor- per-vertex color.
-
SetInside
public void SetInside(boolean bInside)
-
SetTransformation
public void SetTransformation(Transformation rkXFrm)
Set mesh transformation.- Parameters:
rkXFrm- new mesh transformation.
-
subDivide
private static void subDivide(Vector3f p0, Vector3f p1, Vector3f p2, java.util.Vector<Vector3f> newPositions, float maxEdgeLength)
-
Sphere
public TriMesh Sphere(int iSubdivisions)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary. Tessellate a unit sphere centered at the origin. Start with an octahedron and subdivide.- Parameters:
iSubdivisions- the number of levels to subdivide the ellipsoid
-
Sphere
public TriMesh Sphere(int iZSamples, int iRadialSamples, float fRadius)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary.- Parameters:
iZSamples- number of z-samples.iRadialSamples- number of radial samples.fRadius- sphere radius.- Returns:
- Sphere TriMesh.
-
Tetrahedron
public TriMesh Tetrahedron()
Platonic solids, inscribed in a unit sphere centered at (0,0,0).- Returns:
- tetrahedron TriMesh.
-
Torus
public TriMesh Torus(int iCircleSamples, int iRadialSamples, float fOuterRadius, float fInnerRadius)
Standard meshes. Each mesh is centered at (0,0,0) and has an up-axis of (0,0,1). The other axes forming the coordinate system are (1,0,0) and (0,1,0). An application may transform the meshes as necessary.- Parameters:
iCircleSamples- number of circle samples.iRadialSamples- number of radial samples.fOuterRadius- torus outer radius.fInnerRadius- torus inner radius.- Returns:
- Torus TriMesh.
-
Tube
public TriMesh Tube(int iAxisSamples, int iRadialSamples, float fRadius, float fHeight, Polyline polyline)
-
CreatePlatonicNormals
private void CreatePlatonicNormals(VertexBuffer pkVBuffer)
Create Platonic normals- Parameters:
pkVBuffer- VertexBuffer to store normals in.
-
CreatePlatonicUVs
private void CreatePlatonicUVs(VertexBuffer pkVBuffer)
Create Platonic u,v texture-coordinates.- Parameters:
pkVBuffer- VertexBuffer to store texture coordinates in.
-
TransformData
private void TransformData(VertexBuffer pkVB)
Transform data in VertexBuffer- Parameters:
pkVB- VertexBuffer to transform.
-
TransformData
public static void TransformData(Transformation kXFrm, VertexBuffer pkVB)
Transform data in VertexBuffer- Parameters:
kXFrm- Transformation to apply to VertexBuffer.pkVB- VertexBuffer to transform.
-
TransformData
public static void TransformData(Transformation kXFrm, VertexBuffer pkVB, boolean bForward)
Transform data in VertexBuffer- Parameters:
kXFrm- Transformation to apply to VertexBuffer.pkVB- VertexBuffer to transform.
-
-