24 PGVirtualFrame(
const std::string &name) :
PGItem(name)
26 _has_clip_frame =
false;
27 _clip_frame.set(0.0f, 0.0f, 0.0f, 0.0f);
45 _has_clip_frame(copy._has_clip_frame),
46 _clip_frame(copy._clip_frame)
51 if (_has_clip_frame) {
52 set_clip_frame(_clip_frame);
83 PandaNode::r_copy_children(from, inst_map, current_thread);
90 InstanceMap::const_iterator ci;
91 ci = inst_map.find(from_canvas_node);
92 if (ci != inst_map.end()) {
94 _canvas_node = DCAST(
ModelNode, (*ci).second);
97 ci = inst_map.find(from_canvas_parent);
98 if (ci != inst_map.end()) {
100 _canvas_parent = DCAST(
ModelNode, (*ci).second);
104 if (_has_clip_frame) {
115 setup(PN_stdfloat width, PN_stdfloat height) {
122 PN_stdfloat bevel = 0.05f;
128 style.
set_type(PGFrameStyle::T_bevel_out);
132 bevel, height - 2 * bevel);
144 if (!_has_clip_frame || _clip_frame != frame) {
145 _has_clip_frame =
true;
148 CPT(
RenderEffect) scissor_effect = ScissorEffect::make_node
149 (LPoint3(_clip_frame[0], _clip_frame[2], _clip_frame[2]),
150 LPoint3(_clip_frame[1], _clip_frame[2], _clip_frame[2]),
151 LPoint3(_clip_frame[1], _clip_frame[3], _clip_frame[3]),
152 LPoint3(_clip_frame[0], _clip_frame[3], _clip_frame[3]));
154 _canvas_parent->set_effect(scissor_effect);
155 clip_frame_changed();
165 if (_has_clip_frame) {
166 _has_clip_frame =
false;
168 _canvas_parent->clear_effect(ScissorEffect::get_class_type());
169 clip_frame_changed();
176 void PGVirtualFrame::
177 clip_frame_changed() {
183 void PGVirtualFrame::
184 setup_child_nodes() {
185 _canvas_parent =
new ModelNode(
"canvas_parent");
186 _canvas_parent->set_preserve_transform(ModelNode::PT_local);
187 add_child(_canvas_parent);
190 _canvas_node->set_preserve_transform(ModelNode::PT_local);
191 _canvas_parent->add_child(_canvas_node);
Similar to MutexHolder, but for a light reentrant mutex.
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
void set_type(Type type)
Sets the basic type of frame.
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the dominant color of the frame.
void set_width(PN_stdfloat x, PN_stdfloat y)
Sets the width parameter, which has meaning only for certain frame types.
This is the base class for all the various kinds of gui widget objects.
void set_frame_style(int state, const PGFrameStyle &style)
Changes the kind of frame that will be drawn behind the item when it is in the indicated state.
void clear_state_def(int state)
Resets the NodePath assigned to the indicated state to its initial default, with only a frame represe...
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the bounding rectangle of the item, in local coordinates.
This represents a frame that is rendered as a window onto another (possibly much larger) canvas.
PandaNode * get_canvas_parent() const
Returns the parent node of the canvas_node.
void set_clip_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the bounding rectangle of the clip frame.
void clear_clip_frame()
Removes the clip frame from the item.
PandaNode * get_canvas_node() const
Returns the special node that holds all of the children that appear in the virtual canvas.
void setup(PN_stdfloat width, PN_stdfloat height)
Creates a PGVirtualFrame with the indicated dimensions.
A basic node of the scene graph or data graph.
void remove_child(int child_index, Thread *current_thread=Thread::get_current_thread())
Removes the nth child from the node.
set_state
Sets the complete RenderState that will be applied to all nodes at this level and below.
This is the base class for a number of special render effects that may be set on scene graph nodes to...
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
This is our own Panda specialization on the default STL map.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.