/**
 *	This function builds the frame mesh.
 */
void FrameGUIComponent2::buildMesh( void )
{
	cleanMesh();

	uint32 nQuads = 13;
	nVertices_ = nQuads * 4;
	nIndices_ = nQuads * 6;

	blueprint_ = new GUIVertex[nVertices_];
	vertices_ = new GUIVertex[nVertices_];
	indices_ = new uint16[nIndices_];
	
	this->updateVertices(&blueprint_[0], 2.f, 2.f);	

	//all quads have similar indices, its all made of quads
	uint32 idx = 0;
	for (uint32 i=0; i<nQuads; i++)
	{
		uint32 base = i * 4;
		indices_[idx++] = base + 0;
		indices_[idx++] = base + 1;
		indices_[idx++] = base + 2;
		indices_[idx++] = base + 0;
		indices_[idx++] = base + 2;
		indices_[idx++] = base + 3;
	}
}
Exemple #2
0
 void setColor(Color* color) {
   if (_color != color) {
     delete _color;
     _color = color;
     cleanMesh();
   }
 }
 void setExtent(const Vector3D& extent) {
   if ((_extentX != extent._x) ||
       (_extentY != extent._y) ||
       (_extentZ != extent._z)) {
     _extentX = extent._x;
     _extentY = extent._y;
     _extentZ = extent._z;
     cleanMesh();
   }
 }
Exemple #4
0
void mopUpDirt(Mesh &m, float threshold)
{
  cout<<"Num points: "<<m.vertices.size()<<endl;
  cout<<"Num tris: "<<m.triangles.size()<<endl;
  vector<vector<int> > comps;
  identifyComponents(m,comps);
  
  cout<<"No. comps: "<<comps.size()<<endl;
  
  for(int i=0;i<comps.size();i++)
  {
    cout<<"Comp #"<<(i+1)<<": ";
    set<int> c;
    for(int j=0;j<comps[i].size();j++) c.insert(comps[i][j]);
    
    cout<<comps[i].size()<<" faces, "<<(comps[i].size()-c.size())<<" duplicates, Volume="<<computeComponentVolume(m,comps[i])<<endl;
    
//     cout<<"Points: ";
//     for(int j=0;j<comps[i].size();j++) cout<<" "<<comps[i][j];
//     cout<<endl;
  }
  
  vector<int> toBeDeleted;
  
  for(int i=0;i<comps.size();i++)
  {
    double volume=computeComponentVolume(m,comps[i]);
    if(volume<threshold)
    {
      cout<<"Deleting comp #"<<i<<endl;
      for(int j=0;j<comps[i].size();j++)
        toBeDeleted.push_back(comps[i][j]);
    }
  }
  
  vector<vector<unsigned int> >::iterator front=m.triangles.begin();
  
  sort(toBeDeleted.begin(),toBeDeleted.end(),descendingOrder);
  
  for(int i=0;i<toBeDeleted.size();i++)
    m.triangles.erase(front+toBeDeleted[i]);
  
  cleanMesh(m);
  
  cout<<"Num points left: "<<m.vertices.size()<<endl;
  cout<<"Num tris left: "<<m.triangles.size()<<endl;
  
}
 void setBorderWidth(float borderWidth) {
   if (_borderWidth != borderWidth) {
     _borderWidth = borderWidth;
     cleanMesh();
   }
 }
 void setBorderColor(Color* color) {
   delete _borderColor;
   _borderColor = color;
   cleanMesh();
 }
 void setSurfaceColor(Color* color) {
   delete _surfaceColor;
   _surfaceColor = color;
   cleanMesh();
 }
Exemple #8
0
 void setRadius(float radius) {
   if (_radius != radius) {
     _radius = radius;
     cleanMesh();
   }
 }