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) {
256 mouse = mouse.attach_new_node(mouse_recorder);
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);
762 Thread *current_thread = Thread::get_current_thread();
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";
1221 string output_text = (string)ExecutionEnvironment::get_cwd() +
"/" + (string)text;
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;
void write(std::ostream &out, int indent_level=0) const
Describes all the data collected.
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
WindowFramework::BackgroundType get_background_type() const
Returns the current background type setting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_libpandadx9()
Initializes the library.
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...
GraphicsPipe * get_default_pipe()
Returns the default pipe.
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 init_libpnmimagetypes()
Initializes the library.
void add_node(PandaNode *node)
Adds a new node to the set of data for analysis.
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),...
This encapsulates the data that is normally associated with a single window, or with a single display...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void show_bounds()
Causes the bounding volume of the bottom node and all of its descendants (that is,...
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...
get_parent
Returns the NodePath to the parent of the referenced node: that is, this NodePath,...
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...
void init_libpandaegg()
Initializes the library.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_shadow
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offs...
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...
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.
set_text
Changes the text that is stored in the encoder.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void event_f(const Event *, void *data)
Default handler for f key: report and reset frame rate.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
get_num_children
Returns the number of child nodes this node has.
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.
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
static void event_B(const Event *, void *data)
Default handler for shift-B key: describe the bounding volume of the currently selected object,...
get_frame_count
Returns the number of times tick() has been called since the ClockObject was created,...
The name of a file, such as a texture file or an Egg file.
bool has_hook(const std::string &event_name) const
Returns true if there is any hook added on the indicated event name, false otherwise.
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...
static int garbage_collect()
Performs a garbage-collection cycle.
This maintains a list of GraphicsPipes by type that are available for creation.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 set_texture(bool enable)
Sets the texture state on all windows.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 init_libchar()
Initializes the library.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
get_num_pipe_types
Returns the number of different types of GraphicsPipes that are available to create through this inte...
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.
bool get_lighting() const
Returns the current state of the lighting flag.
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 ...
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,...
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,...
static void event_t(const Event *, void *data)
Default handler for t key: toggle texture.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
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.
The primary interface to this module.
Encapsulates all the communication with a particular instance of a given rendering backend.
PT(WindowFramework) PandaFramework
Creates a new WindowFramework object.
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,...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_child
Returns the nth child node of this node.
get_pipe_type
Returns the nth type of GraphicsPipe available through this interface.
TypeHandle is the identifier used to differentiate C++ class types.
has_parent
Returns true if the referenced node has a parent; i.e.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void ls() const
Lists the hierarchy at and below the referenced node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
NodePath get_child(int n, Thread *current_thread=Thread::get_current_thread()) const
Returns a NodePath representing the nth child of the referenced node.
set_title
Specifies the title that should be assigned to the window.
void add_recorder(const std::string &name, RecorderBase *recorder)
Adds the named recorder to the set of recorders that are in use.
void init_libpandagl()
Initializes the library.
static int hide_collision_solids(NodePath node)
Hides any collision solids, or occluders, which are visible in the indicated scene graph.
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,...
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 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.