|
#include "stdAfx.h"
#include "TriangleTool.h"
#include <OAGPrimitives.h>
CTriangleTool::CTriangleTool(void)
{
}
CTriangleTool::~CTriangleTool(void)
{
}
//Virtual
void CTriangleTool::AddAllVerticesToScene()
{
oag::OAGPrimitives* geo = (oag::OAGPrimitives*) m_pScene->GetObjectAt( m_pScene->GetObjectCount() - 1 );
geo->SetArraySize( m_arrVector.GetCount() );
for( int i =0; i < m_arrVector.GetCount(); i++ )
{
oag::OAGVector3f vec = m_arrVector[i];
geo->AddVertex( vec.m_X, vec.m_Y, vec.m_Z );
}
}
void CTriangleTool::OnMouseClick(oag::OAGVector3f& ptMouse)
{
switch( m_nStep )
{
case 0:
{
m_arrVector.Add( ptMouse );
m_arrVector.Add( ptMouse );
m_arrVector.Add( ptMouse );
AddAllVerticesToScene();
m_nStep++;
m_bIsStarted = true;
}
break;
case 1:
{
m_arrVector[ 1 ] = ptMouse;
AddAllVerticesToScene();
m_nStep++;
}
break;
case 2:
{
m_arrVector[ 2 ] = ptMouse;
AddAllVerticesToScene();
CTool::OnFinalize();
}
break;
}
}
void CTriangleTool::OnMouseMove(oag::OAGVector3f &ptMouse)
{
m_arrVector[ m_arrVector.GetCount() - 1 ] = ptMouse;
AddAllVerticesToScene();
}
|
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.