diff options
author | Treeki <treeki@gmail.com> | 2011-03-20 05:53:38 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-20 05:53:38 +0100 |
commit | 9f006ef8ec79d63d3eb60d2a516578af04735560 (patch) | |
tree | 01bf792483666e78fb1bdff02ec5542ac292ef44 /src | |
parent | 070077c1741f30c88baf4ffa5638162dbde43996 (diff) | |
download | kamek-9f006ef8ec79d63d3eb60d2a516578af04735560.tar.gz kamek-9f006ef8ec79d63d3eb60d2a516578af04735560.zip |
working on the camera
Diffstat (limited to '')
-rw-r--r-- | src/wm_player.cpp | 2 | ||||
-rw-r--r-- | src/world_camera.cpp | 29 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/wm_player.cpp b/src/wm_player.cpp index 39dc0a5..ef838a2 100644 --- a/src/wm_player.cpp +++ b/src/wm_player.cpp @@ -15,7 +15,7 @@ int daWMPlayer_c::onCreate() { pos = (Vec){0.0f,0.0f,0.0f}; rot = (S16Vec){0,0,0}; - scale = (Vec){1.5f,1.5f,1.5f}; + scale = (Vec){0.8f,0.8f,0.8f}; current_param = 0; diff --git a/src/world_camera.cpp b/src/world_camera.cpp index 5c7c903..4f9b848 100644 --- a/src/world_camera.cpp +++ b/src/world_camera.cpp @@ -18,16 +18,9 @@ dWorldCamera_c *dWorldCamera_c::build() { int dWorldCamera_c::onCreate() { - this->camPos = (Point3d){58.8f, 1163.7f, 2106.2f}; - this->camRotate = (Point3d){-60.0f, 0.0f, 0.0f}; // ZXY order - //this->camRotate = (Point3d){-40.0f, 0.0f, 0.0f}; // ZXY order - this->camPos = (Point3d){0.0f, 500.0f, 1000.0f}; this->camRotate = (Point3d){-40.0f, -30.0f, 0.0f}; // ZXY order - //this->camPos = (Point3d){0.0f, -2000.0f, 0.0f}; - //this->camRotate = (Point3d){-90.0f, 0.0f, 0.0f}; // ZXY order - return true; } @@ -80,22 +73,32 @@ int dWorldCamera_c::onDraw() { cam3d.SetPerspective(45, (f32)rmode->viWidth / (f32)rmode->viHeight, 0.1f, 2400.0f); //cam3d.SetOrtho(rmode->efbHeight, 0.0f, 0.0f, rmode->fbWidth * (IsWideScreen() ? 1.3333334f : 1.0f), -100000.0f, 100000.0f); - nw4r::g3d::Camera::PostureInfo posture; + /*nw4r::g3d::Camera::PostureInfo posture; posture.tp = nw4r::g3d::Camera::POSTURE_ROTATE; posture.cameraRotate = this->camRotate; cam3d.SetPosition(this->camPos); - cam3d.SetPosture(posture); + cam3d.SetPosture(posture);*/ - /*nw4r::g3d::Camera::PostureInfo posture; + // The map is actually roughly 500x500, but I use a bigger circle in order + // to give leeway for the camera + + // TODO: Make these vars tweakable! + float angle = MTXDegToRad(90.0) - atan2(daWMPlayer_c::instance->pos.z, daWMPlayer_c::instance->pos.x); + float camX = sin(angle) * 800; + float camZ = cos(angle) * 800; + float targetX = sin(angle) * 100; + float targetZ = cos(angle) * 100; + + nw4r::g3d::Camera::PostureInfo posture; posture.tp = nw4r::g3d::Camera::POSTURE_LOOKAT; posture.cameraUp = (Point3d){0,1,0}; - posture.cameraTarget = (Point3d){0,0,0}; + posture.cameraTarget = (Point3d){targetX,0,targetZ}; - cam3d.SetPosition((Point3d){0,400,1000}); - cam3d.SetPosture(posture);*/ + cam3d.SetPosition((Point3d){camX,50,camZ}); + cam3d.SetPosture(posture); return true; } |