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());
116r_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);
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);
148bool 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);
253get_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());
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual GeometricBoundingVolume * as_geometric_bounding_volume()
Virtual downcast method.
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
This functions similarly to a LightAttrib.
PandaNode * node() const
Returns the node traversed to so far.
get_node_path
Constructs and returns an actual NodePath that represents the same path we have just traversed.
void apply_transform_and_state(CullTraverser *trav)
Applies the transform and state from the current node onto the current data.
void apply_transform(const TransformState *node_transform)
Applies the indicated transform changes onto the current data.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
const std::string & get_tag_state_key() const
Returns the tag state key that has been specified for the scene's camera, if any.
bool has_tag_state_key() const
Returns true if a nonempty tag state key has been specified for the scene's camera,...
SceneSetup * get_scene() const
Returns the SceneSetup object.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
This is one component of a NodePath.
This functions similarly to a LightAttrib or ClipPlaneAttrib.
const TransformState * get_transform() const
Returns the transform that has been set on this particular node.
const RenderEffects * get_effects() const
Returns the complete RenderEffects that will be applied to this node.
const BoundingVolume * get_bounds() const
Returns the external bounding volume of this node: a bounding volume that contains the user bounding ...
const RenderState * get_state() const
Returns the complete RenderState that will be applied to all nodes at this level and below,...
void check_cached(bool update_bounds) const
Ensures that the draw masks etc.
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.
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...
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,...
const RenderAttrib * get_off_clip_planes() const
Returns a ClipPlaneAttrib which represents the union of all of the clip planes that have been turned ...
bool is_final() const
Returns the current state of the "final" flag.
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
bool has_cull_callback() const
This function is provided as an optimization, to speed up the render-time checking for the existance ...
const RenderEffect * get_effect(size_t n) const
Returns the nth effect in the state.
void cull_callback(CullTraverser *trav, CullTraverserData &data, CPT(TransformState) &node_transform, CPT(RenderState) &node_state) const
Calls cull_callback() on all effects.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Camera * get_camera_node() const
Returns the camera used to render the scene.
A thread; that is, a lightweight process.
get_pipeline_stage
Returns the Pipeline stage number associated with this thread.
get_current_thread
Returns a pointer to the currently-executing Thread object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.