void FluidMask::setup(ofxMPMFluid *f, string svgPath) { fluid = f; svg.load(svgPath); obstacleSize = 20 / fluid->scaleFactor.x; createObstacles(25); // tweenSize.setParameters(0, easeQuadSize, ofxTween::easeOut, obstacleSize, obstacleSize, 0, 0); }
void initialize() { Shader makeDensity("defaultVS.vs", "densityField.fs"); QuadVao = CreateQuad(); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); velocity = createPingPongTexture(WIDTH, HEIGHT, 2); density = createPingPongTexture(WIDTH, HEIGHT, 1); pressure = createPingPongTexture(WIDTH, HEIGHT, 2); divergence = createSurface(WIDTH, HEIGHT, 3); obstacle = createSurface(WIDTH, HEIGHT, 3); gravity = createSurface(WIDTH, HEIGHT, 2); //createGravityField(); initDensity(makeDensity); createObstacles(obstacle, WIDTH, HEIGHT); ResetState(); }
void World::setup() { m_CellSpace = new CellSpacePartition<Vehicle*>(WORLD_WIDTH, WORLD_HEIGHT, WORLD_DEPTH, 15, 9, 15, 1000); //trialway = new Pathway(20, ofVec3f(-200, 20, 200), ofVec3f(200, 30, -200), Pathway::looped); //creates Player Ship playerShip = new GameActor(ofVec3f(0.1, 20.0, 40), 2.5, v_Zero, .03, v_HeadUp, 1000, v_One, 0.1, 10); //creates First Leader leaderShip = new Vehicle(this, ofVec3f(ofRandom(-30,30), 20.0, ofRandom(-20,20)), 2.5, v_Zero, .05, v_HeadUp, 1000, v_One, 0.1, 25, ofColor::fuchsia, ofColor::mediumPurple); leaderShip->SetEntityType(BaseEntity::master); leaderShip->Steering()->setCloseDistance(10); leaderShip->Steering()->WallAvoidanceOn(); leaderShip->Steering()->ObstacleAvoidanceOn(); leaderShip->Steering()->CreateRandomPath(10, ofVec3f(-100, -30, 100), ofVec3f(100, 30, -100)); leaderShip->Steering()->PathLoopOn(); leaderShip->Steering()->FollowPathOn(); leaderShip->Steering()->setWanderJitter(0.001); leaderShip->WrapAround(); //leaderShip->Steering()->WanderOn(); //creates Second In Command secondShip = new Vehicle(this, ofVec3f(ofRandom(-30, 30), 20.0, ofRandom(-20, 20)), 2.5, v_Zero, .05, v_HeadUp, 1000, v_One, 0.1, 25); secondShip->Steering()->WallAvoidanceOn(); secondShip->Steering()->setCloseDistance(10); secondShip->Steering()->ObstacleAvoidanceOn(); secondShip->Steering()->CreateRandomPath(10, ofVec3f(-100, -30, 100), ofVec3f(100, 30, -100)); secondShip->Steering()->PathLoopOn(); secondShip->Steering()->FollowPathOn(); secondShip->Steering()->setWanderJitter(0.001); secondShip->WrapAround(); //secondShip->Steering()->WanderOn(); //creates Swarms createSwarm_1(); createSwarm_2(); //createSwarm_3(); //createSwarm_4(); //Swarm_vs_Swarm(Swarm_1, Swarm_2); //creates Static Geometry createObstacles(); createWalls(); /* ....................................................... Creates Camera .......................................................*/ cameraMan = new Vehicle(this,ofVec3f(0.0, 30.0, 50.0), 2.5, ofVec3f::zero(), .03, ofVec3f(0, 0, -1), 1200, ofVec3f::one(), .1, 10); cameraMan->setTarget(playerShip); cameraMan->Steering()->ArriveOn(); cameraMan->Steering()->setCloseDistance(20); //cameraMan->Steering()->WanderOn(); cameraMan->SetWrapAround(false); //creates camera #ifdef CAMERAMAN camera.setParent(*cameraMan->Node()); camera.setPosition(ofVec3f(0.0, 5.0, 5.0)); camera.setFov(60); #endif #ifdef FIXED_CAMERA camera.setPosition(ofVec3f(200.0, 60.0, 200.0)); camera.setFov(65); #endif #ifdef TOPDOWN_CAMERA camera.setPosition(ofVec3f(0.1, 200, 0.0)); camera.lookAt(ofVec3f(0.1, 0.1, -0.1)); camera.setFov(90); #endif #ifdef TOPDOWNCLOSE_CAMERA camera.setPosition(ofVec3f(0.1, 80.0, -80.0)); camera.lookAt(ofVec3f(0.1, 0.1, -0.1)); camera.setFov(70); #endif #ifdef SIDE_CAMERA camera.setPosition(ofVec3f(100, 100.0, 0.1)); camera.lookAt(ofVec3f(0.1, 0.00, -0.1)); camera.setFov(90); #endif #ifdef EASY_CAMERA easyCam.setPosition(0, 0, 10); easyCam.setFov(60.0); #endif /* ....................................................... Lights! .......................................................*/ light.enable(); light.setAreaLight(WORLD_DEPTH, WORLD_HEIGHT); light.setPosition(0, 0, 0); }
MyTriangularDecomposition(const ob::RealVectorBounds& bounds) : oc::TriangularDecomposition(bounds, createObstacles()) { setup(); }
World::World(sf::View view_init) : current_view{view_init}, b{current_view}, player{20.f}, player_position{50.f, 50.f}, obstacle_container{createObstacles()} { player.setFillColor(sf::Color::Red); }