Panda3D
Loading...
Searching...
No Matches
cullResult.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file cullResult.h
10 * @author drose
11 * @date 2002-02-27
12 */
13
14#ifndef CULLRESULT_H
15#define CULLRESULT_H
16
17#include "pandabase.h"
18#include "cullBin.h"
19#include "cullBinManager.h"
20#include "renderState.h"
21#include "cullableObject.h"
22#include "geomMunger.h"
23#include "referenceCount.h"
24#include "pointerTo.h"
25#include "pvector.h"
26#include "pset.h"
27#include "pmap.h"
28#include "rescaleNormalAttrib.h"
29
30class CullTraverser;
32class RenderState;
33class SceneSetup;
34class TransformState;
35
36/**
37 * This stores the result of a BinCullHandler traversal: an ordered collection
38 * of CullBins, each of which holds a number of Geoms and RenderStates to be
39 * rendered in some defined order.
40 *
41 * This is also used to keep the results of last frame's cull traversal around
42 * to make next frame's traversal of the same scene a little easier.
43 */
44class EXPCL_PANDA_PGRAPH CullResult : public ReferenceCount {
45public:
46 CullResult(GraphicsStateGuardianBase *gsg,
47 const PStatCollector &draw_region_pcollector);
48 INLINE ~CullResult();
49
50PUBLISHED:
51 PT(CullResult) make_next() const;
52
53 INLINE CullBin *get_bin(int bin_index);
54
55 void add_object(CullableObject *object, const CullTraverser *traverser);
56 void finish_cull(SceneSetup *scene_setup, Thread *current_thread);
57 void draw(Thread *current_thread);
58
60
61public:
62 static void bin_removed(int bin_index);
63
64private:
65 CullBin *make_new_bin(int bin_index);
66
67 INLINE void check_flash_bin(CPT(RenderState) &state, CullBinManager *bin_manager, int bin_index);
68 INLINE void check_flash_transparency(CPT(RenderState) &state, const LColor &color);
69
70#ifndef NDEBUG
71 void apply_flash_color(CPT(RenderState) &state, const LColor &flash_color);
72#endif
73
74 static const RenderState *get_rescale_normal_state(RescaleNormalAttrib::Mode mode);
75 static const RenderState *get_alpha_state();
76 static const RenderState *get_binary_state();
77 static const RenderState *get_dual_transparent_state();
78 static const RenderState *get_dual_opaque_state();
79 static const RenderState *get_wireframe_filled_state();
80 static CPT(RenderState) get_wireframe_overlay_state(const RenderModeAttrib *rmode);
81 static CPT(RenderState) get_wireframe_overlay_state(const RenderModeAttrib *rmode, const ShaderAttrib *shader);
82
84 PStatCollector _draw_region_pcollector;
85
86 typedef pvector< PT(CullBin) > Bins;
87 Bins _bins;
88
89 bool _show_transparency = false;
90
91public:
92 static TypeHandle get_class_type() {
93 return _type_handle;
94 }
95 static void init_type() {
96 ReferenceCount::init_type();
97 register_type(_type_handle, "CullResult",
98 ReferenceCount::get_class_type());
99 }
100
101private:
102 static TypeHandle _type_handle;
103};
104
105#include "cullResult.I"
106
107#endif
This is a global object that maintains the collection of named CullBins in the world.
A collection of Geoms and their associated state, for a particular scene.
Definition cullBin.h:40
void add_object(CullableObject *object, const CullTraverser *traverser)
Adds the indicated CullableObject to the appropriate bin.
PointerTo< PandaNode > make_result_graph()
Returns a special scene graph constructed to represent the results of the cull.
PointerTo< CullResult > make_next() const
Returns a newly-allocated CullResult object that contains a copy of just the subset of the data from ...
void draw(Thread *current_thread)
Asks all the bins to draw themselves in the correct order.
static void bin_removed(int bin_index)
Intended to be called by CullBinManager::remove_bin(), this informs all the CullResults in the world ...
CullBin * get_bin(int bin_index)
Returns the CullBin associated with the indicated bin_index, or NULL if the bin_index is invalid.
Definition cullResult.I:27
void finish_cull(SceneSetup *scene_setup, Thread *current_thread)
Called after all the geoms have been added, this indicates that the cull process is finished for this...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
The smallest atom of cull.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A lightweight class that represents a single element that may be timed and/or counted via stats.
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
Specifies how polygons are to be drawn.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition renderState.h:47
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition sceneSetup.h:32
A thread; that is, a lightweight process.
Definition thread.h:46
Indicates a coordinate-system transform on vertices.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.