Panda3D
|
This class serves to provide a high-level framework for basic applications that use Panda in simple ways (like opening a window to view models, etc.). More...
#include "pandaFramework.h"
Classes | |
class | KeyDefinition |
Public Member Functions | |
bool | all_windows_closed () const |
Returns true if all of the opened windows have been closed by the user, false otherwise. | |
void | clear_exit_flag () |
Resets the exit flag after it has previously been set. | |
void | clear_highlight () |
Unhighlights the currently highlighted node, if any. | |
void | close_all_windows () |
Closes all currently open windows and empties the list of windows. | |
void | close_framework () |
Should be called at the end of an application to close Panda. | |
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 | define_key (const string &event_name, const string &description, EventHandler::EventCallbackFunction *function, void *data) |
Sets up a handler for the indicated key. | |
virtual bool | do_frame (Thread *current_thread) |
Renders one frame and performs all associated processing. | |
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. | |
int | find_window (const GraphicsOutput *win) const |
Returns the index of the first WindowFramework object found that references the indicated GraphicsOutput 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. | |
WindowFramework::BackgroundType | get_background_type () const |
Returns the current background type setting. | |
const NodePath & | get_data_root () const |
Returns the root of the data graph. | |
GraphicsPipe * | get_default_pipe () |
Returns the default pipe. | |
virtual void | get_default_window_props (WindowProperties &props) |
Fills in the indicated window properties structure according to the normal window properties for this application. | |
EventHandler & | get_event_handler () |
Returns the EventHandler object that serves events in the framework. | |
GraphicsEngine * | get_graphics_engine () |
Returns the GraphicsEngine that is used to render all the windows in the framework. | |
const NodePath & | get_highlight () const |
Returns the currently highlighted node, if any, or an empty NodePath if no node is highlighted. | |
bool | get_lighting () const |
Returns the current state of the lighting flag. | |
NodePath & | get_models () |
Returns the root of the scene graph normally reserved for parenting models and such. | |
NodePath | get_mouse (GraphicsOutput *window) |
Returns a NodePath to the MouseAndKeyboard associated with the indicated GraphicsWindow object. | |
int | get_num_windows () const |
Returns the number of windows that are currently open. | |
bool | get_perpixel () const |
Returns the current state of the perpixel flag. | |
RecorderController * | get_recorder () const |
Returns the RecorderController that has been associated with the PandaFramework, if any, or NULL if none has (the normal case). | |
AsyncTaskManager & | get_task_mgr () |
Returns the Task Manager object that manages tasks in the framework. | |
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. | |
WindowFramework * | get_window (int n) const |
Returns the nth window currently open. | |
bool | get_wireframe () const |
Returns the current state of the wireframe flag. | |
bool | has_highlight () const |
Returns true if any node is highlighted, false otherwise. | |
void | main_loop () |
Called to yield control to the panda framework. | |
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. | |
WindowFramework * | open_window () |
Opens a window on the default graphics pipe. | |
WindowFramework * | open_window (GraphicsPipe *pipe, GraphicsStateGuardian *gsg=NULL) |
Opens a new window on the indicated pipe, using the default parameters. | |
WindowFramework * | open_window (const WindowProperties &props, int flags, GraphicsPipe *pipe=NULL, GraphicsStateGuardian *gsg=NULL) |
Opens a new window using the indicated properties. | |
void | remove_mouse (const GraphicsOutput *window) |
Removes the mouse that may have been created by an earlier call to get_mouse(). | |
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_background_type (WindowFramework::BackgroundType type) |
Sets the background type of all windows. | |
void | set_exit_flag () |
Sets the flag that indicates it is time for the application to exit. | |
void | set_highlight (const NodePath &node) |
Sets the indicated node (normally a node within the get_models() tree) up as the highlighted node. | |
void | set_lighting (bool enable) |
Sets the lighting state on all windows. | |
void | set_perpixel (bool enable) |
Sets the perpixel state on all windows. | |
void | set_recorder (RecorderController *recorder) |
Assigns a RecorderController with the PandaFramework. | |
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_window_title (const string &title) |
Specifies the title that is set for all subsequently created windows. | |
void | set_wireframe (bool enable) |
Sets the wireframe state on all windows. | |
Static Public Member Functions | |
static void | event_a (const Event *, void *data) |
Default handler for a key: toggle the animation controls. | |
static void | event_A (const Event *, void *data) |
Default handler for shift-A key: analyze the contents of the scene graph, or the highlighted node. | |
static void | event_arrow_down (const Event *, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's first child. | |
static void | event_arrow_left (const Event *, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the left. | |
static void | event_arrow_right (const Event *, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the right. | |
static void | event_arrow_up (const Event *, void *data) |
Default handler for up arrow key: in highlight mode, move the highlight to the node's parent. | |
static void | event_b (const Event *, void *data) |
Default handler for b key: toggle backface (two-sided rendering). | |
static void | event_B (const Event *, void *data) |
Default handler for shift-B key: describe the bounding volume of the currently selected object, or the entire scene. | |
static void | event_c (const Event *, void *data) |
Default handler for c key: center the trackball over the scene, or over the highlighted part of the scene. | |
static void | event_C (const Event *, void *data) |
Default handler for shift-C key: toggle the showing of collision solids. | |
static void | event_comma (const Event *, void *data) |
Default handler for comma key: rotate background color. | |
static void | event_esc (const Event *, void *data) |
Default handler for ESC or q key: close the current window (and exit the application if that was the last window). | |
static void | event_f (const Event *, void *data) |
Default handler for f key: report and reset frame rate. | |
static void | event_f9 (const Event *, void *data) |
Default handler for f9 key: take screenshot. | |
static void | event_h (const Event *, void *data) |
Default handler for h key: toggle highlight mode. | |
static void | event_i (const Event *, void *data) |
Default handler for i key: invert one-sided faces. | |
static void | event_l (const Event *, void *data) |
Default handler for l key: toggle lighting. | |
static void | event_L (const Event *, void *data) |
Default handler for shift-L key: list the contents of the scene graph, or the highlighted node. | |
static void | event_p (const Event *, void *data) |
Default handler for p key: toggle per-pixel lighting. | |
static void | event_question (const Event *event, void *data) |
Default handler for ? key: show the available keys. | |
static void | event_S (const Event *, void *data) |
Default handler for shift-S key: activate stats. | |
static void | event_t (const Event *, void *data) |
Default handler for t key: toggle texture. | |
static void | event_w (const Event *, void *data) |
Default handler for w key: toggle wireframe. | |
static void | event_window_event (const Event *, void *data) |
Default handler for window events: window resized or closed, etc. | |
static int | hide_collision_solids (NodePath node) |
Hides any collision solids, or occluders, which are visible in the indicated scene graph. | |
static int | show_collision_solids (NodePath node) |
Shows any collision solids, or occluders, which are directly hidden in the indicated scene graph. | |
static AsyncTask::DoneStatus | task_clear_screenshot_text (GenericAsyncTask *task, void *data) |
static AsyncTask::DoneStatus | task_clear_text (GenericAsyncTask *task, void *data) |
Called once to remove the screenshot text from onscreen. | |
static AsyncTask::DoneStatus | task_data_loop (GenericAsyncTask *task, void *data) |
Called once per frame to process the data graph (which handles user input via the mouse and keyboard, etc.) | |
static AsyncTask::DoneStatus | task_event (GenericAsyncTask *task, void *data) |
Called once per frame to process the pending events. | |
static AsyncTask::DoneStatus | task_garbage_collect (GenericAsyncTask *task, void *data) |
This task is created automatically if garbage_collect_states is true. | |
static AsyncTask::DoneStatus | task_igloop (GenericAsyncTask *task, void *data) |
Called once per frame to render the scene. | |
static AsyncTask::DoneStatus | task_play_frame (GenericAsyncTask *task, void *data) |
Called once per frame to ask the recorder to play back the user input data, if enabled. | |
static AsyncTask::DoneStatus | task_record_frame (GenericAsyncTask *task, void *data) |
Called once per frame to ask the recorder to record the user input data, if enabled. | |
Static Public Attributes | |
static LoaderOptions | _loader_options |
Protected Member Functions | |
bool | clear_text () |
Removes any onscreen text (like help text or screenshot filename). | |
virtual void | do_enable_default_keys () |
The implementation of enable_default_keys(). | |
virtual void | make_default_pipe () |
Creates the default GraphicsPipe that will contain all windows that are not opened on a specific pipe. | |
virtual | PT (WindowFramework) make_window_framework() |
Friends | |
class | WindowFramework |
This class serves to provide a high-level framework for basic applications that use Panda in simple ways (like opening a window to view models, etc.).
Definition at line 40 of file pandaFramework.h.
bool PandaFramework::all_windows_closed | ( | ) | const |
Returns true if all of the opened windows have been closed by the user, false otherwise.
Definition at line 567 of file pandaFramework.cxx.
References WindowFramework::get_graphics_output(), and GraphicsOutput::is_valid().
void PandaFramework::clear_exit_flag | ( | ) | [inline] |
Resets the exit flag after it has previously been set.
Definition at line 252 of file pandaFramework.I.
void PandaFramework::clear_highlight | ( | ) |
Unhighlights the currently highlighted node, if any.
Definition at line 806 of file pandaFramework.cxx.
References NodePathCollection::detach(), NodePath::detach_node(), NodePath::get_children(), NodePath::hide_bounds(), and NodePath::is_empty().
Referenced by event_h(), and set_highlight().
bool PandaFramework::clear_text | ( | ) | [protected] |
Removes any onscreen text (like help text or screenshot filename).
Returns true if there was any text in the first place, false otherwise.
Definition at line 939 of file pandaFramework.cxx.
References NodePath::is_empty(), and NodePath::remove_node().
Referenced by task_clear_text().
void PandaFramework::close_all_windows | ( | ) |
Closes all currently open windows and empties the list of windows.
Definition at line 538 of file pandaFramework.cxx.
References WindowFramework::close_window(), and WindowFramework::get_graphics_output().
Referenced by close_framework().
void PandaFramework::close_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 184 of file pandaFramework.cxx.
References close_all_windows(), Thread::prepare_for_exit(), and EventHandler::remove_all_hooks().
void PandaFramework::close_window | ( | int | n | ) |
Closes the nth window and removes it from the list.
Definition at line 518 of file pandaFramework.cxx.
Referenced by close_window(), and event_esc().
void PandaFramework::close_window | ( | WindowFramework * | wf | ) | [inline] |
Closes the indicated WindowFramework window and removes it from the list.
Definition at line 109 of file pandaFramework.I.
References close_window(), and find_window().
void PandaFramework::define_key | ( | const string & | event_name, |
const string & | description, | ||
EventHandler::EventCallbackFunction * | function, | ||
void * | data | ||
) |
Sets up a handler for the indicated key.
When the key is pressed in a window, the given callback will be called. The description is a one-line description of the function of the key, for display to the user.
Definition at line 305 of file pandaFramework.cxx.
References EventHandler::add_hook(), and EventHandler::has_hook().
Referenced by do_enable_default_keys().
void PandaFramework::do_enable_default_keys | ( | ) | [protected, virtual] |
The implementation of enable_default_keys().
Definition at line 903 of file pandaFramework.cxx.
References define_key(), event_a(), event_A(), event_arrow_down(), event_arrow_left(), event_arrow_right(), event_arrow_up(), event_b(), event_B(), event_c(), event_C(), event_comma(), event_esc(), event_f(), event_f9(), event_h(), event_i(), event_l(), event_L(), event_p(), event_question(), event_S(), event_t(), and event_w().
Referenced by enable_default_keys().
bool PandaFramework::do_frame | ( | Thread * | current_thread | ) | [virtual] |
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 841 of file pandaFramework.cxx.
References AsyncTaskManager::poll().
Referenced by MayaPview::doIt(), and main_loop().
void PandaFramework::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.
Definition at line 825 of file pandaFramework.cxx.
References do_enable_default_keys().
Referenced by MayaPview::doIt().
void PandaFramework::event_a | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for a key: toggle the animation controls.
Definition at line 1133 of file pandaFramework.cxx.
References EventParameter::get_ptr(), and WindowFramework::next_anim_control().
Referenced by do_enable_default_keys().
void PandaFramework::event_A | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for shift-A key: analyze the contents of the scene graph, or the highlighted node.
Definition at line 1207 of file pandaFramework.cxx.
References SceneGraphAnalyzer::add_node(), NodePath::is_empty(), NodePath::node(), and SceneGraphAnalyzer::write().
Referenced by do_enable_default_keys().
void PandaFramework::event_arrow_down | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for up arrow key: in highlight mode, move the highlight to the node's first child.
Definition at line 1263 of file pandaFramework.cxx.
References NodePath::get_child(), and NodePath::get_num_children().
Referenced by do_enable_default_keys().
void PandaFramework::event_arrow_left | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the left.
Definition at line 1282 of file pandaFramework.cxx.
References PandaNode::find_child(), PandaNode::get_child(), NodePath::get_parent(), NodePath::has_parent(), and NodePath::node().
Referenced by do_enable_default_keys().
void PandaFramework::event_arrow_right | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for up arrow key: in highlight mode, move the highlight to the node's nearest sibling on the right.
Definition at line 1314 of file pandaFramework.cxx.
References PandaNode::find_child(), PandaNode::get_child(), PandaNode::get_num_children(), NodePath::get_parent(), NodePath::has_parent(), and NodePath::node().
Referenced by do_enable_default_keys().
void PandaFramework::event_arrow_up | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for up arrow key: in highlight mode, move the highlight to the node's parent.
Definition at line 1245 of file pandaFramework.cxx.
References NodePath::get_parent(), and NodePath::has_parent().
Referenced by do_enable_default_keys().
void PandaFramework::event_b | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for b key: toggle backface (two-sided rendering).
Definition at line 1045 of file pandaFramework.cxx.
References EventParameter::get_ptr(), WindowFramework::get_two_sided(), and WindowFramework::set_two_sided().
Referenced by do_enable_default_keys().
void PandaFramework::event_B | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for shift-B key: describe the bounding volume of the currently selected object, or the entire scene.
Definition at line 1171 of file pandaFramework.cxx.
References NodePath::is_empty().
Referenced by do_enable_default_keys().
void PandaFramework::event_c | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for c key: center the trackball over the scene, or over the highlighted part of the scene.
Definition at line 1110 of file pandaFramework.cxx.
References WindowFramework::center_trackball(), EventParameter::get_ptr(), and NodePath::is_empty().
Referenced by do_enable_default_keys().
void PandaFramework::event_C | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for shift-C key: toggle the showing of collision solids.
Definition at line 1150 of file pandaFramework.cxx.
References NodePath::is_empty().
Referenced by do_enable_default_keys().
void PandaFramework::event_comma | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for comma key: rotate background color.
Definition at line 1409 of file pandaFramework.cxx.
References WindowFramework::get_background_type(), EventParameter::get_ptr(), and WindowFramework::set_background_type().
Referenced by do_enable_default_keys().
void PandaFramework::event_esc | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for ESC or q key: close the current window (and exit the application if that was the last window).
Definition at line 962 of file pandaFramework.cxx.
References close_window(), WindowFramework::get_graphics_output(), and EventParameter::get_ptr().
Referenced by do_enable_default_keys().
void PandaFramework::event_f | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for f key: report and reset frame rate.
Definition at line 1000 of file pandaFramework.cxx.
References report_frame_rate().
Referenced by do_enable_default_keys().
void PandaFramework::event_f9 | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for f9 key: take screenshot.
Definition at line 1360 of file pandaFramework.cxx.
References WindowFramework::get_aspect_2d(), ExecutionEnvironment::get_cwd(), WindowFramework::get_graphics_output(), EventParameter::get_ptr(), GraphicsOutput::save_screenshot_default(), TextNode::set_align(), TextNode::set_shadow(), TextNode::set_text(), and task_clear_text().
Referenced by do_enable_default_keys().
void PandaFramework::event_h | ( | const Event * | , |
void * | data | ||
) | [static] |
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 1228 of file pandaFramework.cxx.
References clear_highlight().
Referenced by do_enable_default_keys().
void PandaFramework::event_i | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for i key: invert one-sided faces.
Definition at line 1061 of file pandaFramework.cxx.
References WindowFramework::get_one_sided_reverse(), EventParameter::get_ptr(), and WindowFramework::set_one_sided_reverse().
Referenced by do_enable_default_keys().
void PandaFramework::event_l | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for l key: toggle lighting.
Definition at line 1077 of file pandaFramework.cxx.
References WindowFramework::get_lighting(), EventParameter::get_ptr(), and WindowFramework::set_lighting().
Referenced by do_enable_default_keys().
void PandaFramework::event_L | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for shift-L key: list the contents of the scene graph, or the highlighted node.
Definition at line 1189 of file pandaFramework.cxx.
References NodePath::is_empty(), and NodePath::ls().
Referenced by do_enable_default_keys().
void PandaFramework::event_p | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for p key: toggle per-pixel lighting.
Definition at line 1093 of file pandaFramework.cxx.
References WindowFramework::get_perpixel(), EventParameter::get_ptr(), and WindowFramework::set_perpixel().
Referenced by do_enable_default_keys().
void PandaFramework::event_question | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for ? key: show the available keys.
Definition at line 1436 of file pandaFramework.cxx.
References WindowFramework::get_aspect_2d(), TextNode::get_frame_actual(), EventParameter::get_ptr(), TextNode::set_align(), TextNode::set_shadow(), and TextNode::set_text().
Referenced by do_enable_default_keys().
void PandaFramework::event_S | ( | const Event * | , |
void * | data | ||
) | [static] |
Default handler for shift-S key: activate stats.
Definition at line 1345 of file pandaFramework.cxx.
References PStatClient::connect().
Referenced by do_enable_default_keys().
void PandaFramework::event_t | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for t key: toggle texture.
Definition at line 1028 of file pandaFramework.cxx.
References EventParameter::get_ptr(), WindowFramework::get_texture(), and WindowFramework::set_texture().
Referenced by do_enable_default_keys().
void PandaFramework::event_w | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for w key: toggle wireframe.
Definition at line 1012 of file pandaFramework.cxx.
References EventParameter::get_ptr(), WindowFramework::get_wireframe(), and WindowFramework::set_wireframe().
Referenced by do_enable_default_keys().
void PandaFramework::event_window_event | ( | const Event * | event, |
void * | data | ||
) | [static] |
Default handler for window events: window resized or closed, etc.
Definition at line 1492 of file pandaFramework.cxx.
References EventParameter::get_ptr(), and GraphicsOutput::is_valid().
Referenced by open_framework().
int PandaFramework::find_window | ( | const GraphicsOutput * | win | ) | const |
Returns the index of the first WindowFramework object found that references the indicated GraphicsOutput pointer, or -1 if none do.
Definition at line 481 of file pandaFramework.cxx.
Referenced by close_window().
int PandaFramework::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.
Definition at line 500 of file pandaFramework.cxx.
WindowFramework::BackgroundType PandaFramework::get_background_type | ( | ) | const [inline] |
Returns the current background type setting.
Definition at line 172 of file pandaFramework.I.
Referenced by open_window().
const NodePath & PandaFramework::get_data_root | ( | ) | const [inline] |
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 42 of file pandaFramework.I.
Referenced by get_mouse().
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 231 of file pandaFramework.cxx.
References make_default_pipe().
Referenced by open_window().
void PandaFramework::get_default_window_props | ( | WindowProperties & | props | ) | [virtual] |
Fills in the indicated window properties structure according to the normal window properties for this application.
Definition at line 342 of file pandaFramework.cxx.
References WindowProperties::add_properties(), WindowProperties::get_default(), and WindowProperties::set_title().
Referenced by open_window().
EventHandler & PandaFramework::get_event_handler | ( | ) | [inline] |
Returns the EventHandler object that serves events in the framework.
This is primarily used to dispatch on keypresses and such.
Definition at line 54 of file pandaFramework.I.
GraphicsEngine * PandaFramework::get_graphics_engine | ( | ) | [inline] |
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 24 of file pandaFramework.I.
References AsyncTaskManager::add(), and task_igloop().
Referenced by open_window().
const NodePath & PandaFramework::get_highlight | ( | ) | const [inline] |
Returns the currently highlighted node, if any, or an empty NodePath if no node is highlighted.
Definition at line 194 of file pandaFramework.I.
bool PandaFramework::get_lighting | ( | ) | const [inline] |
Returns the current state of the lighting flag.
Definition at line 152 of file pandaFramework.I.
Referenced by open_window().
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 588 of file pandaFramework.cxx.
References NodePath::is_empty().
Referenced by MayaPview::doIt().
NodePath PandaFramework::get_mouse | ( | GraphicsOutput * | window | ) |
Returns a NodePath to the MouseAndKeyboard associated with the indicated GraphicsWindow object.
If there's not yet a mouse associated with the window, creates one.
This allows multiple WindowFramework objects that represent different display regions of the same GraphicsWindow to share the same mouse.
Definition at line 253 of file pandaFramework.cxx.
References RecorderController::add_recorder(), NodePath::attach_new_node(), get_data_root(), get_recorder(), and TypedObject::is_of_type().
int PandaFramework::get_num_windows | ( | ) | const [inline] |
Returns the number of windows that are currently open.
Definition at line 87 of file pandaFramework.I.
bool PandaFramework::get_perpixel | ( | ) | const [inline] |
Returns the current state of the perpixel flag.
Definition at line 162 of file pandaFramework.I.
Referenced by open_window().
RecorderController * PandaFramework::get_recorder | ( | ) | const [inline] |
Returns the RecorderController that has been associated with the PandaFramework, if any, or NULL if none has (the normal case).
If a RecorderController is associated, it will presumably be used for recording user input to a session file, or for playing back the user input from a previously-recorded session.
Definition at line 211 of file pandaFramework.I.
Referenced by get_mouse().
AsyncTaskManager & PandaFramework::get_task_mgr | ( | ) | [inline] |
Returns the Task Manager object that manages tasks in the framework.
Definition at line 65 of file pandaFramework.I.
bool PandaFramework::get_texture | ( | ) | const [inline] |
Returns the current state of the texture flag.
Definition at line 132 of file pandaFramework.I.
Referenced by open_window().
bool PandaFramework::get_two_sided | ( | ) | const [inline] |
Returns the current state of the two_sided flag.
Definition at line 142 of file pandaFramework.I.
Referenced by open_window().
WindowFramework * PandaFramework::get_window | ( | int | n | ) | const [inline] |
Returns the nth window currently open.
Definition at line 97 of file pandaFramework.I.
bool PandaFramework::get_wireframe | ( | ) | const [inline] |
Returns the current state of the wireframe flag.
Definition at line 122 of file pandaFramework.I.
Referenced by open_window().
bool PandaFramework::has_highlight | ( | ) | const [inline] |
Returns true if any node is highlighted, false otherwise.
Definition at line 183 of file pandaFramework.I.
References NodePath::is_empty().
int PandaFramework::hide_collision_solids | ( | NodePath | node | ) | [static] |
Hides any collision solids, or occluders, which are visible in the indicated scene graph.
Returns the number of nodes hidden.
Definition at line 730 of file pandaFramework.cxx.
References NodePath::get_child(), NodePath::get_num_children(), NodePath::hide(), NodePath::is_hidden(), TypedObject::is_of_type(), and NodePath::node().
void PandaFramework::main_loop | ( | ) |
Called to yield control to the panda framework.
This function does not return until set_exit_flag() has been called.
Definition at line 857 of file pandaFramework.cxx.
References do_frame(), and Thread::get_current_thread().
Referenced by MayaPview::doIt().
void PandaFramework::make_default_pipe | ( | ) | [protected, virtual] |
Creates the default GraphicsPipe that will contain all windows that are not opened on a specific pipe.
Definition at line 882 of file pandaFramework.cxx.
References GraphicsPipeSelection::get_global_ptr(), and GraphicsPipeSelection::print_pipe_types().
Referenced by get_default_pipe().
void PandaFramework::open_framework | ( | int & | argc, |
char **& | argv | ||
) |
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 85 of file pandaFramework.cxx.
References AsyncTaskManager::add(), EventHandler::add_hook(), RecorderController::begin_playback(), RecorderController::begin_record(), event_window_event(), Filename::from_os_specific(), reset_frame_rate(), NodePath::set_attrib(), NodePath::set_color(), NodePath::set_render_mode_wireframe(), NodePath::set_texture_off(), task_data_loop(), task_event(), task_garbage_collect(), task_play_frame(), and task_record_frame().
Referenced by MayaPview::doIt().
Opens a window on the default graphics pipe.
If the default graphics pipe can't open a window for some reason, automatically fails over to the next available graphics pipe, and updates _default_pipe accordingly. Returns NULL only if all graphics pipes fail.
Definition at line 364 of file pandaFramework.cxx.
References get_default_pipe(), GraphicsPipeSelection::get_global_ptr(), GraphicsPipeSelection::get_num_pipe_types(), GraphicsPipeSelection::get_pipe_type(), and GraphicsPipeSelection::load_aux_modules().
Referenced by MayaPview::doIt(), and open_window().
WindowFramework * PandaFramework::open_window | ( | GraphicsPipe * | pipe, |
GraphicsStateGuardian * | gsg = NULL |
||
) |
Opens a new window on the indicated pipe, using the default parameters.
Returns the new WindowFramework if successful, or NULL if not.
Definition at line 408 of file pandaFramework.cxx.
References get_default_window_props(), and open_window().
WindowFramework * PandaFramework::open_window | ( | const WindowProperties & | props, |
int | flags, | ||
GraphicsPipe * | pipe = NULL , |
||
GraphicsStateGuardian * | gsg = NULL |
||
) |
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 433 of file pandaFramework.cxx.
References get_background_type(), get_default_pipe(), get_graphics_engine(), get_lighting(), get_perpixel(), get_texture(), get_two_sided(), get_wireframe(), and GraphicsOutput::is_valid().
void PandaFramework::remove_mouse | ( | const GraphicsOutput * | window | ) |
Removes the mouse that may have been created by an earlier call to get_mouse().
Definition at line 288 of file pandaFramework.cxx.
void PandaFramework::report_frame_rate | ( | ostream & | out | ) | const |
Reports the currently measured average frame rate to the indicated ostream.
Definition at line 602 of file pandaFramework.cxx.
References ClockObject::get_frame_count(), ClockObject::get_frame_time(), and ClockObject::get_global_clock().
Referenced by event_f().
void PandaFramework::reset_frame_rate | ( | ) |
Resets the frame rate computation.
Definition at line 621 of file pandaFramework.cxx.
References ClockObject::get_frame_count(), ClockObject::get_frame_time(), and ClockObject::get_global_clock().
Referenced by open_framework().
void PandaFramework::set_background_type | ( | WindowFramework::BackgroundType | type | ) |
Sets the background type of all windows.
Definition at line 712 of file pandaFramework.cxx.
References WindowFramework::set_background_type().
void PandaFramework::set_exit_flag | ( | ) | [inline] |
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 241 of file pandaFramework.I.
void PandaFramework::set_highlight | ( | const NodePath & | node | ) |
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 784 of file pandaFramework.cxx.
References clear_highlight(), NodePath::get_parent(), NodePath::has_parent(), NodePath::instance_to(), NodePath::is_empty(), NodePath::reparent_to(), and NodePath::show_bounds().
void PandaFramework::set_lighting | ( | bool | enable | ) |
Sets the lighting state on all windows.
Definition at line 680 of file pandaFramework.cxx.
References WindowFramework::set_lighting().
void PandaFramework::set_perpixel | ( | bool | enable | ) |
Sets the perpixel state on all windows.
Definition at line 696 of file pandaFramework.cxx.
References WindowFramework::set_perpixel().
void PandaFramework::set_recorder | ( | RecorderController * | recorder | ) | [inline] |
Assigns a RecorderController with the PandaFramework.
This should be called before any windows are opened. The subsequently opened windows will register their user inputs with the recorder.
If a RecorderController is associated, it will presumably be used for recording user input to a session file, or for playing back the user input from a previously-recorded session.
Definition at line 229 of file pandaFramework.I.
void PandaFramework::set_texture | ( | bool | enable | ) |
Sets the texture state on all windows.
Definition at line 648 of file pandaFramework.cxx.
References WindowFramework::set_texture().
void PandaFramework::set_two_sided | ( | bool | enable | ) |
Sets the two_sided state on all windows.
Definition at line 664 of file pandaFramework.cxx.
References WindowFramework::set_two_sided().
void PandaFramework::set_window_title | ( | const string & | title | ) | [inline] |
Specifies the title that is set for all subsequently created windows.
Definition at line 76 of file pandaFramework.I.
Referenced by MayaPview::doIt().
void PandaFramework::set_wireframe | ( | bool | enable | ) |
Sets the wireframe state on all windows.
Definition at line 632 of file pandaFramework.cxx.
References WindowFramework::set_wireframe().
int PandaFramework::show_collision_solids | ( | NodePath | node | ) | [static] |
Shows any collision solids, or occluders, which are directly hidden in the indicated scene graph.
Returns the number of nodes shown.
Definition at line 757 of file pandaFramework.cxx.
References NodePath::get_child(), NodePath::get_hidden_ancestor(), NodePath::get_num_children(), TypedObject::is_of_type(), NodePath::node(), and NodePath::show().
AsyncTask::DoneStatus PandaFramework::task_clear_text | ( | GenericAsyncTask * | task, |
void * | data | ||
) | [static] |
Called once to remove the screenshot text from onscreen.
Definition at line 1625 of file pandaFramework.cxx.
References clear_text().
Referenced by event_f9().
AsyncTask::DoneStatus PandaFramework::task_data_loop | ( | GenericAsyncTask * | task, |
void * | data | ||
) | [static] |
Called once per frame to process the data graph (which handles user input via the mouse and keyboard, etc.)
Definition at line 1545 of file pandaFramework.cxx.
References DataGraphTraverser::traverse().
Referenced by open_framework().
AsyncTask::DoneStatus PandaFramework::task_event | ( | GenericAsyncTask * | task, |
void * | data | ||
) | [static] |
Called once per frame to process the pending events.
Definition at line 1560 of file pandaFramework.cxx.
Referenced by open_framework().
AsyncTask::DoneStatus PandaFramework::task_garbage_collect | ( | GenericAsyncTask * | task, |
void * | data | ||
) | [static] |
This task is created automatically if garbage_collect_states is true.
It calls the needed TransformState::garbage_collect() and RenderState::garbage_collect() methods each frame.
Definition at line 1641 of file pandaFramework.cxx.
References RenderState::garbage_collect(), and TransformState::garbage_collect().
Referenced by open_framework().
AsyncTask::DoneStatus PandaFramework::task_igloop | ( | GenericAsyncTask * | task, |
void * | data | ||
) | [static] |
Called once per frame to render the scene.
Definition at line 1575 of file pandaFramework.cxx.
Referenced by get_graphics_engine().
AsyncTask::DoneStatus PandaFramework::task_play_frame | ( | GenericAsyncTask * | task, |
void * | data | ||
) | [static] |
Called once per frame to ask the recorder to play back the user input data, if enabled.
Definition at line 1609 of file pandaFramework.cxx.
Referenced by open_framework().
AsyncTask::DoneStatus PandaFramework::task_record_frame | ( | GenericAsyncTask * | task, |
void * | data | ||
) | [static] |
Called once per frame to ask the recorder to record the user input data, if enabled.
Definition at line 1592 of file pandaFramework.cxx.
Referenced by open_framework().