#include <pandaFramework.h>
Public Member Functions | |
PandaFramework () | |
virtual | ~PandaFramework () |
void | open_framework (int &argc, char **&argv) |
Should be called once at the beginning of the application to initialize Panda (and the framework) for use. | |
void | close_framework () |
Should be called at the end of an application to close Panda. | |
GraphicsPipe * | get_default_pipe () |
Returns the default pipe. | |
GraphicsEngine * | get_graphics_engine () |
Returns the GraphicsEngine that is used to render all the windows in the framework. | |
const NodePath & | get_data_root () const |
Returns the root of the data graph. | |
EventHandler & | get_event_handler () |
Returns the EventHandler object that serves events in the framework. | |
void | set_window_title (const string &title) |
Specifies the title that is set for all subsequently created windows. | |
virtual void | get_default_window_props (WindowProperties &props) |
Fills in the indicated window properties structure according to the normal window properties for this application. | |
WindowFramework * | open_window (GraphicsPipe *pipe=NULL) |
Opens a new window, using the default parameters. | |
WindowFramework * | open_window (const WindowProperties &props, GraphicsPipe *pipe=NULL) |
Opens a new window using the indicated properties. | |
int | get_num_windows () const |
Returns the number of windows that are currently open. | |
WindowFramework * | get_window (int n) const |
Returns the nth window currently open. | |
int | find_window (const GraphicsWindow *win) const |
Returns the index of the WindowFramework object that references the indicated GraphicsWindow pointer, or -1 if none do. | |
int | find_window (const WindowFramework *wf) const |
Returns the index of the given WindowFramework object, or -1 if the object does not represent a window opened with this PandaFramework. | |
void | close_window (int n) |
Closes the nth window and removes it from the list. | |
void | close_window (WindowFramework *wf) |
Closes the indicated WindowFramework window and removes it from the list. | |
void | close_all_windows () |
Closes all currently open windows and empties the list of windows. | |
bool | all_windows_closed () const |
Returns true if all of the opened windows have been closed by the user, false otherwise. | |
const NodePath & | get_models () |
Returns the root of the scene graph normally reserved for parenting models and such. | |
void | report_frame_rate (ostream &out) const |
Reports the currently measured average frame rate to the indicated ostream. | |
void | reset_frame_rate () |
Resets the frame rate computation. | |
void | set_wireframe (bool enable) |
Sets the wireframe state on all windows. | |
void | set_texture (bool enable) |
Sets the texture state on all windows. | |
void | set_two_sided (bool enable) |
Sets the two_sided state on all windows. | |
void | set_lighting (bool enable) |
Sets the lighting state on all windows. | |
void | set_background_type (WindowFramework::BackgroundType type) |
Sets the background type of all windows. | |
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_lighting () const |
Returns the current state of the lighting flag. | |
WindowFramework::BackgroundType | get_background_type () const |
Returns the current background type setting. | |
void | set_highlight (const NodePath &node) |
Sets the indicated node (normally a node within the get_models() tree) up as the highlighted node. | |
void | clear_highlight () |
Unhighlights the currently highlighted node, if any. | |
bool | has_highlight () const |
Returns true if any node is highlighted, false otherwise. | |
const NodePath & | get_highlight () const |
Returns the currently highlighted node, if any, or an empty NodePath if no node is highlighted. | |
void | enable_default_keys () |
Sets callbacks on the event handler to handle all of the normal viewer keys, like t to toggle texture, ESC or q to quit, etc. | |
virtual bool | do_frame () |
Renders one frame and performs all associated processing. | |
void | main_loop () |
Called to yield control to the panda framework. | |
void | set_exit_flag () |
Sets the flag that indicates it is time for the application to exit. | |
void | clear_exit_flag () |
Resets the exit flag after it has previously been set. | |
Static Public Member Functions | |
int | hide_collision_solids (NodePath node) |
Hides any collision solids which are visible in the indicated scene graph. | |
int | show_collision_solids (NodePath node) |
Shows any collision solids which are directly hidden in the indicated scene graph. | |
Protected Member Functions | |
virtual PointerTo< WindowFramework > | make_window_framework () |
Creates a new WindowFramework object. | |
virtual void | make_default_pipe () |
Creates the default GraphicsPipe that will contain all windows that are not opened on a specific pipe. | |
virtual void | do_enable_default_keys () |
The implementation of enable_default_keys(). | |
Static Protected Member Functions | |
void | event_esc (CPT_Event, void *data) |
Default handler for ESC or q key: close the current window (and exit the application if that was the last window). | |
void | event_f (CPT_Event, void *data) |
Default handler for f key: report and reset frame rate. | |
void | event_w (CPT_Event, void *data) |
Default handler for w key: toggle wireframe. | |
void | event_t (CPT_Event, void *data) |
Default handler for t key: toggle texture. | |
void | event_b (CPT_Event, void *data) |
Default handler for b key: toggle backface (two-sided rendering). | |
void | event_i (CPT_Event, void *data) |
Default handler for i key: invert one-sided faces. | |
void | event_l (CPT_Event, void *data) |
Default handler for l key: toggle lighting. | |
void | event_c (CPT_Event, void *data) |
Default handler for c key: center the trackball over the scene, or over the highlighted part of the scene. | |
void | event_C (CPT_Event, void *data) |
Default handler for shift-C key: toggle the showing of collision solids. | |
void | event_B (CPT_Event, void *data) |
Default handler for shift-B key: describe the bounding volume of the currently selected object, or the entire scene. | |
void | event_L (CPT_Event, void *data) |
Default handler for shift-L key: list the contents of the scene graph, or the highlighted node. | |
void | event_h (CPT_Event, void *data) |
Default handler for h key: toggle highlight mode. | |
void | event_arrow_up (CPT_Event, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's parent. | |
void | event_arrow_down (CPT_Event, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's first child. | |
void | event_arrow_left (CPT_Event, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the left. | |
void | event_arrow_right (CPT_Event, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the right. | |
void | event_S (CPT_Event, void *data) |
Default handler for shift-S key: activate stats. | |
void | event_comma (CPT_Event, void *data) |
Default handler for comma key: rotate background color. | |
void | event_window_event (CPT_Event, void *data) |
Default handler for window events: window resized or closed, etc. | |
Private Types | |
typedef pvector< PointerTo< WindowFramework > > | Windows |
Private Attributes | |
bool | _is_open |
bool | _made_default_pipe |
string | _window_title |
PointerTo< GraphicsPipe > | _default_pipe |
GraphicsEngine | _engine |
NodePath | _data_root |
EventHandler | _event_handler |
Windows | _windows |
NodePath | _models |
double | _start_time |
int | _frame_count |
bool | _wireframe_enabled |
bool | _texture_enabled |
bool | _two_sided_enabled |
bool | _lighting_enabled |
WindowFramework::BackgroundType | _background_type |
NodePath | _highlight |
bool | _default_keys_enabled |
bool | _exit_flag |
Definition at line 49 of file pandaFramework.h.
|
Definition at line 149 of file pandaFramework.h. |
|
Definition at line 40 of file pandaFramework.cxx. References WindowFramework::BT_gray. |
|
Definition at line 67 of file pandaFramework.cxx. References _is_open, and reset_frame_rate(). |
|
Returns true if all of the opened windows have been closed by the user, false otherwise.
Definition at line 374 of file pandaFramework.cxx. |
|
Resets the exit flag after it has previously been set.
Definition at line 259 of file pandaFramework.I. |
|
Unhighlights the currently highlighted node, if any.
Definition at line 634 of file pandaFramework.cxx. References _exit_flag, _windows, close_window(), DCAST_INTO_V, and EventParameter::get_ptr(). Referenced by event_w(), and set_two_sided(). |
|
Closes all currently open windows and empties the list of windows.
Definition at line 347 of file pandaFramework.cxx. Referenced by open_framework(). |
|
Should be called at the end of an application to close Panda. This is optional, as the destructor will do the same thing. Definition at line 113 of file pandaFramework.cxx. |
|
Closes the indicated WindowFramework window and removes it from the list.
Definition at line 129 of file pandaFramework.I. References _two_sided_enabled. |
|
Closes the nth window and removes it from the list.
Definition at line 323 of file pandaFramework.cxx. References _models. Referenced by clear_highlight(). |
|
The implementation of enable_default_keys().
Definition at line 754 of file pandaFramework.cxx. References WindowFramework::center_trackball(), DCAST_INTO_V, get_highlight(), get_models(), EventParameter::get_ptr(), and NodePath::is_empty(). Referenced by set_background_type(). |
|
Renders one frame and performs all associated processing. Returns true if we should continue rendering, false if we should exit. This is normally called only from main_loop(). Definition at line 676 of file pandaFramework.cxx. |
|
Sets callbacks on the event handler to handle all of the normal viewer keys, like t to toggle texture, ESC or q to quit, etc.
Definition at line 654 of file pandaFramework.cxx. References nout, report_frame_rate(), and reset_frame_rate(). |
|
Default handler for up arrow key: in highlight mode, move the highlight to the node's first child.
Definition at line 1073 of file pandaFramework.cxx. |
|
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the left.
Definition at line 1097 of file pandaFramework.cxx. |
|
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the right.
Definition at line 1127 of file pandaFramework.cxx. |
|
Default handler for up arrow key: in highlight mode, move the highlight to the node's parent.
Definition at line 1051 of file pandaFramework.cxx. |
|
Default handler for shift-B key: describe the bounding volume of the currently selected object, or the entire scene.
Definition at line 984 of file pandaFramework.cxx. References win. |
|
Default handler for b key: toggle backface (two-sided rendering).
Definition at line 872 of file pandaFramework.cxx. References NodePath::get_child(), get_highlight(), NodePath::get_num_children(), and set_highlight(). |
|
Default handler for shift-C key: toggle the showing of collision solids.
Definition at line 958 of file pandaFramework.cxx. References WindowFramework::BackgroundType, WindowFramework::BT_default, WindowFramework::BT_none, WindowFramework::BT_other, WindowFramework::get_background_type(), and WindowFramework::set_background_type(). |
|
Default handler for c key: center the trackball over the scene, or over the highlighted part of the scene.
Definition at line 931 of file pandaFramework.cxx. |
|
Default handler for comma key: rotate background color.
Definition at line 1172 of file pandaFramework.cxx. |
|
Default handler for ESC or q key: close the current window (and exit the application if that was the last window).
Definition at line 790 of file pandaFramework.cxx. References NodePath::get_bounds(), get_highlight(), get_models(), NodePath::is_empty(), and nout. |
|
Default handler for f key: report and reset frame rate.
Definition at line 817 of file pandaFramework.cxx. References get_highlight(), get_models(), NodePath::is_empty(), and NodePath::ls(). |
|
Default handler for h key: toggle highlight mode. In this mode, you can walk the scene graph with the arrow keys to highlight different nodes. Definition at line 1030 of file pandaFramework.cxx. |
|
Default handler for i key: invert one-sided faces.
Definition at line 891 of file pandaFramework.cxx. References PandaNode::find_child(), PandaNode::get_child(), get_highlight(), get_models(), NodePath::get_parent(), NodePath::has_parent(), nassertv, NodePath::node(), and set_highlight(). |
|
Default handler for shift-L key: list the contents of the scene graph, or the highlighted node.
Definition at line 1006 of file pandaFramework.cxx. |
|
Default handler for l key: toggle lighting.
Definition at line 910 of file pandaFramework.cxx. References PandaNode::find_child(), PandaNode::get_child(), get_highlight(), get_models(), PandaNode::get_num_children(), NodePath::get_parent(), has_highlight(), NodePath::has_parent(), nassertv, NodePath::node(), and set_highlight(). |
|
Default handler for shift-S key: activate stats.
Definition at line 1154 of file pandaFramework.cxx. |
|
Default handler for t key: toggle texture.
Definition at line 851 of file pandaFramework.cxx. References get_highlight(), get_models(), NodePath::get_parent(), has_highlight(), NodePath::has_parent(), and set_highlight(). |
|
Default handler for w key: toggle wireframe.
Definition at line 832 of file pandaFramework.cxx. References clear_highlight(), get_models(), has_highlight(), and set_highlight(). |
|
Default handler for window events: window resized or closed, etc.
Definition at line 1203 of file pandaFramework.cxx. |
|
Returns the index of the given WindowFramework object, or -1 if the object does not represent a window opened with this PandaFramework.
Definition at line 302 of file pandaFramework.cxx. References _windows. |
|
Returns the index of the WindowFramework object that references the indicated GraphicsWindow pointer, or -1 if none do.
Definition at line 278 of file pandaFramework.cxx. References _engine, _windows, WindowFramework::close_window(), WindowFramework::get_graphics_window(), NULL, GraphicsEngine::remove_window(), and win. |
|
Returns the current background type setting.
Definition at line 197 of file pandaFramework.I. |
|
Returns the root of the data graph. This is the graph of nodes that is traversed to control the inputs from user devices like the mouse and keyboard. Definition at line 53 of file pandaFramework.I. References _event_handler. Referenced by WindowFramework::get_aspect_2d(). |
|
Returns the default pipe. This is the GraphicsPipe that all windows in the framework will be created on, unless otherwise specified in open_window(). It is usually the primary graphics interface on the local machine. If the default pipe has not yet been created, this creates it. The return value is the default pipe, or NULL if no default pipe could be created. Definition at line 165 of file pandaFramework.cxx. References _is_open, get_default_window_props(), nassertr, NULL, and open_window(). |
|
Fills in the indicated window properties structure according to the normal window properties for this application.
Definition at line 187 of file pandaFramework.cxx. References NULL. Referenced by get_default_pipe(). |
|
Returns the EventHandler object that serves events in the framework. This is primarily used to dispatch on keypresses and such. Definition at line 70 of file pandaFramework.I. |
|
Returns the GraphicsEngine that is used to render all the windows in the framework. Normally there's no reason for user code to mess with this. Definition at line 36 of file pandaFramework.I. References _data_root, and INLINE. |
|
Returns the currently highlighted node, if any, or an empty NodePath if no node is highlighted.
Definition at line 227 of file pandaFramework.I. Referenced by do_enable_default_keys(), event_b(), event_esc(), event_f(), event_i(), event_l(), and event_t(). |
|
Returns the current state of the lighting flag.
Definition at line 184 of file pandaFramework.I. References _exit_flag. |
|
Returns the root of the scene graph normally reserved for parenting models and such. This scene graph may be instanced to each window's render tree as the window is created. Definition at line 401 of file pandaFramework.cxx. Referenced by do_enable_default_keys(), event_esc(), event_f(), event_i(), event_l(), event_t(), event_W(), and event_w(). |
|
Returns the number of windows that are currently open.
Definition at line 100 of file pandaFramework.I. |
|
Returns the current state of the texture flag.
Definition at line 158 of file pandaFramework.I. References _highlight, INLINE, and NodePath::is_empty(). |
|
Returns the current state of the two_sided flag.
Definition at line 171 of file pandaFramework.I. References _highlight. |
|
Returns the nth window currently open.
Definition at line 113 of file pandaFramework.I. References _texture_enabled, and INLINE. |
|
Returns the current state of the wireframe flag.
Definition at line 145 of file pandaFramework.I. References _background_type, WindowFramework::BackgroundType, and INLINE. |
|
Returns true if any node is highlighted, false otherwise.
Definition at line 212 of file pandaFramework.I. |
|
Hides any collision solids which are visible in the indicated scene graph. Returns the number of collision solids hidden. Definition at line 554 of file pandaFramework.cxx. |
|
Called to yield control to the panda framework. This function does not return until set_exit_flag() has been called. Definition at line 699 of file pandaFramework.cxx. References DCAST_INTO_V, EventParameter::get_ptr(), WindowFramework::get_two_sided(), and WindowFramework::set_two_sided(). |
|
Creates the default GraphicsPipe that will contain all windows that are not opened on a specific pipe.
Definition at line 732 of file pandaFramework.cxx. References DCAST_INTO_V, WindowFramework::get_lighting(), EventParameter::get_ptr(), and WindowFramework::set_lighting(). |
|
Creates a new WindowFramework object. This is provided as a hook so derived PandaFramework classes can create custom WindowFramework objects. Definition at line 717 of file pandaFramework.cxx. References DCAST_INTO_V, WindowFramework::get_one_sided_reverse(), EventParameter::get_ptr(), and WindowFramework::set_one_sided_reverse(). |
|
Should be called once at the beginning of the application to initialize Panda (and the framework) for use. The command-line arguments should be passed in so Panda can remove any arguments that it recognizes as special control parameters. Definition at line 90 of file pandaFramework.cxx. References _default_keys_enabled, _default_pipe, _engine, _event_handler, _exit_flag, _frame_count, _is_open, _lighting_enabled, _made_default_pipe, _start_time, _two_sided_enabled, _wireframe_enabled, PointerTo< GraphicsPipe >::clear(), close_all_windows(), EventHandler::remove_all_hooks(), and GraphicsEngine::remove_all_windows(). |
|
Opens a new window using the indicated properties. (You may initialize the properties to their default values by calling get_default_window_props() first.) Returns the new WindowFramework if successful, or NULL if not. Definition at line 237 of file pandaFramework.cxx. References _windows. |
|
Opens a new window, using the default parameters. Returns the new WindowFramework if successful, or NULL if not. Definition at line 209 of file pandaFramework.cxx. References _windows. Referenced by get_default_pipe(). |
|
Reports the currently measured average frame rate to the indicated ostream.
Definition at line 419 of file pandaFramework.cxx. Referenced by enable_default_keys(). |
|
Resets the frame rate computation.
Definition at line 441 of file pandaFramework.cxx. References CollisionNode::get_class_type(), NodePath::hide(), NodePath::is_hidden(), TypedObject::is_of_type(), and NodePath::node(). Referenced by enable_default_keys(), and ~PandaFramework(). |
|
Sets the background type of all windows.
Definition at line 531 of file pandaFramework.cxx. References _default_keys_enabled, and do_enable_default_keys(). |
|
Sets the flag that indicates it is time for the application to exit. The application will actually exit at the end of the current frame. Definition at line 244 of file pandaFramework.I. |
|
Sets the indicated node (normally a node within the get_models() tree) up as the highlighted node. Certain operations affect the highlighted node only. Definition at line 616 of file pandaFramework.cxx. References _event_handler. Referenced by event_b(), event_i(), event_l(), event_t(), and event_w(). |
|
Sets the lighting state on all windows.
Definition at line 512 of file pandaFramework.cxx. References _highlight, NodePath::hide_bounds(), and NodePath::is_empty(). |
|
Sets the texture state on all windows.
Definition at line 474 of file pandaFramework.cxx. References NodePath::get_child(), CollisionNode::get_class_type(), NodePath::get_hidden_ancestor(), NodePath::get_num_children(), TypedObject::is_of_type(), NodePath::node(), NodePath::show(), and show_collision_solids(). |
|
Sets the two_sided state on all windows.
Definition at line 493 of file pandaFramework.cxx. References _highlight, clear_highlight(), NodePath::is_empty(), and NodePath::show_bounds(). |
|
Specifies the title that is set for all subsequently created windows.
Definition at line 85 of file pandaFramework.I. |
|
Sets the wireframe state on all windows.
Definition at line 455 of file pandaFramework.cxx. |
|
Shows any collision solids which are directly hidden in the indicated scene graph. Returns the number of collision solids shown. Definition at line 585 of file pandaFramework.cxx. References _default_pipe, GraphicsPipeSelection::get_global_ptr(), GraphicsPipeSelection::make_default_pipe(), nout, NULL, and GraphicsPipeSelection::print_pipe_types(). Referenced by set_texture(). |
|
Definition at line 162 of file pandaFramework.h. Referenced by get_wireframe(). |
|
Definition at line 146 of file pandaFramework.h. Referenced by get_graphics_engine(). |
|
Definition at line 166 of file pandaFramework.h. Referenced by open_framework(), and set_background_type(). |
|
Definition at line 143 of file pandaFramework.h. Referenced by open_framework(), and show_collision_solids(). |
|
Definition at line 144 of file pandaFramework.h. Referenced by find_window(), and open_framework(). |
|
Definition at line 147 of file pandaFramework.h. Referenced by get_data_root(), open_framework(), and set_highlight(). |
|
Definition at line 168 of file pandaFramework.h. Referenced by clear_highlight(), get_lighting(), and open_framework(). |
|
Definition at line 156 of file pandaFramework.h. Referenced by open_framework(). |
|
Definition at line 164 of file pandaFramework.h. Referenced by get_texture(), get_two_sided(), set_lighting(), and set_two_sided(). |
|
Definition at line 138 of file pandaFramework.h. Referenced by get_default_pipe(), open_framework(), and ~PandaFramework(). |
|
Definition at line 161 of file pandaFramework.h. Referenced by open_framework(). |
|
Definition at line 139 of file pandaFramework.h. Referenced by open_framework(). |
|
Definition at line 152 of file pandaFramework.h. Referenced by close_window(). |
|
Definition at line 155 of file pandaFramework.h. Referenced by open_framework(). |
|
Definition at line 159 of file pandaFramework.h. Referenced by get_window(). |
|
Definition at line 160 of file pandaFramework.h. Referenced by close_window(), and open_framework(). |
|
Definition at line 141 of file pandaFramework.h. |
|
Definition at line 150 of file pandaFramework.h. Referenced by clear_highlight(), find_window(), get_event_handler(), open_window(), and set_window_title(). |
|
Definition at line 158 of file pandaFramework.h. Referenced by open_framework(). |