|
#ifdef _MSC_VER
#include "..\..\..\OpenGL\include\oag\Geometry.h"
#endif
oag::OAGGeometry::OAGGeometry(void)
:m_GeometryType( GL_LINES )
,m_GeometryData(NULL)
,m_ArraySize(0)
,m_nIndices(NULL)
,m_nVectorPos(0)
{
}
oag::OAGGeometry::~OAGGeometry(void)
{
if( m_GeometryData )
delete[] m_GeometryData;
if( m_nIndices )
delete[] m_nIndices;
}
//Operations
void oag::OAGGeometry::AddVertex(float x, float y, float z)
{
m_GeometryData[m_nVectorPos] = oag::OAGVector3f(x, y, z) ;
m_nVectorPos++;
switch( m_GeometryType )
{
case GL_TRIANGLES:
case GL_TRIANGLE_FAN:
case GL_TRIANGLE_STRIP:
{
SetIndiceSize( GetVertexCount() );
}
break;
}
}
void oag::OAGGeometry::SetArraySize(int arraySize)
{
if( m_GeometryData )
delete[] m_GeometryData;
m_nVectorPos = 0;
m_ArraySize = arraySize;
m_GeometryData = NULL;
m_GeometryData = new oag::OAGVector3f[m_ArraySize];
}
void oag::OAGGeometry::SetIndiceSize(int indiceSize)
{
if( m_nIndices )
delete[] m_nIndices;
m_nIndices = NULL;
m_nIndices = new GLubyte[m_ArraySize];
for(int i=0; i < indiceSize; i++ )
m_nIndices[i] = i;
}
void oag::OAGGeometry::ReadNodeXML(CXmlNode *pNode)
{
oag::OAGObject::ReadNodeXML(pNode);
}
void oag::OAGGeometry::SaveNodeXML(CXmlNode *pNode)
{
oag::OAGObject::SaveNodeXML(pNode);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I live in Matão, a small city in Brazil. I studied as Programmer in a College for Software Development in Database.
After finishing the College I have been working with java, c# and Computer Graphics with searches for OpenGL.