Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osirion.kdevelop.pcsbin776293 -> 776291 bytes
-rw-r--r--osirion.kdevses25
-rw-r--r--src/render/camera.cc11
-rw-r--r--src/render/camera.h3
-rw-r--r--src/render/draw.cc99
5 files changed, 69 insertions, 69 deletions
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs
index 46d342d..3e74a85 100644
--- a/osirion.kdevelop.pcs
+++ b/osirion.kdevelop.pcs
Binary files differ
diff --git a/osirion.kdevses b/osirion.kdevses
index c1e8e21..11b0116 100644
--- a/osirion.kdevses
+++ b/osirion.kdevses
@@ -1,28 +1,13 @@
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
- <DocsAndViews NumberOfDocuments="7" >
- <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/player.cc" >
- <View0 Encoding="" line="31" Type="Source" />
+ <DocsAndViews NumberOfDocuments="2" >
+ <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/input.cc" >
+ <View0 Encoding="" line="437" Type="Source" />
</Doc0>
- <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/player.h" >
- <View0 Encoding="" line="50" Type="Source" />
+ <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/game/game.cc" >
+ <View0 Encoding="" line="72" Type="Source" />
</Doc1>
- <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameserver.cc" >
- <View0 Encoding="" line="303" Type="Source" />
- </Doc2>
- <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameserver.h" >
- <View0 Encoding="" line="55" Type="Source" />
- </Doc3>
- <Doc4 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/game/game.cc" >
- <View0 Encoding="" line="126" Type="Source" />
- </Doc4>
- <Doc5 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/netserver.cc" >
- <View0 Encoding="" line="329" Type="Source" />
- </Doc5>
- <Doc6 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/netclient.h" >
- <View0 Encoding="" line="61" Type="Source" />
- </Doc6>
</DocsAndViews>
<pluginList>
<kdevdebugger>
diff --git a/src/render/camera.cc b/src/render/camera.cc
index 6c9a115..a55038d 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -302,18 +302,7 @@ void Camera::draw(float seconds)
}
}
- // Change to the projection matrix and set our viewing volume.
- gl::matrixmode(GL_PROJECTION);
- gl::loadidentity();
-
- const float frustum_size = 0.5f;
- const float frustum_front = 1.0f;
distance += frustum_front;
- gl::frustum(-frustum_size*aspect(), frustum_size*aspect(), -frustum_size, frustum_size, frustum_front, 1024.0f);
-
- // model view
- gl::matrixmode(GL_MODELVIEW);
- gl::loadidentity();
// map world coordinates to opengl coordinates
gl::rotate(90.0f, 0, 1.0, 0);
diff --git a/src/render/camera.h b/src/render/camera.h
index 42bd835..52d2e13 100644
--- a/src/render/camera.h
+++ b/src/render/camera.h
@@ -11,6 +11,9 @@
namespace render {
+const float frustum_size = 0.5f;
+const float frustum_front = 1.0f;
+
/// camera functions
class Camera
{
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 6aafcca..d1b06ea 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -412,25 +412,6 @@ void pass_prepare(float seconds)
}
}
-/* Draw skybox */
-void draw_pass_skybox()
-{
-
- if (!(r_sky && r_sky->value()))
- return;
-
- size_t flare_texture = Textures::load("textures/env/sky");
- Textures::bind(flare_texture);
-
- gl::enable(GL_TEXTURE_2D);
- gl::push();
-
- draw_sphere_inside(math::Color(), 512);
-
- gl::pop();
- gl::disable(GL_TEXTURE_2D);
-}
-
/* Draw entities without model */
void draw_pass_default()
{
@@ -728,6 +709,26 @@ void draw_pass_model_corona()
}
+
+/* Draw skysphere */
+void draw_pass_sky()
+{
+ if (!(r_sky && r_sky->value()))
+ return;
+
+ size_t flare_texture = Textures::load("textures/env/sky");
+ Textures::bind(flare_texture);
+
+ gl::enable(GL_TEXTURE_2D);
+ gl::push();
+
+ gl::translate(Camera::eye());
+ draw_sphere_inside(math::Color(), 16000);
+
+ gl::pop();
+ gl::disable(GL_TEXTURE_2D);
+}
+
void draw_pass_spacegrid()
{
if (!(r_grid && r_grid->value()))
@@ -778,50 +779,72 @@ void draw(float seconds)
if( angle > 360.0f ) {
angle -= 360.0f;
}
-
+
+ // Change to the projection matrix and set our viewing volume large enough for the skysphere
+ gl::matrixmode(GL_PROJECTION);
+ gl::loadidentity();
+ gl::frustum(-frustum_size*Camera::aspect(), frustum_size*Camera::aspect(),
+ -frustum_size, frustum_size, frustum_front, 16384.0f);
+
+ gl::matrixmode(GL_MODELVIEW);
+ gl::loadidentity();
Camera::draw(seconds); // draw the current camera transformation
+ // calculate client state
pass_prepare(seconds);
- // enable vertex arrays
+ // enable wireframe mode if requested
+ if (r_wireframe && r_wireframe->value()) {
+ glPolygonMode(GL_FRONT, GL_LINE);
+ } else {
+ glPolygonMode(GL_FRONT, GL_FILL);
+ }
+
+ // set vertex array pointers
glVertexPointer(3, GL_FLOAT, 0, vertexarray->vertex());
glNormalPointer(GL_FLOAT, 0, vertexarray->normal());
glColorPointer(3, GL_FLOAT, 0, vertexarray->color());
glTexCoordPointer(3, GL_FLOAT, 0, vertexarray->texture());
+ // enable vertex arrays
glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
- draw_pass_skybox(); // draw the skybox
-
- gl::enable(GL_DEPTH_TEST); // enable depth buffer writing
- gl::enable(GL_CULL_FACE); // enable culling
- gl::enable(GL_COLOR_MATERIAL); // enable color tracking
- gl::enable(GL_LIGHTING);
- gl::disable(GL_BLEND); // disbable alpha blending for world polys
+ gl::disable(GL_BLEND); // disbable alpha blending
gl::disable(GL_RESCALE_NORMAL);
- if (r_wireframe && r_wireframe->value()) {
- glPolygonMode(GL_FRONT, GL_LINE);
- } else {
- glPolygonMode(GL_FRONT, GL_FILL);
- }
-
- draw_pass_model_vertex(); // draw entities with model
+ draw_pass_sky(); // draw the skysphere
- glDisableClientState(GL_COLOR_ARRAY);
+ gl::enable(GL_DEPTH_TEST); // enable depth buffer writing
+ gl::enable(GL_CULL_FACE); // enable culling
+ gl::enable(GL_COLOR_MATERIAL); // enable color tracking
+ gl::enable(GL_LIGHTING);
gl::enable(GL_RESCALE_NORMAL); // rescale normals by the transformation matrix scale factor
draw_pass_default(); // draw entities without model
gl::disable(GL_RESCALE_NORMAL);
+ // adjust the projection matrix for local world view
+ gl::matrixmode(GL_PROJECTION);
+ gl::loadidentity();
+ gl::frustum(-frustum_size*Camera::aspect(), frustum_size*Camera::aspect(),
+ -frustum_size, frustum_size, frustum_front, 1024.0f);
+ gl::matrixmode(GL_MODELVIEW);
+
+ glEnableClientState(GL_COLOR_ARRAY);
+
+ draw_pass_model_vertex(); // draw entities with model
+
+ glDisableClientState(GL_COLOR_ARRAY);
+
draw_pass_model_evertex(); // draw entities with model, vertices with entity color
- gl::disable(GL_LIGHTING);
gl::enable(GL_BLEND);
+ gl::disable(GL_LIGHTING);
draw_pass_spacegrid(); // draw the blue spacegrid