15 #include "pandaFramework.h" 16 #include "clockObject.h" 17 #include "pStatClient.h" 18 #include "eventQueue.h" 19 #include "dataGraphTraverser.h" 20 #include "depthOffsetAttrib.h" 21 #include "collisionNode.h" 22 #include "occluderNode.h" 23 #include "config_framework.h" 24 #include "graphicsPipeSelection.h" 25 #include "nodePathCollection.h" 27 #include "mouseAndKeyboard.h" 28 #include "mouseRecorder.h" 29 #include "throw_event.h" 30 #include "executionEnvironment.h" 31 #include "sceneGraphAnalyzer.h" 32 #include "transformState.h" 33 #include "renderState.h" 44 _event_handler(*
EventHandler::get_global_event_handler()),
48 _made_default_pipe =
false;
49 _window_title = string();
53 _wireframe_enabled =
false;
54 _texture_enabled =
true;
55 _two_sided_enabled =
false;
56 _lighting_enabled =
false;
57 _perpixel_enabled =
false;
58 _background_type = WindowFramework::BT_default;
59 _default_keys_enabled =
false;
92 #ifdef LINK_ALL_STATIC 96 extern EXPCL_PANDAGL
void init_libpandagl();
98 #elif defined(HAVE_DX9) 99 extern EXPCL_PANDADX
void init_libpandadx9();
101 #elif defined(HAVE_TINYDISPLAY) 102 extern EXPCL_TINYDISPLAY
void init_libtinydisplay();
103 init_libtinydisplay();
107 extern EXPCL_PANDA_CHAR
void init_libchar();
112 extern EXPCL_PANDAEGG
void init_libpandaegg();
120 extern EXPCL_PANDA_PNMIMAGETYPES
void init_libpnmimagetypes();
121 init_libpnmimagetypes();
137 if (garbage_collect_states) {
143 if (!playback_session.empty()) {
153 }
else if (!record_session.empty()) {
183 _engine->remove_all_windows();
190 _made_default_pipe =
false;
191 _default_pipe.clear();
195 _wireframe_enabled =
false;
196 _two_sided_enabled =
false;
197 _lighting_enabled =
false;
198 _default_keys_enabled =
false;
223 nassertr(_is_open, NULL);
224 if (!_made_default_pipe) {
226 _made_default_pipe =
true;
228 return _default_pipe;
245 Mouses::iterator mi = _mouses.find(window);
246 if (mi != _mouses.end()) {
252 if (window->
is_of_type(GraphicsWindow::get_class_type())) {
267 _mouses[window] = mouse;
280 Mouses::iterator mi = _mouses.find(window);
281 if (mi != _mouses.end()) {
282 (*mi).second.remove_node();
296 define_key(
const string &event_name,
const string &description,
297 EventHandler::EventCallbackFunction *
function,
299 if (_event_handler.
has_hook(event_name)) {
303 KeyDefinitions::iterator di;
304 di = _key_definitions.begin();
305 while (di != _key_definitions.end() && (*di)._event_name != event_name) {
308 if (di != _key_definitions.end()) {
309 _key_definitions.erase(di);
315 _event_handler.
add_hook(event_name,
function, data);
317 if (!description.empty()) {
318 KeyDefinition keydef;
319 keydef._event_name = event_name;
320 keydef._description = description;
321 _key_definitions.push_back(keydef);
339 if (!_window_title.empty()) {
369 for (
int i = 0; i < num_pipe_types; i++) {
371 if (pipe_type != _default_pipe->get_type()) {
372 PT(
GraphicsPipe) new_pipe = selection->make_pipe(pipe_type);
377 _default_pipe = new_pipe;
400 nassertr(_is_open, NULL);
405 int flags = GraphicsPipe::BF_require_window;
406 if (window_type ==
"offscreen") {
407 flags = GraphicsPipe::BF_refuse_window;
434 nassertr(_is_open, NULL);
445 _engine->open_windows();
448 _engine->remove_window(win);
455 framework_cat.error()
456 <<
"Unable to create window.\n";
460 _windows.push_back(wf);
474 for (n = 0; n < (int)_windows.size(); n++) {
475 if (_windows[n]->get_graphics_output() == win) {
493 for (n = 0; n < (int)_windows.size(); n++) {
494 if (_windows[n] == wf) {
510 nassertv(n >= 0 && n < (
int)_windows.size());
515 _engine->remove_window(win);
519 _windows.erase(_windows.begin() + n);
530 Windows::iterator wi;
531 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
536 _engine->remove_window(win);
543 for (mi = _mouses.begin(); mi != _mouses.end(); ++mi) {
544 (*mi).second.remove_node();
559 Windows::const_iterator wi;
560 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
595 double delta = now - _start_time;
598 int num_frames = frame_count - _frame_count;
599 if (num_frames > 0) {
600 out << num_frames <<
" frames in " << delta <<
" seconds.\n";
601 double fps = ((double)num_frames) / delta;
602 out << fps <<
" fps average (" << 1000.0 / fps <<
"ms)\n";
624 Windows::iterator wi;
625 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
630 _wireframe_enabled = enable;
640 Windows::iterator wi;
641 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
646 _texture_enabled = enable;
656 Windows::iterator wi;
657 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
662 _two_sided_enabled = enable;
672 Windows::iterator wi;
673 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
678 _lighting_enabled = enable;
688 Windows::iterator wi;
689 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
694 _perpixel_enabled = enable;
704 Windows::iterator wi;
705 for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
710 _background_type = type;
733 for (
int i = 0; i < num_children; i++) {
760 for (
int i = 0; i < num_children; i++) {
779 framework_cat.info(
false) << _highlight <<
"\n";
808 if (!_default_keys_enabled) {
809 do_enable_default_keys();
810 _default_keys_enabled =
true;
824 nassertr(_is_open,
false);
853 make_window_framework() {
863 void PandaFramework::
864 make_default_pipe() {
870 _default_pipe = selection->make_default_pipe();
873 nout <<
"No graphics pipe is available!\n" 874 <<
"Your Config.prc file must name at least one valid panda display\n" 875 <<
"library via load-display or aux-display.\n";
884 void PandaFramework::
885 do_enable_default_keys() {
920 bool PandaFramework::
922 bool any_text =
false;
945 if (event->get_num_parameters() == 1) {
948 DCAST_INTO_V(wf, param.
get_ptr());
956 int window_index =
self->find_window(win);
957 while (window_index != -1) {
958 self->close_window(window_index);
959 window_index =
self->find_window(win);
963 self->remove_mouse(win);
966 self->_engine->open_windows();
969 if (self->all_windows_closed()) {
970 self->_exit_flag =
true;
985 self->reset_frame_rate();
995 if (event->get_num_parameters() == 1) {
998 DCAST_INTO_V(wf, param.
get_ptr());
1017 if (event->get_num_parameters() == 1) {
1020 DCAST_INTO_V(wf, param.
get_ptr());
1034 if (event->get_num_parameters() == 1) {
1037 DCAST_INTO_V(wf, param.
get_ptr());
1050 if (event->get_num_parameters() == 1) {
1053 DCAST_INTO_V(wf, param.
get_ptr());
1066 if (event->get_num_parameters() == 1) {
1069 DCAST_INTO_V(wf, param.
get_ptr());
1082 if (event->get_num_parameters() == 1) {
1085 DCAST_INTO_V(wf, param.
get_ptr());
1099 if (event->get_num_parameters() == 1) {
1102 DCAST_INTO_V(wf, param.
get_ptr());
1106 NodePath node =
self->get_highlight();
1108 node =
self->get_models();
1122 if (event->get_num_parameters() == 1) {
1125 DCAST_INTO_V(wf, param.
get_ptr());
1141 NodePath node =
self->get_highlight();
1143 node =
self->get_models();
1146 if (self->hide_collision_solids(node) == 0) {
1147 self->show_collision_solids(node);
1162 NodePath node =
self->get_highlight();
1164 node =
self->get_models();
1167 node.get_bounds()->write(nout);
1180 NodePath node =
self->get_highlight();
1182 node =
self->get_models();
1198 NodePath node =
self->get_highlight();
1200 node =
self->get_models();
1219 if (self->has_highlight()) {
1222 self->set_highlight(self->get_models());
1236 if (self->has_highlight()) {
1237 NodePath node =
self->get_highlight();
1238 if (node.
has_parent() && node !=
self->get_models()) {
1254 if (self->has_highlight()) {
1255 NodePath node =
self->get_highlight();
1273 if (self->has_highlight()) {
1274 NodePath node =
self->get_highlight();
1276 if (node.
has_parent() && node !=
self->get_models()) {
1278 nassertv(index >= 0);
1279 int sibling = index - 1;
1298 if (self->has_highlight()) {
1299 NodePath node =
self->get_highlight();
1301 if (node.
has_parent() && node !=
self->get_models()) {
1303 nassertv(index >= 0);
1305 int sibling = index + 1;
1306 if (sibling < num_children) {
1321 nout <<
"Connecting to stats host" << endl;
1324 nout <<
"Stats host not supported." << endl;
1337 if (event->get_num_parameters() == 1) {
1340 DCAST_INTO_V(wf, param.
get_ptr());
1342 if (self->clear_text()) {
1344 self->_engine->render_frame();
1349 if (filename.empty()) {
1350 text =
"Screenshot failed";
1359 self->_screenshot_text =
NodePath(text_node);
1360 text_node->set_align(TextNode::A_center);
1361 text_node->set_shadow_color(0.0f, 0.0f, 0.0f, 1.0f);
1364 self->_screenshot_text.set_scale(0.06);
1365 self->_screenshot_text.set_pos(0.0, 0.0, -0.7);
1367 cout <<
"Screenshot saved: " + output_text +
"\n";
1370 self->_task_mgr.remove(self->_task_mgr.find_tasks(
"clear_text"));
1372 task->set_delay(3.0);
1373 self->_task_mgr.add(task);
1384 if (event->get_num_parameters() == 1) {
1387 DCAST_INTO_V(wf, param.
get_ptr());
1390 case WindowFramework::BT_other:
1391 case WindowFramework::BT_none:
1394 case WindowFramework::BT_white:
1412 if (event->get_num_parameters() == 1) {
1415 DCAST_INTO_V(wf, param.
get_ptr());
1417 self->_screenshot_text.remove_node();
1419 if (!self->_help_text.is_empty()) {
1420 self->_help_text.remove_node();
1426 KeyDefinitions::const_iterator ki;
1427 for (ki = self->_key_definitions.begin();
1428 ki !=
self->_key_definitions.end();
1430 const KeyDefinition &keydef = (*ki);
1431 help << keydef._event_name <<
"\t" << keydef._description <<
"\n";
1434 string help_text = help.str();
1437 self->_help_text =
NodePath(text_node);
1438 text_node->set_align(TextNode::A_left);
1439 text_node->set_shadow_color(0.0f, 0.0f, 0.0f, 1.0f);
1445 PN_stdfloat height = frame[3] - frame[2];
1446 PN_stdfloat scale = min(0.06, 1.8 / height);
1447 self->_help_text.set_scale(scale);
1449 PN_stdfloat pos_scale = scale / -2.0;
1450 self->_help_text.set_pos((frame[0] + frame[1]) * pos_scale,
1452 (frame[2] + frame[3]) * pos_scale);
1468 if (event->get_num_parameters() == 1) {
1474 DCAST_INTO_V(win, param.
get_ptr());
1477 int window_index =
self->find_window(win);
1478 if (window_index == -1) {
1479 framework_cat.debug()
1480 <<
"Ignoring message from unknown window.\n";
1485 int window_index =
self->find_window(win);
1486 while (window_index != -1) {
1487 self->close_window(window_index);
1488 window_index =
self->find_window(win);
1492 self->remove_mouse(win);
1495 if (self->all_windows_closed() && !
self->_exit_flag) {
1496 framework_cat.info()
1497 <<
"Last window was closed by user.\n";
1498 self->_exit_flag =
true;
1502 for (
int n = 0; n < (int)self->_windows.size(); n++) {
1503 if (self->_windows[n]->get_graphics_output() == win) {
1504 self->_windows[n]->adjust_dimensions();
1523 dg_trav.
traverse(self->_data_root.node());
1525 return AsyncTask::DS_cont;
1537 throw_event(
"NewFrame");
1538 self->_event_handler.process_events();
1540 return AsyncTask::DS_cont;
1553 self->_engine->render_frame();
1556 return AsyncTask::DS_cont;
1570 self->_recorder->record_frame();
1573 return AsyncTask::DS_cont;
1587 self->_recorder->play_frame();
1590 return AsyncTask::DS_cont;
1603 return AsyncTask::DS_cont;
1616 TransformState::garbage_collect();
1618 return AsyncTask::DS_cont;
bool get_wireframe_filled() const
Returns the current state of the wireframe_filled flag.
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
void remove_all_hooks()
Removes all hooks assigned to all events.
int get_num_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of children of the referenced node.
static AsyncTask::DoneStatus task_clear_text(GenericAsyncTask *task, void *data)
Called once to remove the screenshot text from onscreen.
static void event_w(const Event *, void *data)
Default handler for w key: toggle wireframe.
static AsyncTask::DoneStatus task_garbage_collect(GenericAsyncTask *task, void *data)
This task is created automatically if garbage_collect_states is true.
bool begin_playback(const Filename &filename)
Begins playing back data from the indicated filename.
void set_two_sided(bool enable)
Sets the two_sided state on all windows.
static void event_i(const Event *, void *data)
Default handler for i key: invert one-sided faces.
void enable_default_keys()
Sets callbacks on the event handler to handle all of the normal viewer keys, like t to toggle texture...
void set_perpixel(bool enable)
Turns per-pixel lighting on (true) or off (false).
static void event_f9(const Event *, void *data)
Default handler for f9 key: take screenshot.
static bool connect(const string &=string(), int=-1)
Attempts to establish a connection to the indicated PStatServer.
WindowFramework::BackgroundType get_background_type() const
Returns the current background type setting.
A class to monitor events from the C++ side of things.
void reset_frame_rate()
Resets the frame rate computation.
An optional parameter associated with an event.
bool get_wireframe() const
Returns the current state of the wireframe flag.
NodePath & get_models()
Returns the root of the scene graph normally reserved for parenting models and such.
bool is_empty() const
Returns true if the NodePath contains no nodes.
void close_framework()
Should be called at the end of an application to close Panda.
static AsyncTask::DoneStatus task_event(GenericAsyncTask *task, void *data)
Called once per frame to process the pending events.
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
int find_window(const GraphicsOutput *win) const
Returns the index of the first WindowFramework object found that references the indicated GraphicsOut...
int get_num_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of child nodes this node has.
GraphicsPipe * get_default_pipe()
Returns the default pipe.
void set_text(const string &text)
Changes the text that is displayed under the TextNode.
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_C(const Event *, void *data)
Default handler for shift-C key: toggle the showing of collision solids.
Specifies parameters that may be passed to the loader.
static void event_comma(const Event *, void *data)
Default handler for comma key: rotate background color.
NodePath get_aspect_2d()
Returns the node under the 2-d scene graph that is scaled to suit the window's aspect ratio...
GraphicsOutput * get_graphics_output() const
Returns a pointer to the underlying GraphicsOutput object.
static void event_a(const Event *, void *data)
Default handler for a key: toggle the animation controls.
void add_node(PandaNode *node)
Adds a new node to the set of data for analysis.
Filename save_screenshot_default(const string &prefix="screenshot")
Saves a screenshot of the region to a default filename, and returns the filename, or empty string if ...
bool add_hook(const string &event_name, EventFunction *function)
Adds the indicated function to the list of those that will be called when the named event is thrown...
bool get_perpixel() const
Returns the current state of the perpixel flag.
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)...
PandaNode * get_child(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns the nth child node of this node.
This encapsulates the data that is normally associated with a single window, or with a single display...
static void prepare_for_exit()
Should be called by the main thread just before exiting the program, this blocks until any remaining ...
virtual void get_default_window_props(WindowProperties &props)
Fills in the indicated window properties structure according to the normal window properties for this...
void print_pipe_types() const
Writes a list of the currently known GraphicsPipe types to nout, for the user's information.
void hide_bounds()
Stops the rendering of the bounding volume begun with show_bounds().
void show_bounds()
Causes the bounding volume of the bottom node and all of its descendants (that is, the bounding volume associated with the the bottom arc) to be rendered, if possible.
void set_lighting(bool enable)
Turns lighting on (true) or off (false).
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...
Reads the mouse and/or keyboard data sent from a GraphicsWindow, and transmits it down the data graph...
double get_frame_time(Thread *current_thread=Thread::get_current_thread()) const
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
bool get_one_sided_reverse() const
Returns the current state of the one_sided_reverse flag.
void show()
Undoes the effect of a previous hide() on this node: makes the referenced node (and the entire subgra...
void add_recorder(const string &name, RecorderBase *recorder)
Adds the named recorder to the set of recorders that are in use.
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
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...
bool get_texture() const
Returns the current state of the texture flag.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
void set_wireframe(bool enable, bool filled=false)
Forces wireframe state (true) or restores default rendering (false).
void set_one_sided_reverse(bool enable)
Toggles one-sided reverse mode.
bool is_valid() const
Returns true if the output is fully created and ready for rendering, false otherwise.
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 ...
static void event_f(const Event *, void *data)
Default handler for f key: report and reset frame rate.
const NodePath & get_data_root() const
Returns the root of the data graph.
bool get_two_sided() const
Returns the current state of the two_sided flag.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
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...
NodePath get_mouse(GraphicsOutput *window)
Returns a NodePath to the MouseAndKeyboard associated with the indicated GraphicsWindow object...
void write(ostream &out, int indent_level=0) const
Describes all the data collected.
LVecBase4 get_frame_actual() const
Returns the actual dimensions of the frame around the text.
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_arrow_down(const Event *, void *data)
Default handler for up arrow key: in highlight mode, move the highlight to the node's first child...
A handy class that can scrub over a scene graph and collect interesting statistics on it...
bool get_lighting() const
Returns the current state of the lighting flag.
TypeHandle get_pipe_type(int n) const
Returns the nth type of GraphicsPipe available through this interface.
static void event_B(const Event *, void *data)
Default handler for shift-B key: describe the bounding volume of the currently selected object...
The name of a file, such as a texture file or an Egg file.
void set_two_sided(bool enable)
Forces two-sided rendering (true) or restores default rendering (false).
void add(AsyncTask *task)
Adds the indicated task to the active queue.
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...
int get_frame_count(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of times tick() has been called since the ClockObject was created, or since it was last reset.
static int garbage_collect()
Performs a garbage-collection cycle.
static WindowProperties get_default()
Returns the "default" WindowProperties.
This maintains a list of GraphicsPipes by type that are available for creation.
void center_trackball(const NodePath &object)
Centers the trackball on the indicated object, and scales the trackball motion suitably.
static AsyncTask::DoneStatus task_igloop(GenericAsyncTask *task, void *data)
Called once per frame to render the scene.
void main_loop()
Called to yield control to the panda framework.
void clear_render_mode()
Completely removes any render mode adjustment that may have been set on this node via set_render_mode...
void next_anim_control()
Rotates the animation controls through all of the available animations.
void clear_highlight()
Unhighlights the currently highlighted node, if any.
An object to create GraphicsOutputs that share a particular 3-D API.
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 set_highlight(const NodePath &node)
Sets the indicated node (normally a node within the get_models() tree) up as the highlighted node...
void define_key(const string &event_name, const string &description, EventHandler::EventCallbackFunction *function, void *data)
Sets up a handler for the indicated key.
void set_texture(bool enable)
Sets the texture state on all windows.
BackgroundType get_background_type() const
Returns the current background type setting.
Associates a generic C-style function pointer with an AsyncTask object.
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.
WindowFramework * open_window()
Opens a window on the default graphics pipe.
static GraphicsPipeSelection * get_global_ptr()
Returns a pointer to the one global GraphicsPipeSelection object.
void set_background_type(WindowFramework::BackgroundType type)
Sets the background type of all windows.
static int show_collision_solids(NodePath node)
Shows any collision solids, or occluders, which are directly hidden in the indicated scene graph...
void close_window(int n)
Closes the nth window and removes it from the list.
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...
TypedWritableReferenceCount * get_ptr() const
Retrieves a pointer to the actual value stored in the parameter.
This is a base class for the various different classes that represent the result of a frame of render...
static void event_p(const Event *, void *data)
Default handler for p key: toggle per-pixel lighting.
static void event_b(const Event *, void *data)
Default handler for b key: toggle backface (two-sided rendering).
static void event_S(const Event *, void *data)
Default handler for shift-S key: activate stats.
bool get_lighting() const
Returns the current state of the lighting flag.
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, but overlay the wireframe on top with a fixed color.
This is the base class for all three-component vectors and points.
static void event_window_event(const Event *, void *data)
Default handler for window events: window resized or closed, etc.
void set_background_type(BackgroundType type)
Sets the background of the window to one of the pre-canned background types (or to BT_other...
void open_framework(int &argc, char **&argv)
Should be called once at the beginning of the application to initialize Panda (and the framework) for...
static void event_t(const Event *, void *data)
Default handler for t key: toggle texture.
int get_num_pipe_types() const
Returns the number of different types of GraphicsPipes that are available to create through this inte...
static void event_l(const Event *, void *data)
Default handler for l key: toggle lighting.
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...
PandaNode * node() const
Returns the referenced node of the path.
void set_texture(bool enable)
Forces textures off (false) or restores default rendering (true).
void load_aux_modules()
Loads all the modules named in the aux-display Configrc variable, making as many graphics pipes as po...
void add_properties(const WindowProperties &other)
Sets any properties that are explicitly specified in other on this object.
A thread; that is, a lightweight process.
A named event, possibly with parameters.
bool has_parent(Thread *current_thread=Thread::get_current_thread()) const
Returns true if the referenced node has a parent; i.e.
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
void set_lighting(bool enable)
Sets the lighting state on all windows.
bool begin_record(const Filename &filename)
Begins recording data to the indicated filename.
bool has_hook(const string &event_name) const
Returns true if there is any hook added on the indicated event name, false otherwise.
void set_title(const string &title)
Specifies the title that should be assigned to the window.
The primary interface to this module.
Encapsulates all the communication with a particular instance of a given rendering backend...
NodePath get_parent(Thread *current_thread=Thread::get_current_thread()) const
Returns the NodePath to the parent of the referenced node: that is, this NodePath, shortened by one node.
void report_frame_rate(ostream &out) const
Reports the currently measured average frame rate to the indicated ostream.
static void event_h(const Event *, void *data)
Default handler for h key: toggle highlight mode.
RecorderController * get_recorder() const
Returns the RecorderController that has been associated with the PandaFramework, if any...
static Filename get_cwd()
Returns the name of the current working directory.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
This object manages the process of recording the user's runtime inputs to a bam file so that the sess...
static void event_question(const Event *event, void *data)
Default handler for ? key: show the available keys.
This object records any data generated by a particular MouseAndKeyboard node on the datagraph for a s...
void close_all_windows()
Closes all currently open windows and empties the list of windows.
void remove_mouse(const GraphicsOutput *window)
Removes the mouse that may have been created by an earlier call to get_mouse().
This class serves to provide a high-level framework for basic applications that use Panda in simple w...
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
GraphicsEngine * get_graphics_engine()
Returns the GraphicsEngine that is used to render all the windows in the framework.
bool get_two_sided() const
Returns the current state of the two_sided flag.
bool get_perpixel() const
Returns the current state of the perpixel flag.
void hide()
Makes the referenced node (and the entire subgraph below this node) invisible to all cameras...
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 ls() const
Lists the hierarchy at and below the referenced node.
void set_wireframe(bool enable)
Sets the wireframe state on all windows.
bool all_windows_closed() const
Returns true if all of the opened windows have been closed by the user, false otherwise.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset)
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offs...
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 int hide_collision_solids(NodePath node)
Hides any collision solids, or occluders, which are visible in the indicated scene graph...
virtual bool do_frame(Thread *current_thread)
Renders one frame and performs all associated processing.
void traverse(PandaNode *node)
Starts the traversal of the data graph at the indicated root node.
bool get_wireframe() const
Returns the current state of the wireframe flag.
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...
void poll()
Runs through all the tasks in the task list, once, if the task manager is running in single-threaded ...
static Filename from_os_specific(const string &os_specific, Type type=T_general)
This named constructor returns a Panda-style filename (that is, using forward slashes, and no drive letter) based on the supplied filename string that describes a filename in the local system conventions (for instance, on Windows, it may use backslashes or begin with a drive letter and a colon).
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...
bool get_texture() const
Returns the current state of the texture flag.