Mali OpenGL ES SDK  2.0.0
A simple framework to aid development of OpenGL ES applications targeting ARM Mali platforms.
 All Classes Files Functions Variables Enumerations Enumerator
MaliSDK::Geometry Class Reference

Functions for generating geometrical shapes. More...

#include <Geometry.h>

List of all members.

Static Public Member Functions

static void calculateTorusControlPointsIndices (unsigned int patchDimension, unsigned int patchInstancesCount, unsigned int controlPointsIndicesCount, unsigned int *controlPointsIndices)
 Determines an array of indices defining a mesh of control points for instanced torus patches. To simplify mathemathics, it is assumed that torus model consists of 12 circles, each built of 12 points, so it is easy to divide each circle into 4 quadrants and define Bezier surfaces approximating perfectly round torus.
static void calculateTorusPatchData (unsigned int patchDensity, float *patchVertices, unsigned int *patchTriangleIndices)
 Determines patch data for an instanced torus model.
static void calculateTorusWireframeIndices (unsigned int circlesCount, unsigned int pointsPerCircleCount, unsigned int *indices)
 Determines indices for glDrawElements() call for wireframed torus.
static void generateTorusVertices (float torusRadius, float cirlceRadius, unsigned int circlesCount, unsigned int poitsPerCircleCount, float *torusVertices)
 Generate vertices of the torus model. The vertices are grouped in circlesCount circles, where each circle consists of pointsPerCircleCount vertices.
static void generateBezierTorusVertices (float torusRadius, float circleRadius, float *torusVertices)
 Generate torus vertices applying distortions to some of them. The distortions in control mesh are needed for proper construction of Bezier surface patches. It is assumed that each patch consists of 4 control rows and columns. Hence, in each column and each row, we can distinguish 2 middle control points and 2 edge control points, which are shared between patches. The middle control points have to be moved in such a way that C1 continuity between patches is satisfied. Implemented algorithm assumes that each construction circle contains 12 points and the torus model consists of 12 circles.
static void getSpherePointRepresentation (const float radius, const int numberOfSamples, int *numberOfCoordinates, float **sphereCoordinates)
 Compute coordinates of points which make up a sphere.
static void getSphereTriangleRepresentation (const float radius, const int numberOfSamples, int *numberOfCoordinates, float **sphereTrianglesCoordinates)
 Create triangular representation of a sphere. For each point of each circle (excluding last circle) there are two triangles created according to rule described in example below:
static void getCubeTriangleRepresentation (float scalingFactor, int *numberOfCoordinates, float **cubeTrianglesCoordinates)
 Compute coordinates of points which make up a cube.
static void getCubeNormals (int *numberOfCoordinates, float **cubeNormals)
 Create normals for a cube which was created with getCubeTriangleRepresentation function.
static void getSquareTriangleRepresentationInXZSpace (float scalingFactor, int *numberOfCoordinates, float **squareCoordinates)
 Get coordinates of points which make up a square. Square is located in XZ space.
static void getSquareXZNormals (int *numberOfCoordinates, float **squareNormals)
 Get normals for square placed in XZ space.

Detailed Description

Functions for generating geometrical shapes.


Member Function Documentation

void MaliSDK::Geometry::calculateTorusControlPointsIndices ( unsigned int  patchDimension,
unsigned int  patchInstancesCount,
unsigned int  controlPointsIndicesCount,
unsigned int *  controlPointsIndices 
)
static

Determines an array of indices defining a mesh of control points for instanced torus patches. To simplify mathemathics, it is assumed that torus model consists of 12 circles, each built of 12 points, so it is easy to divide each circle into 4 quadrants and define Bezier surfaces approximating perfectly round torus.

Parameters:
patchDimension[in] Number of control points in one dimension for a patch.
patchInstancesCount[in] Number of instances needed to draw the whole torus.
controlPointsIndicesCount[in] Number of indices needed to create a control mesh.
controlPointsIndices[out] Deref will be used to store control points indices. Cannot be null.
void MaliSDK::Geometry::calculateTorusPatchData ( unsigned int  patchDensity,
float *  patchVertices,
unsigned int *  patchTriangleIndices 
)
static

Determines patch data for an instanced torus model.

Parameters:
patchDensity[in] Number of vertices in one edge of a patch.
patchVertices[out] Deref will be used to store patch vertices. Cannot be null.
patchTriangleIndices[out] Deref will be used to store indices of triangle vertices. Cannot be null.
void MaliSDK::Geometry::calculateTorusWireframeIndices ( unsigned int  circlesCount,
unsigned int  pointsPerCircleCount,
unsigned int *  indices 
)
static

Determines indices for glDrawElements() call for wireframed torus.

Parameters:
circlesCount[in] Number of circles in torus model.
pointsPerCircleCount[in] Number of points in one circle.
indices[out] Deref will be used to store calculated indices.
void MaliSDK::Geometry::generateBezierTorusVertices ( float  torusRadius,
float  circleRadius,
float *  torusVertices 
)
static

Generate torus vertices applying distortions to some of them. The distortions in control mesh are needed for proper construction of Bezier surface patches. It is assumed that each patch consists of 4 control rows and columns. Hence, in each column and each row, we can distinguish 2 middle control points and 2 edge control points, which are shared between patches. The middle control points have to be moved in such a way that C1 continuity between patches is satisfied. Implemented algorithm assumes that each construction circle contains 12 points and the torus model consists of 12 circles.

Parameters:
torusRadius[in] Distance between the center of torus and the center of its tube.
circleRadius[in] Radius of circles that model the tube.
torusVertices[out] Deref will be used to sotre generated vertices. Cannot be null.
void MaliSDK::Geometry::generateTorusVertices ( float  torusRadius,
float  cirlceRadius,
unsigned int  circlesCount,
unsigned int  poitsPerCircleCount,
float *  torusVertices 
)
static

Generate vertices of the torus model. The vertices are grouped in circlesCount circles, where each circle consists of pointsPerCircleCount vertices.

Parameters:
torusRadius[in] Distance between the center of torus and the center of its tube.
circleRadius[in] Radius of circles that model the tube.
circlesCount[in] Number of circles in torus model.
pointsPerCircleCount[in] Number of points in one circle.
torusVertices[out] Deref will be used to sotre generated vertices. Cannot be null.
void MaliSDK::Geometry::getCubeNormals ( int *  numberOfCoordinates,
float **  cubeNormals 
)
static

Create normals for a cube which was created with getCubeTriangleRepresentation function.

Parameters:
numberOfCoordinates[out] Number of generated coordinates.
cubeNormals[out] Deref will be used to store generated coordinates. Cannot be null.
void MaliSDK::Geometry::getCubeTriangleRepresentation ( float  scalingFactor,
int *  numberOfCoordinates,
float **  cubeTrianglesCoordinates 
)
static

Compute coordinates of points which make up a cube.

Parameters:
scalingFactor[in] Scaling factor indicating size of a cube.
numberOfCoordinates[out] Number of generated coordinates.
cubeTrianglesCoordinates[out] Deref will be used to store generated coordinates. Cannot be null.
void MaliSDK::Geometry::getSpherePointRepresentation ( const float  radius,
const int  numberOfSamples,
int *  numberOfCoordinates,
float **  sphereCoordinates 
)
static

Compute coordinates of points which make up a sphere.

Parameters:
radius[in] Radius of a sphere. Has to be greater than zero.
numberOfSamples[in] A sphere consists of
numberOfSamplescircles and
numberOfSamplespoints lying on one circle. Has to be greater than zero.
numberOfCoordinates[out] Number of generated coordinates.
sphereCoordinates[out] Deref will be used to store generated coordinates. Cannot be null.
void MaliSDK::Geometry::getSphereTriangleRepresentation ( const float  radius,
const int  numberOfSamples,
int *  numberOfCoordinates,
float **  sphereTrianglesCoordinates 
)
static

Create triangular representation of a sphere. For each point of each circle (excluding last circle) there are two triangles created according to rule described in example below:

                 A2___________.B2
                 . \       .  / |
                 |. \   .    /  |
                 | . A1____B1   |
                 |  . |     |.  |
                 |   D1____C1 . |
                 |  /    .   \ .|
                 | /  .       \ .
                D2 .___________C2

   Points named A1, B1, C1 and D1 create a first circle of sphere and points named A2, B2, C2 and D2 create the second one 
   (if numberOfSamples is equal to 4). For each loop iteration, for each point lying at one circle of sphere there are 2 triangles created:
   for point A1:  A1 B1 B2,   A1 B2 A2
   for point B1:  B1 C1 C2,   B1 C2 B2
   for point C1:  C1 D1 D2,   C1 D2 C2
   for point D1:  D1 A1 A2,   D1 A2 D2
Parameters:
radius[in] Radius of a sphere. Has to be greater than zero.
numberOfSamples[in] A sphere consists of
numberOfSamplescircles and
numberOfSamplespoints lying on one circle. Has to be greater than zero.
numberOfCoordinates[out] Number of generated coordinates.
sphereTrianglesCoordinates[out] Deref will be used to store generated coordinates. Cannot be null.
void MaliSDK::Geometry::getSquareTriangleRepresentationInXZSpace ( float  scalingFactor,
int *  numberOfCoordinates,
float **  squareCoordinates 
)
static

Get coordinates of points which make up a square. Square is located in XZ space.

Parameters:
scalingFactor[in] Scaling factor indicating size of a square.
numberOfCoordinates[out] Number of generated coordinates.
squareCoordinates[out] Deref will be used to store generated coordinates. Cannot be null.
void MaliSDK::Geometry::getSquareXZNormals ( int *  numberOfCoordinates,
float **  squareNormals 
)
static

Get normals for square placed in XZ space.

Parameters:
numberOfCoordinates[out] Number of generated coordinates.
squareCoordinates[out] Deref will be used to store generated coordinates. Cannot be null.

The documentation for this class was generated from the following files: