ViewWidget::ViewWidget(QWidget * widget, osgViewer::View * view, osg::Group * sceneRoot, bool showGrids, bool showAxes) : _widget(widget), _view(view), compassAxes(0), mpXYGridTransform(0), mpXZGridTransform(0), mpYZGridTransform(0) { if (!view) return; _sceneRoot = static_cast<osg::Group*>(_view->getSceneData()); _showGrids = showGrids; _showAxes = showAxes; if (_showGrids) { initGrids(); if (mpXYGridTransform && sceneRoot) _sceneRoot->addChild(getXYGrid()); } if (_showAxes) { initAxes(); if (compassAxes && sceneRoot) _sceneRoot->addChild(getAxes()); } xyGridToggled = showGrids; axesToggled = showAxes; }
void StableFluid3D::setRes(int resX_, int resY_, int resZ_) { clearGrids(); resX = resX_; resY = resY_; resZ = resZ_; initGrids(); initPoisson(); }
void StableFluid3D::setSize(int width_, int height_, int depth_) { clearGrids(); width = width_; height = height_; depth = depth_; initGrids(); initPoisson(); }
void MarchCube::setRes (int x, int y, int z) { if ((x < 0) || (y < 0) || (z < 0)) return; clearGrids(); resx = x; resy = y; resz = z; initGrids(); }
StableFluid3D::StableFluid3D() :viscosity(0), density(1), width(0), height(0), depth(0), resX(0), resY(0), resZ(0), velocities(NULL), tempVelocities(NULL) { initGrids(); }
StableFluid3D::StableFluid3D(double width_, double height_, double depth_, int resX_, int resY_, int resZ_) :viscosity(0), density(1), width(width_), height(height_), depth(depth_), resX(resX_), resY(resY_), resZ(resZ_), velocities(NULL), tempVelocities(NULL) { initGrids(); initPoisson(); }
MarchCube::MarchCube () : vtxGrid(NULL), edgeGrid(NULL), edgeFlags(NULL), vtxFlags(NULL), threshold(0), sizex(1), sizey(1), sizez(1), resx(1), resy(1), resz(1), center(Point3d(0, 0, 0)) { initGrids(); }
StableFluid3D& StableFluid3D::operator =(const StableFluid3D& toCopy) { viscosity = toCopy.viscosity; density = toCopy.density; if ((resX != toCopy.resX) || (resY != toCopy.resY) || (resZ != toCopy.resZ)) { clearPoisson(); resX = toCopy.resX; resY = toCopy.resY; resZ = toCopy.resZ; laplacian = toCopy.laplacian; preconditioner = toCopy.preconditioner; vel = toCopy.vel; r = toCopy.r; z = toCopy.z; } ones = toCopy.ones; pressure = toCopy.pressure; tempPressure = toCopy.tempPressure; if ((width != toCopy.width) || (height != toCopy.height) || (depth != toCopy.depth)) { clearGrids(); width = toCopy.width; height = toCopy.height; depth = toCopy.depth; initGrids(); } for (int d = 0; d < 3; ++d) { for (int i = 0; i < resX + xOffset3[d]; ++i) { for (int j = 0; j < resY + yOffset3[d]; ++j) { for (int k = 0; k < resZ + zOffset3[d]; ++k) { tempVelocities[d][i][j][k] = tempVelocities[d][i][j][k]; velocities[d][i][j][k] = toCopy.velocities[d][i][j][k]; } } } } return *this; }