Main Page Namespace List Class Hierarchy Alphabetical List Data Structures File List Namespace Members Data Fields Globals

# ExCOctree Class Reference

`#include <ExCOctree.h>`

## Public Methods
| ExCOctree (void)
| ExCOctree (std::vector< ExCMesh > VecMesh)
| ~ExCOctree (void)
void | SetSubDivisionLevel (long SubDivisionLevel)
long | GetSubDivisionLevel (void)
void | SetNumberMesh (long NumberMesh)
long | GetNumberMesh (void)
void | SetManagerTexture (ExManagerTexture *Texture)
void | ShowOctreeSubdivision (void)
void | HideOctreeSubdivision (void)
void | Build (std::vector< ExCMesh > VecMesh)
void | Draw (void)
## Data Fields
std::vector< ExCMesh > | m_VecMesh
std::vector< ExCMesh >::iterator | m_ItVecMesh
## Private Methods
void | BuildFirstBox (void)
void | BuildBox (ExCVertex center, double size)
void | BuilList (void)
void | SubDivise (void)
bool | MeshInOctree (ExCMesh Mesh, ExCOctree *octree)
## Private Attributes
ExManagerTexture * | ManagerTexture
ExCGizmoRectangle | m_GLobalBox
long | m_NumberMesh
GLuint | m_GlListId
int | m_SubDivisionLevel
bool | m_ShowOctreeSubdivision
ExCFrustum | Frustrum
double | maxsegment
ExCOctree * | A
ExCOctree * | B
ExCOctree * | C
ExCOctree * | D
ExCOctree * | E
ExCOctree * | F
ExCOctree * | G
ExCOctree * | H

## Constructor & Destructor Documentation

ExCOctree | ( | void |  | ) |

| Definition at line 26 of file ExCOctree.cpp. References A, B, C, D, E, ExCOctree(), F, G, Guard, H, m_ShowOctreeSubdivision, and m_SubDivisionLevel. Referenced by ExCOctree(), SubDivise(), and ~ExCOctree().
    00027 {
    00028 Guard(ExCOctree::ExCOctree(void))
    00029         m_ShowOctreeSubdivision=true;
    00030         m_SubDivisionLevel=1;
    00031         A=NULL;
    00032         B=NULL;
    00033         C=NULL;
    00034         D=NULL;
    00035         E=NULL;
    00036         F=NULL;
    00037         G=NULL;
    00038         H=NULL;
    00039 UnGuard
    00040 }

ExCOctree | ( | std::vector< ExCMesh > | VecMesh | ) |

| Definition at line 42 of file ExCOctree.cpp. References Build(), ExCOctree(), and Guard.
    00043 {
    00044 Guard(ExCOctree::ExCOctree(std::vector<ExCMesh> VecMesh))
    00045         ExCOctree();
    00046         Build(VecMesh);
    00047 UnGuard
    00048 }

~ExCOctree | ( | void |  | ) |

| Definition at line 50 of file ExCOctree.cpp. References ExCOctree(), and Guard.
    00051 {
    00052 Guard(ExCOctree::~ExCOctree(void))
    00053
    00054 UnGuard
    00055 }

## Member Function Documentation

void Build | ( | std::vector< ExCMesh > | VecMesh | ) |

| Definition at line 402 of file ExCOctree.cpp. References Build(), BuildBox(), BuilList(), Guard, m_SubDivisionLevel, m_VecMesh, MAX_MESH_IN_CUBE, MAX_SUBDIVISION, and SubDivise(). Referenced by Build(), and ExCOctree().
    00403 {
    00404 Guard(void ExCOctree::Build(std::vector<ExCMesh> VecMesh))
    00405         m_VecMesh=VecMesh;
    00406         BuildBox(ExCVertex(),1000);
    00407         if(m_VecMesh.size()>MAX_MESH_IN_CUBE&&m_SubDivisionLevel<MAX_SUBDIVISION)//to many in cube
    00408         {
    00409                 SubDivise();
    00410         }else
    00411         {
    00412                 BuilList();
    00413         }
    00414
    00415 UnGuard
    00416 }

void BuildBox | ( | ExCVertex | center,
|  | double | size
| ) | `[private]`

| Definition at line 118 of file ExCOctree.cpp. References BuildBox(), ExCVertex::GetX(), ExCVertex::GetY(), ExCVertex::GetZ(), Guard, ExCGizmo::m_Center, m_GLobalBox, ExCGizmoRectangle::m_Vertex, maxsegment, ExCVertex::SetX(), ExCVertex::SetY(), and ExCVertex::SetZ(). Referenced by Build(), BuildBox(), BuildFirstBox(), and SubDivise().
    00119 {
    00120 Guard(void ExCOctree::BuildBox(ExCVertex center,double size))
    00121         maxsegment=size;
    00122         m_GLobalBox.m_Center=center;
    00123
    00124         m_GLobalBox.m_Vertex[0].SetX(center.GetX()+(size/2));
    00125         m_GLobalBox.m_Vertex[0].SetY(center.GetY()+(size/2));
    00126         m_GLobalBox.m_Vertex[0].SetZ(center.GetZ()-(size/2));
    00127         m_GLobalBox.m_Vertex[1].SetX(center.GetX()+(size/2));
    00128         m_GLobalBox.m_Vertex[1].SetY(center.GetY()+(size/2));
    00129         m_GLobalBox.m_Vertex[1].SetZ(center.GetZ()+(size/2));
    00130         m_GLobalBox.m_Vertex[2].SetX(center.GetX()-(size/2));
    00131         m_GLobalBox.m_Vertex[2].SetY(center.GetY()+(size/2));
    00132         m_GLobalBox.m_Vertex[2].SetZ(center.GetZ()+(size/2));
    00133         m_GLobalBox.m_Vertex[3].SetX(center.GetX()-(size/2));
    00134         m_GLobalBox.m_Vertex[3].SetY(center.GetY()+(size/2));
    00135         m_GLobalBox.m_Vertex[3].SetZ(center.GetZ()-(size/2));
    00136         m_GLobalBox.m_Vertex[4].SetX(center.GetX()+(size/2));
    00137         m_GLobalBox.m_Vertex[4].SetY(center.GetY()-(size/2));
    00138         m_GLobalBox.m_Vertex[4].SetZ(center.GetZ()-(size/2));
    00139         m_GLobalBox.m_Vertex[5].SetX(center.GetX()+(size/2));
    00140         m_GLobalBox.m_Vertex[5].SetY(center.GetY()-(size/2));
    00141         m_GLobalBox.m_Vertex[5].SetZ(center.GetZ()+(size/2));
    00142         m_GLobalBox.m_Vertex[6].SetX(center.GetX()-(size/2));
    00143         m_GLobalBox.m_Vertex[6].SetY(center.GetY()-(size/2));
    00144         m_GLobalBox.m_Vertex[6].SetZ(center.GetZ()+(size/2));
    00145         m_GLobalBox.m_Vertex[7].SetX(center.GetX()-(size/2));
    00146         m_GLobalBox.m_Vertex[7].SetY(center.GetY()-(size/2));
    00147         m_GLobalBox.m_Vertex[7].SetZ(center.GetZ()-(size/2));
    00148
    00149         /*std::cout<<"0:";m_GLobalBox.m_Vertex[0].Affich();std::cout<<std::endl;
    00150         std::cout<<"1:";m_GLobalBox.m_Vertex[1].Affich();std::cout<<std::endl;
    00151         std::cout<<"2:";m_GLobalBox.m_Vertex[2].Affich();std::cout<<std::endl;
    00152         std::cout<<"3:";m_GLobalBox.m_Vertex[3].Affich();std::cout<<std::endl;
    00153         std::cout<<"4:";m_GLobalBox.m_Vertex[4].Affich();std::cout<<std::endl;
    00154         std::cout<<"5:";m_GLobalBox.m_Vertex[5].Affich();std::cout<<std::endl;
    00155         std::cout<<"6:";m_GLobalBox.m_Vertex[6].Affich();std::cout<<std::endl;
    00156         std::cout<<"7:";m_GLobalBox.m_Vertex[7].Affich();std::cout<<std::endl;*/
    00157 UnGuard
    00158 }

void BuildFirstBox | ( | void |  | ) | `[private]`

| Definition at line 57 of file ExCOctree.cpp. References BuildBox(), BuildFirstBox(), Guard, ExCGizmo::m_Center, m_GLobalBox, m_ItVecMesh, m_VecMesh, maxsegment, ExCVertex::SetX(), ExCVertex::SetY(), and ExCVertex::SetZ(). Referenced by BuildFirstBox().
    00058 {
    00059 Guard(void ExCOctree::BuildFirstBox(void))
    00060         //1 build the box search for min and max value
    00061         double MaxX,MaxY,MaxZ,MinX,MinY,MinZ;
    00062         m_ItVecMesh=m_VecMesh.begin();
    00063         MaxX=m_ItVecMesh->A.GetX();
    00064         MinX=m_ItVecMesh->A.GetX();
    00065         MaxY=m_ItVecMesh->A.GetY();
    00066         MinY=m_ItVecMesh->A.GetY();
    00067         MaxZ=m_ItVecMesh->A.GetZ();
    00068         MinZ=m_ItVecMesh->A.GetZ();
    00069         for(m_ItVecMesh=m_VecMesh.begin();m_ItVecMesh!=m_VecMesh.end();++m_ItVecMesh)
    00070         {
    00071                 if(m_ItVecMesh->A.GetX()<MinX){MinX=m_ItVecMesh->A.GetX();}
    00072                 if(m_ItVecMesh->A.GetX()>MaxX){MaxX=m_ItVecMesh->A.GetX();}
    00073                 if(m_ItVecMesh->B.GetX()<MinX){MinX=m_ItVecMesh->B.GetX();}
    00074                 if(m_ItVecMesh->B.GetX()>MaxX){MaxX=m_ItVecMesh->B.GetX();}
    00075                 if(m_ItVecMesh->C.GetX()<MinX){MinX=m_ItVecMesh->C.GetX();}
    00076                 if(m_ItVecMesh->C.GetX()>MaxX){MaxX=m_ItVecMesh->C.GetX();}
    00077
    00078                 if(m_ItVecMesh->A.GetY()<MinY){MinY=m_ItVecMesh->A.GetY();}
    00079                 if(m_ItVecMesh->A.GetY()>MaxY){MaxY=m_ItVecMesh->A.GetY();}
    00080                 if(m_ItVecMesh->B.GetY()<MinY){MinY=m_ItVecMesh->B.GetY();}
    00081                 if(m_ItVecMesh->B.GetY()>MaxY){MaxY=m_ItVecMesh->B.GetY();}
    00082                 if(m_ItVecMesh->C.GetY()<MinY){MinY=m_ItVecMesh->C.GetY();}
    00083                 if(m_ItVecMesh->C.GetY()>MaxY){MaxY=m_ItVecMesh->C.GetY();}
    00084
    00085                 if(m_ItVecMesh->A.GetZ()<MinZ){MinZ=m_ItVecMesh->A.GetZ();}
    00086                 if(m_ItVecMesh->A.GetZ()>MaxZ){MaxZ=m_ItVecMesh->A.GetZ();}
    00087                 if(m_ItVecMesh->B.GetZ()<MinZ){MinZ=m_ItVecMesh->B.GetZ();}
    00088                 if(m_ItVecMesh->B.GetZ()>MaxZ){MaxZ=m_ItVecMesh->B.GetZ();}
    00089                 if(m_ItVecMesh->C.GetZ()<MinZ){MinZ=m_ItVecMesh->C.GetZ();}
    00090                 if(m_ItVecMesh->C.GetZ()>MaxZ){MaxZ=m_ItVecMesh->C.GetZ();}
    00091         }
    00092
    00093
    00094         //2 search for max segment
    00095
    00096         if((MaxX-MinX)>=(MaxY-MinY)&&(MaxX-MinX)>=(MaxZ-MinZ))
    00097         {
    00098                 maxsegment=MaxX-MinX;
    00099         }
    00100         if((MaxY-MinY)>=(MaxX-MinX)&&(MaxY-MinY)>=(MaxZ-MinZ))
    00101         {
    00102                 maxsegment=MaxY-MinY;
    00103         }
    00104         if((MaxZ-MinZ)>=(MaxY-MinY)&&(MaxZ-MinZ)>=(MaxX-MinX))
    00105         {
    00106                 maxsegment=MaxZ-MinZ;
    00107         }
    00108         //3 serach for center
    00109         m_GLobalBox.m_Center.SetX(((MaxX-MinX)/2)-maxsegment/2);
    00110         m_GLobalBox.m_Center.SetY(((MaxY-MinY)/2)-maxsegment/2);
    00111         m_GLobalBox.m_Center.SetZ(((MaxZ-MinZ)/2));
    00112         //4 build a cube with max segment long around the center
    00113         BuildBox(m_GLobalBox.m_Center,maxsegment);
    00114
    00115 UnGuard
    00116 }

void BuilList | ( | void |  | ) | `[private]`

| Definition at line 447 of file ExCOctree.cpp. References Guard, m_GlListId, m_ItVecMesh, m_VecMesh, ManagerTexture, and ExManagerTexture::SetCurrentObject(). Referenced by Build(), and SubDivise().
    00448 {
    00449 Guard(void ExMap::BuilList(void))
    00450         m_GlListId=glGenLists(1);
    00451         glNewList(m_GlListId,GL_COMPILE);
    00452                 glColor3f(1.0f, 1.0f, 1.0f);
    00453                 glDisable(GL_LIGHTING);
    00454                 glEnable(GL_TEXTURE_2D);
    00455                 int i=0;
    00456
    00457                 for(m_ItVecMesh=m_VecMesh.begin();m_ItVecMesh!=m_VecMesh.end();++m_ItVecMesh)
    00458                 {
    00459                         ManagerTexture->SetCurrentObject(m_ItVecMesh->GetMaterial());
    00460                         glBegin(GL_TRIANGLES);
    00461                         /*if(m_ItVecMesh->m_MeshNumber%2==1)//impair
    00462                         {
    00463                                 glTexCoord2f(0.0f,0.0f);
    00464                         }else
    00465                         {
    00466                                 glTexCoord2f(1.0f,1.0f);
    00467                         }*/
    00468                         glTexCoord2f(m_ItVecMesh->A.GetU(), m_ItVecMesh->A.GetV());
    00469                         glVertex3f(m_ItVecMesh->A.GetX(),m_ItVecMesh->A.GetY(),m_ItVecMesh->A.GetZ());
    00470                         /*if(m_ItVecMesh->m_MeshNumber%2==1)//impair
    00471                         {
    00472                                 glTexCoord2f(1.0f,0.0f);
    00473                         }else
    00474                         {
    00475                                 glTexCoord2f(0.0f,1.0f);
    00476                         } */
    00477                         glTexCoord2f(m_ItVecMesh->B.GetU(), m_ItVecMesh->B.GetV());
    00478                         glVertex3f(m_ItVecMesh->B.GetX(),m_ItVecMesh->B.GetY(),m_ItVecMesh->B.GetZ());
    00479                         /*if(m_ItVecMesh->m_MeshNumber%2==1)//impair
    00480                         {
    00481                                 glTexCoord2f(1.0f,1.0f);
    00482                         }else
    00483                         {
    00484                                 glTexCoord2f(0.0f,0.0f);
    00485                         }*/
    00486                         glTexCoord2f(m_ItVecMesh->C.GetU(), m_ItVecMesh->C.GetV());
    00487                         glVertex3f(m_ItVecMesh->C.GetX(),m_ItVecMesh->C.GetY(),m_ItVecMesh->C.GetZ());
    00488                         glEnd();
    00489                         i++;
    00490                 }
    00491                 glEnable(GL_LIGHTING);
    00492                 glDisable(GL_TEXTURE_2D);
    00493         glEndList();
    00494 UnGuard
    00495 }

void Draw | ( | void |  | ) |

| Definition at line 418 of file ExCOctree.cpp. References A, B, C, ExCFrustum::CalculateFrustum(), ExCFrustum::CubeInFrustum(), D, ExCGizmoRectangle::Draw(), Draw(), E, F, Frustrum, G, ExCVertex::GetX(), ExCVertex::GetY(), ExCVertex::GetZ(), Guard, H, ExCGizmo::m_Center, m_GlListId, m_GLobalBox, m_SubDivisionLevel, and maxsegment. Referenced by Draw().
    00419 {
    00420 Guard(void ExCOctree::Draw(void))
    00421         Frustrum.CalculateFrustum();
    00422
    00423         if(Frustrum.CubeInFrustum(m_GLobalBox.m_Center.GetX(),m_GLobalBox.m_Center.GetY(),m_GLobalBox.m_Center.GetZ(),maxsegment))
    00424         {
    00425                 if(m_ShowOctreeSubdivision)
    00426                 {
    00427                         if(m_SubDivisionLevel%1==0){glColor3f((float)m_SubDivisionLevel/10,1.0f-((float)m_SubDivisionLevel/10),1.0f);}
    00428                         if(m_SubDivisionLevel%2==0){glColor3f(1.0f,1.0f-((float)m_SubDivisionLevel/10),(float)m_SubDivisionLevel/10);}
    00429                         if(m_SubDivisionLevel%3==0){glColor3f(1.0f-((float)m_SubDivisionLevel/10),1.0f,(float)m_SubDivisionLevel/10);}
    00430                         m_GLobalBox.Draw();
    00431                 }
    00432                 glCallList(m_GlListId);
    00433                 //DRAW CHILD
    00434                 if(A!=NULL)A->Draw();
    00435                 if(B!=NULL)B->Draw();
    00436                 if(C!=NULL)C->Draw();
    00437                 if(D!=NULL)D->Draw();
    00438                 if(E!=NULL)E->Draw();
    00439                 if(F!=NULL)F->Draw();
    00440                 if(G!=NULL)G->Draw();
    00441                 if(H!=NULL)H->Draw();
    00442         }
    00443
    00444 UnGuard
    00445 }

long GetNumberMesh | ( | void |  | ) | `[inline]`

| Definition at line 75 of file ExCOctree.h. References m_NumberMesh.
    00075 {m_NumberMesh=NumberMesh;}

long GetSubDivisionLevel | ( | void |  | ) | `[inline]`

| Definition at line 73 of file ExCOctree.h. References m_SubDivisionLevel.
    00073 {m_SubDivisionLevel=SubDivisionLevel;}

void HideOctreeSubdivision | ( | void |  | ) | `[inline]`

| Definition at line 78 of file ExCOctree.h. References m_ShowOctreeSubdivision.
    00078 {m_ShowOctreeSubdivision=true;}

bool MeshInOctree | ( | ExCMesh | Mesh,
|  | ExCOctree * | octree
| ) | `[private]`

| Definition at line 349 of file ExCOctree.cpp. References ExCMesh::A, ExCMesh::B, ExCMesh::C, ExCVertex::GetX(), ExCVertex::GetY(), ExCVertex::GetZ(), Guard, ExCGizmo::m_Center, m_GLobalBox, maxsegment, and MeshInOctree(). Referenced by MeshInOctree(), and SubDivise().
    00350 {
    00351 Guard(bool ExCOctree::MeshInOctree(ExCMesh Mesh,ExCOctree *octree))
    00352         double MaxX,MaxY,MaxZ,MinX,MinY,MinZ;
    00353         int cmptin=0;
    00354         MaxX=octree->m_GLobalBox.m_Center.GetX()+(maxsegment/2);
    00355         MinX=octree->m_GLobalBox.m_Center.GetX()-(maxsegment/2);
    00356         MaxY=octree->m_GLobalBox.m_Center.GetY()+(maxsegment/2);
    00357         MinY=octree->m_GLobalBox.m_Center.GetY()-(maxsegment/2);
    00358         MaxZ=octree->m_GLobalBox.m_Center.GetZ()+(maxsegment/2);
    00359         MinZ=octree->m_GLobalBox.m_Center.GetZ()-(maxsegment/2);
    00360
    00361         if(Mesh.A.GetX()<=MaxX && Mesh.A.GetX()>=MinX)
    00362         {
    00363                 if(Mesh.A.GetY()<=MaxY && Mesh.A.GetY()>=MinY)
    00364                 {
    00365                         if(Mesh.A.GetZ()<=MaxZ && Mesh.A.GetZ()>=MinZ)
    00366                         {
    00367                                 cmptin++;//one point is in cube
    00368                         }
    00369                 }
    00370         }
    00371
    00372         if(Mesh.B.GetX()<=MaxX && Mesh.B.GetX()>=MinX)
    00373         {
    00374                 if(Mesh.B.GetY()<=MaxY && Mesh.B.GetY()>=MinY)
    00375                 {
    00376                         if(Mesh.B.GetZ()<=MaxZ && Mesh.B.GetZ()>=MinZ)
    00377                         {
    00378                                 cmptin++;//one point is in cube
    00379                         }
    00380                 }
    00381         }
    00382
    00383         if(Mesh.C.GetX()<=MaxX && Mesh.C.GetX()>=MinX)
    00384         {
    00385                 if(Mesh.C.GetY()<=MaxY && Mesh.C.GetY()>=MinY)
    00386                 {
    00387                         if(Mesh.C.GetZ()<=MaxZ && Mesh.C.GetZ()>=MinZ)
    00388                         {
    00389                                 cmptin++;//one point is in cube
    00390                         }
    00391                 }
    00392         }
    00393
    00394         if(cmptin>1)//2 points are in cube add this mesh to this cube
    00395         {
    00396                 return true;
    00397         }
    00398         else return false;
    00399 UnGuard
    00400 }

void SetManagerTexture | ( | ExManagerTexture * | Texture | ) | `[inline]`

| Definition at line 76 of file ExCOctree.h. References m_NumberMesh. Referenced by SubDivise().
    00076 {return m_NumberMesh;}

void SetNumberMesh | ( | long | NumberMesh | ) | `[inline]`

| Definition at line 74 of file ExCOctree.h. References m_SubDivisionLevel.
    00074 {return m_SubDivisionLevel;}

void SetSubDivisionLevel | ( | long | SubDivisionLevel | ) | `[inline]`

| Definition at line 72 of file ExCOctree.h. Referenced by SubDivise().
    00073 {m_SubDivisionLevel=SubDivisionLevel;}

void ShowOctreeSubdivision | ( | void |  | ) | `[inline]`

| Definition at line 77 of file ExCOctree.h. References ManagerTexture.
    00077 {ManagerTexture=Texture;}

void SubDivise | ( | void |  | ) | `[private]`

| Definition at line 160 of file ExCOctree.cpp. References A, B, BuildBox(), BuilList(), C, D, E, ExCOctree(), F, G, ExCVertex::GetX(), ExCVertex::GetY(), ExCVertex::GetZ(), Guard, H, ExCGizmo::m_Center, m_GLobalBox, m_ItVecMesh, m_SubDivisionLevel, m_VecMesh, ManagerTexture, MAX_MESH_IN_CUBE, MAX_SUBDIVISION, maxsegment, MeshInOctree(), SetManagerTexture(), SetSubDivisionLevel(), ExCVertex::SetX(), ExCVertex::SetY(), ExCVertex::SetZ(), and SubDivise(). Referenced by Build(), and SubDivise().
    00161 {
    00162 Guard(void ExCOctree::SubDivise(void))
    00163                 ExCVertex       VertexTmp;
    00164                 A=new ExCOctree();
    00165                 A->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00166                 A->SetManagerTexture(ManagerTexture);
    00167                 VertexTmp.SetX(m_GLobalBox.m_Center.GetY()+maxsegment/4);
    00168                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()+maxsegment/4);
    00169                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()+maxsegment/4);
    00170                 A->BuildBox(VertexTmp,maxsegment/2);
    00171
    00172                 B=new ExCOctree();
    00173                 B->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00174                 B->SetManagerTexture(ManagerTexture);
    00175                 VertexTmp.SetX(m_GLobalBox.m_Center.GetX()+maxsegment/4);
    00176                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()+maxsegment/4);
    00177                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()-maxsegment/4);
    00178                 B->BuildBox(VertexTmp,maxsegment/2);
    00179
    00180                 C=new ExCOctree();
    00181                 C->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00182                 C->SetManagerTexture(ManagerTexture);
    00183                 VertexTmp.SetX(m_GLobalBox.m_Center.GetX()-maxsegment/4);
    00184                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()+maxsegment/4);
    00185                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()-maxsegment/4);
    00186                 C->BuildBox(VertexTmp,maxsegment/2);
    00187
    00188                 D=new ExCOctree();
    00189                 D->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00190                 D->SetManagerTexture(ManagerTexture);
    00191                 VertexTmp.SetX(m_GLobalBox.m_Center.GetX()-maxsegment/4);
    00192                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()+maxsegment/4);
    00193                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()+maxsegment/4);
    00194                 D->BuildBox(VertexTmp,maxsegment/2);
    00195
    00196                 /*E=new ExCOctree();
    00197                 E->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00198                 E->SetManagerTexture(ManagerTexture);
    00199                 VertexTmp.SetX(m_GLobalBox.m_Center.GetX()+maxsegment/4);
    00200                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()-maxsegment/4);
    00201                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()+maxsegment/4);
    00202                 E->BuildBox(VertexTmp,maxsegment/2);
    00203
    00204                 F=new ExCOctree();
    00205                 F->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00206                 F->SetManagerTexture(ManagerTexture);
    00207                 VertexTmp.SetX(m_GLobalBox.m_Center.GetX()+maxsegment/4);
    00208                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()-maxsegment/4);
    00209                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()-maxsegment/4);
    00210                 F->BuildBox(VertexTmp,maxsegment/2);
    00211
    00212                 G=new ExCOctree();
    00213                 G->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00214                 G->SetManagerTexture(ManagerTexture);
    00215                 VertexTmp.SetX(m_GLobalBox.m_Center.GetX()-maxsegment/4);
    00216                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()-maxsegment/4);
    00217                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()-maxsegment/4);
    00218                 G->BuildBox(VertexTmp,maxsegment/2);
    00219
    00220                 H=new ExCOctree();
    00221                 H->SetSubDivisionLevel(m_SubDivisionLevel+1);
    00222                 H->SetManagerTexture(ManagerTexture);
    00223                 VertexTmp.SetX(m_GLobalBox.m_Center.GetX()-maxsegment/4);
    00224                 VertexTmp.SetY(m_GLobalBox.m_Center.GetY()-maxsegment/4);
    00225                 VertexTmp.SetZ(m_GLobalBox.m_Center.GetZ()+maxsegment/4);
    00226                 H->BuildBox(VertexTmp,maxsegment/2);
    00227                 */
    00228                 int i=0;
    00229                 for(m_ItVecMesh=m_VecMesh.begin(),i=0;m_ItVecMesh!=m_VecMesh.end();m_ItVecMesh++,i++)
    00230                 {
    00231                         //std::cout<<"Iter :"<<i<<" Mesh :"<<m_ItVecMesh->m_MeshNumber<<" Level :"<<m_SubDivisionLevel<<"Stay :"<<m_VecMesh.size()<<std::endl;
    00232                         if(MeshInOctree(*m_ItVecMesh,A))
    00233                         {
    00234                                 A->m_VecMesh.push_back(*m_ItVecMesh);
    00235                                 //m_VecMesh.erase(m_ItVecMesh);
    00236                                 continue;
    00237                         }
    00238                         if(MeshInOctree(*m_ItVecMesh,B))
    00239                         {
    00240                                 B->m_VecMesh.push_back(*m_ItVecMesh);
    00241                                 //m_VecMesh.erase(m_ItVecMesh);
    00242                                 continue;
    00243                         }
    00244                         if(MeshInOctree(*m_ItVecMesh,C))
    00245                         {
    00246                                 C->m_VecMesh.push_back(*m_ItVecMesh);
    00247                                 //m_VecMesh.erase(m_ItVecMesh);
    00248                                 continue;
    00249                         }
    00250                         if(MeshInOctree(*m_ItVecMesh,D))
    00251                         {
    00252                                 D->m_VecMesh.push_back(*m_ItVecMesh);
    00253                                 //m_VecMesh.erase(m_ItVecMesh);
    00254                                 continue;
    00255                         }
    00256                         /*if(MeshInOctree(*m_ItVecMesh,E))
    00257                         {
    00258                                 E->m_VecMesh.push_back(*m_ItVecMesh);
    00259                                 //m_VecMesh.erase(m_ItVecMesh);
    00260                                 continue;
    00261                         }
    00262                         if(MeshInOctree(*m_ItVecMesh,F))
    00263                         {
    00264                                 F->m_VecMesh.push_back(*m_ItVecMesh);
    00265                                 //m_VecMesh.erase(m_ItVecMesh);
    00266                                 continue;
    00267                         }
    00268                         if(MeshInOctree(*m_ItVecMesh,G))
    00269                         {
    00270                                 G->m_VecMesh.push_back(*m_ItVecMesh);
    00271                                 //m_VecMesh.erase(m_ItVecMesh);
    00272                                 continue;
    00273                         }
    00274                         if(MeshInOctree(*m_ItVecMesh,H))
    00275                         {
    00276                                 H->m_VecMesh.push_back(*m_ItVecMesh);
    00277                                 //m_VecMesh.erase(m_ItVecMesh);
    00278                                 continue;
    00279                         }       */
    00280
    00281         }
    00282
    00283                 std::cout<<"Level :"<<m_SubDivisionLevel<<"Stay :"<<m_VecMesh.size()<<std::endl;
    00284                 if(m_VecMesh.size()>0)
    00285                 {
    00286                         BuilList();
    00287                 }
    00288
    00289                 if(A->m_VecMesh.size()==0)
    00290                 {
    00291                         //std::cout<<"No Mesh for A deleting A"<<std::endl;
    00292                         A=NULL;
    00293                 }
    00294                 if(B->m_VecMesh.size()==0)
    00295                 {
    00296                         //std::cout<<"No Mesh for B deleting B"<<std::endl;
    00297                         B=NULL;
    00298                 }
    00299                 if(C->m_VecMesh.size()==0)
    00300                 {
    00301                         //std::cout<<"No Mesh for C deleting C"<<std::endl;
    00302                         C=NULL;
    00303                 }
    00304                 if(D->m_VecMesh.size()==0)
    00305                 {
    00306                         //std::cout<<"No Mesh for D deleting D"<<std::endl;
    00307                         D=NULL;
    00308                 }/*
    00309                 if(E->m_VecMesh.size()==0)
    00310                 {
    00311                         //std::cout<<"No Mesh for B deleting B"<<std::endl;
    00312                         E=NULL;
    00313                 }
    00314                 if(F->m_VecMesh.size()==0)
    00315                 {
    00316                         //std::cout<<"No Mesh for B deleting B"<<std::endl;
    00317                         F=NULL;
    00318                 }
    00319                 if(G->m_VecMesh.size()==0)
    00320                 {
    00321                         //std::cout<<"No Mesh for B deleting B"<<std::endl;
    00322                         G=NULL;
    00323                 }
    00324                 if(H->m_VecMesh.size()==0)
    00325                 {
    00326                         //std::cout<<"No Mesh for B deleting B"<<std::endl;
    00327                         H=NULL;
    00328                 }  */
    00329
    00330                 if(m_VecMesh.size()>MAX_MESH_IN_CUBE&&m_SubDivisionLevel<MAX_SUBDIVISION)//to many in cube
    00331                 {
    00332                         if(A!=NULL)A->SubDivise();
    00333                         if(B!=NULL)B->SubDivise();
    00334                         if(C!=NULL)C->SubDivise();
    00335                         if(D!=NULL)D->SubDivise();
    00336                         if(E!=NULL)E->SubDivise();
    00337                         if(F!=NULL)F->SubDivise();
    00338                         if(G!=NULL)G->SubDivise();
    00339                         if(H!=NULL)H->SubDivise();
    00340
    00341                 }
    00342                 else
    00343                 {
    00344                         BuilList();
    00345                 }
    00346 UnGuard
    00347 }

## Field Documentation

ExCOctree* A`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

ExCOctree * B`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

ExCOctree * C`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

ExCOctree * D`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

ExCOctree * E`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

ExCOctree * F`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

ExCFrustum Frustrum`[private]`

| Definition at line 49 of file ExCOctree.h. Referenced by Draw().

ExCOctree * G`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

ExCOctree * H`[private]`

| Definition at line 53 of file ExCOctree.h. Referenced by Draw(), ExCOctree(), and SubDivise().

GLuint m_GlListId`[private]`

| Definition at line 46 of file ExCOctree.h. Referenced by BuilList(), and Draw().

ExCGizmoRectangle m_GLobalBox`[private]`

| Definition at line 44 of file ExCOctree.h. Referenced by BuildBox(), BuildFirstBox(), Draw(), MeshInOctree(), and SubDivise().

std::vector<ExCMesh>::iterator m_ItVecMesh

| Definition at line 70 of file ExCOctree.h. Referenced by BuildFirstBox(), BuilList(), and SubDivise().

long m_NumberMesh`[private]`

| Definition at line 45 of file ExCOctree.h. Referenced by GetNumberMesh(), and SetManagerTexture().

bool m_ShowOctreeSubdivision`[private]`

| Definition at line 48 of file ExCOctree.h. Referenced by ExCOctree(), and HideOctreeSubdivision().

int m_SubDivisionLevel`[private]`

| Definition at line 47 of file ExCOctree.h. Referenced by Build(), Draw(), ExCOctree(), GetSubDivisionLevel(), SetNumberMesh(), and SubDivise().

std::vector<ExCMesh> m_VecMesh

| Definition at line 69 of file ExCOctree.h. Referenced by Build(), BuildFirstBox(), BuilList(), and SubDivise().

ExManagerTexture* ManagerTexture`[private]`

| Definition at line 43 of file ExCOctree.h. Referenced by BuilList(), and SubDivise().

double maxsegment`[private]`

| Definition at line 50 of file ExCOctree.h. Referenced by BuildBox(), BuildFirstBox(), Draw(), MeshInOctree(), and SubDivise().

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

- ExCOctree.h
- ExCOctree.cpp