Panda3D
Loading...
Searching...
No Matches
PandaFramework Class Reference

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"

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 std::string &event_name, const std::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 NodePathget_data_root () const
 Returns the root of the data graph.
 
GraphicsPipeget_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.
 
EventHandlerget_event_handler ()
 Returns the EventHandler object that serves events in the framework.
 
GraphicsEngineget_graphics_engine ()
 Returns the GraphicsEngine that is used to render all the windows in the framework.
 
const NodePathget_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.
 
NodePathget_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.
 
RecorderControllerget_recorder () const
 Returns the RecorderController that has been associated with the PandaFramework, if any, or NULL if none has (the normal case).
 
AsyncTaskManagerget_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.
 
WindowFrameworkget_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 ()
 Should be called once at the beginning of the application to initialize Panda (and the framework) for use.
 
void open_framework (int &argc, char **&argv)
 
WindowFrameworkopen_window ()
 Opens a window on the default graphics pipe.
 
WindowFrameworkopen_window (const WindowProperties &props, int flags, GraphicsPipe *pipe=nullptr, GraphicsStateGuardian *gsg=nullptr)
 Opens a new window using the indicated properties.
 
WindowFrameworkopen_window (GraphicsPipe *pipe, GraphicsStateGuardian *gsg=nullptr)
 Opens a new window on the indicated pipe, using the default parameters.
 
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 (std::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 std::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 shift-A key: analyze the contents of the scene graph, or the highlighted node.
 
static void event_a (const Event *, void *data)
 Default handler for a key: toggle the animation controls.
 
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 shift-B key: describe the bounding volume of the currently selected object, or the entire scene.
 
static void event_b (const Event *, void *data)
 Default handler for b key: toggle backface (two-sided rendering).
 
static void event_C (const Event *, void *data)
 Default handler for shift-C key: toggle the showing of collision solids.
 
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_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 shift-L key: list the contents of the scene graph, or the highlighted node.
 
static void event_l (const Event *, void *data)
 Default handler for l key: toggle lighting.
 
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 ?
 
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
 

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 38 of file pandaFramework.h.

Constructor & Destructor Documentation

◆ PandaFramework()

PandaFramework::PandaFramework ( )

Definition at line 47 of file pandaFramework.cxx.

◆ ~PandaFramework()

PandaFramework::~PandaFramework ( )
virtual

Definition at line 71 of file pandaFramework.cxx.

Member Function Documentation

◆ all_windows_closed()

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 520 of file pandaFramework.cxx.

References WindowFramework::get_graphics_output(), and GraphicsOutput::is_valid().

Referenced by event_esc(), and event_window_event().

◆ clear_exit_flag()

void PandaFramework::clear_exit_flag ( )
inline

Resets the exit flag after it has previously been set.

Definition at line 196 of file pandaFramework.I.

◆ clear_highlight()

void PandaFramework::clear_highlight ( )

Unhighlights the currently highlighted node, if any.

Definition at line 723 of file pandaFramework.cxx.

Referenced by event_h(), and set_highlight().

◆ close_all_windows()

void PandaFramework::close_all_windows ( )

Closes all currently open windows and empties the list of windows.

Definition at line 493 of file pandaFramework.cxx.

References WindowFramework::get_graphics_output().

Referenced by close_framework().

◆ 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 177 of file pandaFramework.cxx.

References close_all_windows(), and Thread::prepare_for_exit().

◆ close_window() [1/2]

void PandaFramework::close_window ( int n)

Closes the nth window and removes it from the list.

Definition at line 476 of file pandaFramework.cxx.

References WindowFramework::get_graphics_output().

Referenced by close_window(), event_esc(), and event_window_event().

◆ close_window() [2/2]

void PandaFramework::close_window ( WindowFramework * wf)
inline

Closes the indicated WindowFramework window and removes it from the list.

Definition at line 84 of file pandaFramework.I.

References close_window(), and find_window().

◆ define_key()

void PandaFramework::define_key ( const std::string & event_name,
const std::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 286 of file pandaFramework.cxx.

◆ do_frame()

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 749 of file pandaFramework.cxx.

Referenced by main_loop().

◆ enable_default_keys()

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 736 of file pandaFramework.cxx.

◆ event_A()

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 1078 of file pandaFramework.cxx.

References SceneGraphAnalyzer::add_node(), get_highlight(), get_models(), NodePath::is_empty(), NodePath::node(), and SceneGraphAnalyzer::write().

◆ event_a()

void PandaFramework::event_a ( const Event * event,
void * data )
static

Default handler for a key: toggle the animation controls.

Definition at line 1014 of file pandaFramework.cxx.

References EventParameter::get_ptr(), and WindowFramework::next_anim_control().

◆ event_arrow_down()

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 1127 of file pandaFramework.cxx.

References NodePath::get_child(), get_highlight(), NodePath::get_num_children(), has_highlight(), and set_highlight().

◆ event_arrow_left()

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 1143 of file pandaFramework.cxx.

References PandaNode::find_child(), PandaNode::get_child, get_highlight(), get_models(), NodePath::get_parent, has_highlight(), NodePath::has_parent, NodePath::node(), and set_highlight().

◆ event_arrow_right()

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 1165 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, NodePath::node(), and set_highlight().

◆ event_arrow_up()

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 1111 of file pandaFramework.cxx.

References get_highlight(), get_models(), NodePath::get_parent, has_highlight(), NodePath::has_parent, and set_highlight().

◆ event_B()

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 1046 of file pandaFramework.cxx.

References NodePath::get_bounds(), get_highlight(), get_models(), and NodePath::is_empty().

◆ event_b()

void PandaFramework::event_b ( const Event * event,
void * data )
static

Default handler for b key: toggle backface (two-sided rendering).

Definition at line 937 of file pandaFramework.cxx.

References EventParameter::get_ptr(), WindowFramework::get_two_sided(), and WindowFramework::set_two_sided().

◆ event_C()

void PandaFramework::event_C ( const Event * ,
void * data )
static

Default handler for shift-C key: toggle the showing of collision solids.

Definition at line 1028 of file pandaFramework.cxx.

References get_highlight(), get_models(), hide_collision_solids(), NodePath::is_empty(), and show_collision_solids().

◆ event_c()

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 994 of file pandaFramework.cxx.

References WindowFramework::center_trackball(), get_highlight(), get_models(), EventParameter::get_ptr(), and NodePath::is_empty().

◆ event_comma()

void PandaFramework::event_comma ( const Event * event,
void * data )
static

Default handler for comma key: rotate background color.

Definition at line 1247 of file pandaFramework.cxx.

References WindowFramework::get_background_type(), EventParameter::get_ptr(), and WindowFramework::set_background_type().

◆ event_esc()

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 858 of file pandaFramework.cxx.

References all_windows_closed(), close_window(), find_window(), WindowFramework::get_graphics_output(), EventParameter::get_ptr(), and remove_mouse().

◆ event_f()

void PandaFramework::event_f ( const Event * ,
void * data )
static

Default handler for f key: report and reset frame rate.

Definition at line 893 of file pandaFramework.cxx.

References report_frame_rate(), and reset_frame_rate().

◆ event_f9()

◆ event_h()

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 1096 of file pandaFramework.cxx.

References clear_highlight(), get_models(), has_highlight(), and set_highlight().

◆ event_i()

void PandaFramework::event_i ( const Event * event,
void * data )
static

Default handler for i key: invert one-sided faces.

Definition at line 951 of file pandaFramework.cxx.

References WindowFramework::get_one_sided_reverse(), EventParameter::get_ptr(), and WindowFramework::set_one_sided_reverse().

◆ event_L()

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 1062 of file pandaFramework.cxx.

References get_highlight(), get_models(), NodePath::is_empty(), and NodePath::ls().

◆ event_l()

void PandaFramework::event_l ( const Event * event,
void * data )
static

Default handler for l key: toggle lighting.

Definition at line 965 of file pandaFramework.cxx.

References WindowFramework::get_lighting(), EventParameter::get_ptr(), and WindowFramework::set_lighting().

◆ event_p()

void PandaFramework::event_p ( const Event * event,
void * data )
static

Default handler for p key: toggle per-pixel lighting.

Definition at line 979 of file pandaFramework.cxx.

References WindowFramework::get_perpixel(), EventParameter::get_ptr(), and WindowFramework::set_perpixel().

◆ event_question()

void PandaFramework::event_question ( const Event * event,
void * data )
static

◆ event_S()

void PandaFramework::event_S ( const Event * ,
void * data )
static

Default handler for shift-S key: activate stats.

Definition at line 1187 of file pandaFramework.cxx.

◆ event_t()

void PandaFramework::event_t ( const Event * event,
void * data )
static

Default handler for t key: toggle texture.

Definition at line 923 of file pandaFramework.cxx.

References EventParameter::get_ptr(), WindowFramework::get_texture(), and WindowFramework::set_texture().

◆ event_w()

void PandaFramework::event_w ( const Event * event,
void * data )
static

◆ event_window_event()

void PandaFramework::event_window_event ( const Event * event,
void * data )
static

Default handler for window events: window resized or closed, etc.

Definition at line 1325 of file pandaFramework.cxx.

References all_windows_closed(), close_window(), find_window(), EventParameter::get_ptr(), GraphicsOutput::is_valid(), and remove_mouse().

Referenced by open_framework().

◆ find_window() [1/2]

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 444 of file pandaFramework.cxx.

Referenced by close_window(), event_esc(), and event_window_event().

◆ find_window() [2/2]

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 460 of file pandaFramework.cxx.

◆ get_background_type()

WindowFramework::BackgroundType PandaFramework::get_background_type ( ) const
inline

Returns the current background type setting.

Definition at line 135 of file pandaFramework.I.

Referenced by open_window().

◆ get_data_root()

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 34 of file pandaFramework.I.

Referenced by get_mouse().

◆ get_default_pipe()

GraphicsPipe * PandaFramework::get_default_pipe ( )

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 221 of file pandaFramework.cxx.

Referenced by open_window(), and open_window().

◆ get_default_window_props()

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 319 of file pandaFramework.cxx.

References WindowProperties::add_properties(), WindowProperties::get_default, and WindowProperties::set_title.

Referenced by open_window().

◆ get_event_handler()

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 43 of file pandaFramework.I.

◆ get_graphics_engine()

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 18 of file pandaFramework.I.

References task_igloop().

Referenced by open_window().

◆ get_highlight()

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 152 of file pandaFramework.I.

Referenced by event_A(), event_arrow_down(), event_arrow_left(), event_arrow_right(), event_arrow_up(), event_B(), event_C(), event_c(), and event_L().

◆ get_lighting()

bool PandaFramework::get_lighting ( ) const
inline

Returns the current state of the lighting flag.

Definition at line 119 of file pandaFramework.I.

Referenced by open_window().

◆ get_models()

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 538 of file pandaFramework.cxx.

Referenced by event_A(), event_arrow_left(), event_arrow_right(), event_arrow_up(), event_B(), event_C(), event_c(), event_h(), and event_L().

◆ get_mouse()

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 239 of file pandaFramework.cxx.

References RecorderController::add_recorder(), NodePath::attach_new_node(), NodePath::find(), get_data_root(), get_recorder(), and TypedObject::is_of_type().

◆ get_num_windows()

int PandaFramework::get_num_windows ( ) const
inline

Returns the number of windows that are currently open.

Definition at line 67 of file pandaFramework.I.

◆ get_perpixel()

bool PandaFramework::get_perpixel ( ) const
inline

Returns the current state of the perpixel flag.

Definition at line 127 of file pandaFramework.I.

Referenced by open_window().

◆ get_recorder()

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 165 of file pandaFramework.I.

Referenced by get_mouse().

◆ get_task_mgr()

AsyncTaskManager & PandaFramework::get_task_mgr ( )
inline

Returns the Task Manager object that manages tasks in the framework.

Definition at line 51 of file pandaFramework.I.

◆ get_texture()

bool PandaFramework::get_texture ( ) const
inline

Returns the current state of the texture flag.

Definition at line 103 of file pandaFramework.I.

Referenced by open_window().

◆ get_two_sided()

bool PandaFramework::get_two_sided ( ) const
inline

Returns the current state of the two_sided flag.

Definition at line 111 of file pandaFramework.I.

Referenced by open_window().

◆ get_window()

WindowFramework * PandaFramework::get_window ( int n) const
inline

Returns the nth window currently open.

Definition at line 75 of file pandaFramework.I.

◆ get_wireframe()

bool PandaFramework::get_wireframe ( ) const
inline

Returns the current state of the wireframe flag.

Definition at line 95 of file pandaFramework.I.

Referenced by open_window().

◆ has_highlight()

bool PandaFramework::has_highlight ( ) const
inline

Returns true if any node is highlighted, false otherwise.

Definition at line 143 of file pandaFramework.I.

Referenced by event_arrow_down(), event_arrow_left(), event_arrow_right(), event_arrow_up(), and event_h().

◆ hide_collision_solids()

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 660 of file pandaFramework.cxx.

References NodePath::get_child(), NodePath::get_num_children(), NodePath::hide(), hide_collision_solids(), NodePath::is_hidden(), TypedObject::is_of_type(), and NodePath::node().

Referenced by event_C(), and hide_collision_solids().

◆ main_loop()

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 762 of file pandaFramework.cxx.

References do_frame(), and Thread::get_current_thread.

◆ open_framework() [1/2]

void PandaFramework::open_framework ( )

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 84 of file pandaFramework.cxx.

References RecorderController::begin_playback(), RecorderController::begin_record(), event_window_event(), init_libchar(), init_libpandadx9(), init_libpandaegg(), init_libpandagl(), init_libpnmimagetypes(), reset_frame_rate(), task_data_loop(), task_event(), task_garbage_collect(), task_play_frame(), and task_record_frame().

Referenced by MayaPview::doIt(), and open_framework().

◆ open_framework() [2/2]

void PandaFramework::open_framework ( int & argc,
char **& argv )

Definition at line 168 of file pandaFramework.cxx.

References open_framework().

◆ open_window() [1/3]

WindowFramework * PandaFramework::open_window ( )

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 336 of file pandaFramework.cxx.

References get_default_pipe(), GraphicsPipeSelection::get_global_ptr(), GraphicsPipeSelection::get_num_pipe_types, GraphicsPipeSelection::get_pipe_type, GraphicsPipeSelection::load_aux_modules(), and open_window().

Referenced by open_window(), and open_window().

◆ open_window() [2/3]

WindowFramework * PandaFramework::open_window ( const WindowProperties & props,
int flags,
GraphicsPipe * pipe = nullptr,
GraphicsStateGuardian * gsg = nullptr )

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 399 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().

◆ open_window() [3/3]

WindowFramework * PandaFramework::open_window ( GraphicsPipe * pipe,
GraphicsStateGuardian * gsg = nullptr )

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 377 of file pandaFramework.cxx.

References get_default_window_props(), and open_window().

◆ remove_mouse()

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 272 of file pandaFramework.cxx.

References NodePath::find().

Referenced by event_esc(), and event_window_event().

◆ report_frame_rate()

void PandaFramework::report_frame_rate ( std::ostream & out) const

Reports the currently measured average frame rate to the indicated ostream.

Definition at line 549 of file pandaFramework.cxx.

References ClockObject::get_frame_count, ClockObject::get_frame_time, and ClockObject::get_global_clock().

Referenced by event_f().

◆ reset_frame_rate()

void PandaFramework::reset_frame_rate ( )

Resets the frame rate computation.

Definition at line 566 of file pandaFramework.cxx.

References ClockObject::get_frame_count, ClockObject::get_frame_time, and ClockObject::get_global_clock().

Referenced by event_f(), and open_framework().

◆ set_background_type()

void PandaFramework::set_background_type ( WindowFramework::BackgroundType type)

Sets the background type of all windows.

Definition at line 645 of file pandaFramework.cxx.

References WindowFramework::set_background_type().

◆ set_exit_flag()

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 188 of file pandaFramework.I.

◆ set_highlight()

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 709 of file pandaFramework.cxx.

References clear_highlight().

Referenced by event_arrow_down(), event_arrow_left(), event_arrow_right(), event_arrow_up(), and event_h().

◆ set_lighting()

void PandaFramework::set_lighting ( bool enable)

Sets the lighting state on all windows.

Definition at line 617 of file pandaFramework.cxx.

References WindowFramework::set_lighting().

◆ set_perpixel()

void PandaFramework::set_perpixel ( bool enable)

Sets the perpixel state on all windows.

Definition at line 631 of file pandaFramework.cxx.

References WindowFramework::set_perpixel().

◆ set_recorder()

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 179 of file pandaFramework.I.

◆ set_texture()

void PandaFramework::set_texture ( bool enable)

Sets the texture state on all windows.

Definition at line 589 of file pandaFramework.cxx.

References WindowFramework::set_texture().

◆ set_two_sided()

void PandaFramework::set_two_sided ( bool enable)

Sets the two_sided state on all windows.

Definition at line 603 of file pandaFramework.cxx.

References WindowFramework::set_two_sided().

◆ set_window_title()

void PandaFramework::set_window_title ( const std::string & title)
inline

Specifies the title that is set for all subsequently created windows.

Definition at line 59 of file pandaFramework.I.

◆ set_wireframe()

void PandaFramework::set_wireframe ( bool enable)

Sets the wireframe state on all windows.

Definition at line 575 of file pandaFramework.cxx.

References WindowFramework::set_wireframe().

◆ show_collision_solids()

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 684 of file pandaFramework.cxx.

References NodePath::get_child(), NodePath::get_hidden_ancestor(), NodePath::get_num_children(), TypedObject::is_of_type(), NodePath::node(), NodePath::show(), and show_collision_solids().

Referenced by event_C(), and show_collision_solids().

◆ task_clear_text()

AsyncTask::DoneStatus PandaFramework::task_clear_text ( GenericAsyncTask * task,
void * data )
static

Called once to remove the screenshot text from onscreen.

Definition at line 1452 of file pandaFramework.cxx.

Referenced by event_f9().

◆ task_data_loop()

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 1376 of file pandaFramework.cxx.

References NodePath::node(), and DataGraphTraverser::traverse().

Referenced by open_framework().

◆ task_event()

AsyncTask::DoneStatus PandaFramework::task_event ( GenericAsyncTask * task,
void * data )
static

Called once per frame to process the pending events.

Definition at line 1389 of file pandaFramework.cxx.

References EventHandler::process_events().

Referenced by open_framework().

◆ task_garbage_collect()

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 1465 of file pandaFramework.cxx.

References RenderState::garbage_collect(), and TransformState::garbage_collect().

Referenced by open_framework().

◆ task_igloop()

AsyncTask::DoneStatus PandaFramework::task_igloop ( GenericAsyncTask * task,
void * data )
static

Called once per frame to render the scene.

Definition at line 1402 of file pandaFramework.cxx.

Referenced by get_graphics_engine().

◆ task_play_frame()

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 1438 of file pandaFramework.cxx.

Referenced by open_framework().

◆ task_record_frame()

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 1423 of file pandaFramework.cxx.

Referenced by open_framework().

Friends And Related Symbol Documentation

◆ WindowFramework

friend class WindowFramework
friend

Definition at line 215 of file pandaFramework.h.

Member Data Documentation

◆ _loader_options

LoaderOptions PandaFramework::_loader_options
static

Definition at line 118 of file pandaFramework.h.


The documentation for this class was generated from the following files: