|
|
|
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"
List of all members.
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 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.
|
| 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.
|
| 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 (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.
|
| WindowFramework * | open_window () |
| | Opens a window on the default graphics pipe.
|
| 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 |
Detailed Description
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.
Member Function Documentation
| bool PandaFramework::all_windows_closed |
( |
| ) |
const |
| 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 |
( |
| ) |
|
| bool PandaFramework::clear_text |
( |
| ) |
[protected] |
| void PandaFramework::close_all_windows |
( |
| ) |
|
| void PandaFramework::close_framework |
( |
| ) |
|
| void PandaFramework::close_window |
( |
int |
n | ) |
|
| void PandaFramework::define_key |
( |
const string & |
event_name, |
|
|
const string & |
description, |
|
|
EventHandler::EventCallbackFunction * |
function, |
|
|
void * |
data |
|
) |
| |
| 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] |
| void PandaFramework::enable_default_keys |
( |
| ) |
|
| void PandaFramework::event_a |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_A |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_arrow_down |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_arrow_left |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_arrow_right |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_arrow_up |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_B |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_b |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_c |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_C |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_comma |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_esc |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_f |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_f9 |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_h |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_i |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_L |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_l |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_p |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_question |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_S |
( |
const Event * |
, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_t |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_w |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| void PandaFramework::event_window_event |
( |
const Event * |
event, |
|
|
void * |
data |
|
) |
| [static] |
| WindowFramework::BackgroundType PandaFramework::get_background_type |
( |
| ) |
const [inline] |
| 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] |
| 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.
| 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] |
| NodePath & PandaFramework::get_models |
( |
| ) |
|
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().
| 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 Task Manager object that manages tasks in the framework.
Definition at line 65 of file pandaFramework.I.
| bool PandaFramework::get_texture |
( |
| ) |
const [inline] |
| bool PandaFramework::get_two_sided |
( |
| ) |
const [inline] |
| bool PandaFramework::get_wireframe |
( |
| ) |
const [inline] |
| bool PandaFramework::has_highlight |
( |
| ) |
const [inline] |
| int PandaFramework::hide_collision_solids |
( |
NodePath |
node | ) |
[static] |
| void PandaFramework::main_loop |
( |
| ) |
|
| void PandaFramework::make_default_pipe |
( |
| ) |
[protected, virtual] |
| 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().
| void PandaFramework::report_frame_rate |
( |
ostream & |
out | ) |
const |
| void PandaFramework::reset_frame_rate |
( |
| ) |
|
| void PandaFramework::set_background_type |
( |
WindowFramework::BackgroundType |
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 | ) |
|
| void PandaFramework::set_lighting |
( |
bool |
enable | ) |
|
| void PandaFramework::set_perpixel |
( |
bool |
enable | ) |
|
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 | ) |
|
| void PandaFramework::set_two_sided |
( |
bool |
enable | ) |
|
| void PandaFramework::set_window_title |
( |
const string & |
title | ) |
[inline] |
| void PandaFramework::set_wireframe |
( |
bool |
enable | ) |
|
| int PandaFramework::show_collision_solids |
( |
NodePath |
node | ) |
[static] |
| AsyncTask::DoneStatus PandaFramework::task_clear_text |
( |
GenericAsyncTask * |
task, |
|
|
void * |
data |
|
) |
| [static] |
| AsyncTask::DoneStatus PandaFramework::task_data_loop |
( |
GenericAsyncTask * |
task, |
|
|
void * |
data |
|
) |
| [static] |
| AsyncTask::DoneStatus PandaFramework::task_event |
( |
GenericAsyncTask * |
task, |
|
|
void * |
data |
|
) |
| [static] |
| AsyncTask::DoneStatus PandaFramework::task_garbage_collect |
( |
GenericAsyncTask * |
task, |
|
|
void * |
data |
|
) |
| [static] |
| AsyncTask::DoneStatus PandaFramework::task_igloop |
( |
GenericAsyncTask * |
task, |
|
|
void * |
data |
|
) |
| [static] |
| AsyncTask::DoneStatus PandaFramework::task_play_frame |
( |
GenericAsyncTask * |
task, |
|
|
void * |
data |
|
) |
| [static] |
| AsyncTask::DoneStatus PandaFramework::task_record_frame |
( |
GenericAsyncTask * |
task, |
|
|
void * |
data |
|
) |
| [static] |
The documentation for this class was generated from the following files:
| | |