View::View(Chose* _root) : root(_root), camera(Camera(Vertex(0,0,5000), 45, 100, 10000, 0.6f)), lod(camera.cameraCenter, _root) { fogColor[0] = Couleurs::r(Couleurs::fog) / 255.f; fogColor[1] = Couleurs::g(Couleurs::fog) / 255.f; fogColor[2] = Couleurs::b(Couleurs::fog) / 255.f; fogColor[3] = 1.0; initWindow(); mainLoop(); }
TEST(CameraTest, PassValuesToVec3) { Camera c = Camera(vec3(0, 0, 2), vec3(0, 0, 0), vec3(0, 1, 0), 90); EXPECT_EQ(c.lookFrom.z, 2); EXPECT_EQ(c.lookAt.y, 0); EXPECT_EQ(c.up.y, 1); EXPECT_EQ(c.fovy, 90); // coord frame EXPECT_EQ(c.u, vec3(1,0,0)); EXPECT_EQ(c.v, vec3(0,1,0)); EXPECT_EQ(c.w, vec3(0,0,1)); }
Camera CameraList::get(const int index) { EdsCameraRef camera = nullptr; EdsError err = EdsGetChildAtIndex(list_, 0, &camera); if (EDS_ERR_OK != err) { DEBUGSTREAM << DescribeError(err) << std::endl; throw Exception(err); } Camera retval = Camera(camera); retval.Initialize(); return retval; }
/** * Create a new Camera based on a model. * * @param m the model to base the camera on * @return a new Camera that looks at the model */ Camera Camera::fromModel(const Model& m) { auto box = m.getBounds(); auto zdiff = sqrt( pow(box.len().y(), 2) * pow(box.len().x(), 2)) + box.len().z(); auto fl = -1.0; auto up = Vector(0, 1, 0); auto at = Vector(0, 0, 1); auto fp = (box.min() + (box.len() / 2.0)) + Vector(0, 0, 0.25 * zdiff); auto vrp = fp + (at * fl); return Camera(fp, vrp, up); }
Crate_State::Crate_State() : m_crate(Point3f(35.0f, 12.0f, 0.0f), Vector3f(30.0f, 30.0f, 30.0f)), other_crate(Point3f(35.0f, 50.0f, 50.0f), Vector3f(30.0f, 30.0f, 30.0f)), m_player(Camera(Point3f(0.0f, 0.0f, 50.0f), Quaternion(), 1.0f, 10000.0f), Vector3f(0.0f, 0.0f, -39.0f), 11.0f) { set_pausable(true); }
void CHMMDemoView::SetSelection( RECT* sel ) { if( sel ) { m_tmp_sel = NormalizeRect( *sel ); } else { CImage& img = Camera().GetFrame(); m_tmp_sel = CRect( 0, 0, img.Width(), img.Height() ); } CheckUpdate(); }
/* * Instructions on using this program: * * 'H' - hardware viewing and perspective transforms * 'O' - orthographic projection mode * 'P' - perspective projection mode * 'I' - reset to original setup * * In each mode, pressing the 'l', 'k', 'w' keys * makes the transformation in the 'forward' direction, * pressing 'h', 'j', 's' makes the transformation in the * 'reverse' direction. You are required to implement this * functionality. Look at the kbd() function to see how * the various functions are called. * */ void kbd(unsigned char key, int x, int y) { switch(key) { case 'q': /* quit */ case 27 : glutDestroyWindow(wd); exit (0); case 'I': /* reset */ cam = Camera(eye_pos0, gaze_dir0, top_dir0, zNear0, zFar0, fovy0); resetWorld(mode); setup_view(mode); transformWorld(mode); // TODO do the transform, including perspective transform in objects.cpp fprintf(stderr, "Reset!\n"); break; case 'H': mode = HARDWARE; init_viewcam(mode); reshape(screen_w, screen_h); fprintf(stderr, "Hardware transforms\n"); break; case 'O': mode = ORTHOGRAPHIC; init_viewcam(mode); reshape(screen_w, screen_h); fprintf(stderr, "Orthographic mode\n"); break; case 'P': mode = PERSPECTIVE; init_viewcam(mode); reshape(screen_w, screen_h); fprintf(stderr, "Perspective mode\n"); break; default: movecam(key, x, y); // TODO in transfomrs.cpp setup_view(mode); // TODO set up the viewing transformation in transforms.cpp transformWorld(mode); // TODO do the transform, including perspective transform in objects.cpp break; } glutPostRedisplay(); return; }
void Viewer::setup_scene() { trac0r::Material emissive{1, {1.f, 0.93f, 0.85f}, 0.f, 1.f, 15.f}; trac0r::Material default_material{2, {0.740063, 0.742313, 0.733934}}; trac0r::Material diffuse_red{2, {0.366046, 0.0371827, 0.0416385}}; trac0r::Material diffuse_green{2, {0.162928, 0.408903, 0.0833759}}; trac0r::Material glass{3, {0.5f, 0.5f, 0.9f}, 0.0f, 1.51714f}; trac0r::Material glossy{4, {1.f, 1.f, 1.f}, 0.09f}; auto wall_left = trac0r::Shape::make_plane({-0.5f, 0.4f, 0}, {0, 0, -glm::half_pi<float>()}, {1, 1}, diffuse_red); auto wall_right = trac0r::Shape::make_plane({0.5f, 0.4f, 0}, {0, 0, glm::half_pi<float>()}, {1, 1}, diffuse_green); auto wall_back = trac0r::Shape::make_plane({0, 0.4f, 0.5}, {-glm::half_pi<float>(), 0, 0}, {1, 1}, default_material); auto wall_top = trac0r::Shape::make_plane({0, 0.9f, 0}, {glm::pi<float>(), 0, 0}, {1, 1}, default_material); auto wall_bottom = trac0r::Shape::make_plane({0, -0.1f, 0}, {0, 0, 0}, {1, 1}, default_material); auto lamp = trac0r::Shape::make_plane({0, 0.85f, -0.1}, {0, 0, 0}, {0.4, 0.4}, emissive); auto box1 = trac0r::Shape::make_box({0.3f, 0.1f, 0.1f}, {0, 0.6f, 0}, {0.2f, 0.5f, 0.2f}, default_material); auto box2 = trac0r::Shape::make_box({-0.2f, 0.15f, 0.1f}, {0, -0.5f, 0}, {0.3f, 0.6f, 0.3f}, glossy); if (m_benchmark_mode > 0) { auto sphere1 = trac0r::Shape::make_icosphere({0.f, 0.1f, -0.3f}, {0, 0, 0}, 0.15f, m_benchmark_mode - 1, default_material); Scene::add_shape(m_scene, sphere1); } else { auto sphere1 = trac0r::Shape::make_icosphere({0.f, 0.1f, -0.3f}, {0, 0, 0}, 0.15f, 2, glass); auto sphere2 = trac0r::Shape::make_icosphere({0.3f, 0.45f, 0.1f}, {0, 0, 0}, 0.15f, 2, glossy); Scene::add_shape(m_scene, sphere1); Scene::add_shape(m_scene, sphere2); } Scene::add_shape(m_scene, wall_left); Scene::add_shape(m_scene, wall_right); Scene::add_shape(m_scene, wall_back); Scene::add_shape(m_scene, wall_top); Scene::add_shape(m_scene, wall_bottom); Scene::add_shape(m_scene, lamp); Scene::add_shape(m_scene, box1); Scene::add_shape(m_scene, box2); glm::vec3 cam_pos = {0, 0.31, -1.2}; glm::vec3 cam_dir = {0, 0, 1}; glm::vec3 world_up = {0, 1, 0}; m_camera = Camera(cam_pos, cam_dir, world_up, 90.f, 0.001, 100.f, m_screen_width, m_screen_height); }
void rt::Ra2Parser::loadCamFile(const std::string& filename) { std::ifstream file(filename.c_str()); std::string line; std::vector<std::string> tokens; Point position; Vector direction; Vector up; float depth; float filmSizeY; if (file.is_open()) { while (!file.eof()) { getline(file, line); tokenize(line, tokens); if (tokens[0] == "position") { float x = atof(tokens[1].c_str()); float y = atof(tokens[2].c_str()); float z = atof(tokens[3].c_str()); position = Point(x,y,z); } else if (tokens[0] == "direction") { float x = atof(tokens[1].c_str()); float y = atof(tokens[2].c_str()); float z = atof(tokens[3].c_str()); direction = Vector(x,y,z); } else if (tokens[0] == "up") { float x = atof(tokens[1].c_str()); float y = atof(tokens[2].c_str()); float z = atof(tokens[3].c_str()); up = Vector(x,y,z); } else if (tokens[0] == "depth") { depth = atof(tokens[1].c_str()); } else if (tokens[0] == "filmSizeY") { filmSizeY = atof(tokens[1].c_str()); } } float fovy = toDegrees(atan((filmSizeY / 2) / depth)); camera_ = Camera(position, direction, up, fovy, fovy, depth, 1024, 1024); } else std::cerr << "Unabe to open file " << filename << std::endl; file.close(); }
void SceneLoader::ImportCamera(Scene& scene, const aiCamera* const camera) { float width = camera->mAspect; float height = 1.0; glm::mat4x4 persp = glm::perspective(camera->mHorizontalFOV, camera->mAspect, camera->mClipPlaneNear, camera->mClipPlaneFar); aiVector3D ai_at = camera->mLookAt; aiVector3D ai_pos = camera->mPosition; aiVector3D ai_up = camera->mUp; glm::vec3 at = glm::vec3(ai_at[0], ai_at[1], ai_at[2]); glm::vec3 pos = glm::vec3(ai_pos[0], ai_pos[1], ai_pos[2]); glm::vec3 up = glm::vec3(ai_up[0], ai_up[1], ai_up[2]); glm::mat4x4 look_at = glm::lookAt(pos, at, up); scene.AddCamera(Camera(width, height, persp, look_at)); }
Void RPGGame::_CreateWorld() { BaseCharacter * pPlayer = GameplayFn->GetCharacter( TEXT("Shiki") ); // Landscape m_pLandscape = New Landscape(); m_pLandscape->SetEyeEntity( pPlayer->GetEntity() ); WorldFn->AddChild( m_pLandscape ); // World camera m_pRenderCamera = New Camera( true ); m_pWorldCamera = New WorldCamera3rdPerson( m_pRenderCamera, pPlayer->GetEntity(), NULL, 3.0f ); WorldFn->SetWorldCamera( m_pWorldCamera ); }
void CWeaponStatMgun::UpdateCL() { inheritedPH::UpdateCL (); UpdateBarrelDir (); UpdateFire (); if(OwnerActor() && OwnerActor()->IsMyCamera()) { cam_Update(Device.fTimeDelta, g_fov); OwnerActor()->Cameras().UpdateFromCamera(Camera()); OwnerActor()->Cameras().ApplyDevice(VIEWPORT_NEAR); } }
PAIS::Camera FileLoader::loadNvm2Camera(ifstream &file, const char* path) { // camera information string fileName = path; Vec2d focal; Vec2d principlePoint; Vec4d quaternion; Vec3d center; char strbuf[STRING_BUFFER_LENGTH]; char *strip; file.getline(strbuf, STRING_BUFFER_LENGTH); // image file name strip = strtok(strbuf, DELIMITER); fileName.append(strip); // focal length strip = strtok(NULL, DELIMITER); focal[0] = atof(strip); strip = strtok(NULL, DELIMITER); focal[1] = atof(strip); // priciple point strip = strtok(NULL, DELIMITER); principlePoint[0] = atof(strip); strip = strtok(NULL, DELIMITER); principlePoint[1] = atof(strip); // quaternion rotation strip = strtok(NULL, DELIMITER); // k quaternion[0] = atof(strip); strip = strtok(NULL, DELIMITER); // wx quaternion[1] = atof(strip); strip = strtok(NULL, DELIMITER); // wy quaternion[2] = atof(strip); strip = strtok(NULL, DELIMITER); // wz quaternion[3] = atof(strip); // 3D camera center in world coordinate Vec3d cameraCenter; strip = strtok(NULL, DELIMITER); // cx center[0] = atof(strip); strip = strtok(NULL, DELIMITER); // cy center[1] = atof(strip); strip = strtok(NULL, DELIMITER); // cz center[2] = atof(strip); return Camera(fileName.c_str(), focal, principlePoint, quaternion, center, 0); }
EKFOA::EKFOA() : cam(Camera( //Sample // 0.0112, //d // 1.7945 / 0.0112, //Cx // 1.4433 / 0.0112, //Cy // 6.333e-2, //k1 // 1.390e-2, //k2 // 2.1735 //f //1394_HQ // 743.820952250528, //fx // 745.938565001168, //fy // 340.661572727241, //cx // 236.368684007102, //cy // -0.220047987197564, //k1 // 0.220478586879841 //k2 // //1394_DownSample // 369.63729683985, //fx // 370.836503127339, //fy // 170.501040779887, //cx // 118.086801153144, //cy // -0.212379296868053, //k1 // 0.189944746349158 //k2 //ARDRONE: 588.878779108602, //fx 588.643674196636, //fy 303.725019622098, //cx 185.837132396075, //cy -0.550446697998159, //k1 0.311341231340524 //k2 )), filter(Kalman( 0.0, //v_0 0.025, //std_v_0 1e-15, //w_0 0.025, //std_w_0 0.007, //standar deviation for linear acceleration noise 0.007, //standar deviation for angular acceleration noise 1.0 //standar deviation for measurement noise )), motion_tracker(MotionTrackerOF( 30, //min_number_of_features_in_image 20 //distance_between_points )) { }
Renderer::Renderer( GLContext* gl_context ) : m_gl_context( gl_context ), m_scene(), m_run( false ), m_width( 0 ), m_height( 0 ), m_translation_zoom_scale( 1 ) { double temp_pos[] = { 0.0, 0.0, 0.0 }; double temp_dir[] = { 0.0, 0.0, -1.0 }; double temp_up[] = { 0.0, 1.0, 0.0 }; m_camera = Camera( temp_pos, temp_dir, temp_up ); m_gl_context->makeCurrent(); }
void C_MatchBall::OnDataChanged(DataUpdateType_t updateType) { BaseClass::OnDataChanged( updateType ); if (updateType == DATA_UPDATE_CREATED) { if (!g_pBall) { g_pBall = this; Camera()->SetTarget(this->entindex()); } SetNextClientThink(CLIENT_THINK_ALWAYS); } }
TemplatePropertyTimeline<Camera>::TemplatePropertyTimeline(TemplateProperty<Camera>* prop) : property_(prop) , activeOnRendering_(true) , timelineChanged_(false) { duration_ = 60.f * 15.f; tgt::Camera cam = property_->get(); // Camera* node0 = new Camera(cam->getPosition(), cam->getFocus(), cam->getUpVector(), cam->getStrafe()); // node0->setNodeIdentifier("Node 0"); // node0->setDirection(node0->getStrafe()); Camera node0 = Camera(cam); timeline_ = new CameraPropertyTimelineState(new PropertyKeyValue<Camera>(node0, 0.f)); }
void Stage::processContinuousInput(){ if(keyStates[GLFW_KEY_A]) { cpVect curVel = cpBodyGetVelocity(userControlObject->body); if(curVel.x >= -1000.0) cpBodySetForce(userControlObject->body, cpv(-100000.0, 0.0)); } if(keyStates[GLFW_KEY_D]) { cpVect curVel = cpBodyGetVelocity(userControlObject->body); if(curVel.x <= 1000.0) cpBodySetForce(userControlObject->body, cpv(100000.0, 0.0)); } if(!keyStates[GLFW_KEY_A] && !keyStates[GLFW_KEY_D]) { cpVect curVel = cpBodyGetVelocity(userControlObject->body); if(curVel.x != 0) { curVel.x /= 1.1; if(curVel.x > -100 || curVel.x < 100) curVel.x = 0; cpBodySetVelocity(userControlObject->body, curVel); } } if(keyStates[GLFW_KEY_SPACE]){ cpVect curVel = cpBodyGetVelocity(userControlObject->body); // if(curVel.y < 0.5 && curVel.y > -0.5){ // cpBodySetVelocity(userControlObject->body, cpvadd(curVel, cpv(0.0, 1150.0))); // soundMap.find("Jump")->second->play(); // } if(userControlObject->canJump){ cpBodySetVelocity(userControlObject->body, cpvadd(curVel, cpv(0.0, 1150.0))); soundMap.find("Jump")->second->play(); } } if(keyStates[GLFW_KEY_E]){ firstPerson = !firstPerson; camera = Camera(); keyStates[GLFW_KEY_E] = 0; } }
int main() { // Initiatisation glm::ivec2 screenSize = glm::ivec2(400, 300); // -- Camera Camera cam = Camera(70.f, screenSize, 1); cam.LookAt(glm::vec3(50,52,295.6), glm::vec3(50,52,295.6) + glm::vec3(0,0.0,-1)); // -- Scene Scene sc; // Sphere(1e5, Vec( 1e5+1,40.8,81.6), Vec(),Vec(.75,.25,.25),DIFF),//Left // Sphere(1e5, Vec(-1e5+99,40.8,81.6),Vec(),Vec(.25,.25,.75),DIFF),//Rght // Sphere(1e5, Vec(50,40.8, 1e5), Vec(),Vec(.75,.75,.75),DIFF),//Back // Sphere(1e5, Vec(50,40.8,-1e5+170), Vec(),Vec(), DIFF),//Frnt // Sphere(1e5, Vec(50, 1e5, 81.6), Vec(),Vec(.75,.75,.75),DIFF),//Botm // Sphere(1e5, Vec(50,-1e5+81.6,81.6),Vec(),Vec(.75,.75,.75),DIFF),//Top sc.AddPrimitive( new Sphere(glm::vec3(1e5 + 1, 40.8, 81.6), 1e5, Material(glm::vec3(.75, .25, .25)))); sc.AddPrimitive( new Sphere(glm::vec3(-1e5 + 99, 40.8, 81.6), 1e5, Material(glm::vec3(.25, .25, .75)))); sc.AddPrimitive( new Sphere(glm::vec3(50,40.8, 1e5), 1e5, Material(glm::vec3(.75, .75, .75)))); sc.AddPrimitive( new Sphere(glm::vec3(50, 40.8, -1e5 + 250), 1e5, Material(glm::vec3(.75, .75, .75)))); sc.AddPrimitive( new Sphere(glm::vec3(50, 1e5, 81.6), 1e5, Material(glm::vec3(.75, .75, .75)))); sc.AddPrimitive( new Sphere(glm::vec3(50,-1e5+81.6,81.6), 1e5, Material(glm::vec3(.75, .75, .75)))); sc.AddLight(new PointLight(glm::vec3(50,52,240))); // -- Screne Screen screen(screenSize); // Ray generation for (int x = 0; x < screenSize.x; x++) for (int y = 0; y < screenSize.y; y++) { glm::vec3 colorFinal = sc.ComputeColor(cam.GetRay(x,y)); screen.Store(x, y, colorFinal*100.f); } screen.SaveToPGM("out.pgm"); return 0; }
GLint init() { glfwInit(); /* Create a GLFW window */ glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); window = glfwCreateWindow(screenWidth, screenHeight, "Learning OpenGL", nullptr, nullptr); if (window == nullptr) { std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); /* Initialize GLEW */ glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { std::cout << "Failed to initialize GLEW" << std::endl; return -1; } glViewport(0, 0, 800, 600); /* Input */ glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glfwSetKeyCallback(window, key_callback); glfwSetCursorPosCallback(window, mouse_callback); glEnable(GL_DEPTH_TEST); cubeShader = Shader("cube.vert", "cube.frag"); lightShader = Shader("light.vert", "light.frag"); viewCamera = Camera( glm::vec3(0.0f, 0.0f, 3.0f), glm::vec3(0.0f, 0.0f,-1.0f), glm::vec3(0.0f, 1.0f, 0.0f), 5.0f ); return 0; }
void OBJScene::setScene(char *filename) { std::vector<tinyobj::shape_t> tinyshapes; std::string err = tinyobj::LoadObj(tinyshapes, filename, "Scenes/obj/"); printf("%s\n", err.c_str()); this->camera = Camera( Vector(15, 15, -10), Vector(-0.8,-0.8, 0.5), 0, Vector(0,1,0), M_PI/2 ); this->lights.push_back(Light( POINT, Vector(20, 5, 0), Vector(0,0,1), RTColor(1,1,1), 0, 0 )); //this->camera = Camera( // Vector(275,270,-260), // Vector(0,0,1), // 0, // Vector(0,1,0), // M_PI/2 //); // //this->lights.push_back(Light( // POINT, // Vector(270,500,270), // Vector(0,0,1), // RTColor(1,1,1), // 0, // 0 //)); setObjects(tinyshapes); Scene::setScene(); }
ModelPreviewCanvas::ModelPreviewCanvas(wxWindow* parent, wxWindowID id /*= wxID_ANY*/, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/, long style /*= 0*/) :wxWindow(parent, id, pos, size, style | wxFULL_REPAINT_ON_RESIZE) ,mModel(NULL) { D3DPRESENT_PARAMETERS presentParams = gEngine->GetDriver()->GetPresentParameters(0); presentParams.BackBufferWidth = 160; presentParams.BackBufferHeight = 180; int swapChainIndex = gEngine->GetDriver()->CreateAdditionalSwapChain(presentParams); SetSwapChainIndex(swapChainIndex); D3DVIEWPORT9 viewPort = gEngine->GetDriver()->GetViewPort(mSwapChainIndex); mCamera = New Camera(Vector3(0, 0, -10.0f), Vector3::Zero, PI/3, (float)viewPort.Width / (float)viewPort.Height, 0.1f, 1000.0f); }
PAIS::Camera FileLoader::loadNvmCamera(ifstream &file, const char* path) { // camera information string fileName = path; Vec2d focal; Vec4d quaternion; Vec3d center; double radialDistortion; char strbuf[STRING_BUFFER_LENGTH]; char *strip; file.getline(strbuf, STRING_BUFFER_LENGTH); // image file name strip = strtok(strbuf, DELIMITER); fileName.append(strip); // focal length strip = strtok(NULL, DELIMITER); focal[0] = atof(strip); focal[1] = atof(strip); // quaternion rotation strip = strtok(NULL, DELIMITER); // k quaternion[0] = atof(strip); strip = strtok(NULL, DELIMITER); // wx quaternion[1] = atof(strip); strip = strtok(NULL, DELIMITER); // wy quaternion[2] = atof(strip); strip = strtok(NULL, DELIMITER); // wz quaternion[3] = atof(strip); // 3D camera center in world coordinate Vec3d cameraCenter; strip = strtok(NULL, DELIMITER); // cx center[0] = atof(strip); strip = strtok(NULL, DELIMITER); // cy center[1] = atof(strip); strip = strtok(NULL, DELIMITER); // cz center[2] = atof(strip); // radial distortion parameters strip = strtok(NULL, DELIMITER); radialDistortion = atof(strip); return Camera(fileName.c_str(), focal, Vec2d(-1, -1), quaternion, center, radialDistortion); }
void SetSceneCamera() { BezierType** bezierTemp = sceneReader.GetBezierObjects(); int size = sceneReader.GetNumberOfBezierObjects(); float radius = 0.0; float y = 0.0; for (int i=0; i<size; i++) { BezierType* bt = bezierTemp[i]; radius = std::max(bt->GetMaxZ(), radius); y = std::max(bt->GetMaxY(), y); } displayCamera = Camera(radius, y, 70.0); }
void init_viewcam(transform_t mode) { eye_pos0 = XVec4f(0.0, 0.0, 1000, 1.0); // {100, 50, 250, 1.0}; gaze_dir0 = XVec4f(0.0, 0.0, -1.0, 0.0); // along -z-axis top_dir0 = XVec4f(0.0, 1.0, 0.0, 0.0); zNear0 = -300.0; // z-coordinate of the near plane, negative number zFar0 = -5000.0; // = infinity fovy0 = 105.0; cam = Camera(eye_pos0, gaze_dir0, top_dir0, zNear0, zFar0, fovy0); // last 2 args not used setup_view(mode); transformWorld(mode); // TODO do the transform, including perspective transform in objects.cpp return; }
/*------------------------------------------------------------------------------* | <<< ゲームメイン >>> *------------------------------------------------------------------------------*/ void game_main(void) { d3_render_begin(); PrintfInit(); // Printf クリアー Camera(); // カメラ switch(game.iMode) { //--- タイトル ------------------------------------------------------------- case MODE_TITLE: Title(TEX_TITLE, &game.iMode, MODE_INFO, SND_OK); break; //--- 説明 --------------------------------------------------------------- case MODE_INFO: if(Title(TEX_INFO, &game.iMode, MODE_GAME, SND_OK)) { PlayerInit(); // プレイヤー初期化 EnemyInit(); } break; //--- ゲーム ------------------------------------------------------------- case MODE_GAME: PlayerMain(); // プレイヤーメイン PlayerDraw(); // プレイヤー描画 EnemyMain(); EnemyDraw(); HitPointDraw(0, player->m_fHP / HP_MAX); HitPointDraw(1, enemy->m_fHP / HP_MAX); break; //--- ゲームオーバー ----------------------------------------------------- case MODE_WIN: Title(TEX_WIN, &game.iMode, MODE_TITLE, SND_WIN_LOSE); break; //case MODE_LOSE: //Title(TEX_LOSE, &game.iMode, MODE_TITLE, SND_WIN_LOSE); //break; } PrintfFlush(); // Printf 描画 d3_render_end(); }
void CCar::UpdateEx (float fov) { #ifdef DEBUG DbgUbdateCl(); #endif // Log("UpdateCL",Device.dwFrame); //XFORM().set(m_pPhysicsShell->mXFORM); VisualUpdate(fov); if(OwnerActor() && OwnerActor()->IsMyCamera()) { cam_Update(Device.fTimeDelta, fov); OwnerActor()->Cameras().UpdateFromCamera(Camera()); OwnerActor()->Cameras().ApplyDevice(VIEWPORT_NEAR); } }
IEnumerable<Camera^>^ CameraManager::GetCameraList() { EdsCameraListRef cameraHandleList; EdsUInt32 cameraCount; List<Camera^>^ cameraList = gcnew List<Camera^>(); // Iterate through the camera handles and create a new Camera wrapper for each one. ErrorCheck(EdsGetCameraList(&cameraHandleList)); ErrorCheck(EdsGetChildCount(cameraHandleList, &cameraCount)); for (int i = 0; i < (int)cameraCount; i++) { EdsCameraRef cameraHandle; ErrorCheck(EdsGetChildAtIndex(cameraHandleList, i, &cameraHandle)); cameraList->Add(gcnew Camera(cameraHandle)); } return cameraList; }
void TemplatePropertyTimeline<Camera>::resetTimeline() { timelineChanged_ = true; lastChanges_.push_back(timeline_); undoObserver_->animationChanged(this); tgt::Camera cam = property_->get(); /* Camera* node0 = new Camera(cam->getPosition(), cam->getFocus(), cam->getUpVector(), cam->getStrafe()); node0->setNodeIdentifier("Node 0"); node0->setDirection(node0->getStrafe()); */ Camera node0 = Camera(cam); timeline_ = new CameraPropertyTimelineState(new PropertyKeyValue<Camera>(node0,0)); const std::vector<TimelineObserver*> timelineObservers = getObservers(); std::vector<TimelineObserver*>::const_iterator it; for (it = timelineObservers.begin(); it != timelineObservers.end(); ++it) { (*it)->timelineChanged(); } }
MainWindow::MainWindow() { // Save pointer to current instance. Later on we // will create a proper singleton here... MainWindow::master = this; for(int i = 0; i < 256; i++) { m_keyStates[i] = false; m_specialkeyStates[i] = false; } // Create a triangle mesh instance m_mesh = new TriangleMesh(arrow_faces, arrow_vertices, 248, 396); m_cam = Camera(0, 20, 100); // Init glut main window initGlut(); }