void IrrWidget::createIrrlichtDevice(){ dimension2d<u32> windowSize(this->geometry().width(), this->geometry().height()); SIrrlichtCreationParameters createParams; createParams.WindowId = (void*)this->winId(); createParams.WindowSize = windowSize; createParams.DriverType = EDT_OPENGL; createParams.Stencilbuffer = true; createParams.Vsync = false; m_pDevice = createDeviceEx(createParams); if(m_pDevice == NULL){ qDebug() << "failed to create irrlicht device"; } m_pDevice->setResizable(true); m_pScene = m_pDevice->getSceneManager(); m_pDriver = m_pDevice->getVideoDriver(); m_pGuiEnv = m_pDevice->getGUIEnvironment(); m_pBufferList = m_pGuiEnv->addListBox(core::rect<int>(5,5,200, 400), 0, true, true); //gui::IGUITab* optTab = tabctrl->addTab(L"Demo"); //gui::IGUITab* aboutTab = tabctrl->addTab(L"About"); // add list box //gui::IGUIListBox* box = m_pGuiEnv->addListBox(core::rect<int>(10,10,220,120), optTab, 1); m_pBufferList->addItem(L"OpenGL 1.5"); m_pBufferList->addItem(L"Direct3D 8.1"); m_pBufferList->addItem(L"Direct3D 9.0c"); m_pBufferList->addItem(L"Burning's Video 0.47"); m_pBufferList->addItem(L"Irrlicht Software Renderer 1.0"); m_pBufferList->setSelected(true); scene::IAnimatedMesh* mesh = m_pScene->getMesh("./media/sydney.md2"); if(mesh == NULL){ return; } scene::IAnimatedMeshSceneNode* node = m_pScene->addAnimatedMeshSceneNode(mesh); if(node !=NULL){ node->setMaterialFlag(EMF_LIGHTING, false); node->setMD2Animation(scene::EMAT_STAND); node->setMaterialTexture(0, m_pDriver->getTexture("./media/sydney.bmp")); } m_pScene->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0)); //m_pDevice->setEventReceiver(new IrrEventReciever()); }
ISceneNode* IrrFactory::addAxes() { AxesSceneNode* scene = new AxesSceneNode(mIrr.getSceneManager()->getRootSceneNode(), mIrr.getSceneManager(), -1); Assert(scene); scene->setAxesScale(10); scene->setScale(vector3df(5,5,5)); return scene; }
TrackPartMesh::TrackPartMesh(TrackOperator*_trackop) : trackop(_trackop) { segs.clear(); seglen=1.0; track=trackop->track; ijkcenter=vector3df(0.0,0.0,0.0); }
core::vector3df getWindDir() { const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f; GrassShaderProvider *gsp = (GrassShaderProvider *)irr_driver->getCallback(ES_GRASS); float m_speed = gsp->getSpeed(); return m_speed * vector3df(1., 0., 0.) * cos(time); }
void Entity::createLight(E_LIGHT_TYPE typ, f32 r, f32 g, f32 b, f32 a) { type = LIGHT_TYPE; lightNode = Scene->addLightSceneNode(0, vector3df(0,0,0), SColorf(r,g,b,a), 100.0f); lightNode->setLightType(typ); lightNode->enableCastShadow(); rx=ry=rz=0; isVisible = true; }
/*----------------------------------------------------------------------------*/ Smodel* OcclusionCulling::createSmodel(u16 id, vector3df pos, u16 angle, u16 upvector) { Smodel* x = new Smodel; x->pos = vector3df(pos); x->angle = angle; x->upvector = upvector; x->id = id; return x; }
int Java_zte_irrlib_scene_SceneNode_nativeAddFlyCircleAnimator( JNIEnv* env, jobject defaultObj, jdouble cx, jdouble cy, jdouble cz, jdouble radius, jdouble speed, jdouble ax, jdouble ay, jdouble az, jdouble startPosition, jdouble radiusEllipsoid, jint id) { ISceneNode* node = smgr->getSceneNodeFromId(id); if (!node) { WARN_NODE_NOT_FOUND(id, AddFlyCircleAnimator); return -1; } ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator(vector3df(cx,cy,cz),radius,speed,vector3df(ax, ay, az), startPosition, radiusEllipsoid); node->addAnimator(anim); anim->drop(); return 0; }
CommandDestroyBlock :: CommandDestroyBlock(CharacterInstance* owner, vector3di setBlock, int setHotBarSlot) : CharacterCommand(owner, DESTROY_BLOCK) { hotBarSlot = setHotBarSlot; block = setBlock; debugObject = IRR->sceneMgr->addCubeSceneNode(1.02f, 0, -1, vector3df(block.X + 0.5f, block.Y + 0.5f, block.Z + 0.5f)); debugObject->setMaterialFlag(EMF_WIREFRAME, true); state = inactive; }
void Player::setPlayerBreath() { for (int i = 0; i < 3; i++) { b_left[i]->setPosition( vector3df( bpl[i].X * facingDirection + (facingDirection == -1 ? -10 : 0), bpl[i].Y, 0 ) ); if (judo.energy + 0.5 < i + 1) b_left[i]->setVisible(false); else b_left[i]->setVisible(true); } for (int i = 0; i < 3; i++) { b_right[i]->setPosition( vector3df( bpr[i].X * facingDirection + (facingDirection == -1 ? 10 : 0) ,bpr[i].Y, 0 ) ); if (judo.energy < i + 1) b_right[i]->setVisible(false); else b_right[i]->setVisible(true); } }
ISceneNode* AddEarth() { ISceneNode *earth = smgr->addSphereSceneNode(4.0f, 32, 0, -1, vector3df(0, 0, 0), vector3df(0, 0, 0), vector3df(1.0, 1.0, 1.0)); SSRotationAnimator *animEarthRot = new SSRotationAnimator(vector3df(0, 5.0f / 1.0f, 0), &koeffSpeed, &IsActiveRotating); SSFlyEllipceAnimator *animEarth = new SSFlyEllipceAnimator(sun->getPosition(), 0, 7.25f, 29.0f, &koeffSpeed, 300.0f, 280.0f, &koeffOfDist, &IsActiveMoving); if (earth) { earth->setMaterialFlag(EMF_LIGHTING, false); earth->setMaterialTexture(0, driver->getTexture(std::string(TexturesPath + "Earth/Earth.png").c_str())); earth->addAnimator(animEarth); earth->addAnimator(animEarthRot); earth->setRotation(vector3df(0.0f, 23.0f, 23.0f)); } Planets.push_back(earth); return earth; }
ISceneNode* AddUranus() { ISceneNode *uranus = smgr->addSphereSceneNode(15.4f, 32, 0, -1, vector3df(0, 0, 0), vector3df(0, 0, 0), vector3df(1.0, 1.0, 1.0)); SSRotationAnimator *animUranusRot = new SSRotationAnimator(vector3df(0, 5.0f / 0.45f, 0), &koeffSpeed, &IsActiveRotating); SSFlyEllipceAnimator *animUranus = new SSFlyEllipceAnimator(sun->getPosition(), 0, 6.48f, 6.8f, &koeffSpeed, 1400.0f, 1200.0f, &koeffOfDist, &IsActiveMoving); if (uranus) { uranus->setMaterialFlag(EMF_LIGHTING, false); uranus->setMaterialTexture(0, driver->getTexture(std::string(TexturesPath + "Uranus/Uranus.jpg").c_str())); uranus->addAnimator(animUranus); uranus->addAnimator(animUranusRot); uranus->setRotation(vector3df(0.0f, 82.0f, 82.0f)); } Planets.push_back(uranus); return uranus; }
ISceneNode* AddNeptune() { ISceneNode *neptune = smgr->addSphereSceneNode(16.0f, 32, 0, -1, vector3df(0, 0, 0), vector3df(0, 0, 0), vector3df(1.0, 1.0, 1.0)); SSRotationAnimator *animNeptuneRot = new SSRotationAnimator(vector3df(0, 5.0f / 0.63f, 0), &koeffSpeed, &IsActiveRotating); SSFlyEllipceAnimator *animNeptune = new SSFlyEllipceAnimator(sun->getPosition(), 0, 6.4f, 5.4f, &koeffSpeed, 1800.0f, 1750.0f, &koeffOfDist, &IsActiveMoving); if (neptune) { neptune->setMaterialFlag(EMF_LIGHTING, false); neptune->setMaterialTexture(0, driver->getTexture(std::string(TexturesPath + "Neptune/Neptune.jpg").c_str())); neptune->addAnimator(animNeptune); neptune->addAnimator(animNeptuneRot); neptune->setRotation(vector3df(0.0f, 29.0f, 29.0f)); } Planets.push_back(neptune); return neptune; }
ISceneNode* AddMars() { ISceneNode *mars = smgr->addSphereSceneNode(2.0f, 32, 0, -1, vector3df(0, 0, 0), vector3df(0, 0, 0), vector3df(1.0, 1.0, 1.0)); SSRotationAnimator *animMarsRot = new SSRotationAnimator(vector3df(0, 5.0f / 1.0f, 0), &koeffSpeed, &IsActiveRotating); SSFlyEllipceAnimator *animMars = new SSFlyEllipceAnimator(sun->getPosition(), 0, 5.65f, 24.1f, &koeffSpeed, 491.0f, 420.0f, &koeffOfDist, &IsActiveMoving); if (mars) { mars->setMaterialFlag(EMF_LIGHTING, false); mars->setMaterialTexture(0, driver->getTexture(std::string(TexturesPath + "Mars/Mars.jpg").c_str())); mars->addAnimator(animMars); mars->addAnimator(animMarsRot); mars->setRotation(vector3df(0.0f, 25.0f, 25.0f)); } Planets.push_back(mars); return mars; }
void CSPhysXObject_Character::addForce(vector3df dir, float force) { // if (!m_Controller) return; // if (!m_Controller->getActor()) return; dir.normalize(); PxVec3 disp = PxVec3(dir.X, dir.Y, dir.Z) * force; m_TotalForce += vector3df(disp.x, disp.y, disp.z); }
int example_helloworld() { // create device IrrlichtDevice *device = startup(); if (device == 0) return 1; // could not create selected driver. IVideoDriver* driver = device->getVideoDriver(); ISceneManager* smgr = device->getSceneManager(); IGUIEnvironment* guienv = device->getGUIEnvironment(); IAnimatedMesh* mesh = smgr->getMesh("media/sydney.md2"); if (!mesh) { device->drop(); return 1; } IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh); /* To let the mesh look a little bit nicer, we change its material. We disable lighting because we do not have a dynamic light in here, and the mesh would be totally black otherwise. Then we set the frame loop, such that the predefined STAND animation is used. And last, we apply a texture to the mesh. Without it the mesh would be drawn using only a color. */ if (node) { node->setMaterialFlag(EMF_LIGHTING, false); node->setMD2Animation(scene::EMAT_STAND); node->setMaterialTexture(0, driver->getTexture("media/sydney.bmp")); } /* To look at the mesh, we place a camera into 3d space at the position (0, 30, -40). The camera looks from there to (0,5,0), which is approximately the place where our md2 model is. */ smgr->addCameraSceneNode(0, vector3df(0, 30, -40), vector3df(0, 5, 0)); EventReceiver_basic receiver(device); device->setEventReceiver(&receiver); return run(device); }
Quarry::Quarry(int tileX, int tileY, int player, Scene* scene) : Building(tileX, tileY, player, scene) { Game* game = &Game::getInstance(); model = game->sceneManager->getMesh("res/buildingQuarry.3ds"); if (player == 0) { texture = game->videoDriver->getTexture("res/buildingQuarry.png"); } else { texture = game->videoDriver->getTexture("res/buildingQuarryEnemy.png"); } sizeX = 1; sizeY = 1; createModel(); node->setScale(vector3df(1.f, 1.f, 1.f)); node->setRotation(vector3df(0,0,0)); hp = 4; defense = 2; }
void game::getFieldsList() { ifstream infile("../assets/fields.txt"); float x, y, z; while(infile >> x >> y >> z) { fields->push_back(vector3df(x, y, z)); } }
void camSetPosTar(ICameraSceneNode *camera, vector3df position, vector3df target, vector3df up=vector3df(0, 1, 0)) { camera->setPosition(position); camera->updateAbsolutePosition(); camera->setTarget(target + position); camera->updateAbsolutePosition(); camera->setUpVector(up); camera->updateAbsolutePosition(); }
game::game(void) { //create the device //and get desktop width and height RECT desktop; const HWND hDesktop = GetDesktopWindow(); GetWindowRect(hDesktop, &desktop); //assign the width and height horizontal = desktop.right; vertical = desktop.bottom; device = createDevice(video::EDT_OPENGL, dimension2d<u32>(horizontal, vertical), 16, false, false, false, 0); device->setWindowCaption(L"PSI TEAM 3"); device->setResizable(false); // initialize driver, scenemanager and gui environment driver = device->getVideoDriver(); smgr = device->getSceneManager(); guienv = device->getGUIEnvironment(); playerCamera = new PlayerCamera(device); IGUISkin* skin = guienv->getSkin(); IGUIFont* font = guienv->getFont("../media/fonts/candara14.bmp"); skin->setFont(font); // initialize networkUtilities (all networking stuff is handled in in this class) networkUtilities = new NonRealtimeNetworkingUtilities(); // initialize gameStateDTO gameState = new GameStateDTO(16); // initialize players localPlayer = new Player(device); opposingPlayer = new Player(device); fields = new std::vector<vector3df>(); smgr->addCameraSceneNode(0, vector3df(0,8,-8), vector3df(0,0,0)); }
void Entity::addCollision(Entity coll, f32 tx, f32 ty, f32 tz, f32 sx, f32 sy, f32 sz, f32 gx, f32 gy, f32 gz) { ITriangleSelector* selector = 0; if(coll.type == MESH_TYPE) { selector = Scene->createTriangleSelector(coll.tmesh, coll.sceneNode); coll.sceneNode->setTriangleSelector(selector); } if(coll.type == ANIM_TYPE) { selector = Scene->createTriangleSelector(coll.animNode->getMesh(), coll.animNode); coll.animNode->setTriangleSelector(selector); } if(coll.type == MAP_TYPE) { selector = Scene->createOctreeTriangleSelector(coll.bmesh->getMesh(0), coll.sceneNode); coll.sceneNode->setTriangleSelector(selector); } ISceneNodeAnimator* anim; if(type == MESH_TYPE) { anim = Scene->createCollisionResponseAnimator(selector, sceneNode, vector3df(sx,sy,sz), \ vector3df(gx,gy,gz), vector3df(tx,ty,tz)); sceneNode->addAnimator(anim); } if(type == ANIM_TYPE) { anim = Scene->createCollisionResponseAnimator(selector, animNode, vector3df(sx,sy,sz), \ vector3df(gx,gy,gz), vector3df(tx,ty,tz)); animNode->addAnimator(anim); } if(type == MAP_TYPE) { anim = Scene->createCollisionResponseAnimator(selector, sceneNode, vector3df(sx,sy,sz), \ vector3df(gx,gy,gz), vector3df(tx,ty,tz)); sceneNode->addAnimator(anim); } else return; selector->drop(); anim->drop(); }
// ---------------------------------------------------------------------------- void Editor::initAfterDataDirKnown() { m_rcs = RoadCrossSectionWndw::get(); // fonts IGUISkin* skin = m_gui_env->getSkin(); m_font = m_gui_env->getFont(m_data_loc + L"editor/font/font.xml"); skin->setFont(m_font); // removing gui transparency for (s32 i = 0; i < EGDC_COUNT; ++i) { video::SColor col = skin->getColor((EGUI_DEFAULT_COLOR)i); col.setAlpha(255); skin->setColor((EGUI_DEFAULT_COLOR)i, col); } // free camera ICameraSceneNode* cam; cam = m_scene_manager->addCameraSceneNodeMaya(); cam->setID(1); cam->setFarValue(20000.f); cam->setTarget(vector3df(0, 0, 0)); cam->setInputReceiverEnabled(false); // viewport init ICameraSceneNode* norm_cam; norm_cam = m_scene_manager->addCameraSceneNode(0, vector3df(25, 50, 30), vector3df(5, 10, 6)); norm_cam->setID(2); m_viewport = Viewport::get(norm_cam, &m_mouse, &m_keys); m_viewport->setFreeCamera(cam); m_indicator = m_viewport->getIndicator(); m_scene_manager->setActiveCamera(norm_cam); m_msg_wndw = MsgWndw::get(); m_toolbar = ToolBar::getToolBar(); m_new_dialog_wndw = NewDialogWndw::get(); m_new_dialog_wndw->hide(); m_welcome_screen = WelcomeScreen::get(); } // initAfterDataDirKnown
RainNode::RainNode(scene::ISceneManager* mgr, ITexture *tex) : GPUParticle(0, mgr, tex) { RenderProgram = LoadProgram(file_manager->getAsset("shaders/rain.vert").c_str(), file_manager->getAsset("shaders/rain.frag").c_str()); loc_screenw = glGetUniformLocation(RenderProgram, "screenw"); loc_screen = glGetUniformLocation(RenderProgram, "screen"); loc_invproj = glGetUniformLocation(RenderProgram, "invproj"); texloc_tex = glGetUniformLocation(RenderProgram, "tex"); texloc_normal_and_depths = glGetUniformLocation(RenderProgram, "normals_and_depth"); const char *varyings[] = { "currentPosition" }; SimulationProgram = LoadTFBProgram(file_manager->getAsset("shaders/rainsim.vert").c_str(), varyings, 1); loc_campos = glGetUniformLocation(SimulationProgram, "campos"); loc_viewm = glGetUniformLocation(SimulationProgram, "viewm"); loc_time = glGetUniformLocation(SimulationProgram, "time"); count = 2500; area = 3500; u32 i; float x, y, z, vertices[7500]; for (i = 0; i < count; i++) { x = ((rand() % area) - area / 2) / 100.0f; y = ((rand() % 2400)) / 100.0f; z = ((rand() % area) - area / 2) / 100.0f; vertices[3 * i] = x; vertices[3 * i + 1] = y; vertices[3 * i + 2] = z; } texture = getTextureGLuint(tex); normal_and_depth = getTextureGLuint(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH)); glGenBuffers(2, tfb_vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, tfb_vertex_buffer[0]); glBufferData(GL_ARRAY_BUFFER, 3 * count * sizeof(float), vertices, GL_STREAM_DRAW); glBindBuffer(GL_ARRAY_BUFFER, tfb_vertex_buffer[1]); glBufferData(GL_ARRAY_BUFFER, 3 * count * sizeof(float), 0, GL_STREAM_DRAW); box.addInternalPoint(vector3df((float)(-area / 2))); box.addInternalPoint(vector3df((float)(area / 2))); }
void load_player() { IAnimatedMesh* mesh = smgr->getMesh("resources/nodes/models/ninja.b3d"); //IAnimatedMeshSceneNode* myNode = smgr->addAnimatedMeshSceneNode(mesh); player.setNode(smgr->addAnimatedMeshSceneNode(mesh)); player.setAnimation(IDLE_2); player.getNode()->setPosition(vector3df(-50, 20, -60)); player.getNode()->setMaterialTexture( 0, driver->getTexture("resources/textures/models/nskinrd.jpg")); player.getNode()->setScale(vector3df(5,5,5)); player.getNode()->setRotation(vector3df(0,-90,0)); player.getNode()->addShadowVolumeSceneNode(); player.getNode()->setMaterialFlag(EMF_NORMALIZE_NORMALS, true); }
void Game::addArrow(const vector3df& position, const vector3df& rotation) { string<char> str = "arrow" + arrow->size(); IAnimatedMesh *a = smgr->addArrowMesh(str.c_str(), SColor(255,255,255,255), SColor(255,255,255,255)); IAnimatedMeshSceneNode *arrow_sn = smgr->addAnimatedMeshSceneNode(a); arrow_sn->setPosition(position); arrow_sn->setScale(vector3df(150,150,0)); arrow_sn->setRotation(rotation); arrow_sn->setMaterialType(EMT_SOLID); arrow->push_back(arrow_sn); }
void Car::initModels(ISceneManager * smgr) { this->carMeshClean = smgr->getMesh("res/carC.obj"); this->carMeshDamaged = smgr->getMesh("res/carD.obj"); this->carNode = smgr->addAnimatedMeshSceneNode( this->carMeshClean, 0, -1, vector3df(0,1,0) ); // this->carNode->setRotation(vector3df(0,180,0)); this->wheelMesh = smgr->getMesh("res/wheel.obj"); float wheelPosY = -0.2235f; // float wheelPosY = -0.4f; this->wheels[0] = smgr->addAnimatedMeshSceneNode( this->wheelMesh, this->carNode, -1, vector3df(0.3065f, wheelPosY, 0.619f) ); this->wheels[1] = smgr->addAnimatedMeshSceneNode( this->wheelMesh, this->carNode, -1, vector3df(-0.3065f, wheelPosY, 0.619f) ); this->wheels[2] = smgr->addAnimatedMeshSceneNode( this->wheelMesh, this->carNode, -1, vector3df(0.3065f, wheelPosY, -0.55f) ); this->wheels[3] = smgr->addAnimatedMeshSceneNode( this->wheelMesh, this->carNode, -1, vector3df(-0.3065f, wheelPosY, -0.55f) ); }
ISceneNode* ArrowPrototypeFactory::getArrowPrototype(unsigned char type, float offset) { ISceneNode* newArrow = prototypes[type]->clone(parent, smgr); newArrow->setVisible(true); //if (offest != 0.0) { newArrow->setPosition( vector3df(newArrow->getPosition().X, ARROW_HEIGHT - offset, newArrow->getPosition().Z)); // printf ("offset is %f. \n", offset); //} return newArrow; }
bool Application::OnEvent(const SEvent &TEvent) { static int ph = 0; if(TEvent.EventType == EET_KEY_INPUT_EVENT && !TEvent.KeyInput.PressedDown) { switch(TEvent.KeyInput.Key) { case KEY_ESCAPE: Done = true; break; case KEY_KEY_Q: paused = ~paused; break; case KEY_KEY_T: mRCThrottle += 10; break; case KEY_KEY_G: mRCThrottle -= 10; break; case KEY_LEFT: mRCRoll -= 10; break; case KEY_RIGHT: mRCRoll += 10; break; case KEY_UP: ph+=1; mRCPitch += 10; break; case KEY_DOWN: ph-=1; mRCPitch -= 10; break; case KEY_KEY_F: mRCYaw -= 1; break; case KEY_KEY_H: mRCYaw += 1; break; case KEY_KEY_1: CreateBox(btVector3(GetRandInt(10) - 5.0f, 7.0f, GetRandInt(10) - 5.0f), vector3df(GetRandInt(3) + 0.5f, GetRandInt(3) + 0.5f, GetRandInt(3) + 0.5f), 500.0f); break; case KEY_KEY_X: CreateStartScene(); break; default: return false; break; } return true; } return false; }
/* ---------------------------------------------------------------------------- Add an affector to the particle system to alter their position with gravity */ IParticleGravityAffector* DLL_EXPORT IrrAddGravityParticleAffector( IParticleSystemSceneNode* ps, float x, float y, float z, unsigned int timeForceLost ) { IParticleGravityAffector* paf = ps->createGravityAffector(vector3df(x,y,z), timeForceLost); ps->addAffector(paf); paf->drop(); return paf; }
void load_map() { IAnimatedMesh* mesh = smgr->getMesh("resources/nodes/maps/room.3ds"); smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.008f); ISceneNode* node = 0; node = smgr->addAnimatedMeshSceneNode(mesh); node->setMaterialTexture(0, driver->getTexture("resources/textures/maps/wall.jpg")); node->getMaterial(0).SpecularColor.set(0,0,0,0); mesh = smgr->addHillPlaneMesh("myHill", dimension2d<f32>(20,20), dimension2d<u32>(40,40), 0, 0, dimension2d<f32>(0,0), dimension2d<f32>(10,10) ); node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f); node->setPosition(vector3df(0,7,0)); node->setMaterialTexture(0, driver->getTexture("resources/textures/maps/stones.jpg")); node->setMaterialTexture(1, driver->getTexture("resources/textures/maps/water.jpg")); node->setMaterialType(video::EMT_REFLECTION_2_LAYER); // create light node = smgr->addLightSceneNode(0, vector3df(0,0,0), SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f); ISceneNodeAnimator* anim = 0; anim = smgr->createFlyCircleAnimator (vector3df(0,150,0),250.0f); node->addAnimator(anim); anim->drop(); // attach billboard to light node = smgr->addBillboardSceneNode(node, dimension2d<f32>(50, 50)); node->setMaterialFlag(EMF_LIGHTING, false); node->setMaterialType(EMT_TRANSPARENT_ADD_COLOR); node->setMaterialTexture(0, driver->getTexture("resources/textures/particles/particlewhite.bmp")); }
CFPSController::CFPSController(IrrlichtDevice *device, irrBulletWorld *world, IAnimatedMesh *mesh) { setControlSchemeEnable(true); setType(E_ENTITY_FPSCONTROLLER); cameraOffset = vector3df(0,0,0); nodeOffset = vector3df(0,0,0); isMoving = false; isActive = false; Device = device; World = world; Smgr = Device->getSceneManager(); Video = Device->getVideoDriver(); Physics = Smgr->addCubeSceneNode(); Physics->setScale(vector3df(5,7,5)); // Physics->setPosition(vector3df(715,700,500)); Physics->setMaterialFlag(EMF_LIGHTING, false); Node = Smgr->addAnimatedMeshSceneNode(mesh); Smgr->getActiveCamera()->setPosition(vector3df(715,2100,500)); Node->setPosition(vector3df(715,5000,500)); // Node->setPosition(vector3df(715,700,500)); Physics->setPosition(vector3df(715,5000,500)); Node->setMaterialFlag(EMF_LIGHTING, false); Shape = new IBoxShape(Physics, 30.0f, false); Body = World->addRigidBody(Shape); }