#include <windowFramework.h>
Inheritance diagram for WindowFramework:
Public Types | |
enum | BackgroundType { BT_other = 0, BT_default, BT_gray, BT_black, BT_none } |
Public Member Functions | |
virtual | ~WindowFramework () |
PandaFramework * | get_panda_framework () const |
Returns a pointer to the associated PandaFramework object. | |
GraphicsWindow * | get_graphics_window () const |
Returns a pointer to the underlying GraphicsWindow object. | |
const NodePath & | get_camera_group () |
Returns the node above the collection of 3-d cameras in the scene graph. | |
int | get_num_cameras () const |
Returns the number of 3-d cameras associated with the window. | |
Camera * | get_camera (int n) const |
Returns the nth camera associated with the window. | |
const NodePath & | get_render () |
Returns the root of the 3-d scene graph. | |
const NodePath & | get_render_2d () |
Returns the root of the 2-d scene graph. | |
const NodePath & | get_aspect_2d () |
Returns the node under the 2-d scene graph that is scaled to suit the window's aspect ratio. | |
const NodePath & | get_mouse () |
Returns the node in the data graph corresponding to the mouse associated with this window. | |
void | enable_keyboard () |
Creates a ButtonThrower to listen to button presses and throw them as events. | |
void | setup_trackball () |
Sets up the mouse to trackball around the camera. | |
void | center_trackball (const NodePath &object) |
Centers the trackball on the indicated object, and scales the trackball motion suitably. | |
bool | load_models (const NodePath &parent, int argc, char *argv[], int first_arg=1) |
Loads up all the model files listed in the indicated argument list. | |
bool | load_models (const NodePath &parent, const pvector< Filename > &files) |
Loads up all the model files listed in the indicated argument list. | |
NodePath | load_model (const NodePath &parent, Filename filename) |
Loads up the indicated model and returns the new NodePath, or the empty NodePath if the model could not be loaded. | |
NodePath | load_default_model (const NodePath &parent) |
Loads our favorite blue triangle. | |
void | loop_animations () |
Looks for characters and their matching animation files in the scene graph; binds and loops any matching animations found. | |
void | set_wireframe (bool enable) |
Forces wireframe state (true) or restores default rendering (false). | |
void | set_texture (bool enable) |
Forces textures off (false) or restores default rendering (true). | |
void | set_two_sided (bool enable) |
Forces two-sided rendering (true) or restores default rendering (false). | |
void | set_one_sided_reverse (bool enable) |
Toggles one-sided reverse mode. | |
void | set_lighting (bool enable) |
Turns lighting on (true) or off (false). | |
void | set_background_type (BackgroundType type) |
Sets the background of the window to one of the pre-canned background types (or to BT_other, which indicates the user intends to set up his own special background mode). | |
bool | get_wireframe () const |
Returns the current state of the wireframe flag. | |
bool | get_texture () const |
Returns the current state of the texture flag. | |
bool | get_two_sided () const |
Returns the current state of the two_sided flag. | |
bool | get_one_sided_reverse () const |
Returns the current state of the one_sided_reverse flag. | |
bool | get_lighting () const |
Returns the current state of the lighting flag. | |
BackgroundType | get_background_type () const |
Returns the current background type setting. | |
virtual TypeHandle | get_type () const |
virtual TypeHandle | force_init_type () |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
Static Public Member Functions | |
TypeHandle | get_class_type () |
void | init_type () |
Protected Member Functions | |
WindowFramework (PandaFramework *panda_framework) | |
GraphicsWindow * | open_window (const WindowProperties &props, GraphicsEngine *engine, GraphicsPipe *pipe) |
Opens the actual window. | |
void | close_window () |
Closes the window. | |
PointerTo< Camera > | make_camera () |
Makes a new 3-d camera for the window. | |
void | setup_lights () |
Makes light nodes and attaches them to the camera for viewing the scene. | |
Private Types | |
typedef pvector< PointerTo< Camera > > | Cameras |
Private Member Functions | |
PointerTo< PandaNode > | load_image_as_model (const Filename &filename) |
Loads the indicated image file as a texture, and creates a polygon to render it. | |
Private Attributes | |
PandaFramework * | _panda_framework |
PointerTo< GraphicsWindow > | _window |
NodePath | _camera_group |
Cameras | _cameras |
NodePath | _render |
NodePath | _render_2d |
NodePath | _aspect_2d |
AnimControlCollection | _anim_controls |
NodePath | _mouse |
PointerTo< Trackball > | _trackball |
AmbientLight * | _alight |
DirectionalLight * | _dlight |
bool | _got_keyboard |
bool | _got_trackball |
bool | _got_lights |
bool | _wireframe_enabled |
bool | _texture_enabled |
bool | _two_sided_enabled |
bool | _one_sided_reverse_enabled |
bool | _lighting_enabled |
BackgroundType | _background_type |
Static Private Attributes | |
TypeHandle | _type_handle |
Friends | |
class | PandaFramework |
Definition at line 51 of file windowFramework.h.
|
Definition at line 121 of file windowFramework.h. |
|
Definition at line 87 of file windowFramework.h. Referenced by PandaFramework::event_C(), get_two_sided(), and PandaFramework::get_wireframe(). |
|
Definition at line 69 of file windowFramework.cxx. References _background_type, _got_lights, _got_trackball, _lighting_enabled, _one_sided_reverse_enabled, _texture_enabled, _two_sided_enabled, _wireframe_enabled, and BT_default. |
|
Definition at line 94 of file windowFramework.cxx. References _window, GraphicsEngine::make_gsg(), GraphicsEngine::make_window(), nassertr, NULL, and PT. |
|
Centers the trackball on the indicated object, and scales the trackball motion suitably.
Definition at line 394 of file windowFramework.cxx. Referenced by PandaFramework::do_enable_default_keys(). |
|
Closes the window. This is normally called from PandaFramework::close_window(). Definition at line 142 of file windowFramework.cxx. References _lighting_enabled. Referenced by PandaFramework::find_window(). |
|
Creates a ButtonThrower to listen to button presses and throw them as events.
Definition at line 332 of file windowFramework.cxx. References _trackball, and tball2cam. Referenced by event_W(). |
|
Reimplemented from TypedReferenceCount. Definition at line 159 of file windowFramework.h. |
|
Returns the node under the 2-d scene graph that is scaled to suit the window's aspect ratio.
Definition at line 274 of file windowFramework.cxx. References _mouse, _panda_framework, _window, data_root, PandaFramework::get_data_root(), NodePath::is_empty(), and nassertr. |
|
Returns the current background type setting.
Definition at line 160 of file windowFramework.I. Referenced by PandaFramework::event_C(). |
|
Returns the nth camera associated with the window.
Definition at line 81 of file windowFramework.I. References _texture_enabled, and INLINE. |
|
Returns the node above the collection of 3-d cameras in the scene graph. This node may be moved around to represent the viewpoint. Definition at line 175 of file windowFramework.cxx. References _render_2d, and NodePath::is_empty(). Referenced by set_one_sided_reverse(). |
|
Reimplemented from TypedReferenceCount. Definition at line 148 of file windowFramework.h. |
|
Returns a pointer to the underlying GraphicsWindow object.
Definition at line 49 of file windowFramework.I. References _cameras, and INLINE. Referenced by PandaFramework::find_window(). |
|
Returns the current state of the lighting flag.
Definition at line 147 of file windowFramework.I. Referenced by PandaFramework::make_default_pipe(). |
|
Returns the node in the data graph corresponding to the mouse associated with this window.
Definition at line 310 of file windowFramework.cxx. References _got_keyboard. |
|
Returns the number of 3-d cameras associated with the window. A window usually has only one camera, but it may have multiple cameras if there are multiple display regions within the window. Definition at line 68 of file windowFramework.I. References _wireframe_enabled, and INLINE. |
|
Returns the current state of the one_sided_reverse flag.
Definition at line 134 of file windowFramework.I. Referenced by PandaFramework::make_window_framework(). |
|
Returns a pointer to the associated PandaFramework object.
Definition at line 34 of file windowFramework.I. |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Returns the root of the 3-d scene graph.
Definition at line 191 of file windowFramework.cxx. References _render_2d, and _window. Referenced by event_W(). |
|
Returns the root of the 2-d scene graph.
Definition at line 210 of file windowFramework.cxx. References _render_2d. |
|
Returns the current state of the texture flag.
Definition at line 108 of file windowFramework.I. References _lighting_enabled, and INLINE. |
|
Returns the current state of the two_sided flag.
Definition at line 121 of file windowFramework.I. References _background_type, BackgroundType, and INLINE. Referenced by PandaFramework::main_loop(). |
|
Reimplemented from TypedReferenceCount. Definition at line 156 of file windowFramework.h. |
|
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). Definition at line 71 of file typedObject.I. References TypeHandle::get_name(), TypedObject::get_type(), and INLINE. |
|
Returns the current state of the wireframe flag.
Definition at line 95 of file windowFramework.I. References _one_sided_reverse_enabled, and INLINE. |
|
Reimplemented from TypedReferenceCount. Definition at line 151 of file windowFramework.h. |
|
Returns true if the current object is the indicated type exactly.
Definition at line 101 of file typedObject.I. Referenced by PT(), and CollisionNode::xform(). |
|
|
Loads our favorite blue triangle. This is intended to provide some default geometry to have *something* to look at for testing, when no other models are provided. Definition at line 601 of file windowFramework.cxx. |
|
Loads the indicated image file as a texture, and creates a polygon to render it. Returns the new model. Definition at line 950 of file windowFramework.cxx. |
|
Loads up the indicated model and returns the new NodePath, or the empty NodePath if the model could not be loaded.
Definition at line 542 of file windowFramework.cxx. |
|
Loads up all the model files listed in the indicated argument list. Returns true if all models loaded successfully, or false if at least one of them had an error. Definition at line 512 of file windowFramework.cxx. References nout. |
|
Loads up all the model files listed in the indicated argument list. If first_arg is supplied, it is the first argument in the list to consider. Returns true if all models loaded successfully, or false if at least one of them had an error. Definition at line 485 of file windowFramework.cxx. References NULL. |
|
Looks for characters and their matching animation files in the scene graph; binds and loops any matching animations found.
Definition at line 654 of file windowFramework.cxx. |
|
Makes a new 3-d camera for the window.
Definition at line 878 of file windowFramework.cxx. |
|
Opens the actual window. This is normally called only from PandaFramework::open_window(). Definition at line 109 of file windowFramework.cxx. References _window. |
|
Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
Sets the background of the window to one of the pre-canned background types (or to BT_other, which indicates the user intends to set up his own special background mode).
Definition at line 831 of file windowFramework.cxx. References PointerToArray< int >::empty_array(), Texture::FT_linear, Texture::FT_linear_mipmap_linear, PNMImageHeader::get_x_size(), PNMImageHeader::get_y_size(), PNMImageHeader::has_alpha(), NULL, PT, PointerToArray< TexCoordf >::push_back(), PointerToArray< Vertexf >::push_back(), PointerToArray< int >::push_back(), Texture::read(), PNMImageHeader::read_header(), Geom::set_coords(), Geom::set_lengths(), Texture::set_magfilter(), Texture::set_minfilter(), Geom::set_num_prims(), tex, and TexCoordf. Referenced by PandaFramework::event_C(). |
|
Turns lighting on (true) or off (false).
Definition at line 796 of file windowFramework.cxx. Referenced by PandaFramework::make_default_pipe(). |
|
Toggles one-sided reverse mode. In this mode, the front sides of one-sided polygons are culled instead of the back side. Definition at line 767 of file windowFramework.cxx. References _cameras, _window, NodePath::attach_new_node(), get_camera_group(), WindowProperties::get_x_size(), WindowProperties::get_y_size(), WindowProperties::has_size(), PT, and Lens::set_film_size(). Referenced by PandaFramework::make_window_framework(). |
|
Forces textures off (false) or restores default rendering (true).
Definition at line 708 of file windowFramework.cxx. |
|
Forces two-sided rendering (true) or restores default rendering (false).
Definition at line 735 of file windowFramework.cxx. References _window, BT_black, BT_default, BT_gray, and BT_none. Referenced by PandaFramework::main_loop(). |
|
Forces wireframe state (true) or restores default rendering (false).
Definition at line 673 of file windowFramework.cxx. References _one_sided_reverse_enabled. |
|
Makes light nodes and attaches them to the camera for viewing the scene.
Definition at line 920 of file windowFramework.cxx. |
|
Sets up the mouse to trackball around the camera.
Definition at line 362 of file windowFramework.cxx. Referenced by event_W(). |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Definition at line 164 of file windowFramework.h. |
|
Definition at line 132 of file windowFramework.h. |
|
Definition at line 127 of file windowFramework.h. |
|
Definition at line 126 of file windowFramework.h. |
|
Definition at line 145 of file windowFramework.h. Referenced by get_two_sided(), and WindowFramework(). |
|
Definition at line 120 of file windowFramework.h. |
|
Definition at line 122 of file windowFramework.h. Referenced by get_graphics_window(), and set_one_sided_reverse(). |
|
Definition at line 133 of file windowFramework.h. |
|
Definition at line 135 of file windowFramework.h. Referenced by get_mouse(). |
|
Definition at line 137 of file windowFramework.h. Referenced by WindowFramework(). |
|
Definition at line 136 of file windowFramework.h. Referenced by WindowFramework(). |
|
Definition at line 143 of file windowFramework.h. Referenced by close_window(), get_texture(), and WindowFramework(). |
|
Definition at line 129 of file windowFramework.h. Referenced by get_aspect_2d(). |
|
Definition at line 142 of file windowFramework.h. Referenced by get_wireframe(), set_wireframe(), and WindowFramework(). |
|
Definition at line 117 of file windowFramework.h. Referenced by get_aspect_2d(). |
|
Definition at line 124 of file windowFramework.h. |
|
Definition at line 125 of file windowFramework.h. Referenced by get_camera_group(), get_render(), and get_render_2d(). |
|
Definition at line 140 of file windowFramework.h. Referenced by get_camera(), and WindowFramework(). |
|
Definition at line 130 of file windowFramework.h. Referenced by enable_keyboard(). |
|
Definition at line 141 of file windowFramework.h. Referenced by WindowFramework(). |
|
Reimplemented from TypedReferenceCount. Definition at line 58 of file windowFramework.cxx. |
|
Definition at line 118 of file windowFramework.h. Referenced by get_aspect_2d(), get_panda_framework(), get_render(), open_window(), set_one_sided_reverse(), set_two_sided(), and ~WindowFramework(). |
|
Definition at line 139 of file windowFramework.h. Referenced by get_num_cameras(), and WindowFramework(). |