3 #include "cmd/planet.h"
5 #include "cmd/unit_collide.h"
6 #include "cmd/collection.h"
7 #include "cmd/click_list.h"
10 #include "gfx/sphere.h"
11 #include "cmd/unit_collide.h"
13 #include "gfx/background.h"
14 #include "gfx/animation.h"
15 #include "gfx/aux_texture.h"
19 #include "gfx/cockpit.h"
21 #include "cmd/music.h"
24 #include "cmd/cont_terrain.h"
27 #include "cmd/atmosphere.h"
29 #include "cmd/nebula.h"
31 #include "cmd/script/mission.h"
33 #include "cmd/script/flightgroup.h"
35 #include "gfx/particle.h"
37 #include "gfx/warptrail.h"
38 #include "gfx/env_map_gent.h"
40 #include "cmd/unit_find.h"
53 bolts =
new bolt_draw;
58 LoadXML( filename, centr, timeofyear );
60 name = strdup( filename );
65 Atmosphere::Parameters params;
67 params.radius = 40000;
69 params.low_color[0] =
GFXColor( 0, 0.5, 0.0 );
71 params.low_color[1] =
GFXColor( 0, 1.0, 0.0 );
73 params.low_ambient_color[0] =
GFXColor( 0.0/255.0, 0.0/255.0, 0.0/255.0 );
75 params.low_ambient_color[1] =
GFXColor( 0.0/255.0, 0.0/255.0, 0.0/255.0 );
77 params.high_color[0] =
GFXColor( 0.5, 0.0, 0.0 );
79 params.high_color[1] =
GFXColor( 1.0, 0.0, 0.0 );
81 params.high_ambient_color[0] =
GFXColor( 0, 0, 0 );
83 params.high_ambient_color[1] =
GFXColor( 0, 0, 0 );
85 params.scattering = 5;
99 LightMap[0]->MakeActive( stage );
101 LightMap[0]->MakeActive( stage );
108 const float tempo[4] = {1, 0, 0, 0};
140 return new ClickList(
this, &
drawList );
146 winsys_show_cursor( tf );
166 vsUMap< void*, struct empty >gravunits;
177 if ( gravunits.find( unit ) == gravunits.end() )
185 if (
parent->isSubUnit() ) {
211 unit->sim_atom_multiplier,
212 unit->cur_sim_queue_slot,
222 gravunits[unit] = empty();
237 AnimatedTexture::UpdateAllFrame();
241 bool alreadysetviewport =
false;
244 }
else if ( !par->isSubUnit() ) {
246 par->cumulative_transformation = linear_interpolate( par->prev_physical_state,
247 par->curr_physical_state,
249 Unit *targ = par->Target();
250 if ( targ && !targ->isSubUnit() ) {
251 targ->cumulative_transformation = linear_interpolate( targ->prev_physical_state,
252 targ->curr_physical_state,
256 alreadysetviewport =
true;
265 targ = saveparent->Target();
267 Unit *camunits[2] = {saveparent, targ};
270 for (
int i = 0; i < 2; ++i) {
271 Unit *unit = camunits[i];
273 if ( unit && !unit->isSubUnit() ) {
275 unit->sim_atom_multiplier,
276 unit->cur_sim_queue_slot,
279 ( (GameUnit< Unit >*)unit )->GameUnit< Unit >::Draw();
291 setupdrawtime =
queryTime()-setupdrawtime;
296 double maxdrawtime = 0;
302 Collidable key_iterator( 0, 1, drawstartpos );
303 UnitWithinRangeOfPosition< UnitDrawer >drawer( game_options.
precull_dist, 0, key_iterator );
307 drawer.action.parenttarget = drawer.action.parent->Target();
308 for (un_iter iter = this->
GravitationalUnits.createIterator(); (unit = *iter) != NULL; ++iter) {
309 float distance = ( drawstartpos-unit->Position() ).Magnitude()-unit->rSize();
311 drawer.action.grav_acquire( unit );
313 drawer.action.draw( unit );
316 CollideMap::iterator parent =
collidemap[Unit::UNIT_ONLY]->lower_bound( key_iterator );
317 findObjectsFromPosition( this->
collidemap[Unit::UNIT_ONLY], parent, &drawer, drawstartpos, 0,
true );
318 drawer.action.drawParents();
322 for (
unsigned int sim_counter = 0; sim_counter <=
SIM_QUEUE_SIZE; ++sim_counter) {
325 UnitCollection::UnitIterator iter =
physics_buffer[sim_counter].createIterator();
328 while ( ( unit = iter.current() ) != NULL ) {
330 unit->sim_atom_multiplier,
331 unit->cur_sim_queue_slot,
337 ( (GameUnit< Unit >*)unit )->Draw();
343 if (tmp > maxdrawtime) maxdrawtime = tmp;
355 Mesh::ProcessZFarMeshes();
360 GamePlanet::ProcessTerrains();
361 Terrain::RenderAll();
362 Mesh::ProcessUndrawnMeshes(
true );
373 Beam::ProcessDrawQueue();
377 Animation::ProcessDrawQueue();
378 Halo::ProcessDrawQueue();
379 particleTrail.DrawAndUpdate();
385 MeshAnimation::UpdateFrames();
391 AnimatedTexture::UpdateAllPhysics();
397 Terrain::CollideAll();
402 Terrain::UpdateAll( 64 );
415 if (neb->getFade() <= 0)
425 printf(
"using NV_CUBE_MAP\n" );
429 if ( LightMap[0]->LoadSuccess() && LightMap[0]->isCube() ) {
430 LightMap[1] = LightMap[2] = LightMap[3] = LightMap[4] = LightMap[5] = 0;