45 node_state = node_state->compose(camera->get_tag_state(tag_state));
55 node_effects->
cull_callback(trav, *
this, node_transform, node_state);
62 if (!node_state->is_empty()) {
63 _state = _state->compose(node_state);
66 if (clip_plane_cull) {
67 _cull_planes = _cull_planes->apply_state(trav,
this,
68 (
const ClipPlaneAttrib *)node_state->get_attrib(ClipPlaneAttrib::get_class_slot()),
80 _net_transform = _net_transform->compose(node_transform);
82 if ((_view_frustum !=
nullptr) ||
83 (!_cull_planes->is_empty())) {
89 _view_frustum =
nullptr;
90 _cull_planes = CullPlanes::make_empty();
94 node_transform->invert_compose(TransformState::make_identity());
98 if (_view_frustum !=
nullptr) {
99 _view_frustum = _view_frustum->make_copy()->as_geometric_bounding_volume();
100 nassertv(_view_frustum !=
nullptr);
102 _view_frustum->xform(inv_transform->get_mat());
105 _cull_planes = _cull_planes->xform(inv_transform->get_mat());
116 r_get_node_path()
const {
117 if (_next ==
nullptr) {
118 nassertr(_start !=
nullptr,
nullptr);
123 nassertr(_start ==
nullptr,
nullptr);
125 nassertr(
node() !=
nullptr,
nullptr);
128 nassertr(comp !=
nullptr,
nullptr);
130 Thread *current_thread = Thread::get_current_thread();
133 PandaNode::get_component(comp,
node(), pipeline_stage, current_thread);
134 if (result ==
nullptr) {
139 return PandaNode::get_top_component(
node(),
true, pipeline_stage, current_thread);
148 bool CullTraverserData::
152 if (_view_frustum !=
nullptr) {
154 nassertr(node_gbv !=
nullptr,
false);
156 int result = _view_frustum->contains(node_gbv);
158 if (pgraph_cat.is_spam()) {
160 <<
get_node_path() <<
" cull result = " << std::hex << result << std::dec <<
"\n";
163 if (result == BoundingVolume::IF_no_intersection) {
168 if (!fake_view_frustum_cull) {
174 _view_frustum =
nullptr;
175 _state = _state->compose(get_fake_view_frustum_cull_state());
178 }
else if ((result & BoundingVolume::IF_all) != 0) {
181 _view_frustum =
nullptr;
191 _view_frustum =
nullptr;
196 if (!_cull_planes->is_empty()) {
197 if (node_gbv ==
nullptr) {
199 nassertr(node_gbv !=
nullptr,
false);
204 _cull_planes = _cull_planes->do_cull(result, _state, node_gbv);
206 if (pgraph_cat.is_spam()) {
208 <<
get_node_path() <<
" cull planes cull result = " << std::hex
209 << result << std::dec <<
"\n";
210 _cull_planes->write(pgraph_cat.spam(
false));
216 _cull_planes = CullPlanes::make_empty();
218 if (pgraph_cat.is_spam()) {
220 <<
get_node_path() <<
" is_final, cull planes disabled, state:\n";
221 _state->write(pgraph_cat.spam(
false), 2);
225 if (result == BoundingVolume::IF_no_intersection) {
230 if (!fake_view_frustum_cull) {
233 _cull_planes = CullPlanes::make_empty();
234 _state = _state->compose(get_fake_view_frustum_cull_state());
237 }
else if ((result & BoundingVolume::IF_all) != 0) {
241 nassertr(_cull_planes->is_empty(),
true);
253 get_fake_view_frustum_cull_state() {
260 if (state ==
nullptr) {
261 state = RenderState::make
262 (ColorAttrib::make_flat(LColor(1.0f, 0.0f, 0.0f, 1.0f)),
263 TextureAttrib::make_all_off(),
264 RenderModeAttrib::make(RenderModeAttrib::M_wireframe),
265 RenderState::get_max_priority());
bool is_final() const
Returns the current state of the "final" flag.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_tag_state_key() const
Returns true if a nonempty tag state key has been specified for the scene's camera,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const RenderEffects * get_effects() const
Returns the complete RenderEffects that will be applied to this node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const TransformState * get_transform() const
Returns the transform that has been set on this particular node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const RenderState * get_state() const
Returns the complete RenderState that will be applied to all nodes at this level and below,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void compose_draw_mask(DrawMask &running_draw_mask) const
Computes the result of applying this node's draw masks to a running draw mask, as during a traversal.
get_node_path
Constructs and returns an actual NodePath that represents the same path we have just traversed.
bool has_tag(const std::string &key) const
Returns true if a value has been defined on this node for the particular key (even if that value is t...
This functions similarly to a LightAttrib.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_pipeline_stage
Returns the Pipeline stage number associated with this thread.
void apply_transform(const TransformState *node_transform)
Applies the indicated transform changes onto the current data.
PandaNode * node() const
Returns the node traversed to so far.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void cull_callback(CullTraverser *trav, CullTraverserData &data, CPT(TransformState) &node_transform, CPT(RenderState) &node_state) const
Calls cull_callback() on all effects.
bool has_cull_callback() const
This function is provided as an optimization, to speed up the render-time checking for the existance ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
void check_cached(bool update_bounds) const
Ensures that the draw masks etc.
const std::string & get_tag_state_key() const
Returns the tag state key that has been specified for the scene's camera, if any.
const RenderAttrib * get_off_clip_planes() const
Returns a ClipPlaneAttrib which represents the union of all of the clip planes that have been turned ...
This functions similarly to a LightAttrib or ClipPlaneAttrib.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const RenderEffect * get_effect(size_t n) const
Returns the nth effect in the state.
Camera * get_camera_node() const
Returns the camera used to render the scene.
std::string get_tag(const std::string &key) const
Retrieves the user-defined value that was previously set on this node for the particular key,...
PT(NodePathComponent) CullTraverserData
The private, recursive implementation of get_node_path(), this returns the NodePathComponent represen...
const BoundingVolume * get_bounds() const
Returns the external bounding volume of this node: a bounding volume that contains the user bounding ...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void apply_transform_and_state(CullTraverser *trav)
Applies the transform and state from the current node onto the current data.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
SceneSetup * get_scene() const
Returns the SceneSetup object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
virtual GeometricBoundingVolume * as_geometric_bounding_volume()
Virtual downcast method.
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is one component of a NodePath.