void fakeHaskell() { DemoApp* da = initDemo(); Ogre::SceneManager* sm = getSceneManager(); Ogre::SceneNode* rnode = getRootSceneNode(sm); /* OgreFramework::getSingletonPtr()->m_pSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox"); m_pCubeEntity = OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity("Cube", "ogrehead.mesh"); m_pCubeNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode("CubeNode"); m_pCubeNode->attachObject(m_pCubeEntity); m_pCube2E = OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity("Steve", Ogre::SceneManager::PT_CUBE); m_pCube2N = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode("SteveN"); m_pCube2N->attachObject(m_pCube2E);*/ setSkybox(sm, true, "Examples/SpaceSkyBox"); Ogre::Entity* cubeEntity = createEntity(sm, "Cube", "ogrehead.mesh"); Ogre::SceneNode* cubeNode = createChildSceneNode(rnode, "CubeNode"); attachObject(cubeNode, cubeEntity); finishSetupAndRun(da); }
void View::renderScene(int lastTime, int currentTime) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ; camera.animation(std::min(100, currentTime-lastTime)); camera.setCamera(); lod.setCamera(camera.cameraCenter); setLight(); setSkybox(); glBegin(GL_TRIANGLES); root->display(); glEnd(); if (false) { // displayNormals ? glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glBegin(GL_LINES); root->displayNormals(); glEnd(); glEnable(GL_LIGHTING); glEnable(GL_TEXTURE_2D); } float fps = (int)(1000/(currentTime-lastTime)); char text[100]; // Text snprintf(&(text[0]), 100, "FPS: %4.2f", fps); std::cerr << "\r" << fps << " "; std::cerr.flush(); /* glLoadIdentity (); glDisable(GL_LIGHTING); glColor3f(0.0f, 0.0f, 0.0f); //glRasterPos3f (0, 0, 0); glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (unsigned char*)(&(text[0]))); */ glFlush(); SDL_GL_SwapBuffers(); }
void TestScene::initScene() { scene_State* currentState = &scene_states[SimState::currentUpdateState]; extern std::string ROME_PATH; std::string location = ROME_PATH + "/Assets/Meshes/test_sphere_hires.msh"; std::string cubeLocation = ROME_PATH + "/Assets/Meshes/test_cube.msh"; std::string quadLocation = ROME_PATH + "/Assets/Meshes/test_quad.msh"; std::string testTextureLocation = ROME_PATH + "/Assets/Textures/stone.png"; std::string testNormalLocation = ROME_PATH + "/Assets/Textures/stone_normal.png"; std::string transTextureLocation = ROME_PATH + "/Assets/Textures/stone_transparent.png"; std::string skyboxLocation = ROME_PATH + "/Assets/Meshes/test_cube_skybox.msh"; std::string skyboxTexLocation = ROME_PATH + "/Assets/Textures/skybox.png"; std::string cubeMapLocation = ROME_PATH + "/Assets/Textures/debug"; //make two offset objects MeshNode* childNode = new MeshNode(location, MaterialList::BLINNPHONG); childNode->setMaterialColor(1.0, 1.0, 1.0); childNode->setMaterialAlpha(0.4); childNode->setMaterialProperties(40.0, 0.2, 4.0); //childNode->setMaterialTexture(transTextureLocation); //childNode->setMaterialNormalMap(testNormalLocation); childNode->setTranslation(0, 0, 0); currentState->sceneRoot->addChild(childNode); ////float randRot = rand() % 90; VitalEntity * secondChild = new VitalEntity(location, 1, 0, 0); secondChild->setTranslation(2, 2, 0); //secondChild->setRotation(20, randRot, 0); childNode->addChild(secondChild); //add a floor MeshNode* floor = new MeshNode(quadLocation, MaterialList::BLINNPHONG); floor->setMaterialColor(1.0, 1.0, 1.0, 1.0, 0.0, 0.0); floor->setMaterialProperties(40.0, 1.0, 1.0); floor->setMaterialTexture(testTextureLocation); floor->setMaterialNormalMap(testNormalLocation); floor->setScaling(5, 5, 1.0); floor->setTranslation(0, 0, -1.1); currentState->sceneRoot->addChild(floor); //make a ring of spheres for(double i = 0; i < 6; ++i) { MeshNode* newNode = new MeshNode(location, MaterialList::SOLIDTRANSPARENT); newNode->setMaterialColor(0.0, 1.0, 1.0); newNode->setMaterialAlpha(0.4); //newNode->setMaterialProperties(40.0, 1.0, 1.0); newNode->setMaterialTexture(transTextureLocation); //newNode->setMaterialNormalMap(testNormalLocation); newNode->setTranslation(3*sin(i*6.28/6), 3*cos(i*6.28/6), 0); currentState->sceneRoot->addChild(newNode); } Skybox* sky = new Skybox(this, skyboxLocation); sky->setMaterialColor(1.0, 1.0, 1.0, 0.0, 0.0, 0.0); sky->setMaterialTexture(skyboxTexLocation); sky->setScaling(100.0, 100.0, 100.0); setSkybox(sky); //add a light LightNode* light = new LightNode(); light->setTranslation(16.0, 16.0, 6.0); currentState->sceneRoot->addChild(light); //cube mapping setCubeMap(cubeMapLocation); };
LevelEditor::LevelEditor(QMap<GLint,GLuint> &_iconsList, Alphabet *_alphabet, QObject *_parent, Level *_level, bool _audioEnabled, Skin *_asphaltSkin): parent(_parent), iconsList(_iconsList), audioEnabled(_audioEnabled), isMoving(false), level(_level), currentView(SET_NAME_VIEW), currentLength(LEVEL_LENGTH_DEFAULT), currentWidth(LEVEL_WIDTH_DEFAULT), currentGravity(LEVEL_GRAVITY_DEFAULT), alphabet(_alphabet), volumeSkin(NULL), asphaltSkin(_asphaltSkin), visible(true), visibleTime(0), currentName(""), currentError(""), movingObject(-1), positionValid(false), xCell(0), yCell(0), zCell(0), lastMouseX(0), lastMouseY(0) { connect(this, SIGNAL(playAmbientMusic(QString)), parent, SIGNAL(playAmbientMusic(QString))); connect(this, SIGNAL(setMouseMovementTracking(int)), parent, SLOT(setMouseMovementTracking(int))); connect(this, SIGNAL(setSkybox(QString)), parent, SLOT(setSkybox(QString))); emit playAmbientMusic("editor.mp3"); emit setSkybox("stars"); currentActions = new ActionList(INITIAL_MOVEMENT); cameraOffset = new Vector3f(-30.0f, -30.0f, 0.0f); levelOffset = new Vector3f(0.0f, -3.0f, 0.0f); if (level != NULL) { // Carica il livello level->load(); currentGravity = level->getGravity(); currentLength = level->getLength(); currentWidth = level->getWidth(); cameraOffset->x = 30.0f; currentView = SET_GRAVITY_VIEW; } angleRotVolumeCube = (audioEnabled ? 0.0f : 90.0f); lengthLabel = new CubeString(QString::number(currentLength / 3), 3.0f, alphabet, LENGTH_LABEL); widthLabel = new CubeString(QString::number(currentWidth / 3), 3.0f, alphabet, WIDTH_LABEL); gravityLabel = new CubeString(QString::number(currentGravity), 3.0f, alphabet, GRAVITY_LABEL); lengthString = new CubeString("length", 1.5f, alphabet, LENGTH_STRING); widthString = new CubeString("width", 1.5f, alphabet, WIDTH_STRING); gravityString = new CubeString("gravity", 1.5f, alphabet, GRAVITY_STRING); back = new CubeString("back", 1.0f, alphabet, BUTTON_BACK); menu = new CubeString("menu", 1.0f, alphabet, BUTTON_EXIT); create = new CubeString("create", 1.0f, alphabet, BUTTON_NEXT); next = new CubeString("next", 1.0f, alphabet, BUTTON_NEXT); save = new CubeString("save", 0.8f, alphabet, BUTTON_SAVE); cancel = new CubeString("cancel", 0.8f, alphabet, BUTTON_CANCEL); clear = new CubeString("clear", 0.8f, alphabet, BUTTON_CLEAR); exit = new CubeString("exit", 0.8f, alphabet, BUTTON_EXIT); labelSetLevelName = new CubeString("level name", 1.3f, alphabet, LABEL_SET_LEVEL_NAME); formSetLevelName = new CubeStringList("", 14.0f, 6.0f, alphabet, 2.0f, FORM_SET_LEVEL_NAME); GLuint volume_on = iconsList.value(VOLUME_ON); GLuint volume_off = iconsList.value(VOLUME_OFF); volumeSkin = new Skin(0, 0, volume_off, volume_off, volume_on, volume_on); toolbarObstacleCentres.append(new Vector3f(80.0f, 6.0f, 0.0f)); toolbarObstacleCentres.append(new Vector3f(80.0f, 3.2f, 0.0f)); toolbarObstacleCentres.append(new Vector3f(80.0f, 0.4f, 0.0f)); toolbarObstacleCentres.append(new Vector3f(80.0f, -2.4f, 0.0f)); }