bool RenderObject::updateObjectState() { // Falls sich das Objekt verändert hat, muss der interne Zustand neu berechnet werden und evtl. Update-Regions für den nächsten Frame // registriert werden. if ((calcBoundingBox() != _oldBbox) || (_visible != _oldVisible) || (_x != _oldX) || (_y != _oldY) || (_z != _oldZ) || _refreshForced) { // Renderrang des Objektes neu bestimmen, da sich dieser verändert haben könnte if (_parentPtr.isValid()) _parentPtr->signalChildChange(); // Die Bounding-Box neu berechnen und Update-Regions registrieren. updateBoxes(); // Änderungen Validieren validateObject(); } // Dann muss der Objektstatus der Kinder aktualisiert werden. RENDEROBJECT_ITER it = _children.begin(); for (; it != _children.end(); ++it) if (!(*it)->updateObjectState()) return false; return true; }
void DirtyRect::add( SDL_Rect src ) { //printf("add %d %d %d %d\n", src.x, src.y, src.w, src.h ); if ( src.w == 0 || src.h == 0 ) return; if (src.x < 0){ if (src.w < -src.x) return; src.w += src.x; src.x = 0; } if (src.y < 0){ if (src.h < -src.y) return; src.h += src.y; src.y = 0; } if (src.x >= screen_width) return; if (src.x+src.w >= screen_width) src.w = screen_width-src.x; if (src.y >= screen_height) return; if (src.y+src.h >= screen_height) src.h = screen_height-src.y; bounding_box = calcBoundingBox( bounding_box, src ); }
void CloudsVisualSystem3DModelLoader::loadModel( string fileName ) { // perspCam.reset(); cout << "*** LOADING MODEL " << fileName << endl; //xxx string filePath = GetCloudsMediaPath() + "assets/3DModelLoader/models_binary/" + fileName; //string filePath = getVisualSystemDataPath(true) + "models_binary/" + fileName; // string filePath = getVisualSystemDataPath(false) + fileName; //ofStringReplace(filePath,"models/", "models_binary/"); //ofStringReplace(filePath,".obj", ".obm"); if(!ofFile(filePath).exists()){ ofLogError("CloudsVisualSystem3DModelLoader::loadModel") << filePath << " Doesn't exist"; } else{ cout << "Found path " << filePath << " to exist" << endl; } ofxBinaryMesh::load(filePath, modelMesh); // ofxObjLoader::load(filePath, modelMesh, true ); // ofxObjLoader::load_oldway(filePath, modelMesh, true ); cout << "*** FULL PATH " << filePath << " FOUND " << modelMesh.getNumVertices() << " verts " << endl; calcBoundingBox(); float mScl = maxDim / max( maxBound.x - minBound.x, max(maxBound.y-minBound.y, maxBound.z - minBound.z )); modelScl.set( mScl, mScl, mScl ); updateModelTransform(); setupMultipleCameras( modelTransform.getPosition() ); }
void MaskPolygon::removePoint(const unsigned int index) { if(index<m_polygon.size()) { m_polygon.erase(m_polygon.begin()+index); calcBoundingBox(); }; };
void MaskPolygon::insertPoint(const unsigned int index, const FDiff2D p) { if(index<=m_polygon.size()) { m_polygon.insert(m_polygon.begin()+index,p); calcBoundingBox(); }; };
void MaskPolygon::movePointBy(const unsigned int index, const hugin_utils::FDiff2D diff) { if(index<m_polygon.size()) { m_polygon[index].x+=diff.x; m_polygon[index].y+=diff.y; calcBoundingBox(); }; };
void MaskPolygon::scale(const double factorx,const double factory) { for(unsigned int i=0;i<m_polygon.size();i++) { m_polygon[i].x*=factorx; m_polygon[i].y*=factory; }; calcBoundingBox(); };
void MaskPolygon::movePointTo(const unsigned int index, const hugin_utils::FDiff2D p) { if(index<m_polygon.size()) { m_polygon[index].x=p.x; m_polygon[index].y=p.y; calcBoundingBox(); }; };
StaticMesh::StaticMesh( MeshBufferPtr mesh, string name ) : Renderable( name ) { m_model = ModelPtr( new Model( mesh ) ); m_nameList = -1; init( mesh ); calcBoundingBox(); compileColoredMeshList(); compileWireframeList(); compileNameList(); }
StaticMesh::StaticMesh( ModelPtr model, string name ) : Renderable( name ) { m_model = model; m_nameList = -1; init( model->m_mesh ); calcBoundingBox(); compileColoredMeshList(); compileWireframeList(); compileNameList(); }
void MaskPolygon::transformPolygon(const PTools::Transform &trans) { double xnew,ynew; VectorPolygon newPoly; for(unsigned int i=0;i<m_polygon.size();i++) { if(trans.transformImgCoord(xnew,ynew,m_polygon[i].x,m_polygon[i].y)) { newPoly.push_back(FDiff2D(xnew,ynew)); }; }; m_polygon=newPoly; calcBoundingBox(); };
void ModelEditor::newBounds(BoundVolumeHelper help) { _Tn("void ModelEditor::newBounds(BoundVolumeHelper help)"); //normals int newSize = FileSize + sizeof(Vec3D) * help.nBNormals; char *n = f; f = new char[newSize]; memcpy(f, n, FileSize); SetStructure(); header_m->ofsBoundingNormals = FileSize; header_m->nBoundingNormals = help.nBNormals; memcpy(f + FileSize, help.BNormals, help.nBNormals * sizeof(Vec3D)); FileSize = newSize; FillLine(); //vertices newSize = FileSize + sizeof(Vec3D) * help.nBVertices; n = f; f = new char[newSize]; memcpy(f, n, FileSize); SetStructure(); header_m->ofsBoundingVertices = FileSize; header_m->nBoundingVertices = help.nBVertices; memcpy(f + FileSize, help.BVertices, sizeof(Vec3D) * help.nBVertices); FileSize = newSize; FillLine(); //triangles newSize = FileSize + sizeof(ModelBoundTriangle) * help.nBTriangles; n = f; f = new char[newSize]; memcpy(f, n, FileSize); SetStructure(); header_m->ofsBoundingTriangles = FileSize; header_m->nBoundingTriangles = help.nBTriangles; memcpy(f + FileSize, help.BTriangles, sizeof(ModelBoundTriangle) * help.nBTriangles); FileSize = newSize; FillLine(); calcBoundingBox(); }
void ModelEditor::ResizeModel(float factor) { for (int i = 0; i < header_m->nVertices; i++) { vertex_m[i].pos[0] *= factor; vertex_m[i].pos[1] *= factor; vertex_m[i].pos[2] *= factor; } for (int i = 0; i < header_m->nBones; i++) { bone_m[i].pivot[0] *= factor; bone_m[i].pivot[1] *= factor; bone_m[i].pivot[2] *= factor; } for (int i = 0; i < header_m->nLights; i++) { light_m[i].pos[0] *= factor; light_m[i].pos[1] *= factor; light_m[i].pos[2] *= factor; } for (int i = 0; i < header_m->nAttachments; i++) { attach_m[i].pos[0] *= factor; attach_m[i].pos[1] *= factor; attach_m[i].pos[2] *= factor; } for (int i = 0; i < header_m->nRibbonEmitters; i++) { ribbon_m[i].pos[0] *= factor; ribbon_m[i].pos[1] *= factor; ribbon_m[i].pos[2] *= factor; } for (int i = 0; i < header_m->nParticleEmitters; i++) { part_m[i].pos[0] *= factor; part_m[i].pos[1] *= factor; part_m[i].pos[2] *= factor; } for(int i=0;i<header_m->nBoundingVertices;i++){ boundvertices_m[i].x*= factor; boundvertices_m[i].y*= factor; boundvertices_m[i].z*= factor; } calcVertexBox(); calcBoundingBox(); }
IRResultType PolygonLine :: initializeFrom(InputRecord *ir) { IRResultType result; // Required by IR_GIVE_FIELD macro FloatArray points; IR_GIVE_FIELD(ir, points, _IFT_PolygonLine_points); int numPoints = points.giveSize() / 2; for ( int i = 1; i <= numPoints; i++ ) { mVertices.push_back({points.at(2 * ( i - 1 ) + 1), points.at( 2 * ( i ) )}); } #ifdef __BOOST_MODULE // Precompute bounding box to speed up calculation of intersection points. calcBoundingBox(LC, UC); #endif return IRRT_OK; }
XnBoundingBox3D Cylinder::getBoundingBox() { return calcBoundingBox(getCenter(), getBoundingBoxSize()); }
void RenderObject::updateBoxes() { // Bounding-Box aktualisieren _bbox = calcBoundingBox(); }
XnBoundingBox3D RectPrism::getBoundingBox() { return calcBoundingBox(getCenter(), getBoundingBoxSize()); }
void MaskPolygon::addPoint(const FDiff2D p) { m_polygon.push_back(p); calcBoundingBox(); };