Go to the documentation of this file.
34 #ifdef LINK_ALL_STATIC
49 _event_handler(*
EventHandler::get_global_event_handler()),
53 _made_default_pipe =
false;
54 _window_title = string();
58 _wireframe_enabled =
false;
59 _texture_enabled =
true;
60 _two_sided_enabled =
false;
61 _lighting_enabled =
false;
62 _perpixel_enabled =
false;
63 _background_type = WindowFramework::BT_default;
64 _default_keys_enabled =
false;
92 #ifdef LINK_ALL_STATIC
98 #elif defined(HAVE_DX9)
101 #elif defined(HAVE_TINYDISPLAY)
102 extern EXPCL_TINYDISPLAY
void init_libtinydisplay();
103 init_libtinydisplay();
135 if (garbage_collect_states) {
141 if (!playback_session.empty()) {
151 }
else if (!record_session.empty()) {
185 if (_engine !=
nullptr) {
186 _engine->remove_all_windows();
193 _made_default_pipe =
false;
194 _default_pipe.clear();
198 _wireframe_enabled =
false;
199 _two_sided_enabled =
false;
200 _lighting_enabled =
false;
201 _default_keys_enabled =
false;
221 nassertr(_is_open,
nullptr);
222 if (!_made_default_pipe) {
224 _made_default_pipe =
true;
226 return _default_pipe;
239 Mouses::iterator mi = _mouses.find(window);
240 if (mi != _mouses.end()) {
246 if (window->
is_of_type(GraphicsWindow::get_class_type())) {
253 if (recorder !=
nullptr) {
261 _mouses[window] = mouse;
272 Mouses::iterator mi = _mouses.find(window);
273 if (mi != _mouses.end()) {
274 (*mi).second.remove_node();
285 define_key(
const string &event_name,
const string &description,
286 EventHandler::EventCallbackFunction *
function,
288 if (_event_handler.
has_hook(event_name)) {
292 KeyDefinitions::iterator di;
293 di = _key_definitions.begin();
294 while (di != _key_definitions.end() && (*di)._event_name != event_name) {
297 if (di != _key_definitions.end()) {
298 _key_definitions.erase(di);
303 _event_handler.
add_hook(event_name,
function, data);
305 if (!description.empty()) {
306 KeyDefinition keydef;
307 keydef._event_name = event_name;
308 keydef._description = description;
309 _key_definitions.push_back(keydef);
323 if (!_window_title.empty()) {
337 if (pipe ==
nullptr) {
349 for (
int i = 0; i < num_pipe_types; i++) {
351 if (pipe_type != _default_pipe->get_type()) {
352 PT(
GraphicsPipe) new_pipe = selection->make_pipe(pipe_type);
353 if (new_pipe !=
nullptr) {
357 _default_pipe = new_pipe;
377 nassertr(_is_open,
nullptr);
382 int flags = GraphicsPipe::BF_require_window;
383 if (window_type ==
"offscreen") {
384 flags = GraphicsPipe::BF_refuse_window;
400 if (pipe ==
nullptr) {
402 if (pipe ==
nullptr) {
408 nassertr(_is_open,
nullptr);
419 _engine->open_windows();
420 if (win !=
nullptr && !win->
is_valid()) {
422 _engine->remove_window(win);
427 if (win ==
nullptr) {
429 framework_cat.error()
430 <<
"Unable to create window.\n";
434 _windows.push_back(wf);
445 for (n = 0; n < (int)_windows.size(); n++) {
446 if (_windows[n]->get_graphics_output() == win) {
461 for (n = 0; n < (int)_windows.size(); n++) {
462 if (_windows[n] == wf) {
476 nassertv(n >= 0 && n < (
int)_windows.size());
480 if (win !=
nullptr) {
481 _engine->remove_window(win);
485 _windows.erase(_windows.begin() + n);
493 Windows::iterator wi;
494 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
498 if (win !=
nullptr) {
499 _engine->remove_window(win);
506 for (mi = _mouses.begin(); mi != _mouses.end(); ++mi) {
507 (*mi).second.remove_node();
520 Windows::const_iterator wi;
521 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
550 double delta = now - _start_time;
553 int num_frames = frame_count - _frame_count;
554 if (num_frames > 0) {
555 out << num_frames <<
" frames in " << delta <<
" seconds.\n";
556 double fps = ((double)num_frames) / delta;
557 out << fps <<
" fps average (" << 1000.0 / fps <<
"ms)\n";
575 Windows::iterator wi;
576 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
581 _wireframe_enabled = enable;
589 Windows::iterator wi;
590 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
595 _texture_enabled = enable;
603 Windows::iterator wi;
604 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
609 _two_sided_enabled = enable;
617 Windows::iterator wi;
618 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
623 _lighting_enabled = enable;
631 Windows::iterator wi;
632 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
637 _perpixel_enabled = enable;
645 Windows::iterator wi;
646 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
651 _background_type = type;
671 for (
int i = 0; i < num_children; i++) {
695 for (
int i = 0; i < num_children; i++) {
712 framework_cat.info(
false) << _highlight <<
"\n";
736 if (!_default_keys_enabled) {
737 do_enable_default_keys();
738 _default_keys_enabled =
true;
749 nassertr(_is_open,
false);
772 make_window_framework() {
780 void PandaFramework::
781 make_default_pipe() {
787 if (print_pipe_types) {
791 _default_pipe = selection->make_default_pipe();
793 if (_default_pipe ==
nullptr) {
794 nout <<
"No graphics pipe is available!\n"
795 <<
"Your Config.prc file must name at least one valid panda display\n"
796 <<
"library via load-display or aux-display.\n";
803 void PandaFramework::
804 do_enable_default_keys() {
836 bool PandaFramework::
838 bool any_text =
false;
858 if (event->get_num_parameters() == 1) {
861 DCAST_INTO_V(wf, param.
get_ptr());
866 self->close_window(wf);
869 int window_index =
self->find_window(win);
870 while (window_index != -1) {
871 self->close_window(window_index);
872 window_index =
self->find_window(win);
876 self->remove_mouse(win);
879 self->_engine->open_windows();
882 if (self->all_windows_closed()) {
883 self->_exit_flag =
true;
894 self->report_frame_rate(nout);
895 self->reset_frame_rate();
903 if (event->get_num_parameters() == 1) {
906 DCAST_INTO_V(wf, param.
get_ptr());
923 if (event->get_num_parameters() == 1) {
926 DCAST_INTO_V(wf, param.
get_ptr());
937 if (event->get_num_parameters() == 1) {
940 DCAST_INTO_V(wf, param.
get_ptr());
951 if (event->get_num_parameters() == 1) {
954 DCAST_INTO_V(wf, param.
get_ptr());
965 if (event->get_num_parameters() == 1) {
968 DCAST_INTO_V(wf, param.
get_ptr());
979 if (event->get_num_parameters() == 1) {
982 DCAST_INTO_V(wf, param.
get_ptr());
994 if (event->get_num_parameters() == 1) {
997 DCAST_INTO_V(wf, param.
get_ptr());
1001 NodePath node =
self->get_highlight();
1003 node =
self->get_models();
1014 if (event->get_num_parameters() == 1) {
1017 DCAST_INTO_V(wf, param.
get_ptr());
1030 NodePath node =
self->get_highlight();
1032 node =
self->get_models();
1035 if (self->hide_collision_solids(node) == 0) {
1036 self->show_collision_solids(node);
1048 NodePath node =
self->get_highlight();
1050 node =
self->get_models();
1053 node.get_bounds()->write(nout);
1064 NodePath node =
self->get_highlight();
1066 node =
self->get_models();
1080 NodePath node =
self->get_highlight();
1082 node =
self->get_models();
1098 if (self->has_highlight()) {
1099 self->clear_highlight();
1101 self->set_highlight(self->get_models());
1113 if (self->has_highlight()) {
1114 NodePath node =
self->get_highlight();
1115 if (node.
has_parent() && node !=
self->get_models()) {
1129 if (self->has_highlight()) {
1130 NodePath node =
self->get_highlight();
1145 if (self->has_highlight()) {
1146 NodePath node =
self->get_highlight();
1148 if (node.
has_parent() && node !=
self->get_models()) {
1150 nassertv(index >= 0);
1151 int sibling = index - 1;
1167 if (self->has_highlight()) {
1168 NodePath node =
self->get_highlight();
1170 if (node.
has_parent() && node !=
self->get_models()) {
1172 nassertv(index >= 0);
1174 int sibling = index + 1;
1175 if (sibling < num_children) {
1188 nout <<
"Connecting to stats host" << std::endl;
1189 PStatClient::connect();
1191 nout <<
"Stats host not supported." << std::endl;
1202 if (event->get_num_parameters() == 1) {
1205 DCAST_INTO_V(wf, param.
get_ptr());
1207 if (self->clear_text()) {
1209 self->_engine->render_frame();
1214 if (filename.empty()) {
1215 text =
"Screenshot failed";
1224 self->_screenshot_text =
NodePath(text_node);
1225 text_node->set_align(TextNode::A_center);
1226 text_node->set_shadow_color(0.0f, 0.0f, 0.0f, 1.0f);
1229 self->_screenshot_text.set_scale(0.06);
1230 self->_screenshot_text.set_pos(0.0, 0.0, -0.7);
1232 std::cout <<
"Screenshot saved: " + output_text +
"\n";
1235 self->_task_mgr.remove(self->_task_mgr.find_tasks(
"clear_text"));
1237 task->set_delay(3.0);
1238 self->_task_mgr.add(task);
1247 if (event->get_num_parameters() == 1) {
1250 DCAST_INTO_V(wf, param.
get_ptr());
1253 case WindowFramework::BT_other:
1254 case WindowFramework::BT_none:
1257 case WindowFramework::BT_white:
1273 if (event->get_num_parameters() == 1) {
1276 DCAST_INTO_V(wf, param.
get_ptr());
1278 self->_screenshot_text.remove_node();
1280 if (!self->_help_text.is_empty()) {
1281 self->_help_text.remove_node();
1286 std::ostringstream help;
1287 KeyDefinitions::const_iterator ki;
1288 for (ki = self->_key_definitions.begin();
1289 ki != self->_key_definitions.end();
1291 const KeyDefinition &keydef = (*ki);
1292 help << keydef._event_name <<
"\t" << keydef._description <<
"\n";
1295 string help_text = help.str();
1298 self->_help_text =
NodePath(text_node);
1299 text_node->set_align(TextNode::A_left);
1300 text_node->set_shadow_color(0.0f, 0.0f, 0.0f, 1.0f);
1306 PN_stdfloat height = frame[3] - frame[2];
1307 PN_stdfloat scale = std::min(0.06, 1.8 / height);
1308 self->_help_text.set_scale(scale);
1310 PN_stdfloat pos_scale = scale / -2.0;
1311 self->_help_text.set_pos((frame[0] + frame[1]) * pos_scale,
1313 (frame[2] + frame[3]) * pos_scale);
1326 if (event->get_num_parameters() == 1) {
1332 DCAST_INTO_V(win, param.
get_ptr());
1335 int window_index =
self->find_window(win);
1336 if (window_index == -1) {
1337 framework_cat.debug()
1338 <<
"Ignoring message from unknown window.\n";
1343 int window_index =
self->find_window(win);
1344 while (window_index != -1) {
1345 self->close_window(window_index);
1346 window_index =
self->find_window(win);
1350 self->remove_mouse(win);
1353 if (self->all_windows_closed() && !self->_exit_flag) {
1354 framework_cat.info()
1355 <<
"Last window was closed by user.\n";
1356 self->_exit_flag =
true;
1360 for (
int n = 0; n < (int)self->_windows.size(); n++) {
1361 if (self->_windows[n]->get_graphics_output() == win) {
1362 self->_windows[n]->adjust_dimensions();
1379 dg_trav.
traverse(self->_data_root.node());
1381 return AsyncTask::DS_cont;
1391 throw_event(
"NewFrame");
1392 self->_event_handler.process_events();
1394 return AsyncTask::DS_cont;
1409 if (engine !=
nullptr) {
1410 engine->render_frame();
1411 return AsyncTask::DS_cont;
1413 return AsyncTask::DS_done;
1425 if (self->_recorder !=
nullptr) {
1426 self->_recorder->record_frame();
1429 return AsyncTask::DS_cont;
1440 if (self->_recorder !=
nullptr) {
1441 self->_recorder->play_frame();
1444 return AsyncTask::DS_cont;
1455 return AsyncTask::DS_cont;
1465 TransformState::garbage_collect();
1467 return AsyncTask::DS_cont;
BackgroundType get_background_type() const
Returns the current background type setting.
void set_two_sided(bool enable)
Sets the two_sided state on all windows.
NodePath get_child(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns a NodePath representing the nth child of the referenced node.
static void event_i(const Event *, void *data)
Default handler for i key: invert one-sided faces.
bool begin_record(const Filename &filename)
Begins recording data to the indicated filename.
get_cwd
Returns the name of the current working directory.
bool is_hidden(DrawMask camera_mask=PandaNode::get_overall_bit()) const
Returns true if the referenced node is hidden from the indicated camera(s) either directly,...
void load_aux_modules()
Loads all the modules named in the aux-display Configrc variable, making as many graphics pipes as po...
static void event_window_event(const Event *, void *data)
Default handler for window events: window resized or closed, etc.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_two_sided(bool enable)
Forces two-sided rendering (true) or restores default rendering (false).
GraphicsOutput * get_graphics_output() const
Returns a pointer to the underlying GraphicsOutput object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void event_t(const Event *, void *data)
Default handler for t key: toggle texture.
void report_frame_rate(std::ostream &out) const
Reports the currently measured average frame rate to the indicated ostream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_render_mode_filled_wireframe(const LColor &wireframe_color, int priority=0)
Sets up the geometry at this level and below (unless overridden) to render in filled,...
Reads the mouse and/or keyboard data sent from a GraphicsWindow, and transmits it down the data graph...
void open_framework()
Should be called once at the beginning of the application to initialize Panda (and the framework) for...
static void event_b(const Event *, void *data)
Default handler for b key: toggle backface (two-sided rendering).
static void event_w(const Event *, void *data)
Default handler for w key: toggle wireframe.
static void event_comma(const Event *, void *data)
Default handler for comma key: rotate background color.
static Filename from_os_specific(const std::string &os_specific, Type type=T_general)
This named constructor returns a Panda-style filename (that is, using forward slashes,...
bool get_texture() const
Returns the current state of the texture flag.
bool is_valid() const
Returns true if the output is fully created and ready for rendering, false otherwise.
void init_libpnmimagetypes()
Initializes the library.
void init_libpandaegg()
Initializes the library.
void traverse(PandaNode *node)
Starts the traversal of the data graph at the indicated root node.
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...
PT(WindowFramework) PandaFramework
Creates a new WindowFramework object.
bool get_wireframe() const
Returns the current state of the wireframe flag.
virtual bool do_frame(Thread *current_thread)
Renders one frame and performs all associated processing.
LVecBase4 get_frame_actual() const
Returns the actual dimensions of the frame around the text.
has_parent
Returns true if the referenced node has a parent; i.e.
WindowFramework::BackgroundType get_background_type() const
Returns the current background type setting.
Associates a generic C-style function pointer with an AsyncTask object.
This encapsulates the data that is normally associated with a single window, or with a single display...
GraphicsEngine * get_graphics_engine()
Returns the GraphicsEngine that is used to render all the windows in the framework.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static AsyncTask::DoneStatus task_event(GenericAsyncTask *task, void *data)
Called once per frame to process the pending events.
bool get_perpixel() const
Returns the current state of the perpixel flag.
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,...
void set_one_sided_reverse(bool enable)
Toggles one-sided reverse mode.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_libchar()
Initializes the library.
int find_child(PandaNode *node, Thread *current_thread=Thread::get_current_thread()) const
Returns the index of the indicated child node, if it is a child, or -1 if it is not.
void center_trackball(const NodePath &object)
Centers the trackball on the indicated object, and scales the trackball motion suitably.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
static void event_a(const Event *, void *data)
Default handler for a key: toggle the animation controls.
void next_anim_control()
Rotates the animation controls through all of the available animations.
static AsyncTask::DoneStatus task_garbage_collect(GenericAsyncTask *task, void *data)
This task is created automatically if garbage_collect_states is true.
void write(std::ostream &out, int indent_level=0) const
Describes all the data collected.
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 int hide_collision_solids(NodePath node)
Hides any collision solids, or occluders, which are visible in the indicated scene graph.
void enable_default_keys()
Sets callbacks on the event handler to handle all of the normal viewer keys, like t to toggle texture...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_parent
Returns the NodePath to the parent of the referenced node: that is, this NodePath,...
int get_num_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of children of the referenced node.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
The primary interface to this module.
bool get_two_sided() const
Returns the current state of the two_sided flag.
Specifies parameters that may be passed to the loader.
TypedWritableReferenceCount * get_ptr() const
Retrieves a pointer to the actual value stored in the parameter.
This object manages the process of recording the user's runtime inputs to a bam file so that the sess...
static void event_f(const Event *, void *data)
Default handler for f key: report and reset frame rate.
void set_texture(bool enable)
Sets the texture state on all windows.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void print_pipe_types() const
Writes a list of the currently known GraphicsPipe types to nout, for the user's information.
static AsyncTask::DoneStatus task_igloop(GenericAsyncTask *task, void *data)
Called once per frame to render the scene.
This class is the main interface to controlling the render process.
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.
get_current_thread
Returns a pointer to the currently-executing Thread object.
void add_properties(const WindowProperties &other)
Sets any properties that are explicitly specified in other on this object.
void set_background_type(BackgroundType type)
Sets the background of the window to one of the pre-canned background types (or to BT_other,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class serves to provide a high-level framework for basic applications that use Panda in simple w...
TypeHandle is the identifier used to differentiate C++ class types.
bool has_hook(const std::string &event_name) const
Returns true if there is any hook added on the indicated event name, false otherwise.
set_title
Specifies the title that should be assigned to the window.
bool begin_playback(const Filename &filename)
Begins playing back data from the indicated filename.
void set_perpixel(bool enable)
Turns per-pixel lighting on (true) or off (false).
void show()
Undoes the effect of a previous hide() on this node: makes the referenced node (and the entire subgra...
This is a base class for the various different classes that represent the result of a frame of render...
void close_window(int n)
Closes the nth window and removes it from the list.
void clear_render_mode()
Completely removes any render mode adjustment that may have been set on this node via set_render_mode...
A named event, possibly with parameters.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
void set_wireframe(bool enable)
Sets the wireframe state on all windows.
bool get_lighting() const
Returns the current state of the lighting flag.
bool all_windows_closed() const
Returns true if all of the opened windows have been closed by the user, false otherwise.
static int garbage_collect()
Performs a garbage-collection cycle.
void add_node(PandaNode *node)
Adds a new node to the set of data for analysis.
int find_window(const GraphicsOutput *win) const
Returns the index of the first WindowFramework object found that references the indicated GraphicsOut...
static void event_question(const Event *event, void *data)
Default handler for ? key: show the available keys.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_highlight(const NodePath &node)
Sets the indicated node (normally a node within the get_models() tree) up as the highlighted node.
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.
get_num_pipe_types
Returns the number of different types of GraphicsPipes that are available to create through this inte...
set_text
Changes the text that is stored in the encoder.
WindowFramework * open_window()
Opens a window on the default graphics pipe.
get_child
Returns the nth child node of this node.
void set_perpixel(bool enable)
Sets the perpixel 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...
A handy class that can scrub over a scene graph and collect interesting statistics on it.
This maintains a list of GraphicsPipes by type that are available for creation.
void init_libpandagl()
Initializes the library.
void remove_all_hooks()
Removes all hooks assigned to all events.
An object to create GraphicsOutputs that share a particular 3-D API.
void close_framework()
Should be called at the end of an application to close Panda.
static void event_S(const Event *, void *data)
Default handler for shift-S key: activate stats.
get_default
Returns the "default" WindowProperties.
bool get_wireframe_filled() const
Returns the current state of the wireframe_filled flag.
void close_all_windows()
Closes all currently open windows and empties the list of windows.
void clear_highlight()
Unhighlights the currently highlighted node, if any.
bool get_texture() const
Returns the current state of the texture flag.
void poll()
Runs through all the tasks in the task list, once, if the task manager is running in single-threaded ...
static void event_f9(const Event *, void *data)
Default handler for f9 key: take screenshot.
void set_lighting(bool enable)
Turns lighting on (true) or off (false).
void hide_bounds()
Stops the rendering of the bounding volume begun with show_bounds().
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
set_shadow
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offs...
static void prepare_for_exit()
Should be called by the main thread just before exiting the program, this blocks until any remaining ...
void show_bounds()
Causes the bounding volume of the bottom node and all of its descendants (that is,...
NodePath get_hidden_ancestor(DrawMask camera_mask=PandaNode::get_overall_bit(), Thread *current_thread=Thread::get_current_thread()) const
Returns the NodePath at or above the referenced node that is hidden to the indicated camera(s),...
void add(AsyncTask *task)
Adds the indicated task to the active queue.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_frame_count
Returns the number of times tick() has been called since the ClockObject was created,...
An optional parameter associated with an event.
bool get_lighting() const
Returns the current state of the lighting flag.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_recorder(const std::string &name, RecorderBase *recorder)
Adds the named recorder to the set of recorders that are in use.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
NodePath get_mouse(GraphicsOutput *window)
Returns a NodePath to the MouseAndKeyboard associated with the indicated GraphicsWindow object.
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 AsyncTask::DoneStatus task_clear_text(GenericAsyncTask *task, void *data)
Called once to remove the screenshot text from onscreen.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
RecorderController * get_recorder() const
Returns the RecorderController that has been associated with the PandaFramework, if any,...
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool add_hook(const std::string &event_name, EventFunction *function)
Adds the indicated function to the list of those that will be called when the named event is thrown.
static GraphicsPipeSelection * get_global_ptr()
Returns a pointer to the one global GraphicsPipeSelection object.
void remove_mouse(const GraphicsOutput *window)
Removes the mouse that may have been created by an earlier call to get_mouse().
This object records any data generated by a particular MouseAndKeyboard node on the datagraph for a s...
A class to monitor events from the C++ side of things.
void reset_frame_rate()
Resets the frame rate computation.
void ls() const
Lists the hierarchy at and below the referenced node.
NodePath get_aspect_2d()
Returns the node under the 2-d scene graph that is scaled to suit the window's aspect ratio.
const NodePath & get_data_root() const
Returns the root of the data graph.
NodePath & get_models()
Returns the root of the scene graph normally reserved for parenting models and such.
NodePath attach_new_node(PandaNode *node, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Attaches a new node, with or without existing parents, to the scene graph below the referenced node o...
virtual void get_default_window_props(WindowProperties &props)
Fills in the indicated window properties structure according to the normal window properties for this...
GraphicsPipe * get_default_pipe()
Returns the default pipe.
void hide()
Makes the referenced node (and the entire subgraph below this node) invisible to all cameras.
Encapsulates all the communication with a particular instance of a given rendering backend.
void set_background_type(WindowFramework::BackgroundType type)
Sets the background type of all windows.
bool get_two_sided() const
Returns the current state of the two_sided flag.
void main_loop()
Called to yield control to the panda framework.
get_num_children
Returns the number of child nodes this node has.
bool get_one_sided_reverse() const
Returns the current state of the one_sided_reverse flag.
PandaNode * node() const
Returns the referenced node of the path.
void init_libpandadx9()
Initializes the library.
A thread; that is, a lightweight process.
bool get_perpixel() const
Returns the current state of the perpixel flag.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
bool get_wireframe() const
Returns the current state of the wireframe flag.
static void event_l(const Event *, void *data)
Default handler for l key: toggle lighting.
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the 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,...
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 ...
The name of a file, such as a texture file or an Egg file.
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.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
static void event_p(const Event *, void *data)
Default handler for p key: toggle per-pixel lighting.
static void event_h(const Event *, void *data)
Default handler for h key: toggle highlight mode.
get_pipe_type
Returns the nth type of GraphicsPipe available through this interface.
void set_lighting(bool enable)
Sets the lighting state on all windows.
Filename save_screenshot_default(const std::string &prefix="screenshot")
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_empty() const
Returns true if the NodePath contains no nodes.
void set_wireframe(bool enable, bool filled=false)
Forces wireframe state (true) or restores default rendering (false).
static void event_C(const Event *, void *data)
Default handler for shift-C key: toggle the showing of collision solids.
void set_texture(bool enable)
Forces textures off (false) or restores default rendering (true).
static int show_collision_solids(NodePath node)
Shows any collision solids, or occluders, which are directly hidden in the indicated scene graph.