00001 #ifndef GSGL_SG_CONTEXT_H 00002 #define GSGL_SG_CONTEXT_H 00003 00004 // 00005 // $Id: context.hpp 2 2008-03-01 20:58:50Z kulibali $ 00006 // 00007 // Copyright (c) 2008, The Periapsis Project. All rights reserved. 00008 // 00009 // Redistribution and use in source and binary forms, with or without 00010 // modification, are permitted provided that the following conditions are 00011 // met: 00012 // 00013 // * Redistributions of source code must retain the above copyright notice, 00014 // this list of conditions and the following disclaimer. 00015 // 00016 // * Redistributions in binary form must reproduce the above copyright 00017 // notice, this list of conditions and the following disclaimer in the 00018 // documentation and/or other materials provided with the distribution. 00019 // 00020 // * Neither the name of the The Periapsis Project nor the names of its 00021 // contributors may be used to endorse or promote products derived from 00022 // this software without specific prior written permission. 00023 // 00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00025 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 // 00036 00037 #include "scenegraph/scenegraph.hpp" 00038 #include "platform/display.hpp" 00039 00040 #include <ctime> 00041 00042 namespace gsgl 00043 { 00044 00045 namespace scenegraph 00046 { 00047 00048 class simulation; 00049 class node; 00050 class camera; 00051 00052 /// The current game context. 00053 class SCENEGRAPH_API context 00054 : public scenegraph_object 00055 { 00056 public: 00057 simulation *sim; ///< The current simulation. 00058 platform::display *console; ///< The game console. 00059 node *scenery; ///< The root of the scene graph. 00060 00061 platform::display *screen; ///< The current screen (may be different from the console). 00062 node *view; ///< The current viewpoint node. 00063 camera *cam; ///< The current viewpoint's camera node. 00064 00065 // 00066 int num_lights; ///< The number of lights in the world. 00067 00068 // 00069 gsgl::real_t time_scale; 00070 00071 unsigned long frame; ///< The current frame number. 00072 00073 time_t start_t_time; ///< The start time of the simulation. 00074 time_t cur_t_time; ///< The current time. 00075 00076 unsigned long start_tick; ///< The starting tick value (in milliseconds). 00077 unsigned long cur_tick; ///< The tick value at the start of the current frame. 00078 unsigned long delta_tick; ///< The number of ticks since the last frame (milliseconds; NOT scaled). 00079 00080 double start_time; ///< In Unix time (seconds starting Jan 1, 1970). 00081 double cur_time; ///< In Unix time (seconds starting Jan 1, 1970). 00082 double delta_time; ///< Time since the last frame (in game-time seconds; i.e. may be scaled). 00083 00084 double julian_start; ///< The starting game time in Julian days. 00085 double julian_cur; ///< The current game time in Julian days. 00086 double julian_dt; ///< Time since the last frame (in game-time Julian days; i.e. may be scaled). 00087 00088 // 00089 enum 00090 { 00091 NO_RENDER_FLAGS = 0, 00092 RENDER_LABELS = 1 << 0, 00093 RENDER_COORD_SYSTEMS = 1 << 1, 00094 RENDER_WIREFRAME = 1 << 2, 00095 RENDER_UNTEXTURED = 1 << 3, 00096 RENDER_ANISOTROPIC = 1 << 4, 00097 RENDER_UNLIT = 1 << 5 00098 }; 00099 00100 gsgl::flags_t render_flags; 00101 00102 // 00103 00104 context(); 00105 virtual ~context(); 00106 }; // class context 00107 00108 } // namespace scenegraph 00109 00110 } // namespace scenegraph 00111 00112 #endif