32 ~TexProjectorEffect() {
42 if (_empty_effect ==
nullptr) {
64 StageDef &def = effect->_stages[stage];
67 def.set_lens_index(lens_index);
68 return return_new(effect);
78 effect->_stages.erase(stage);
79 return return_new(effect);
86 bool TexProjectorEffect::
88 return _stages.empty();
96 bool TexProjectorEffect::
98 Stages::const_iterator mi = _stages.find(stage);
99 return (mi != _stages.end());
109 Stages::const_iterator mi = _stages.find(stage);
111 return (*mi).second._from;
124 Stages::const_iterator mi = _stages.find(stage);
126 return (*mi).second._to;
134 int TexProjectorEffect::
136 Stages::const_iterator mi = _stages.find(stage);
137 nassertr(mi != _stages.end(), 0);
138 return (*mi).second._lens_index;
144 void TexProjectorEffect::
145 output(std::ostream &out)
const {
146 out << get_type() <<
":";
148 Stages::const_iterator mi;
149 for (mi = _stages.begin(); mi != _stages.end(); ++mi) {
151 const StageDef &def = (*mi).second;
152 out <<
" " << stage->
get_name() <<
"(" << def._to
153 <<
", " << def._from <<
", " << def._lens_index <<
")";
162 bool TexProjectorEffect::
163 has_cull_callback()
const {
164 return !_stages.empty();
179 void TexProjectorEffect::
185 Stages::const_iterator mi;
186 for (mi = _stages.begin(); mi != _stages.end(); ++mi) {
188 const StageDef &def = (*mi).second;
192 if (def._to_lens_node !=
nullptr &&
193 def._to_lens_node->get_lens() !=
nullptr) {
196 Lens *lens = def._to_lens_node->get_lens(def._lens_index);
197 if (lens !=
nullptr) {
203 if (fixmat ==
nullptr) {
204 fixmat = TransformState::make_pos_hpr_scale
205 (LVecBase3(0.5f, 0.5f, 0.0f),
206 LVecBase3(0.0f, 0.0f, 0.0f),
207 LVecBase3(0.5f, 0.5f, 1.0f));
211 transform = fixmat->compose(projmat)->compose(transform);
215 if (!transform->is_identity()) {
217 tex_matrix->add_stage(stage, transform));
221 if (!tex_matrix->is_empty()) {
222 node_state = node_state->compose(RenderState::make(tex_matrix));
238 int TexProjectorEffect::
241 DCAST_INTO_R(ta, other, 0);
243 Stages::const_iterator ai, bi;
244 ai = _stages.begin();
245 bi = ta->_stages.begin();
246 while (ai != _stages.end() && bi != ta->_stages.end()) {
247 if ((*ai).first < (*bi).first) {
251 }
else if ((*bi).first < (*ai).first) {
257 int compare = (*ai).second.compare_to((*bi).second);
266 if (bi != ta->_stages.end()) {
271 if (ai != _stages.end()) {
282 void TexProjectorEffect::
283 register_with_read_factory() {
329 effect->fillin(scan, manager);
338 void TexProjectorEffect::
340 RenderEffect::fillin(scan, manager);
348 nassertv(num_stages == 0);
354 void TexProjectorEffect::StageDef::
357 if (!_to.is_empty() && _to.node()->is_of_type(LensNode::get_class_type())) {
358 DCAST_INTO_V(_to_lens_node, _to.node());
360 _to_lens_node =
nullptr;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
A class to retrieve the individual data elements previously stored in a Datagram.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
A base class for any number of different kinds of lenses, linear and otherwise.
const LMatrix4 & get_projection_mat(StereoChannel channel=SC_mono) const
Returns the complete transformation matrix from a 3-d point in space to a point on the film,...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
static NodePath fail()
Creates a NodePath with the ET_fail error type set.
This is the base class for a number of special render effects that may be set on scene graph nodes to...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Applies a transform matrix to UV's before they are rendered.
This effect automatically applies a computed texture matrix to the specified texture stage,...
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Defines the properties of a named stage of the multitexture pipeline.
get_name
Returns the name of this texture stage.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
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.
CPT(RenderEffect) TexProjectorEffect
Constructs a TexProjectorEffect that modifies no stages at all.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.