00001 // Filename: sceneSetup.I00002 // Created by: drose (27Mar02)00003 //00004 ////////////////////////////////////////////////////////////////////00005 //00006 // PANDA 3D SOFTWARE00007 // Copyright (c) Carnegie Mellon University. All rights reserved.00008 //00009 // All use of this software is subject to the terms of the revised BSD00010 // license. You should have received a copy of this license along00011 // with this source code in a file named "LICENSE."00012 //00013 ////////////////////////////////////////////////////////////////////00014
00015
00016 ////////////////////////////////////////////////////////////////////00017 // Function: SceneSetup::Constructor00018 // Access: Public00019 // Description: 00020 ////////////////////////////////////////////////////////////////////00021 INLINE SceneSetup::
00022 SceneSetup() {
00023 _display_region = NULL;
00024 _viewport_width = 0;
00025 _viewport_height = 0;
00026 _inverted = false;
00027 _initial_state = RenderState::make_empty();
00028 _camera_transform = TransformState::make_identity();
00029 _world_transform = TransformState::make_identity();
00030 }
00031
00032 ////////////////////////////////////////////////////////////////////00033 // Function: SceneSetup::set_display_region00034 // Access: Published00035 // Description: Specifies the display region for the scene.00036 ////////////////////////////////////////////////////////////////////00037 INLINE voidSceneSetup::00038set_display_region(DisplayRegion *display_region) {
00039 _display_region = display_region;
00040 }
00041
00042 ////////////////////////////////////////////////////////////////////00043 // Function: SceneSetup::get_display_region00044 // Access: Published00045 // Description: Returns the display region for the scene.00046 ////////////////////////////////////////////////////////////////////00047 INLINE DisplayRegion *SceneSetup::00048get_display_region() const {
00049 return _display_region;
00050 }
00051
00052 ////////////////////////////////////////////////////////////////////00053 // Function: SceneSetup::set_viewport_size00054 // Access: Published00055 // Description: Specifies the size of the viewport (display region),00056 // in pixels.00057 ////////////////////////////////////////////////////////////////////00058 INLINE voidSceneSetup::00059set_viewport_size(int width, int height) {
00060 _viewport_width = width;
00061 _viewport_height = height;
00062 }
00063
00064 ////////////////////////////////////////////////////////////////////00065 // Function: SceneSetup::get_viewport_width00066 // Access: Published00067 // Description: Returns the width of the viewport (display region) in00068 // pixels.00069 ////////////////////////////////////////////////////////////////////00070 INLINE intSceneSetup::00071get_viewport_width() const {
00072 return _viewport_width;
00073 }
00074
00075 ////////////////////////////////////////////////////////////////////00076 // Function: SceneSetup::get_viewport_height00077 // Access: Published00078 // Description: Returns the height of the viewport (display region) in00079 // pixels.00080 ////////////////////////////////////////////////////////////////////00081 INLINE intSceneSetup::00082get_viewport_height() const {
00083 return _viewport_height;
00084 }
00085
00086 ////////////////////////////////////////////////////////////////////00087 // Function: SceneSetup::set_scene_root00088 // Access: Published00089 // Description: Specifies the root node of the scene.00090 ////////////////////////////////////////////////////////////////////00091 INLINE voidSceneSetup::00092set_scene_root(constNodePath &scene_root) {
00093 _scene_root = scene_root;
00094 }
00095
00096 ////////////////////////////////////////////////////////////////////00097 // Function: SceneSetup::get_scene_root00098 // Access: Published00099 // Description: Returns the root node of the scene.00100 ////////////////////////////////////////////////////////////////////00101 INLINE constNodePath &SceneSetup::00102get_scene_root() const {
00103 return _scene_root;
00104 }
00105
00106 ////////////////////////////////////////////////////////////////////00107 // Function: SceneSetup::set_camera_path00108 // Access: Published00109 // Description: Specifies the NodePath to the camera.00110 ////////////////////////////////////////////////////////////////////00111 INLINE voidSceneSetup::00112set_camera_path(constNodePath &camera_path) {
00113 _camera_path = camera_path;
00114 }
00115
00116 ////////////////////////////////////////////////////////////////////00117 // Function: SceneSetup::get_camera_path00118 // Access: Published00119 // Description: Returns the NodePath to the camera.00120 ////////////////////////////////////////////////////////////////////00121 INLINE constNodePath &SceneSetup::00122get_camera_path() const {
00123 return _camera_path;
00124 }
00125
00126 ////////////////////////////////////////////////////////////////////00127 // Function: SceneSetup::set_camera_node00128 // Access: Published00129 // Description: Specifies the camera used to render the scene.00130 ////////////////////////////////////////////////////////////////////00131 INLINE voidSceneSetup::00132set_camera_node(Camera *camera_node) {
00133 _camera_node = camera_node;
00134 }
00135
00136 ////////////////////////////////////////////////////////////////////00137 // Function: SceneSetup::get_camera_node00138 // Access: Published00139 // Description: Returns the camera used to render the scene.00140 ////////////////////////////////////////////////////////////////////00141 INLINE Camera *SceneSetup::00142get_camera_node() const {
00143 return _camera_node;
00144 }
00145
00146 ////////////////////////////////////////////////////////////////////00147 // Function: SceneSetup::set_lens00148 // Access: Published00149 // Description: Indicates the particular Lens used for rendering.00150 ////////////////////////////////////////////////////////////////////00151 INLINE voidSceneSetup::00152set_lens(constLens *lens) {
00153 _lens = lens;
00154 }
00155
00156 ////////////////////////////////////////////////////////////////////00157 // Function: SceneSetup::get_lens00158 // Access: Published00159 // Description: Returns the particular Lens used for rendering.00160 ////////////////////////////////////////////////////////////////////00161 INLINE constLens *SceneSetup::00162get_lens() const {
00163 return _lens;
00164 }
00165
00166 ////////////////////////////////////////////////////////////////////00167 // Function: SceneSetup::set_inverted00168 // Access: Published00169 // Description: Changes the current setting of the inverted flag.00170 // When this is true, the scene is rendered into the00171 // window upside-down and backwards, that is, inverted00172 // as if viewed through a mirror placed on the floor.00173 ////////////////////////////////////////////////////////////////////00174 INLINE voidSceneSetup::00175set_inverted(bool inverted) {
00176 _inverted = inverted;
00177 }
00178
00179 ////////////////////////////////////////////////////////////////////00180 // Function: SceneSetup::get_inverted00181 // Access: Published00182 // Description: Returns the current setting of the inverted flag.00183 // When this is true, the scene is rendered into the00184 // window upside-down, flipped like a mirror along the X00185 // axis.00186 ////////////////////////////////////////////////////////////////////00187 INLINE boolSceneSetup::00188get_inverted() const {
00189 return _inverted;
00190 }
00191
00192 ////////////////////////////////////////////////////////////////////00193 // Function: SceneSetup::get_cull_center00194 // Access: Published00195 // Description: Returns the point from which the culling operations00196 // will be performed. This is normally the camera, but00197 // if camera->set_cull_center() has been specified, it00198 // will be that special node instead.00199 ////////////////////////////////////////////////////////////////////00200 INLINE constNodePath &SceneSetup::00201get_cull_center() const {
00202 if (_camera_node->get_cull_center().is_empty()) {
00203 return _camera_path;
00204 } else {
00205 return _camera_node->get_cull_center();
00206 }
00207 }
00208
00209 ////////////////////////////////////////////////////////////////////00210 // Function: SceneSetup::set_initial_state00211 // Access: Published00212 // Description: Sets the initial state which is applied to all nodes00213 // in the scene, as if it were set at the top of the00214 // scene graph.00215 ////////////////////////////////////////////////////////////////////00216 INLINE voidSceneSetup::00217set_initial_state(constRenderState *state) {
00218 _initial_state = state;
00219 }
00220
00221 ////////////////////////////////////////////////////////////////////00222 // Function: SceneSetup::get_initial_state00223 // Access: Published00224 // Description: Returns the initial state as set by a previous call00225 // to set_initial_state().00226 ////////////////////////////////////////////////////////////////////00227 INLINE constRenderState *SceneSetup::00228get_initial_state() const {
00229 return _initial_state;
00230 }
00231
00232 ////////////////////////////////////////////////////////////////////00233 // Function: SceneSetup::set_camera_transform00234 // Access: Published00235 // Description: Specifies the position of the camera relative to the00236 // starting node.00237 ////////////////////////////////////////////////////////////////////00238 INLINE voidSceneSetup::00239set_camera_transform(constTransformState *camera_transform) {
00240 _camera_transform = camera_transform;
00241 }
00242
00243 ////////////////////////////////////////////////////////////////////00244 // Function: SceneSetup::get_camera_transform00245 // Access: Published00246 // Description: Returns the position of the camera relative to the00247 // starting node.00248 ////////////////////////////////////////////////////////////////////00249 INLINE constTransformState *SceneSetup::00250get_camera_transform() const {
00251 return _camera_transform;
00252 }
00253
00254 ////////////////////////////////////////////////////////////////////00255 // Function: SceneSetup::set_world_transform00256 // Access: Published00257 // Description: Specifies the position of the starting node relative00258 // to the camera. This is the inverse of the camera00259 // transform.00260 ////////////////////////////////////////////////////////////////////00261 INLINE voidSceneSetup::00262set_world_transform(constTransformState *world_transform) {
00263 _world_transform = world_transform;
00264 }
00265
00266 ////////////////////////////////////////////////////////////////////00267 // Function: SceneSetup::get_world_transform00268 // Access: Published00269 // Description: Returns the position of the starting node relative00270 // to the camera. This is the inverse of the camera00271 // transform.00272 ////////////////////////////////////////////////////////////////////00273 INLINE constTransformState *SceneSetup::00274get_world_transform() const {
00275 return _world_transform;
00276 }