14#ifndef PANDAFRAMEWORK_H
15#define PANDAFRAMEWORK_H
38class EXPCL_FRAMEWORK PandaFramework {
41 virtual ~PandaFramework();
56 const std::string &description,
57 EventHandler::EventCallbackFunction *function,
71 INLINE WindowFramework *
get_window(
int n)
const;
121 virtual PT(WindowFramework) make_window_framework();
122 virtual void make_default_pipe();
123 virtual void do_enable_default_keys();
155 static AsyncTask::DoneStatus task_clear_screenshot_text(
GenericAsyncTask *task,
void *data);
165 bool _made_default_pipe;
167 std::string _window_title;
176 typedef pvector< PT(WindowFramework) > Windows;
188 bool _wireframe_enabled;
189 bool _texture_enabled;
190 bool _two_sided_enabled;
191 bool _lighting_enabled;
192 bool _perpixel_enabled;
193 WindowFramework::BackgroundType _background_type;
198 bool _default_keys_enabled;
202 class KeyDefinition {
204 std::string _event_name;
205 std::string _description;
207 typedef pvector<KeyDefinition> KeyDefinitions;
208 KeyDefinitions _key_definitions;
215 friend class WindowFramework;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
A class to monitor events from the C++ side of things.
A named event, possibly with parameters.
Associates a generic C-style function pointer with an AsyncTask object.
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
An object to create GraphicsOutputs that share a particular 3-D API.
Encapsulates all the communication with a particular instance of a given rendering backend.
Specifies parameters that may be passed to the loader.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
static int hide_collision_solids(NodePath node)
Hides any collision solids, or occluders, which are visible in the indicated scene graph.
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,...
static void event_window_event(const Event *, void *data)
Default handler for window events: window resized or closed, etc.
void set_background_type(WindowFramework::BackgroundType type)
Sets the background type of all windows.
void close_window(int n)
Closes the nth window and removes it from the list.
void remove_mouse(const GraphicsOutput *window)
Removes the mouse that may have been created by an earlier call to get_mouse().
static AsyncTask::DoneStatus task_event(GenericAsyncTask *task, void *data)
Called once per frame to process the pending events.
const NodePath & get_data_root() const
Returns the root of the data graph.
int find_window(const GraphicsOutput *win) const
Returns the index of the first WindowFramework object found that references the indicated GraphicsOut...
bool get_texture() const
Returns the current state of the texture flag.
void clear_highlight()
Unhighlights the currently highlighted node, if any.
void set_recorder(RecorderController *recorder)
Assigns a RecorderController with the PandaFramework.
static void event_S(const Event *, void *data)
Default handler for shift-S key: activate stats.
void set_two_sided(bool enable)
Sets the two_sided state on all windows.
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...
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.
GraphicsPipe * get_default_pipe()
Returns the default pipe.
void clear_exit_flag()
Resets the exit flag after it has previously been set.
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...
static void event_t(const Event *, void *data)
Default handler for t key: toggle texture.
WindowFramework * open_window()
Opens a window on the default graphics pipe.
static int show_collision_solids(NodePath node)
Shows any collision solids, or occluders, which are directly hidden in the indicated scene graph.
static void event_B(const Event *, void *data)
Default handler for shift-B key: describe the bounding volume of the currently selected object,...
void enable_default_keys()
Sets callbacks on the event handler to handle all of the normal viewer keys, like t to toggle texture...
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,...
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_L(const Event *, void *data)
Default handler for shift-L key: list the contents of the scene graph, or the highlighted node.
WindowFramework::BackgroundType get_background_type() const
Returns the current background type setting.
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.
void open_framework()
Should be called once at the beginning of the application to initialize Panda (and the framework) for...
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.
void reset_frame_rate()
Resets the frame rate computation.
void set_exit_flag()
Sets the flag that indicates it is time for the application to exit.
static void event_f(const Event *, void *data)
Default handler for f key: report and reset frame rate.
const NodePath & get_highlight() const
Returns the currently highlighted node, if any, or an empty NodePath if no node is highlighted.
void report_frame_rate(std::ostream &out) const
Reports the currently measured average frame rate to the indicated ostream.
static AsyncTask::DoneStatus task_clear_text(GenericAsyncTask *task, void *data)
Called once to remove the screenshot text from onscreen.
void set_window_title(const std::string &title)
Specifies the title that is set for all subsequently created windows.
static void event_i(const Event *, void *data)
Default handler for i key: invert one-sided faces.
static void event_a(const Event *, void *data)
Default handler for a key: toggle the animation controls.
int get_num_windows() const
Returns the number of windows that are currently open.
WindowFramework * get_window(int n) const
Returns the nth window currently open.
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 ...
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.
void set_wireframe(bool enable)
Sets the wireframe state on all windows.
static void event_f9(const Event *, void *data)
Default handler for f9 key: take screenshot.
GraphicsEngine * get_graphics_engine()
Returns the GraphicsEngine that is used to render all the windows in the framework.
static void event_question(const Event *event, void *data)
Default handler for ?
static void event_C(const Event *, void *data)
Default handler for shift-C key: toggle the showing of collision solids.
NodePath & get_models()
Returns the root of the scene graph normally reserved for parenting models and such.
void main_loop()
Called to yield control to the panda framework.
bool all_windows_closed() const
Returns true if all of the opened windows have been closed by the user, false otherwise.
static void event_h(const Event *, void *data)
Default handler for h key: toggle highlight mode.
virtual void get_default_window_props(WindowProperties &props)
Fills in the indicated window properties structure according to the normal window properties for this...
void set_texture(bool enable)
Sets the texture state on all windows.
static void event_comma(const Event *, void *data)
Default handler for comma key: rotate background color.
bool get_wireframe() const
Returns the current state of the wireframe flag.
void close_all_windows()
Closes all currently open windows and empties the list of windows.
static void event_w(const Event *, void *data)
Default handler for w key: toggle wireframe.
bool get_two_sided() const
Returns the current state of the two_sided flag.
static void event_p(const Event *, void *data)
Default handler for p key: toggle per-pixel lighting.
static void event_l(const Event *, void *data)
Default handler for l key: toggle lighting.
void set_lighting(bool enable)
Sets the lighting state on all windows.
static void event_b(const Event *, void *data)
Default handler for b key: toggle backface (two-sided rendering).
void set_perpixel(bool enable)
Sets the perpixel state on all windows.
NodePath get_mouse(GraphicsOutput *window)
Returns a NodePath to the MouseAndKeyboard associated with the indicated GraphicsWindow object.
void set_highlight(const NodePath &node)
Sets the indicated node (normally a node within the get_models() tree) up as the highlighted node.
EventHandler & get_event_handler()
Returns the EventHandler object that serves events in the framework.
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_c(const Event *, void *data)
Default handler for c key: center the trackball over the scene, or over the highlighted part of the s...
static AsyncTask::DoneStatus task_garbage_collect(GenericAsyncTask *task, void *data)
This task is created automatically if garbage_collect_states is true.
void close_framework()
Should be called at the end of an application to close Panda.
AsyncTaskManager & get_task_mgr()
Returns the Task Manager object that manages tasks in the framework.
virtual bool do_frame(Thread *current_thread)
Renders one frame and performs all associated processing.
static AsyncTask::DoneStatus task_igloop(GenericAsyncTask *task, void *data)
Called once per frame to render the scene.
bool get_lighting() const
Returns the current state of the lighting flag.
bool has_highlight() const
Returns true if any node is highlighted, false otherwise.
This object manages the process of recording the user's runtime inputs to a bam file so that the sess...
A thread; that is, a lightweight process.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.