00001
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "K3dPolyWork.h"
00033
00034 K3dPolyWork::K3dPolyWork(K3dGameData *_pGameData)
00035 {
00036 m_pGameData = _pGameData;
00037
00038 m_pGameData->SetPolyWork(this);
00039 }
00040
00041 K3dPolyWork::~K3dPolyWork()
00042 {
00043 }
00044
00046 void K3dPolyWork::CheckPoly(K3dPolyObj *_pPoly)
00047 {
00048 cout << "void K3dPolyWork::CheckPoly(K3dPolyObj *_pPoly)" << endl;
00049
00050 stringstream strFilename;
00051 strFilename << m_pGameData->GetPath(K_PATH_APP).GetString().c_str() << m_pGameData->GetDebugPath().GetString().c_str();
00052
00053 m_pGameData->GetDir()->CreateDirectory(strFilename.str().c_str());
00054
00055 strFilename << "K3dPolyObj_" << _pPoly->GetId() << ".k3dobj";
00056
00057 ofstream out(strFilename.str().c_str());
00058 cout << "strFilename = " << strFilename.str() << endl;
00059 m_pGameData->GetVertexWork()->CheckVertexArray(_pPoly->GetVertexArray(), &out);
00060 out << endl;
00061 out << "Num edges" << _pPoly->GetEdgeArray().size() << endl;
00062 for(int i=0; i<(int)_pPoly->GetEdgeArray().size(); i++)
00063 {
00064 out << "Edge " << i << endl;
00065 out << "Edge Origin X = " << _pPoly->GetEdgeArray()[i]->GetOrigin()->GetX() << endl;
00066 out << "Edge Origin Y = " << _pPoly->GetEdgeArray()[i]->GetOrigin()->GetY() << endl;
00067 out << "Edge Origin Z = " << _pPoly->GetEdgeArray()[i]->GetOrigin()->GetZ() << endl;
00068 out << "Edge Direction X = " << _pPoly->GetEdgeArray()[i]->GetDirection()->GetX() << endl;
00069 out << "Edge Direction Y = " << _pPoly->GetEdgeArray()[i]->GetDirection()->GetY() << endl;
00070 out << "Edge Direction Z = " << _pPoly->GetEdgeArray()[i]->GetDirection()->GetZ() << endl;
00071 }
00072 out << endl;
00073 out << "Num planes" << _pPoly->GetPlaneArray().size() << endl;
00074 for(int i=0; i<(int)_pPoly->GetPlaneArray().size(); i++)
00075 {
00076 out << "Plane " << i << endl;
00077 out << "Plane position X = " << _pPoly->GetPlaneArray()[i]->GetPosition()->GetX() << endl;
00078 out << "Plane position Y = " << _pPoly->GetPlaneArray()[i]->GetPosition()->GetY() << endl;
00079 out << "Plane position Z = " << _pPoly->GetPlaneArray()[i]->GetPosition()->GetZ() << endl;
00080 out << "Plane normal X = " << _pPoly->GetPlaneArray()[i]->GetNormal()->GetX() << endl;
00081 out << "Plane normal Y = " << _pPoly->GetPlaneArray()[i]->GetNormal()->GetY() << endl;
00082 out << "Plane normal Z = " << _pPoly->GetPlaneArray()[i]->GetNormal()->GetZ() << endl;
00083 out << "Plane distance = " << _pPoly->GetPlaneArray()[i]->GetDistance() << endl;
00084 }
00085 out.close();
00086 }
00087
00090 void K3dPolyWork::VisiblePoly(K3dPolyObj *_pPoly)
00091 {
00092 cout << "void K3dPolyWork::VisiblePoly(K3dPolyObj *_pPoly)" << endl;
00093 for(int i=0; i<(int)_pPoly->GetEdgeArray().size(); i++)
00094 {
00095 K3dLineObj *pEdge = _pPoly->GetEdgeArray()[i];
00096 pEdge->GetIsVisible() = true;
00097 }
00098 }
00099