Yage3D.net
 

yage.resource.geometry

Authors:
Eric Poggel

License:
LGPL v3

class Geometry ;
Each Geometry has arrays of vertex data and one or more Meshes; each Mesh has its own material and an array of triangle indices that correspond to vertices in the Geometry vertex array.

static const char[] VERTICES ;
static const char[] NORMALS ;
static const char[] TEXCOORDS0 ;
static const char[] TEXCOORDS1 ;
static const char[] TEXCOORDS2 ;
static const char[] TEXCOORDS3 ;
static const char[] TEXCOORDS4 ;
static const char[] TEXCOORDS5 ;
static const char[] TEXCOORDS6 ;
static const char[] TEXCOORDS7 ;
static const char[] COLORS0 ;
static const char[] COLORS1 ;
static const char[] FOGCOORDS ;
Constants representing fixed-function VertexBuffer types, for use with get/set attributes.

VERTICES:
An array of vertices specifying x,y,z coordinates.

NORMALS:
Optional normal vectors for each vertex used in lighting calculations.

TEXCOORDS:
Optional texture coordinates for each vertex, one for each multi-texture unit.

COLORS0:
An optional color value for each vertex.

COLORS1:
An optional secondary color value for each vertex.

FOGCOORDS:
Currently unused.

Vec3f[] createTangentVectors ();
Create tangent vectors required for MaterialPass.AutoShader.PHONG when a normal map is used.

From:
Lengyel, Eric. "Computing Tangent Space Basis Vectors for an Arbitrary Mesh". Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html

void[] getAttribute (char[] name);
void[] getAttribute (char[] name, out int components);
void setAttribute (T)(char[] name, T[] values);
These functions allow modifying the vertex attributes of the geometry. Vertex attributes are arrays that specify data for each vertex, such as a position, texture coodinate, or custom value.

Params:
char[] name Specifies the vertex attribute to get/set. It can be one of the named constants defined above or a custom name. Custom attributes are passed to the vertex shader into an attribute variable of the same name. Custom names must not use the "gl_" prefix; it is reserved.
values Vertex data values to set.
components on getAttribute , this out parameter specifies how many values per vertex.

Notes:
getAttribute will return an empty array if the attribute doesn't exist.

Example:
 Vec3f[] vertices;
 ...
 if (!geom.getAttribute(Geometry.VERTICES))
     geom.setAttribute(Geometry.VERTICES, vertices);


void removeAttribute (char[] name);


VertexBuffer[char[]] getVertexBuffers ();
Get the vertex buffers used for rendering. Vertex buffers wrap attributes.

VertexBuffer getVertexBuffer (char[] name);
Get a single VertexBuffer by name rendering.

Mesh[] getMeshes ();
void setMeshes (Mesh[] meshes);
Get / set the array of meshes for this Geometry. Meshes define a material and an array of triangles to connect vertices.

TODO:
are these accessors needed?

float getRadius ();
Calculate the radius of a sphere, centered at the model's origin, that can contain this Model.

int[] optimize ();
Merge duplicate vertices and Meshes. This should be done before creating binormals in order to work well.

Returns:
a map from the old vertex indices to the new ones.

static Geometry merge (Geometry[] geometries);
Merge all geometries into a single Geometry.

Returns:
The new Geometry will have copies of all vertex attributes and triangles, but share the same material references as the input geometries.

static Geometry createPlane (int widthSegments = 1, int heightSegments = 1);
Get a plane to play with.

class Mesh ;
A Mesh groups a Material with a set of triangle indices. The Geometry class groups a Mesh with vertex buffers referenced by the traingle indices

static const char[] TRIANGLES ;
static const char[] LINES ;
static const char[] POINTS ;
Constants used to specify various built-in polgyon attribute type names.

this();
Construct an empty mesh.

this(Material matl, Vec3i[] triangles);
Create with a material and triangles.

Material getMaterial ();
void setMaterial (Material material);
void setMaterial (char[] filename, char[] id);
Get the material, or set the material from another material or a file.

Vec!(3,int)[] getTriangles ();
void setTriangles (Vec!(3,int)[] triangles);
Get/set the triangles

VertexBuffer getTrianglesVertexBuffer ();
Get the trangles vertex buffer used for rendering.

Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
Documentation generated with CandyDoc on Wed Aug 11 11:14:28 2010