|
#ifdef _MSC_VER
#include "..\..\..\OpenGL\include\oag\OAGObject.h"
#include "..\..\..\OpenGL\include\oag\OAGCamera.h"
#endif
oag::OAGObject::OAGObject(void)
:oag::OAGNode()
,m_strName("")
,m_bIsSelected(false)
,m_PolygonFace(GL_FRONT_AND_BACK)
,m_PolygonMode(GL_LINE)
{
m_scale.SetVertex(1, 1, 1);
}
oag::OAGObject::~OAGObject(void)
{
}
//Operations
//Draws the objects and childs
void oag::OAGObject::Draw()
{
OnDraw();
if( HasChild() )
{
for( vector<int>::size_type i = 0; i < m_ListChilds.size(); ++i )
{
oag::OAGObject* childObj = (oag::OAGObject*)m_ListChilds[i];
if( childObj )
childObj->Draw();
}
}
}
void oag::OAGObject::ReadNodeXML(CXmlNode* pNode)
{
SetObjectName( pNode->GetAttribute("Name") );
CXmlNode* pNodeTransform = pNode->GetNode("Transform");
if ( pNodeTransform )
{
SetPosition( pNodeTransform );
SetScale( pNodeTransform );
SetRotation( pNodeTransform );
}
CXmlNode* pNodeColor = pNode->GetNode("Color");
if( pNodeColor )
SetColor(pNodeColor);
}
void oag::OAGObject::SaveNodeXML(CXmlNode* pNode)
{
pNode->AddAttribute( "Name", m_strName );
//Creating the color node
pNode->AppendChild( CreateNodeColor() );
CXmlNode* pNodeTransform = new CXmlNode("Transform");
pNode->AppendChild( pNodeTransform );
//Creating the Position
CXmlNode* pNodeTranslation = CreateVectorNodeAttribute( &m_position, "Translation");
pNodeTransform->AppendChild( pNodeTranslation );
CXmlNode* pNodeScale = CreateVectorNodeAttribute( &m_scale, "Scale");
pNodeTransform->AppendChild( pNodeScale );
//Creating the Rotation
CXmlNode* pNodeRotation = CreateVectorNodeAttribute( &m_rotation, "Rotation");
pNodeTransform->AppendChild( pNodeRotation );
}
//Operations for XML
|
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.