void runTerrainDestructionDemo() { isRunning = true; EngineInterface::createEngine("Data/Scripts/config.lua"); EngineInterface::addRenderTask("renderSprites"); EngineInterface::addUpdateTask("performFrustumCulling"); EngineInterface::addGameLoopTask("updateTerrain",updateTerrain); EngineInterface::connectKeyboardAction(Escape,exitTerrainDestructionDemo); EngineInterface::connectMouseAction(LeftButton,fireMissile); FlightCamera* camera = new FlightCamera(Vector3D(0.0f,2000.0f,0.0f),Vector3D(0.0f,0.0f,-1.0f)); EngineInterface::connectKeyboardAction(W,boost::bind(&FlightCamera::moveCameraForward,camera)); EngineInterface::connectMouseMoveAction(boost::bind(&FlightCamera::changeViewTarget,camera,_1,_2)); EngineInterface::addSceneCamera(camera); SceneEntity* terrain = new SceneEntity("Terrain","Terrain","Terrain"); terrain->initializeSceneEntity(); terrain->setEntityPosition(-128.0f*50.0f,0.0f,-128.0f*50.0f); EngineInterface::addIndependentToScene(terrain); SceneEntity* skyDome = new SceneEntity("Sky","SkyDome","SkyDome"); skyDome->initializeSceneEntity(); skyDome->setEntityOrientation(-90.0f,0.0f,0.0f); skyDome->setEntityScale(10000.0f,10000.0f,10000.0f); EngineInterface::addIndependentToScene(skyDome); SceneEntity* flight = new SceneEntity("F16","F16","F16"); flight->initializeSceneEntity(); flight->setEntityScale(0.1f,0.1f,0.1f); flight->setEntityPosition(0.0f,1600.0f,-10.0f); flight->setEntityOrientation(0.0f,180.0f,180.0f); flight->setFunctionUpdating(updateFlight); flight->entityPhysics.velocity.set(20.0f,20.0f,20.0f); flight->entityPhysics.isKinematic = true; EngineInterface::addEntityToScene(flight); Missile* missile = new Missile("Missile","Missile","Missile"); missile->initializeSceneEntity(); missile->setEntityScale(20.0f,20.0f,20.0f); missile->setExtendingUpdating(); missile->entityPhysics.isKinematic = true; missile->entityPhysics.velocity.set(200.0f,200.0f,200.0f); EngineInterface::addEntityToScene(missile); EngineInterface::initializeFont("Font",32); EngineInterface::addSprite("AyumiLogo",Vector3D(-500.0f,-500.0f,0.0f),Vector3D(256.0f,47.0f,0.0f)); EngineInterface::addSprite("Crosshair",Vector3D(0.0f,0.0f,0.0f),Vector3D(64.0f,64.0f,0.0f)); EngineInterface::addDynamicActor(flight,BOX,CollisionFilter::AIRCRAFT,CollisionFilter::TERRAIN); EngineInterface::addDynamicActor(missile,BOX,CollisionFilter::MISSILE,CollisionFilter::TERRAIN); EngineInterface::addCollisionCallback("F16","Terrain",flightCollision); EngineInterface::addCollisionCallback("Missile","Terrain",missileCollision); destruction = EngineInterface::createDestructibleTerrain(terrain,"Data/Mesh/terrainDemo.raw",Vector4D(256.0,50.0,50.0,1500.0),CollisionFilter::TERRAIN,CollisionFilter::MISSILE | CollisionFilter::AIRCRAFT); EngineInterface::runGameLoop(&isRunning); EngineInterface::releaseDestructibleTerrain(destruction); EngineInterface::releaseEngine(); }