Panda3D
 All Classes Functions Variables Enumerations
texGenAttrib.cxx
1 // Filename: texGenAttrib.cxx
2 // Created by: masad (21Jun04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "texGenAttrib.h"
16 #include "texturePool.h"
17 #include "graphicsStateGuardianBase.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
20 #include "datagram.h"
21 #include "datagramIterator.h"
22 #include "dcast.h"
23 
24 CPT(RenderAttrib) TexGenAttrib::_empty_attrib;
25 TypeHandle TexGenAttrib::_type_handle;
26 int TexGenAttrib::_attrib_slot;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: TexGenAttrib::Destructor
30 // Access: Public, Virtual
31 // Description:
32 ////////////////////////////////////////////////////////////////////
34 ~TexGenAttrib() {
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: TexGenAttrib::make
39 // Access: Published, Static
40 // Description: Constructs a TexGenAttrib that generates no stages at
41 // all.
42 ////////////////////////////////////////////////////////////////////
44 make() {
45  // We make it a special case and store a pointer to the empty attrib
46  // forever once we find it the first time, as an optimization.
47  if (_empty_attrib == (RenderAttrib *)NULL) {
48  _empty_attrib = return_new(new TexGenAttrib);
49  }
50 
51  return _empty_attrib;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: TexGenAttrib::make
56 // Access: Published, Static
57 // Description: Constructs a TexGenAttrib that generates just the
58 // indicated stage.
59 ////////////////////////////////////////////////////////////////////
61 make(TextureStage *stage, TexGenAttrib::Mode mode) {
62  return DCAST(TexGenAttrib, make())->add_stage(stage, mode);
63 }
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: TexGenAttrib::make_default
67 // Access: Published, Static
68 // Description: Returns a RenderAttrib that corresponds to whatever
69 // the standard default properties for render attributes
70 // of this type ought to be.
71 ////////////////////////////////////////////////////////////////////
73 make_default() {
74  return return_new(new TexGenAttrib);
75 }
76 
77 ////////////////////////////////////////////////////////////////////
78 // Function: TexGenAttrib::add_stage
79 // Access: Published, Static
80 // Description: Returns a new TexGenAttrib just like this one,
81 // with the indicated generation mode for the given
82 // stage. If this stage already exists, its mode is
83 // replaced.
84 ////////////////////////////////////////////////////////////////////
86 add_stage(TextureStage *stage, TexGenAttrib::Mode mode) const {
87  nassertr(mode != M_constant, this);
88 
89  CPT(RenderAttrib) removed = remove_stage(stage);
90  TexGenAttrib *attrib = new TexGenAttrib(*DCAST(TexGenAttrib, removed));
91 
92  ModeDef &mode_def = attrib->_stages[stage];
93  mode_def._mode = mode;
94  attrib->record_stage(stage, mode_def);
95 
96  return return_new(attrib);
97 }
98 
99 ////////////////////////////////////////////////////////////////////
100 // Function: TexGenAttrib::add_stage
101 // Access: Published, Static
102 // Description: Returns a new TexGenAttrib just like this one,
103 // with the indicated generation mode for the given
104 // stage. If this stage already exists, its mode is
105 // replaced.
106 //
107 // This variant also accepts constant_value, which is
108 // only meaningful if mode is M_constant.
109 ////////////////////////////////////////////////////////////////////
110 CPT(RenderAttrib) TexGenAttrib::
111 add_stage(TextureStage *stage, TexGenAttrib::Mode mode,
112  const LTexCoord3 &constant_value) const {
113  nassertr(mode == M_constant, this);
114 
115  CPT(RenderAttrib) removed = remove_stage(stage);
116  TexGenAttrib *attrib = new TexGenAttrib(*DCAST(TexGenAttrib, removed));
117 
118  ModeDef &mode_def = attrib->_stages[stage];
119  mode_def._mode = mode;
120  mode_def._constant_value = constant_value;
121  attrib->record_stage(stage, mode_def);
122 
123  return return_new(attrib);
124 }
125 
126 ////////////////////////////////////////////////////////////////////
127 // Function: TexGenAttrib::remove_stage
128 // Access: Published, Static
129 // Description: Returns a new TexGenAttrib just like this one,
130 // with the indicated stage removed.
131 ////////////////////////////////////////////////////////////////////
132 CPT(RenderAttrib) TexGenAttrib::
133 remove_stage(TextureStage *stage) const {
134  Stages::const_iterator si;
135  si = _stages.find(stage);
136  if (si == _stages.end()) {
137  return this;
138  }
139 
140  Mode mode = (*si).second._mode;
141  TexGenAttrib *attrib = new TexGenAttrib(*this);
142  attrib->_stages.erase(stage);
143  attrib->_no_texcoords.erase(stage);
144  if (mode == M_point_sprite) {
145  attrib->_num_point_sprites--;
146  if (attrib->_num_point_sprites == 0) {
147  attrib->_point_geom_rendering &= ~Geom::GR_point_sprite;
148  }
149  }
150  return return_new(attrib);
151 }
152 
153 ////////////////////////////////////////////////////////////////////
154 // Function: TexGenAttrib::is_empty
155 // Access: Published
156 // Description: Returns true if no stages are defined in the
157 // TexGenAttrib, false if at least one is.
158 ////////////////////////////////////////////////////////////////////
159 bool TexGenAttrib::
160 is_empty() const {
161  return _stages.empty();
162 }
163 
164 ////////////////////////////////////////////////////////////////////
165 // Function: TexGenAttrib::has_stage
166 // Access: Published
167 // Description: Returns true if there is a mode associated with
168 // the indicated stage, or false otherwise (in which
169 // case get_transform(stage) will return M_off).
170 ////////////////////////////////////////////////////////////////////
171 bool TexGenAttrib::
172 has_stage(TextureStage *stage) const {
173  Stages::const_iterator mi = _stages.find(stage);
174  return (mi != _stages.end());
175 }
176 
177 ////////////////////////////////////////////////////////////////////
178 // Function: TexGenAttrib::get_mode
179 // Access: Published
180 // Description: Returns the generation mode associated with
181 // the named texture stage, or M_off if
182 // nothing is associated with the indicated stage.
183 ////////////////////////////////////////////////////////////////////
184 TexGenAttrib::Mode TexGenAttrib::
185 get_mode(TextureStage *stage) const {
186  Stages::const_iterator mi = _stages.find(stage);
187  if (mi != _stages.end()) {
188  return (*mi).second._mode;
189  }
190  return M_off;
191 }
192 
193 ////////////////////////////////////////////////////////////////////
194 // Function: TexGenAttrib::has_gen_texcoord_stage
195 // Access: Published
196 // Description: Returns true if the indicated TextureStage will have
197 // texture coordinates generated for it automatically
198 // (and thus there is no need to upload the texture
199 // coordinates encoded in the vertices).
200 ////////////////////////////////////////////////////////////////////
201 bool TexGenAttrib::
203  NoTexCoordStages::const_iterator mi = _no_texcoords.find(stage);
204  return (mi != _no_texcoords.end());
205 }
206 
207 ////////////////////////////////////////////////////////////////////
208 // Function: TexGenAttrib::get_constant_value
209 // Access: Published
210 // Description: Returns the constant value associated with the named
211 // texture stage. This is only meaningful if the mode
212 // is M_constant.
213 ////////////////////////////////////////////////////////////////////
216  Stages::const_iterator mi = _stages.find(stage);
217  if (mi != _stages.end()) {
218  return (*mi).second._constant_value;
219  }
220  return LTexCoord3::zero();
221 }
222 
223 ////////////////////////////////////////////////////////////////////
224 // Function: TexGenAttrib::output
225 // Access: Public, Virtual
226 // Description:
227 ////////////////////////////////////////////////////////////////////
228 void TexGenAttrib::
229 output(ostream &out) const {
230  out << get_type() << ":";
231 
232  Stages::const_iterator mi;
233  for (mi = _stages.begin(); mi != _stages.end(); ++mi) {
234  TextureStage *stage = (*mi).first;
235  const ModeDef &mode_def = (*mi).second;
236  out << " " << stage->get_name() << "(";
237  switch (mode_def._mode) {
238  case M_off:
239  out << "off";
240  break;
241 
242  case M_eye_sphere_map:
243  out << "eye_sphere_map";
244  break;
245 
246  case M_world_cube_map:
247  out << "world_cube_map";
248  break;
249  case M_eye_cube_map:
250  out << "eye_cube_map";
251  break;
252 
253  case M_world_normal:
254  out << "world_normal";
255  break;
256  case M_eye_normal:
257  out << "eye_normal";
258  break;
259 
260  case M_world_position:
261  out << "world_position";
262  break;
263  case M_eye_position:
264  out << "eye_position";
265  break;
266 
267  case M_point_sprite:
268  out << "point_sprite";
269  break;
270 
271  case M_constant:
272  out << "constant: " << mode_def._constant_value;
273  break;
274 
275  case M_unused:
276  case M_unused2:
277  break;
278  }
279  out << ")";
280  }
281 }
282 
283 ////////////////////////////////////////////////////////////////////
284 // Function: TexGenAttrib::compare_to_impl
285 // Access: Protected, Virtual
286 // Description: Intended to be overridden by derived TexGenAttrib
287 // types to return a unique number indicating whether
288 // this TexGenAttrib is equivalent to the other one.
289 //
290 // This should return 0 if the two TexGenAttrib objects
291 // are equivalent, a number less than zero if this one
292 // should be sorted before the other one, and a number
293 // greater than zero otherwise.
294 //
295 // This will only be called with two TexGenAttrib
296 // objects whose get_type() functions return the same.
297 ////////////////////////////////////////////////////////////////////
298 int TexGenAttrib::
299 compare_to_impl(const RenderAttrib *other) const {
300  const TexGenAttrib *ta;
301  DCAST_INTO_R(ta, other, 0);
302 
303  Stages::const_iterator ai, bi;
304  ai = _stages.begin();
305  bi = ta->_stages.begin();
306  while (ai != _stages.end() && bi != ta->_stages.end()) {
307  if ((*ai).first < (*bi).first) {
308  // This stage is in a but not in b.
309  return -1;
310 
311  } else if ((*bi).first < (*ai).first) {
312  // This stage is in b but not in a.
313  return 1;
314 
315  } else {
316  // This stage is in both; compare the stages.
317  int compare = (*ai).second.compare_to((*bi).second);
318  if (compare != 0) {
319  return compare;
320  }
321  ++ai;
322  ++bi;
323  }
324  }
325 
326  if (bi != ta->_stages.end()) {
327  // a ran out first; b was longer.
328  return -1;
329  }
330 
331  if (ai != _stages.end()) {
332  // b ran out first; a was longer.
333  return 1;
334  }
335 
336  return 0;
337 }
338 
339 ////////////////////////////////////////////////////////////////////
340 // Function: TexGenAttrib::get_hash_impl
341 // Access: Protected, Virtual
342 // Description: Intended to be overridden by derived RenderAttrib
343 // types to return a unique hash for these particular
344 // properties. RenderAttribs that compare the same with
345 // compare_to_impl(), above, should return the same
346 // hash; RenderAttribs that compare differently should
347 // return a different hash.
348 ////////////////////////////////////////////////////////////////////
349 size_t TexGenAttrib::
350 get_hash_impl() const {
351  size_t hash = 0;
352  Stages::const_iterator ri;
353  for (ri = _stages.begin(); ri != _stages.end(); ++ri) {
354  const TextureStage *stage = (*ri).first;
355  const ModeDef &mode_def = (*ri).second;
356 
357  hash = pointer_hash::add_hash(hash, stage);
358  hash = int_hash::add_hash(hash, (int)mode_def._mode);
359  hash = string_hash::add_hash(hash, mode_def._source_name);
360  hash = mode_def._light.add_hash(hash);
361  hash = mode_def._constant_value.add_hash(hash);
362  }
363 
364  return hash;
365 }
366 
367 ////////////////////////////////////////////////////////////////////
368 // Function: TexGenAttrib::compose_impl
369 // Access: Protected, Virtual
370 // Description: Intended to be overridden by derived RenderAttrib
371 // types to specify how two consecutive RenderAttrib
372 // objects of the same type interact.
373 //
374 // This should return the result of applying the other
375 // RenderAttrib to a node in the scene graph below this
376 // RenderAttrib, which was already applied. In most
377 // cases, the result is the same as the other
378 // RenderAttrib (that is, a subsequent RenderAttrib
379 // completely replaces the preceding one). On the other
380 // hand, some kinds of RenderAttrib (for instance,
381 // ColorTransformAttrib) might combine in meaningful
382 // ways.
383 ////////////////////////////////////////////////////////////////////
384 CPT(RenderAttrib) TexGenAttrib::
385 compose_impl(const RenderAttrib *other) const {
386  const TexGenAttrib *ta;
387  DCAST_INTO_R(ta, other, 0);
388 
389  // The composition is the union of the two attribs. In the case
390  // when a stage is in both attribs, we compose the stages.
391 
392  TexGenAttrib *attrib = new TexGenAttrib;
393 
394  Stages::const_iterator ai, bi;
395  ai = _stages.begin();
396  bi = ta->_stages.begin();
397  while (ai != _stages.end() && bi != ta->_stages.end()) {
398  if ((*ai).first < (*bi).first) {
399  // This stage is in a but not in b.
400  attrib->_stages.insert(attrib->_stages.end(), *ai);
401  ++ai;
402 
403  } else if ((*bi).first < (*ai).first) {
404  // This stage is in b but not in a.
405  attrib->_stages.insert(attrib->_stages.end(), *bi);
406  ++bi;
407 
408  } else {
409  // This stage is in both; b wins.
410  attrib->_stages.insert(attrib->_stages.end(), *bi);
411  ++bi;
412  ++ai;
413  }
414  }
415 
416  while (ai != _stages.end()) {
417  // This stage is in a but not in b.
418  attrib->_stages.insert(attrib->_stages.end(), *ai);
419  ++ai;
420  }
421 
422  while (bi != ta->_stages.end()) {
423  // This stage is in b but not in a.
424  attrib->_stages.insert(attrib->_stages.end(), *bi);
425  ++bi;
426  }
427 
428  attrib->filled_stages();
429 
430  return return_new(attrib);
431 }
432 
433 ////////////////////////////////////////////////////////////////////
434 // Function: TexGenAttrib::invert_compose_impl
435 // Access: Protected, Virtual
436 // Description: Intended to be overridden by derived RenderAttrib
437 // types to specify how two consecutive RenderAttrib
438 // objects of the same type interact.
439 //
440 // See invert_compose() and compose_impl().
441 ////////////////////////////////////////////////////////////////////
442 CPT(RenderAttrib) TexGenAttrib::
443 invert_compose_impl(const RenderAttrib *other) const {
444  const TexGenAttrib *ta;
445  DCAST_INTO_R(ta, other, 0);
446 
447  // The inverse composition works a lot like the composition, except
448  // we invert the ai stages.
449 
450  TexGenAttrib *attrib = new TexGenAttrib;
451 
452  Stages::const_iterator ai, bi;
453  ai = _stages.begin();
454  bi = ta->_stages.begin();
455  while (ai != _stages.end() && bi != ta->_stages.end()) {
456  if ((*ai).first < (*bi).first) {
457  // This stage is in a but not in b. Turn a off.
458  attrib->_stages.insert(attrib->_stages.end(), Stages::value_type((*ai).first, ModeDef()));
459  ++ai;
460 
461  } else if ((*bi).first < (*ai).first) {
462  // This stage is in b but not in a.
463  attrib->_stages.insert(attrib->_stages.end(), *bi);
464  ++bi;
465 
466  } else {
467  // This stage is in both; b wins.
468  attrib->_stages.insert(attrib->_stages.end(), *bi);
469  ++bi;
470  ++ai;
471  }
472  }
473 
474  while (ai != _stages.end()) {
475  // This stage is in a but not in b.
476  attrib->_stages.insert(attrib->_stages.end(), Stages::value_type((*ai).first, ModeDef()));
477  ++ai;
478  }
479 
480  while (bi != ta->_stages.end()) {
481  // This stage is in b but not in a.
482  attrib->_stages.insert(attrib->_stages.end(), *bi);
483  ++bi;
484  }
485 
486  attrib->filled_stages();
487 
488  return return_new(attrib);
489 }
490 
491 ////////////////////////////////////////////////////////////////////
492 // Function: TexGenAttrib::get_auto_shader_attrib_impl
493 // Access: Protected, Virtual
494 // Description:
495 ////////////////////////////////////////////////////////////////////
496 CPT(RenderAttrib) TexGenAttrib::
497 get_auto_shader_attrib_impl(const RenderState *state) const {
498  return this;
499 }
500 
501 ////////////////////////////////////////////////////////////////////
502 // Function: TexGenAttrib::filled_stages
503 // Access: Private
504 // Description: This method is to be called after the _stages map has
505 // been built up internally through some artificial
506 // means; it copies the appropriate settings to
507 // _no_texcoords and updates other internal cache values
508 // appropriately.
509 ////////////////////////////////////////////////////////////////////
510 void TexGenAttrib::
511 filled_stages() {
512  Stages::iterator ri;
513  for (ri = _stages.begin(); ri != _stages.end(); ++ri) {
514  TextureStage *stage = (*ri).first;
515  ModeDef &mode_def = (*ri).second;
516  record_stage(stage, mode_def);
517  }
518 }
519 
520 ////////////////////////////////////////////////////////////////////
521 // Function: TexGenAttrib::record_stage
522 // Access: Private
523 // Description: Updates the appropriate internal caches before adding
524 // the indicated stage with the given mode to the
525 // _stages map.
526 ////////////////////////////////////////////////////////////////////
527 void TexGenAttrib::
528 record_stage(TextureStage *stage, TexGenAttrib::ModeDef &mode_def) {
529  switch (mode_def._mode) {
530  case M_point_sprite:
531  _no_texcoords.insert(stage);
532  _point_geom_rendering |= Geom::GR_point_sprite;
533  _num_point_sprites++;
534  break;
535 
536  case M_off:
537  break;
538 
539  default:
540  _no_texcoords.insert(stage);
541  }
542 }
543 
544 ////////////////////////////////////////////////////////////////////
545 // Function: TexGenAttrib::register_with_read_factory
546 // Access: Public, Static
547 // Description: Tells the BamReader how to create objects of type
548 // TexGenAttrib.
549 ////////////////////////////////////////////////////////////////////
550 void TexGenAttrib::
552  BamReader::get_factory()->register_factory(get_class_type(), make_from_bam);
553 }
554 
555 ////////////////////////////////////////////////////////////////////
556 // Function: TexGenAttrib::write_datagram
557 // Access: Public, Virtual
558 // Description: Writes the contents of this object to the datagram
559 // for shipping out to a Bam file.
560 ////////////////////////////////////////////////////////////////////
561 void TexGenAttrib::
563  RenderAttrib::write_datagram(manager, dg);
564 
565  dg.add_uint16(_stages.size());
566 
567  Stages::const_iterator si;
568  for (si = _stages.begin(); si != _stages.end(); ++si) {
569  TextureStage *stage = (*si).first;
570  Mode mode = (*si).second._mode;
571 
572  manager->write_pointer(dg, stage);
573  dg.add_uint8((unsigned int)mode);
574  }
575 }
576 
577 ////////////////////////////////////////////////////////////////////
578 // Function: TexGenAttrib::complete_pointers
579 // Access: Public, Virtual
580 // Description: Receives an array of pointers, one for each time
581 // manager->read_pointer() was called in fillin().
582 // Returns the number of pointers processed.
583 ////////////////////////////////////////////////////////////////////
584 int TexGenAttrib::
586  int pi = RenderAttrib::complete_pointers(p_list, manager);
587 
589  for (mi = _read_modes.begin(); mi != _read_modes.end(); ++mi) {
590  Mode mode = (*mi);
591 
592  TextureStage *stage = DCAST(TextureStage, p_list[pi++]);
593  _stages[stage]._mode = mode;
594  }
595 
596  filled_stages();
597 
598  return pi;
599 }
600 
601 ////////////////////////////////////////////////////////////////////
602 // Function: TexGenAttrib::make_from_bam
603 // Access: Protected, Static
604 // Description: This function is called by the BamReader's factory
605 // when a new object of type TexGenAttrib is encountered
606 // in the Bam file. It should create the TexGenAttrib
607 // and extract its information from the file.
608 ////////////////////////////////////////////////////////////////////
609 TypedWritable *TexGenAttrib::
610 make_from_bam(const FactoryParams &params) {
611  TexGenAttrib *attrib = new TexGenAttrib;
612  DatagramIterator scan;
613  BamReader *manager;
614 
615  parse_params(params, scan, manager);
616  attrib->fillin(scan, manager);
617 
618  return attrib;
619 }
620 
621 ////////////////////////////////////////////////////////////////////
622 // Function: TexGenAttrib::fillin
623 // Access: Protected
624 // Description: This internal function is called by make_from_bam to
625 // read in all of the relevant data from the BamFile for
626 // the new TexGenAttrib.
627 ////////////////////////////////////////////////////////////////////
628 void TexGenAttrib::
629 fillin(DatagramIterator &scan, BamReader *manager) {
630  RenderAttrib::fillin(scan, manager);
631 
632  size_t num_stages = scan.get_uint16();
633 
634  // For now, read in a linear list of the modes we will assign to
635  // each associated TextureStage pointer. Later, in
636  // complete_pointers, we'll fill up the map the with appropriate
637  // TextureStage/Mode pairing.
638  _read_modes.clear();
639  _read_modes.reserve(num_stages);
640  for (size_t i = 0; i < num_stages; i++) {
641  manager->read_pointer(scan);
642  Mode mode = (Mode)scan.get_uint8();
643  _read_modes.push_back(mode);
644  }
645 }
static size_t add_hash(size_t start, const void *key)
Adds the indicated key into a running hash.
Definition: stl_compares.I:133
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
Definition: datagram.I:138
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:60
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
bool is_empty() const
Returns true if no stages are defined in the TexGenAttrib, false if at least one is.
static const LPoint3f & zero()
Returns a zero-length point.
Definition: lpoint3.h:258
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
const string & get_name() const
Returns the name of this texture stage.
Definition: textureStage.I:32
const LTexCoord3 & get_constant_value(TextureStage *stage) const
Returns the constant value associated with the named texture stage.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
Mode get_mode(TextureStage *stage) const
Returns the generation mode associated with the named texture stage, or M_off if nothing is associate...
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
Definition: stl_compares.I:122
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager-&gt;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.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager-&gt;read_pointer() was called in fillin()...
bool has_gen_texcoord_stage(TextureStage *stage) const
Returns true if the indicated TextureStage will have texture coordinates generated for it automatical...
static void register_with_read_factory()
Tells the BamReader how to create objects of type TexGenAttrib.
A container for geometry primitives.
Definition: geom.h:58
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
Definition: factory.I:90
void add_uint16(PN_uint16 value)
Adds an unsigned 16-bit integer to the datagram.
Definition: datagram.I:181
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
Definition: bamReader.I:213
bool has_stage(TextureStage *stage) const
Returns true if there is a mode associated with the indicated stage, or false otherwise (in which cas...
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
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.
Definition: textureStage.h:38
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
Computes texture coordinates for geometry automatically based on vertex position and/or normal...
Definition: texGenAttrib.h:36
static size_t add_hash(size_t start, const Key &key)
Adds the elements of the indicated key into a running hash.
Definition: stl_compares.I:205
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
Definition: bamWriter.cxx:279
void read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
Definition: bamReader.cxx:652