15 #include "rocketRegion.h"
16 #include "graphicsOutput.h"
17 #include "orthographicLens.h"
18 #include "pStatTimer.h"
20 #if defined(HAVE_ROCKET_DEBUGGER) && !defined(CPPPARSER)
21 #include <Rocket/Debugger.h>
33 const string &context_name) :
38 if (Rocket::Core::GetRenderInterface() == NULL) {
39 Rocket::Core::SetRenderInterface(&_interface);
43 get_pixels(pl, pr, pb, pt);
44 Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
47 <<
"Setting initial context dimensions to ("
48 << dimensions.x <<
", " << dimensions.y <<
")\n";
50 _context = Rocket::Core::CreateContext(context_name.c_str(),
51 dimensions, &_interface);
52 nassertv(_context != NULL);
56 _lens->set_film_offset(dimensions.x * 0.5, dimensions.y * 0.5);
57 _lens->set_near_far(-1, 1);
70 if (Rocket::Core::GetRenderInterface() == &_interface) {
71 Rocket::Core::SetRenderInterface(NULL);
74 if (_context != NULL) {
75 if (_context->GetReferenceCount() > 1) {
76 _context->RemoveReference();
82 #ifdef HAVE_ROCKET_PYTHON
83 PyGILState_STATE gstate;
84 gstate = PyGILState_Ensure();
87 _context->RemoveReference();
89 #ifdef HAVE_ROCKET_PYTHON
90 PyGILState_Release(gstate);
104 PStatTimer timer(get_cull_region_pcollector(), current_thread);
108 #ifdef HAVE_ROCKET_PYTHON
109 PyGILState_STATE gstate;
110 gstate = PyGILState_Ensure();
114 get_pixels(pl, pr, pb, pt);
115 Rocket::Core::Vector2i dimensions (pr - pl, pt - pb);
117 if (_context->GetDimensions() != dimensions) {
118 rocket_cat.debug() <<
"Setting context dimensions to ("
119 << dimensions.x <<
", " << dimensions.y <<
")\n";
121 _context->SetDimensions(dimensions);
123 _lens->set_film_size(dimensions.x, -dimensions.y);
124 _lens->set_film_offset(dimensions.x * 0.5, dimensions.y * 0.5);
127 if (_input_handler != NULL) {
128 _input_handler->update_context(_context, pl, pb);
135 trav->
set_scene(scene_setup, gsg, get_incomplete_render());
138 _interface.render(_context, trav);
140 #ifdef HAVE_ROCKET_PYTHON
141 PyGILState_Release(gstate);
157 #ifdef HAVE_ROCKET_DEBUGGER
158 return Rocket::Debugger::Initialise(_context);
171 #ifdef HAVE_ROCKET_DEBUGGER
172 Rocket::Debugger::SetVisible(visible);
183 #ifdef HAVE_ROCKET_DEBUGGER
184 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...
void set_film_size(PN_stdfloat width)
Sets the horizontal size of the film without changing its shape.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
Represents a region in a window or buffer where the libRocket UI will be rendered to...
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
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...
This is the base class for all three-component vectors and points.
A thread; that is, a lightweight process.
Encapsulates all the communication with a particular instance of a given rendering backend...
void set_debugger_visible(bool visible)
Sets whether the debugger should be visible.
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...
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.
bool is_debugger_visible() const
Returns true if the debugger is visible.
void set_cull_handler(CullHandler *cull_handler)
Specifies the object that will receive the culled Geoms.