bool setup() { win = new Engine::glfwWindow; DefaultGameStateManager *manager = new DefaultGameStateManager(win); win->setApplication(this); win->setState(manager); win->setup(); //AssetManager::setBasePath(""); scene = manager->sceneState->scene; scene->systemManager->addSystem(new PhysicsSubSystem()); scene->systemManager->addSystem(new GenericSubSystem()); scene->systemManager->addSystem(new Generic30fpsSubSystem()); scene->systemManager->addSystem(new Generic60fpsSubSystem()); scene->systemManager->addRenderSystem(new DefaultRenderSubSystem()); DebugRenderSubSystem *dr = new DebugRenderSubSystem(); scene->systemManager->addRenderSystem(dr); scene->setEffect(new PostProcessor(scene)); mainchar = addMainActor(scene); scene->addActor(addModel("Data/Model/mappa4.obj", vec3(-10, 0, -10), vec3(1.5))); scene->addActor(addModel("Data/Model/mappa5.obj", vec3(0), vec3(1.1))); scene->addActor(addAxis1()); // addLucy(scene); addParticleSystem(scene,new ParticleSystem(),vec3(10,0,20)); addParticleSystem(scene,new ParticleSystem1(),vec3(-20,0,20)); addSun(scene); loadScene(AssetManager::getBasePath() + "Data/Level/prova/", scene); loadScene(AssetManager::getBasePath() + "Data/Level/handmade/", scene); Debug("Setup done!\n\n\n\n\nPress F1 to switch to FreeCam\nPress F2 to spawn a light sphere\nPress F3 to get the position\n\n\n\nFor any question contact me at: [email protected]\n\n\n"); }
void Scene1400::postInit(SceneObjectList *OwnerList) { if (_globals->_stripNum != 1400) { loadScene(1401); } else { loadScene(1402); } Scene::postInit(); _globals->_sceneManager._scrollerRect = Rect(40, 90, 280, 180); _globals->_player.postInit(); _globals->_player.setVisage(1401); _globals->_player.animate(ANIM_MODE_2, 0); _globals->_player.setStrip2(4); _globals->_player.fixPriority(4); _globals->_player.disableControl(); _globals->_player._moveDiff = Common::Point(4, 2); _globals->_player.setPosition(Common::Point(160, 800)); _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.y = (_globals->_sceneManager._scene->_sceneBounds.top / 100) * 100; setAction(&_action1); _globals->_soundHandler.play(118); }
void App::onInit() { GApp::onInit(); s_app = this; cameraAdjustment = 0.7f; m_sonicSculptureFilename = "default.Soundscape.Any"; m_freezeEverything = false; g_sampleWindowIndex = 0; m_lastSampleWindowProcessed = 0; m_initialTime = System::time(); m_appMode = AppMode::DEFAULT; // TODO: Print instructions m_maxSavedTimeSlices = 128; m_lastInterestingEventTime = System::time(); initializeAudio(); m_rawAudioTexture = Texture::createEmpty("Raw Audio Texture", g_currentAudioBuffer.size(), 1, ImageFormat::R32F()); m_frequencyAudioTexture = Texture::createEmpty("Frequency Audio Texture", g_currentAudioBuffer.size()/2, 1, ImageFormat::RG32F()); m_smoothedRootMeanSquare = 0.0f; setFrameDuration(1.0f/30.0f); makeGUI(); loadScene("Sculpting"); }
// Called before the application loop begins. Load data here and // not in the constructor so that common exceptions will be // automatically caught. void App::onInit() { GApp::onInit(); // This program renders to texture for most 3D rendering, so it can // explicitly delay calling swapBuffers until the Film::exposeAndRender call, // since that is the first call that actually affects the back buffer. This // reduces frame tearing without forcing vsync on. renderDevice->setSwapBuffersAutomatically(false); setFrameDuration(1.0f / 30.0f); // Call setScene(shared_ptr<Scene>()) or setScene(MyScene::create()) to replace // the default scene here. showRenderingStats = false; m_showWireframe = false; makeGBuffer(); makeGUI(); // For higher-quality screenshots: // developerWindow->videoRecordDialog->setScreenShotFormat("PNG"); // developerWindow->videoRecordDialog->setCaptureGui(false); developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0)); loadScene(developerWindow->sceneEditorWindow->selectedSceneName()); }
void App::onInit() { GApp::onInit(); m_gbufferSpecification.encoding[GBuffer::Field::CS_FACE_NORMAL].format = NULL; m_gbufferSpecification.encoding[GBuffer::Field::CS_NORMAL] = Texture::Encoding(ImageFormat::RGB10A2(), FrameName::CAMERA, 2.0f, -1.0f); m_gbufferSpecification.encoding[GBuffer::Field::SS_EXPRESSIVE_MOTION] = Texture::Encoding(GLCaps::supportsTexture(ImageFormat::RG8()) ? ImageFormat::RG8() : ImageFormat::RGBA8(), FrameName::SCREEN, 128.0f, -64.0f); m_gbufferSpecification.encoding[GBuffer::Field::EMISSIVE] = GLCaps::supportsTexture(ImageFormat::RGB5()) ? Texture::Encoding(ImageFormat::RGB5(), FrameName::NONE, 3.0f, 0.0f) : Texture::Encoding(ImageFormat::R11G11B10F()); m_gbufferSpecification.encoding[GBuffer::Field::LAMBERTIAN] = ImageFormat::RGB8(); m_gbufferSpecification.encoding[GBuffer::Field::GLOSSY] = ImageFormat::RGBA8(); m_gbufferSpecification.encoding[GBuffer::Field::DEPTH_AND_STENCIL] = ImageFormat::DEPTH32F(); m_gbufferSpecification.depthEncoding = DepthEncoding::HYPERBOLIC; // Update the actual m_gbuffer before makeGUI creates the buffer visualizer m_gbuffer->setSpecification(m_gbufferSpecification); m_gbuffer->resize(renderDevice->width() + m_settings.depthGuardBandThickness.x * 2, renderDevice->height() + m_settings.depthGuardBandThickness.y * 2); dynamic_pointer_cast<DefaultRenderer>(m_renderer)->setDeferredShading(true); renderDevice->setSwapBuffersAutomatically(false); makeGUI(); loadScene("G3D Cornell Box");// developerWindow->sceneEditorWindow->selectedSceneName()); }
bool RendererBase::initializeBase() { bool initialized = false; m_camera = new Camera; glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glEnable(GL_LINE_SMOOTH); glLineWidth(1.5f); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); m_vboQUAD = GenerateQuad(-1, -1, 1, 1); if (m_modelCube.load("models/cube.model") && m_modelTeapot.load("models/teapot.model")) { m_shaderPostFX = new Shader; if (m_shaderPostFX->compileShaderFile("shaders/postfx.vs", Shader::TypeVertex) && m_shaderPostFX->compileShaderFile("shaders/postfx.fs", Shader::TypeFragment) && m_shaderPostFX->linkAndFinalize()) { initialized = true; } } if (initialized) { loadScene(); } return initialized; }
void App::onInit() { GApp::onInit(); // Called before the application loop begins. Load data here and // not in the constructor so that common exceptions will be // automatically caught. showRenderingStats = false; // For higher-quality screenshots: // developerWindow->videoRecordDialog->setScreenShotFormat("PNG"); // developerWindow->videoRecordDialog->setCaptureGui(false); m_scene = PhysicsScene::create(); setScene(m_scene); m_firstPersonMode = true; m_playerName = "player"; makeGBuffer(); makeGUI(); developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0)); loadScene("Level"); setActiveCamera(m_scene->typedEntity<Camera>("camera")); developerWindow->sceneEditorWindow->setPreventEntitySelect(true); }
Scene::Scene(std::string sn) : quad(0, sf::FloatRect(0, 0, Window->getSize().x, Window->getSize().y)) , GUI(new GUIOverlay) , name(sn) { loadScene(); }
void App::onInit() { GApp::onInit(); // Called before the application loop begins. Load data here and // not in the constructor so that common exceptions will be // automatically caught. showRenderingStats = false; m_showLightSources = true; m_showAxes = true; m_showWireframe = false; m_preventEntityDrag = false; m_preventEntitySelect = false; // For higher-quality screenshots: // developerWindow->videoRecordDialog->setScreenShotFormat("PNG"); // developerWindow->videoRecordDialog->setCaptureGui(false); makeGUI(); // Start wherever the developer HUD last marked as "Home" defaultCamera.setCoordinateFrame(bookmark("Home")); m_shadowMap = ShadowMap::create(); loadScene(); }
void MainWindow::loadFrame(int index) { if (fileCutter == NULL || index < 0 || index >= fileCutter->nVertices()) { return; } currentFrameIndex = index; std::vector<VertexStruct> v; std::vector<EdgeStruct> e; fileCutter->readFrame(index, v, e); VisFrame *a = new VisFrame; int nVertices = (int)v.size(); for (int i = 0; i < nVertices; i ++) { a->addVertex(v[i].x, v[i].y, v[i].z, 0.1); } int nEdges = (int)e.size(); for (int i = 0; i < nEdges; i ++) { a->addEdge(e[i].a, e[i].b); } loadScene(a); }
Scene::Scene() { headPoly = NULL; tailPoly = NULL; headLight = NULL; tailLight = NULL; loadScene(); }
void initGLUT(int argc, char **argv) { /* Initialize GLUT */ glutInit(&argc, argv); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); glutInitWindowSize(window_width, window_height); glutCreateWindow("window_name"); glutInitWindowPosition(100,50); glutDisplayFunc(display); glutKeyboardFunc(keyboard); glutReshapeFunc(reshape); /* set an idle function */ glutIdleFunc(redisplay); // glutIdleFunc(NULL); /* init the mouse */ initMouse(); loadScene(argv[1]); /* Enter main loop */ glutMainLoop(); return; }
void FeatureDemo::onInitializeTesting() { std::vector<ArgList::Arg> model = mArgList.getValues("loadmodel"); if (!model.empty()) { loadModel(model[0].asString(), false); } std::vector<ArgList::Arg> scene = mArgList.getValues("loadscene"); if (!scene.empty()) { loadScene(scene[0].asString(), false); } std::vector<ArgList::Arg> cameraPos = mArgList.getValues("camerapos"); if (!cameraPos.empty()) { mpSceneRenderer->getScene()->getActiveCamera()->setPosition(glm::vec3(cameraPos[0].asFloat(), cameraPos[1].asFloat(), cameraPos[2].asFloat())); } std::vector<ArgList::Arg> cameraTarget = mArgList.getValues("cameratarget"); if (!cameraTarget.empty()) { mpSceneRenderer->getScene()->getActiveCamera()->setTarget(glm::vec3(cameraTarget[0].asFloat(), cameraTarget[1].asFloat(), cameraTarget[2].asFloat())); } }
bool testApp::loadNewScene(){ ofFileDialogResult r = ofSystemLoadDialog("Select a Scene", true); if(r.bSuccess){ return loadScene(r.getPath()); } return false; }
void World::create() { mapList = MapListLoader::getMapList(); renderer = new Renderer(); loadScene(mapList[currentLevel]); std::random_device rd; generator = std::mt19937(rd()); }
void Scene::skipScene() { SceneQueueList::iterator queueIterator; if (!_sceneLoaded) { error("Scene::skip(): Error: Can't skip scene...no scene loaded"); } if (_inGame) { error("Scene::skip(): Error: Can't skip scene...game already started"); } // Walk down scene queue and try to find a skip target queueIterator = _sceneQueue.begin(); if (queueIterator == _sceneQueue.end()) { error("Scene::skip(): Error: Can't skip scene...no scenes in queue"); } ++queueIterator; while (queueIterator != _sceneQueue.end()) { if (queueIterator->sceneSkipTarget) { // If skip target found, remove preceding scenes and load _sceneQueue.erase(_sceneQueue.begin(), queueIterator); endScene(); loadScene(*_sceneQueue.begin()); break; } ++queueIterator; } }
void Scene600::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); loadScene(600); setZoomPercents(0, 100, 200, 100); _sceneBounds.moveTo(320, 0); _sound1.play(58); _sound1.holdAt(1); BF_GLOBALS._player.postInit(); BF_GLOBALS._player.hide(); BF_GLOBALS._player.setPosition(Common::Point(639, 0)); BF_GLOBALS._player.disableControl(); _skidMarks.postInit(); _skidMarks.hide(); _object2.postInit(); _ryan.postInit(); _ryan.setVisage(600); _ryan.setStrip(7); _ryan.setPosition(Common::Point(417, 82)); BF_GLOBALS.clearFlag(onDuty); BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60); BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 60); _sceneMode = 600; setAction(&_action1, this); }
void Scene::nextScene() { SceneQueueList::iterator queueIterator; if (!_sceneLoaded) { error("Scene::next(): Error: Can't advance scene...no scene loaded"); } if (_inGame) { error("Scene::next(): Error: Can't advance scene...game already started"); } endScene(); // Delete the current head in scene queue queueIterator = _sceneQueue.begin(); if (queueIterator == _sceneQueue.end()) { return; } queueIterator = _sceneQueue.erase(queueIterator); if (queueIterator == _sceneQueue.end()) { return; } // Load the head in scene queue loadScene(*queueIterator); }
//------------------------------------------------------------------------------------------------------------------------------------------- Model* FBXReader::LoadModel(){ // Check blank file name if (FileName == ""){ throw Exception("Filename could not be blank"); } // Check file exists std::ifstream file(FileName.c_str()); if (!file.good()){ throw Exception("File does not exist or access (please check if current file is used by another program !"); } FbxManager* sdkManager = NULL; FbxScene* scene = NULL; bool loadSceneResult; initializeSdkObjects(sdkManager, scene); loadSceneResult = loadScene(sdkManager, scene, FileName); Model* fbxModel = NULL; if (loadSceneResult == false){ throw Exception("An error occurred while loading the scene..."); } else{ transferDataFromSceneToModel(scene, fbxModel); } LOG_DEBUG << "Load model successfully! " << "File's name: " << FileName; return fbxModel; }
void bankManager::loadScenes(ofxXmlSettings & XML){ if(XML.pushTag("SCENE_SETTINGS")){ allScenes.clear(); int numScenes = XML.getNumTags("SCENE"); for(int sn = 0; sn < numScenes; sn++){ if(XML.pushTag("SCENE", sn)){ ofPtr<scene> nScene = ofPtr<scene>(new scene(pOsc)); loadScene(XML, nScene); //scene tag XML.popTag(); } } currentScene = (*allScenes.begin()); if(currentScene->getNumTriggerZones() > 0)currentZone = currentScene->getFirstTriggerZone(); //scene settings tag XML.popTag(); } }
void initialise() { srand(time(NULL)); glEnable(GL_DEPTH_TEST); glEnable(GL_VERTEX_ARRAY); glClearColor(0.0f, 1.0f, 1.0f, 1.0f); //Target Camera cam1 = new target_camera(); cam1->setProjection(glm::degrees(glm::pi<float>() / 4.0f), screenWidth/screenHeight, 0.1f, 10000.0f); cam1->setPositon(glm::vec3(10.f, 10.0f, 10.0f)); cam1->setTarget(glm::vec3(0.0f, 0.0f, 0.0f)); //fps cam cam = new first_person_camera(); cam->setProjection(glm::pi<float>() / 4.0f, screenWidth/screenHeight, 0.1f, 10000.0f); cam->setPositon(glm::vec3(2.0f, 0.0f, 2.0f)); if (!eff.addShader("lit_textured.vert", GL_VERTEX_SHADER)) exit(EXIT_FAILURE); if (!eff.addShader("lighting.frag", GL_FRAGMENT_SHADER)) exit(EXIT_FAILURE); if (!eff.addShader("point_light.frag", GL_FRAGMENT_SHADER)) exit(EXIT_FAILURE); if (!eff.addShader("spot_light.frag", GL_FRAGMENT_SHADER)) exit(EXIT_FAILURE); if (!eff.addShader("lit_textured.frag", GL_FRAGMENT_SHADER)) exit(EXIT_FAILURE); if (!eff.create()) exit(EXIT_FAILURE); scene = loadScene("scene.json"); }
void MainWindow::openScene() { QString fileName = QFileDialog::getOpenFileName(this, "Load Scene", QString(), "Scenes (*.scene)"); if (!fileName.isEmpty()) { loadScene(fileName); } }
int main (int argc, char ** argv) { if (argc<2 || argc > 3) { printf ("usage: %s <scenefile> [jpegname]\n", argv[0]); exit(0); } if(argc == 3) { mode = MODE_JPEG; filename = argv[2]; } else if(argc == 2) mode = MODE_DISPLAY; glutInit(&argc,argv); loadScene(argv[1]); glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE); glutInitWindowPosition(0,0); glutInitWindowSize(WIDTH,HEIGHT); int window = glutCreateWindow("Ray Tracer"); glutDisplayFunc(display); glutIdleFunc(idle); init(); glutMainLoop(); }
// Called before the application loop begins. Load data here and // not in the constructor so that common exceptions will be // automatically caught. void App::onInit() { GApp::onInit(); /* shared_ptr<Texture> texture = Texture::fromFile(System::findDataFile("house.jpg")); shared_ptr<PixelTransferBuffer> ptb = texture->toPixelTransferBuffer(); ptb->mapRead(); ptb->unmap(); */ // This program renders to texture for most 3D rendering, so it can // explicitly delay calling swapBuffers until the Film::exposeAndRender call, // since that is the first call that actually affects the back buffer. This // reduces frame tearing without forcing vsync on. renderDevice->setSwapBuffersAutomatically(false); setFrameDuration(1.0f / 30.0f); // Call setScene(shared_ptr<Scene>()) or setScene(MyScene::create()) to replace // the default scene here. showRenderingStats = false; m_showWireframe = false; makeGUI(); m_lastLightingChangeTime = 0.0; // For higher-quality screenshots: // developerWindow->videoRecordDialog->setScreenShotFormat("PNG"); // developerWindow->videoRecordDialog->setCaptureGui(false); developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0)); loadScene( "G3D Cornell Box" // Load something simple // developerWindow->sceneEditorWindow->selectedSceneName() // Load the first scene encountered ); }
void Scene1250::postInit(SceneObjectList *OwnerList) { loadScene(1250); Scene::postInit(); setZoomPercents(0, 100, 200, 100); _stripManager.addSpeaker(&_speakerQText); _speakerQText._textPos = Common::Point(120, 120); _speakerQText._textWidth = 180; _object1.postInit(); _object1.setVisage(1250); _object1.setPosition(Common::Point(126, 69)); _object1.setStrip2(1); _object1._frame = 1; _object1.setAction(&_action1); _object2.postInit(); _object2.setVisage(1250); _object2.setPosition(Common::Point(126, 69)); _object2.setStrip2(2); _object2.fixPriority(255); _object2._frame = 1; _object2.setAction(&_action2); _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds); _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160; if ((_globals->_sceneManager._previousScene != 2000) || (_globals->_stripNum != 1250)) { setAction(&_action4); } else { setAction(&_action3); _globals->_soundHandler.play(114); } }
void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionType transitionType, int chapter) { debug(5, "Scene::changeScene(%d, %d, %d, %d)", sceneNumber, actorsEntrance, transitionType, chapter); // This is used for latter ITE demos where all places on world map except // Tent Faire are substituted with IFF picture and short description if (_vm->_hasITESceneSubstitutes) { for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++) { if (sceneSubstitutes[i].sceneId == sceneNumber) { const byte *pal; Common::File file; Rect rect; PalEntry cPal[PAL_ENTRIES]; _vm->_interface->setMode(kPanelSceneSubstitute); if (file.open(sceneSubstitutes[i].image)) { Image::IFFDecoder decoder; decoder.loadStream(file); pal = decoder.getPalette(); rect.setWidth(decoder.getSurface()->w); rect.setHeight(decoder.getSurface()->h); _vm->_gfx->drawRegion(rect, (const byte *)decoder.getSurface()->getPixels()); for (int j = 0; j < PAL_ENTRIES; j++) { cPal[j].red = *pal++; cPal[j].green = *pal++; cPal[j].blue = *pal++; } _vm->_gfx->setPalette(cPal); } _vm->_interface->setStatusText("Click or Press Return to continue. Press Q to quit.", 96); _vm->_font->textDrawRect(kKnownFontMedium, sceneSubstitutes[i].title, Common::Rect(0, 7, _vm->getDisplayInfo().width, 27), _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline); _vm->_font->textDrawRect(kKnownFontMedium, sceneSubstitutes[i].message, Common::Rect(24, getHeight() - 33, _vm->getDisplayInfo().width - 11, getHeight()), _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline); return; } } } LoadSceneParams sceneParams; sceneParams.actorsEntrance = actorsEntrance; sceneParams.loadFlag = kLoadBySceneNumber; sceneParams.sceneDescriptor = sceneNumber; sceneParams.transitionType = transitionType; sceneParams.sceneProc = NULL; sceneParams.sceneSkipTarget = false; sceneParams.chapter = chapter; if (sceneNumber != -2) { endScene(); } loadScene(sceneParams); }
void World::create() { editor = new Editor(*this); mapList = MapListLoader::getMapList(); renderer = new Renderer(); lastUpdateTime = SDL_GetTicks(); try { std::string map = config->getString(Config::MAP); loadScene(map); System::Log(Info) << "Custom map loaded"; } catch (const std::out_of_range& e) { System::Log(Info) << "No custom map found loading default map."; loadScene(mapList[currentLevel]); } std::random_device rd; generator = std::mt19937(rd()); }
int GameApplication::enterGameLoop() { m_window.setFixedSize(FIXED_WINDOW_SIZE); m_window.show(); connect(&m_window, SIGNAL(activeChanged()), this, SLOT(loadScene())); return exec(); }
Flt2Scene::Flt2Scene() { //загрузить модель loadScene(); //добавить шейдер в сцену AddShader(); }
Scene::Scene(std::string sceneName) { //Init error description string. errorDescription = ""; //Load scene based on name. sceneIsNotValid = loadScene(sceneName); }