36 CPT(
RenderState) node_state = _node_reader.get_state();
45 node_state = node_state->compose(camera->
get_tag_state(tag_state));
47 _node_reader.compose_draw_mask(_draw_mask);
49 const RenderEffects *node_effects = _node_reader.get_effects();
55 node_effects->
cull_callback(trav, *
this, node_transform, node_state);
59 _node_reader.check_cached(
false);
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;
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);
127 PT(NodePathComponent) comp = _next->r_get_node_path();
128 nassertr(comp !=
nullptr,
nullptr);
132 PT(NodePathComponent) result =
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::
150 const GeometricBoundingVolume *node_gbv =
nullptr;
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;
186 if (_node_reader.is_final()) {
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));
213 if (_node_reader.is_final()) {
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) {
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() {
259 static CPT(RenderState) state;
260 if (state ==
nullptr) {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
get_tag_state
Returns the state associated with the indicated tag state by a previous call to set_tag_state(),...
This functions similarly to a LightAttrib.
static ConstPointerTo< RenderAttrib > make_flat(const LColor &color)
Constructs a new ColorAttrib object that indicates geometry should be rendered in the indicated color...
static ConstPointerTo< CullPlanes > make_empty()
Returns a pointer to an empty CullPlanes object.
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.
virtual GeometricBoundingVolume * as_geometric_bounding_volume() final
Virtual downcast method.
This is one component of a NodePath.
This functions similarly to a LightAttrib or ClipPlaneAttrib.
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, ConstPointerTo< TransformState > &node_transform, ConstPointerTo< RenderState > &node_state) const
Calls cull_callback() on all effects.
static ConstPointerTo< RenderAttrib > make(Mode mode, PN_stdfloat thickness=1.0f, bool perspective=false, const LColor &wireframe_color=LColor::zero())
Constructs a new RenderModeAttrib object that specifies whether to draw polygons in the normal,...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
static ConstPointerTo< RenderState > make(const RenderAttrib *attrib, int override=0)
Returns a RenderState with one attribute set.
static int get_max_priority()
Returns the maximum priority number (sometimes called override) that may be set on any node.
Camera * get_camera_node() const
Returns the camera used to render the scene.
static ConstPointerTo< RenderAttrib > make_all_off()
Constructs a new TextureAttrib object that turns off all stages (and hence disables texturing).
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.