The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoMesh

Mesh representation. More...

Files

file  SoMesh.c
file  SoMesh.h
file  SoMeshCube.c

Data Structures

struct  SoMesh
 Mesh definition. More...


Defines

#define SO_MESH_MAX_NUM_VERTICES
 Defines the maximum number of vertices a mesh can contain.


Functions

void SoMeshSetTexture (SoMesh *a_This, SoImage *a_Texture)
 Sets the texture of the mesh.

SoImageSoMeshGetTexture (SoMesh *a_This)
 Returns the texture this mesh is using.

u32 SoMeshGetNumVertices (SoMesh *a_This)
 Returns the number of vertices in the mesh.

u32 SoMeshGetNumPolygons (SoMesh *a_This)
 Returs the number of polygons in the mesh.

SoVector3SoMeshGetVertex (SoMesh *a_This, u32 a_Index)
 Returns a single vertex of the mesh.

SoPolygonSoMeshGetPolygon (SoMesh *a_This, u32 a_Index)
 Returns a single vertex of the mesh.

SoTransformSoMeshGetTransform (SoMesh *a_This)
 Returns the transform of the mesh.

void SoMeshMakeDefaultCube (SoMesh *a_This)
 Makes the mesh equal to a default cube.


Detailed Description

Mesh representation.

This module represents 3D meshes. A mesh is an object consisting of several polygons, ready to be rendered by a camera.


Define Documentation

#define SO_MESH_MAX_NUM_VERTICES
 

Defines the maximum number of vertices a mesh can contain.

If this is not enough, you might want to increase it, but remember this is a GBA we're talking about. You might even want to scale it down a bit if you only use fairly simple meshes.

This value is used by the camera module to know the maximum size for the vertex buffers.


Function Documentation

u32 SoMeshGetNumPolygons SoMesh   a_This
 

Returs the number of polygons in the mesh.

Parameters:
a_This  This pointer
Returns :
Number of polygons in the mesh.
Todo:
Inline this function.

u32 SoMeshGetNumVertices SoMesh   a_This
 

Returns the number of vertices in the mesh.

Parameters:
a_This  This pointer
Returns :
Number of vertices in the mesh.

Todo:
Inline this function.

If you receive a value of 0, then you've got a problem. Or you got a mesh with nothing in it. Or maybe you got some sort of disease, or maybe you got a whole lot of money,or maybe I should shut up now and leave the humour out of this reference. Sorry, couldn't resist. I mean, documenting these self-evident is pretty annoying anyway, but done for the sake of consistency.

SoPolygon* SoMeshGetPolygon SoMesh   a_This,
u32    a_Index
 

Returns a single vertex of the mesh.

Parameters:
a_This  This pointer
a_Index  Index of the polygon.
Returns :
Pointer to the polygon you requested.

Todo:
Inline this function.

In release mode, no checks are made whether the given a_Index is a valid index. In debug mode (when SO_DEBUG is defined) this is asserted (using the SO_ASSERT macro).

SoImage* SoMeshGetTexture SoMesh   a_This
 

Returns the texture this mesh is using.

Parameters:
a_This  This pointer.
Returns :
Texture the mesh is using.
Returns NULL if the mesh has no texture.

SoTransform* SoMeshGetTransform SoMesh   a_This
 

Returns the transform of the mesh.

Parameters:
a_This  This pointer
Returns :
Pointer to the transform the mesh uses.

Todo:
Inline this function.

If you want to transform (translate, rotate, scale) a mesh, use this method to obtain the transform, and manipulate that transform.

SoVector3* SoMeshGetVertex SoMesh   a_This,
u32    a_Index
 

Returns a single vertex of the mesh.

Parameters:
a_This  This pointer
a_Index  Index of the vertex.
Returns :
pointer to the vertex you requested.

Todo:
Inline this function.

In release mode, no checks are made whether the given a_Index is a valid index. In debug mode (when SO_DEBUG is defined) this is asserted (using the SO_ASSERT macro).

void SoMeshMakeDefaultCube SoMesh   a_This
 

Makes the mesh equal to a default cube.

Parameters:
a_This  This pointer.
This makes the mesh represent a default cube, located at the origin (0, 0, 0) with size 2 times SO_CUBE_HALF_SIZE. It will consist of 12 triangles, 8 vertices, and has texture coordinates too.

Check the documentation of the SoMeshCube.c file for more information on this default cube.

Mainly used for testing purposes.

void SoMeshSetTexture SoMesh   a_This,
SoImage   a_Texture
 

Sets the texture of the mesh.

Parameters:
a_This  This pointer
a_Texture  Texture you want this mesh to use. Use NULL for no texture.
Todo:
Inline this function.


Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.