19 #if defined(HAVE_ROCKET_DEBUGGER) && !defined(CPPPARSER) 20 #include <Rocket/Debugger.h> 33 RocketRegion(
GraphicsOutput *window,
const LVecBase4 &dr_dimensions,
34 const std::string &context_name) :
39 if (Rocket::Core::GetRenderInterface() ==
nullptr) {
40 Rocket::Core::SetRenderInterface(&_interface);
44 get_pixels(pl, pr, pb, pt);
45 Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
48 <<
"Setting initial context dimensions to (" 49 << dimensions.x <<
", " << dimensions.y <<
")\n";
51 _context = Rocket::Core::CreateContext(context_name.c_str(),
52 dimensions, &_interface);
53 nassertv(_context !=
nullptr);
57 _lens->set_film_offset(dimensions.x * 0.5, dimensions.y * 0.5);
58 _lens->set_near_far(-1, 1);
69 if (Rocket::Core::GetRenderInterface() == &_interface) {
70 Rocket::Core::SetRenderInterface(
nullptr);
73 if (_context !=
nullptr) {
74 if (_context->GetReferenceCount() > 1) {
75 _context->RemoveReference();
81 #ifdef HAVE_ROCKET_PYTHON 82 PyGILState_STATE gstate;
83 gstate = PyGILState_Ensure();
86 _context->RemoveReference();
88 #ifdef HAVE_ROCKET_PYTHON 89 PyGILState_Release(gstate);
105 #ifdef HAVE_ROCKET_PYTHON 106 PyGILState_STATE gstate;
107 gstate = PyGILState_Ensure();
112 Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
114 if (_context->GetDimensions() != dimensions) {
115 rocket_cat.debug() <<
"Setting context dimensions to (" 116 << dimensions.x <<
", " << dimensions.y <<
")\n";
118 _context->SetDimensions(dimensions);
120 _lens->set_film_size(dimensions.x, -dimensions.y);
121 _lens->set_film_offset(dimensions.x * 0.5, dimensions.y * 0.5);
124 if (_input_handler !=
nullptr) {
125 _input_handler->update_context(_context, pl, pb);
135 _interface.
render(_context, trav);
137 #ifdef HAVE_ROCKET_PYTHON 138 PyGILState_Release(gstate);
151 #ifdef HAVE_ROCKET_DEBUGGER 152 return Rocket::Debugger::Initialise(_context);
163 #ifdef HAVE_ROCKET_DEBUGGER 164 Rocket::Debugger::SetVisible(visible);
172 is_debugger_visible()
const {
173 #ifdef HAVE_ROCKET_DEBUGGER 174 return Rocket::Debugger::IsVisible();
virtual void end_traverse()
Should be called when the traverser has finished traversing its scene, this gives it a chance to do a...
get_cull_traverser
Returns the CullTraverser that will be used to draw the contents of this DisplayRegion.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PStatCollector & get_cull_region_pcollector()
Returns a PStatCollector for timing the cull operation for just this DisplayRegion.
void render(Rocket::Core::Context *context, CullTraverser *trav)
Called by RocketNode in cull_callback.
set_film_size
Sets the horizontal size of the film without changing its shape.
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
get_incomplete_render
Returns the incomplete_render flag.
void set_view_frustum(GeometricBoundingVolume *view_frustum)
Specifies the bounding volume that corresponds to the view frustum.
This is a base class for the various different classes that represent the result of a frame of render...
set_debugger_visible
Sets whether the debugger should be visible.
A thread; that is, a lightweight process.
Encapsulates all the communication with a particular instance of a given rendering backend.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A rectangular subregion within a window for rendering into.
TypeHandle is the identifier used to differentiate C++ class types.
This object holds the camera position, etc., and other general setup information for rendering a part...
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
bool init_debugger()
Initializes the libRocket debugger.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void get_pixels(int &pl, int &pr, int &pb, int &pt) const
Retrieves the coordinates of the DisplayRegion within its window, in pixels.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
virtual void set_scene(SceneSetup *scene_setup, GraphicsStateGuardianBase *gsg, bool dr_incomplete_render)
Sets the SceneSetup object that indicates the initial camera position, etc.
void set_cull_handler(CullHandler *cull_handler)
Specifies the object that will receive the culled Geoms.