18.08.2013 Views

Vega FEM Library (v1.1) User's Manual - University of Southern ...

Vega FEM Library (v1.1) User's Manual - University of Southern ...

Vega FEM Library (v1.1) User's Manual - University of Southern ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Writes to *numVertices and *numTriangles the number <strong>of</strong> vertices and triangles in the mesh, and writes<br />

to *vertices and *triangles pointers to newly-allocated (malloc) arrays <strong>of</strong> the three coordinates <strong>of</strong> each<br />

vertex and the three vertex indices <strong>of</strong> each triangle, respectively.<br />

virtual int GetClosestVertex(Vec3d & queryPos, double * distance=NULL,<br />

double * auxVertexBuffer = NULL)<br />

Returns the index <strong>of</strong> the mesh vertex closest to the specified query location. The auxVertexBuffer option<br />

is only need for derived classes; you may pass NULL when using GetClosestVertex with SceneObject. To<br />

find the nearest vertex in a mesh that has been deformed, you need to use the SceneObjectDeformable<br />

subclass.<br />

int SetUpTextures(LightingModulationType lightingModulation, MipmapType mipmap)<br />

Initializes any textures specified by the .obj file, and enables texture rendering. Calling this function<br />

is mandatory for texture mapping to work. Must be called after OpenGL has been initialized. The<br />

lightingModulation parameter selects either MODULATE or REPLACE for the texture blend mode, and the<br />

mipmap parameter selects either USEMIPMAP or NOMIPMAP for whether to use mip-mapping. Returns 0 iff<br />

successful.<br />

bool hasTextures()<br />

After SetUpTextures has been called, returns whether the model has textures.<br />

void EnableTextures()<br />

void DisableTextures()<br />

Enables or disables textures for rendering. Does not check whether textures have been set up.<br />

void BuildFaceNormals()<br />

Calculates the normals <strong>of</strong> the mesh faces.<br />

void BuildNeighboringStructure()<br />

Must be called before any <strong>of</strong> the three vertex normal methods below. Creates a data structure to optimize<br />

finding neighboring faces <strong>of</strong> mesh vertices.<br />

void BuildVertexNormals(double thresholdAngle=85.0)<br />

Must be called after BuildNeighboringStructure. Calculates smooth normals for each vertex by averaging<br />

the face normals <strong>of</strong> each incident triangle. The thresholdAngle parameter preserves sharp angles in<br />

the mesh; for a given vertex, if a triangle incident to it has angle greater than thresholdAngle between its<br />

normal and the normal <strong>of</strong> the first triangle incident to the vertex, then this triangle does not contribute to<br />

or use the smooth normal at the vertex.<br />

void BuildNormals(double thresholdAngle=85.0)<br />

Must be called after BuildNeighboringStructure. Builds face and vertex normals for the mesh.<br />

void BuildNormalsFancy(double thresholdAngle=85.0)<br />

Must be called after BuildNeighboringStructure. Sets mesh normals, handling sharp edges in a more<br />

precise way.<br />

void ShowPointLabels(int k, int l)<br />

Renders vertex indices alongside the vertices <strong>of</strong> indices k through l. These values are zero-indexed, but<br />

they are written as one-indexed.<br />

void ShowPointLabels()<br />

Renders all vertex indices.<br />

29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!