Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-12-28 22:55:35 +0000
committerStijn Buys <ingar@osirion.org>2012-12-28 22:55:35 +0000
commitf416e6b792e5dda143f60b7a2724db6b3ec33d75 (patch)
tree553ddcaa6c60489904a8db818eff688c0b85a437 /src/render/draw.cc
parentfe96eee5db2acbef1ea0f360b180fd9f8f990444 (diff)
Support for rendering globes with rings,
removed hardcoded 'corona' prefix for corona textures, added support for projectile fire sounds.
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r--src/render/draw.cc66
1 files changed, 64 insertions, 2 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 46d0906..a49b017 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -239,6 +239,7 @@ void draw_globe_corona(const math::Vector3f location, const math::Color & color,
if (a > 0.1f) {
gl::enable(GL_BLEND);
gl::disable(GL_DEPTH_TEST);
+ gl::depthmask(GL_FALSE); // disable depth buffer writes
gl::enable(GL_TEXTURE_2D);
Textures::bind(corona_id);
@@ -263,11 +264,66 @@ void draw_globe_corona(const math::Vector3f location, const math::Color & color,
gl::disable(GL_TEXTURE_2D);
gl::enable(GL_DEPTH_TEST);
+ gl::depthmask(GL_TRUE); // enable depth buffer writes
gl::disable(GL_BLEND);
}
}
}
+void draw_globe_rings(const math::Color & color, const size_t rings_id)
+{
+ gl::color(color);
+
+ gl::enable(GL_BLEND);
+ //gl::disable(GL_CULL_FACE);
+ gl::depthmask(GL_FALSE); // disable depth buffer writes
+
+ Textures::bind(rings_id);
+
+ gl::begin(gl::Quads);
+
+ // top
+ gl::normal(0.0f, 0.0f, 1.0f);
+ gl::texcoord(0, 0);
+ gl::vertex(-2.0f, -2.0f, 0.0f);
+
+ gl::normal(0.0f, 0.0f, 1.0f);
+ gl::texcoord(1, 0);
+ gl::vertex(2.0f, -2.0f, 0.0f);
+
+ gl::normal(0.0f, 0.0f, 1.0f);
+ gl::texcoord(1, 1);
+ gl::vertex(2.0f, 2.0f, 0.0f);
+
+ gl::normal(0.0f, 0.0f, 1.0f);
+ gl::texcoord(0, 1);
+ gl::vertex(-2.0f, 2.0f, 0.0f);
+
+ //bottom
+ gl::normal(0.0f, 0.0f, -1.0f);
+ gl::texcoord(0, 1);
+ gl::vertex(-2.0f, 2.0f, 0.0f);
+
+ gl::normal(0.0f, 0.0f, -1.0f);
+ gl::texcoord(1, 1);
+ gl::vertex(2.0f, 2.0f, 0.0f);
+
+ gl::normal(0.0f, 0.0f, -1.0f);
+ gl::texcoord(1, 0);
+ gl::vertex(2.0f, -2.0f, 0.0f);
+
+ gl::normal(0.0f, 0.0f, -1.0f);
+ gl::texcoord(0, 0);
+ gl::vertex(-2.0f, -2.0f, 0.0f);
+
+ gl::end();
+
+ gl::depthmask(GL_TRUE); // enable depth buffer writes
+
+ //gl::enable(GL_CULL_FACE);
+ gl::disable(GL_BLEND);
+}
+
void draw_pass_globes()
{
// FIXME is this ever reset ?
@@ -311,17 +367,23 @@ void draw_pass_globes()
}
gl::multmatrix(globe->axis());
-
if (globe->rotationspeed()) {
float angle = math::degrees360f(core::application()->time() * globe->rotationspeed());
gl::rotate(angle, math::Vector3f::Zaxis());
}
draw_sphere(globe->color(), radius);
+
+ if (globe->rings_id()) {
+ if (!globe->texture_id()) {
+ gl::enable(GL_TEXTURE_2D);
+ }
+ draw_globe_rings(globe->color(), globe->rings_id());
+ }
gl::pop();
- if (globe->texture_id()) {
+ if (globe->texture_id() || globe->rings_id()) {
gl::disable(GL_TEXTURE_2D);
}