From 2e789cb9894ac5a9565013b134f1c1e51174f430 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 13 Jul 2008 00:36:09 +0000 Subject: skyglobe --- GAMEPLAY | 18 ++++++++++++--- README | 3 ++- osirion.kdevelop.pcs | Bin 765753 -> 770351 bytes osirion.kdevses | 27 +++++++++++++++++++--- src/core/gameserver.cc | 8 +++---- src/model/vertexarray.cc | 42 ++++++++++++++++++++-------------- src/render/draw.cc | 58 +++++++++++++++++++++++++++++++++++++++++------ src/render/render.cc | 12 ++++++++-- src/render/render.h | 5 +++- 9 files changed, 135 insertions(+), 38 deletions(-) diff --git a/GAMEPLAY b/GAMEPLAY index e4b3b6b..18642a6 100644 --- a/GAMEPLAY +++ b/GAMEPLAY @@ -41,7 +41,7 @@ The Player The player enters the universe as a typical out-of-luck person who decided to start a new life. With a small ship he tries to become - the Richest Man in the know Universe. The player earns money by shipping + the Richest Man in the Known Universe. The player earns money by shipping cargo that can be bought at discount prices at one place and sold at a premium on a second location. *mining *fighting *wrecks/looting. @@ -64,7 +64,7 @@ Traveling How the traveling happens in the universe, how the player will travel. - Every ship is equiped with thrusters. The maximum thruster speed depends + Every ship is equipped with thrusters. The maximum thruster speed depends on the ship type, small merchant vessels will have lower maximim trhuster speed then a scout ship. @@ -74,7 +74,18 @@ Traveling is the same for most ship types. Due to the enormous power requirements a ship will not be a able to fire weapons while the impulse drive is enabled. + Neither of these engines will allow the player the leave the star system. + Interstellar travel is only possible using a hyperdrive. A hyperdrive is an + expensive piece of equipment that has massive power requirements. Only very + large ships will be capable of carrying a hyperspace jump drive. + Interstellar travel for the common men is possible through the use + of commercial or government owned hyperspace gates. These gates create + on-demand hyperspace connections between star systems and provide a safe + and easy way to travel. + + Hyperspace travel is almost instantanious, hyperspace jump would be a more + accurate term to describe it. Fleets [Phase 2] @@ -94,7 +105,8 @@ Fleets [Phase 2] Once the flagship is destroyed, the convoy is lost. The player respawns at base with the flagships and any ships - docked on it while it was destroyed. Other cargo is lost. + docked on it while it was destroyed. Other cargo and other ships it + the convoy are lost. Planet and Stations diff --git a/README b/README index 3f1dcaf..b233c77 100644 --- a/README +++ b/README @@ -238,7 +238,8 @@ Editing game data Project contributors - [mDc]Thorn - Canasta and Sharkan models, alpha testing + [mDc]Thorn - Technical advisor, Sharkan model, Horizon model, + Alpha testing Supertanker - Station 15 model, Supertanker model, Avatar model Bumblebee model diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs index 965f53d..344a8de 100644 Binary files a/osirion.kdevelop.pcs and b/osirion.kdevelop.pcs differ diff --git a/osirion.kdevses b/osirion.kdevses index 640c7bb..23d02ba 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,10 +1,31 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index cd656ed..2027098 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -141,7 +141,7 @@ void GameServer::showtime() con_print << "Uptime " << minutes << ":" << setfill('0') << setw(2) << seconds << - " Server localtime " << setfill(' ') << setw(2) << syshours << ":" << setfill('0') << setw(2) << sysminutes << ":" << setw(2) << sysseconds << std::endl; + " Server localtime " << setfill(' ') << setw(2) << syshours << ":" << setfill('0') << setw(2) << sysminutes << ":" << setw(2) << sysseconds << setfill(' ') << std::endl; } Player *GameServer::find_player(std::string const search) @@ -301,17 +301,17 @@ void GameServer::exec(Player *player, std::string const & cmdline) } else if ((function->flags() & Func::Shared) == Func::Shared) { // enable rcon buffering - sys::ConsoleInterface::instance()->buffer_rcon(true); + console()->buffer_rcon(true); function->exec(args); char line[MAXCMDSIZE]; - while(sys::ConsoleInterface::instance()->buffer().getline(line, MAXCMDSIZE-1)) { + while(console()->buffer().getline(line, MAXCMDSIZE-1)) { send_rcon(player, std::string(line)); } // disable rcon buffering - sys::ConsoleInterface::instance()->buffer_rcon(false); + console()->buffer_rcon(false); return; } } diff --git a/src/model/vertexarray.cc b/src/model/vertexarray.cc index da9c3d2..b0da6ab 100644 --- a/src/model/vertexarray.cc +++ b/src/model/vertexarray.cc @@ -75,34 +75,18 @@ void VertexArray::add_sphere() math::Vector3f v; math::Vector3f n; math::Vector3f tex; - int count; - //float h = (float) (SPHERESEGMENTS-1) / 2 -1; + // add sphere for (int j=0; j < (SPHERESEGMENTS-1) / 2; j++) { float r = sintable[j]; float r1 = sintable[j+1]; -/* v.assign(r, 0, costable[j]); - n = v; - n.normalize(); - tex.assign(1, (float)(SPHERESEGMENTS-1-j) / (float)(SPHERESEGMENTS-1), 0); - add_vertex(v, n, white, tex); - - v = math::Vector3f(r1, 0, costable[j+1]); - n = v; - n.normalize(); - tex.assign(1, (float) (SPHERESEGMENTS-2-j) / (float)(SPHERESEGMENTS-1), 0 ); - add_vertex(v, n, white, tex); - - count =2; -*/ for (int i = 0; i < SPHERESEGMENTS; i++) { v = math::Vector3f(r*costable[i], r*sintable[i], costable[j]); n = v; n.normalize(); - //tex.assign((float)i/(float)(SPHERESEGMENTS), (float) (j) / h, 0); tex.assign((float)i/(float)(SPHERESEGMENTS-1), -costable[j]/2 + 0.5f , 0); add_vertex(v, n, white, tex); @@ -116,6 +100,30 @@ void VertexArray::add_sphere() } + // add inside-out sphere + for (int j=0; j < (SPHERESEGMENTS-1) / 2; j++) { + + float r = sintable[j]; + float r1 = sintable[j+1]; + + + for (int i = SPHERESEGMENTS -1 ; i >= 0; i--) { + v = math::Vector3f(r*costable[i], r*sintable[i], costable[j]); + n = v; + n.normalize(); + tex.assign(1-(float)i/(float)(SPHERESEGMENTS-1), -costable[j]/2 + 0.5f , 0); + add_vertex(v, n, white, tex); + + v = math::Vector3f(r1*costable[i], r1*sintable[i], costable[j+1]); + n = v; + n.normalize(); + tex.assign(1-(float)i/(float)(SPHERESEGMENTS-1), -costable[j+1]/2 + 0.5f, 0); + add_vertex(v, n, white, tex); + count +=2; + } + + } + delete[] sintable; delete[] costable; } diff --git a/src/render/draw.cc b/src/render/draw.cc index 1091d8c..6aafcca 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -66,6 +66,25 @@ void draw_sphere(math::Color const & color, float radius) //gl::pop(); } +void draw_sphere_inside(math::Color const & color, float radius) +{ + //gl::push(); + gl::scale(radius, radius, radius); + gl::color(color); + + size_t index = (model::SPHERESEGMENTS) * (model::SPHERESEGMENTS-1); + size_t count = (model::SPHERESEGMENTS)*2; + + // draw body + for (int j=0; j < (model::SPHERESEGMENTS-1)/2; j++) { + glDrawArrays(gl::QuadStrip, index, count); + index += count; + Stats::quads += count/2-1; + } + + //gl::pop(); +} + void draw_entity_sphere(core::Entity *entity) { if ((entity->type() == core::Entity::Globe) && !flag_is_set(entity->flags(), core::Entity::Bright)) { @@ -393,6 +412,25 @@ 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() { @@ -692,6 +730,9 @@ void draw_pass_model_corona() void draw_pass_spacegrid() { + if (!(r_grid && r_grid->value())) + return; + int gridsize = 32; float s = 1.0f / gridsize; float z = -4.0f; @@ -741,14 +782,8 @@ void draw(float seconds) Camera::draw(seconds); // draw the current camera transformation pass_prepare(seconds); - - 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_RESCALE_NORMAL); + // enable vertex arrays glVertexPointer(3, GL_FLOAT, 0, vertexarray->vertex()); glNormalPointer(GL_FLOAT, 0, vertexarray->normal()); glColorPointer(3, GL_FLOAT, 0, vertexarray->color()); @@ -759,6 +794,15 @@ void draw(float seconds) glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_TEXTURE_COORD_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_RESCALE_NORMAL); + if (r_wireframe && r_wireframe->value()) { glPolygonMode(GL_FRONT, GL_LINE); } else { diff --git a/src/render/render.cc b/src/render/render.cc index dac0972..ea70dbf 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -23,10 +23,12 @@ namespace render { GLuint textures[32]; -core::Cvar *r_radius = 0; -core::Cvar *r_wireframe = 0; core::Cvar *r_arraysize = 0; core::Cvar *r_bbox = 0; +core::Cvar *r_grid = 0; +core::Cvar *r_radius = 0; +core::Cvar *r_sky = 0; +core::Cvar *r_wireframe = 0; using model::VertexArray; @@ -82,9 +84,15 @@ void init() r_wireframe = core::Cvar::get("r_wireframe", "0", core::Cvar::Archive); r_wireframe->set_info("[bool] render wireframe"); + r_grid = core::Cvar::get("r_grid", "1", core::Cvar::Archive); + r_grid->set_info("[bool] render the space grid"); + r_bbox = core::Cvar::get("r_bbox", "0", core::Cvar::Archive); r_bbox->set_info("[bool] render model bounding box"); + r_sky = core::Cvar::get("r_sky", "1", core::Cvar::Archive); + r_sky->set_info("[bool] render the sky globe"); + Camera::init(); Textures::init(); diff --git a/src/render/render.h b/src/render/render.h index ebecf7f..2a8952e 100644 --- a/src/render/render.h +++ b/src/render/render.h @@ -24,10 +24,13 @@ namespace render { /// shutdown the render subsystem void shutdown(); + extern core::Cvar *r_arraysize; extern core::Cvar *r_bbox; + extern core::Cvar *r_grid; extern core::Cvar *r_radius; + extern core::Cvar *r_sky; extern core::Cvar *r_wireframe; - extern core::Cvar *r_arraysize; + extern model::VertexArray *vertexarray; } -- cgit v1.2.3