Panda3D
shader.I
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 shader.I
10  * @author jyelon
11  * @date 2005-09
12  * @author fperazzi, PandaSE
13  * @date 2010-04-06
14  */
15 
16 /**
17  * Return the Shader's filename for the given shader type.
18  */
19 INLINE Filename Shader::
20 get_filename(ShaderType type) const {
21  if (_filename._separate && type != ST_none) {
22  switch (type) {
23  case ST_vertex:
24  return _filename._vertex;
25  break;
26  case ST_fragment:
27  return _filename._fragment;
28  break;
29  case ST_geometry:
30  return _filename._geometry;
31  break;
32  case ST_tess_control:
33  return _filename._tess_control;
34  break;
35  case ST_tess_evaluation:
36  return _filename._tess_evaluation;
37  break;
38  case ST_compute:
39  return _filename._compute;
40  break;
41  default:
42  return _filename._shared;
43  }
44  } else if (!_filename._shared.empty()) {
45  return _filename._shared;
46 
47  } else {
48  // Um, better than nothing?
49  return _filename._fragment;
50  }
51 }
52 
53 /**
54  * Sets the Shader's filename for the given shader type. Useful for
55  * associating a shader created with Shader.make with a name for diagnostics.
56  */
57 INLINE void Shader::
58 set_filename(ShaderType type, const Filename &filename) {
59  _filename._separate = true;
60  switch (type) {
61  case ST_vertex:
62  _filename._vertex = filename;
63  break;
64  case ST_fragment:
65  _filename._fragment = filename;
66  break;
67  case ST_geometry:
68  _filename._geometry = filename;
69  break;
70  case ST_tess_control:
71  _filename._tess_control = filename;
72  break;
73  case ST_tess_evaluation:
74  _filename._tess_evaluation = filename;
75  break;
76  case ST_compute:
77  _filename._compute = filename;
78  break;
79  default:
80  _filename._shared = filename;
81  _filename._separate = false;
82  }
83 }
84 
85 /**
86  * Return the Shader's text for the given shader type.
87  */
88 INLINE const std::string &Shader::
89 get_text(ShaderType type) const {
90  if (_text._separate) {
91  nassertr(type != ST_none || !_text._shared.empty(), _text._shared);
92  switch (type) {
93  case ST_vertex:
94  return _text._vertex;
95  break;
96  case ST_fragment:
97  return _text._fragment;
98  break;
99  case ST_geometry:
100  return _text._geometry;
101  break;
102  case ST_tess_control:
103  return _text._tess_control;
104  break;
105  case ST_tess_evaluation:
106  return _text._tess_evaluation;
107  break;
108  case ST_compute:
109  return _text._compute;
110  break;
111  default:
112  return _text._shared;
113  }
114  } else {
115  return _text._shared;
116  }
117 }
118 
119 /**
120  * Returns true if the shader contains a compile-time error. This doesn't
121  * tell you whether or not the shader is supported on the current video card.
122  */
123 INLINE bool Shader::
124 get_error_flag() const {
125  return _error_flag;
126 }
127 
128 /**
129  * Returns the shader language in which this shader was written.
130  */
131 INLINE Shader::ShaderLanguage Shader::
132 get_language() const {
133  return _language;
134 }
135 
136 /**
137  * Returns true if the fullpath has been set and is available. See
138  * set_fullpath().
139  */
140 INLINE bool Shader::
141 has_fullpath() const {
142  return !_fullpath.empty();
143 }
144 
145 /**
146  * Returns the fullpath that has been set. This is the full path to the file
147  * as it was found along the model-path.
148  */
149 INLINE const Filename &Shader::
150 get_fullpath() const {
151  return _fullpath;
152 }
153 
154 /**
155  * Returns the setting of the cache_compiled_shader flag. See
156  * set_cache_compiled_shader().
157  */
158 INLINE bool Shader::
160  return _cache_compiled_shader;
161 }
162 
163 /**
164  * Sets the cache_compiled_shader flag. When this is set, the next time the
165  * Shader is loaded on a GSG, it will automatically extract the compiled
166  * shader from the GSG and save it to the global BamCache.
167  *
168  * This is used to store compiled shaders in the BamCache. This flag should
169  * not be set explicitly; it is set automatically by the ShaderPool when
170  * model-cache-compiled-shaders is set true.
171  */
172 INLINE void Shader::
174  _cache_compiled_shader = flag;
175 }
176 
177 /**
178  *
179  */
180 INLINE Shader::ShaderCaps::
181 ShaderCaps() {
182  clear();
183 }
184 
185 /**
186  *
187  */
188 INLINE bool Shader::ShaderCaps::
189 operator == (const ShaderCaps &other) const {
190 #ifdef HAVE_CG
191  if ((_active_vprofile != other._active_vprofile) ||
192  (_active_fprofile != other._active_fprofile) ||
193  (_active_gprofile != other._active_gprofile) ||
194  (_ultimate_vprofile != other._ultimate_vprofile) ||
195  (_ultimate_fprofile != other._ultimate_fprofile) ||
196  (_ultimate_gprofile != other._ultimate_gprofile)) {
197  return false;
198  }
199 #endif
200  return true;
201 }
202 
203 /**
204  *
205  */
206 INLINE Shader::ShaderPtrData::
207 ShaderPtrData() :
208  _ptr(nullptr),
209  _type(SPT_unknown),
210  _updated(true),
211  _size(0)
212 {
213 }
214 
215 /**
216  *
217  */
218 INLINE Shader::ShaderPtrData::
219 ShaderPtrData(const PTA_float &ptr):
220  _pta(ptr.v0()),
221  _ptr(ptr.p()),
222  _type(SPT_float),
223  _updated(true),
224  _size(ptr.size())
225 {
226 }
227 
228 /**
229  *
230  */
231 INLINE Shader::ShaderPtrData::
232 ShaderPtrData(const PTA_LMatrix4f &ptr):
233  _pta(ptr.v0()),
234  _ptr(ptr.p()),
235  _type(SPT_float),
236  _updated(true),
237  _size(ptr.size() * 16)
238 {
239 }
240 
241 /**
242  *
243  */
244 INLINE Shader::ShaderPtrData::
245 ShaderPtrData(const PTA_LMatrix3f &ptr):
246  _pta(ptr.v0()),
247  _ptr(ptr.p()),
248  _type(SPT_float),
249  _updated(true),
250  _size(ptr.size() * 9)
251 {
252 }
253 
254 /**
255  *
256  */
257 INLINE Shader::ShaderPtrData::
258 ShaderPtrData(const PTA_LVecBase4f &ptr):
259  _pta(ptr.v0()),
260  _ptr(ptr.p()),
261  _type(SPT_float),
262  _updated(true),
263  _size(ptr.size() * 4)
264 {
265 }
266 
267 /**
268  *
269  */
270 INLINE Shader::ShaderPtrData::
271 ShaderPtrData(const PTA_LVecBase3f &ptr):
272  _pta(ptr.v0()),
273  _ptr(ptr.p()),
274  _type(SPT_float),
275  _updated(true),
276  _size(ptr.size() * 3)
277 {
278 }
279 
280 /**
281  *
282  */
283 INLINE Shader::ShaderPtrData::
284 ShaderPtrData(const PTA_LVecBase2f &ptr):
285  _pta(ptr.v0()),
286  _ptr(ptr.p()),
287  _type(SPT_float),
288  _updated(true),
289  _size(ptr.size() * 2)
290 {
291 }
292 
293 /**
294  *
295  */
296 INLINE Shader::ShaderPtrData::
297 ShaderPtrData(const LVecBase4f &vec) :
298  _type(SPT_float),
299  _updated(true),
300  _size(4)
301 {
302  PTA_float pta = PTA_float::empty_array(4);
303  _pta = pta.v0();
304  _ptr = pta.p();
305  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
306  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
307 }
308 
309 /**
310  *
311  */
312 INLINE Shader::ShaderPtrData::
313 ShaderPtrData(const LVecBase3f &vec) :
314  _type(SPT_float),
315  _updated(true),
316  _size(3)
317 {
318  PTA_float pta = PTA_float::empty_array(3);
319  _pta = pta.v0();
320  _ptr = pta.p();
321  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
322  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
323 }
324 
325 /**
326  *
327  */
328 INLINE Shader::ShaderPtrData::
329 ShaderPtrData(const LVecBase2f &vec) :
330  _type(SPT_float),
331  _updated(true),
332  _size(2)
333 {
334  PTA_float pta = PTA_float::empty_array(2);
335  _pta = pta.v0();
336  _ptr = pta.p();
337  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
338  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
339 }
340 
341 /**
342  *
343  */
344 INLINE Shader::ShaderPtrData::
345 ShaderPtrData(const LMatrix4f &mat) :
346  _type(SPT_float),
347  _updated(true),
348  _size(16)
349 {
350  PTA_float pta = PTA_float::empty_array(16);
351  _pta = pta.v0();
352  _ptr = pta.p();
353  nassertv(sizeof(mat(0, 0)) * mat.get_num_components() == pta.size() * sizeof(pta[0]));
354  memcpy(_ptr, mat.get_data(), sizeof(mat(0, 0)) * mat.get_num_components());
355 }
356 
357 /**
358  *
359  */
360 INLINE Shader::ShaderPtrData::
361 ShaderPtrData(const LMatrix3f &mat) :
362  _type(SPT_float),
363  _updated(true),
364  _size(9)
365 {
366  PTA_float pta = PTA_float::empty_array(9);
367  _pta = pta.v0();
368  _ptr = pta.p();
369  nassertv(sizeof(mat(0, 0)) * mat.get_num_components() == pta.size() * sizeof(pta[0]));
370  memcpy(_ptr, mat.get_data(), sizeof(mat(0, 0)) * mat.get_num_components());
371 }
372 
373 /**
374  *
375  */
376 INLINE Shader::ShaderPtrData::
377 ShaderPtrData(const PTA_double &ptr):
378  _pta(ptr.v0()),
379  _ptr(ptr.p()),
380  _type(SPT_double),
381  _updated(true),
382  _size(ptr.size())
383 {
384 }
385 
386 /**
387  *
388  */
389 INLINE Shader::ShaderPtrData::
390 ShaderPtrData(const PTA_LMatrix4d &ptr):
391  _pta(ptr.v0()),
392  _ptr(ptr.p()),
393  _type(SPT_double),
394  _updated(true),
395  _size(ptr.size() * 16)
396 {
397 }
398 
399 /**
400  *
401  */
402 INLINE Shader::ShaderPtrData::
403 ShaderPtrData(const PTA_LMatrix3d &ptr):
404  _pta(ptr.v0()),
405  _ptr(ptr.p()),
406  _type(SPT_double),
407  _updated(true),
408  _size(ptr.size() * 9)
409 {
410 }
411 
412 /**
413  *
414  */
415 INLINE Shader::ShaderPtrData::
416 ShaderPtrData(const PTA_LVecBase4d &ptr):
417  _pta(ptr.v0()),
418  _ptr(ptr.p()),
419  _type(SPT_double),
420  _updated(true),
421  _size(ptr.size() * 4)
422 {
423 }
424 
425 /**
426  *
427  */
428 INLINE Shader::ShaderPtrData::
429 ShaderPtrData(const PTA_LVecBase3d &ptr):
430  _pta(ptr.v0()),
431  _ptr(ptr.p()),
432  _type(SPT_double),
433  _updated(true),
434  _size(ptr.size() * 3)
435 {
436 }
437 
438 /**
439  *
440  */
441 INLINE Shader::ShaderPtrData::
442 ShaderPtrData(const PTA_LVecBase2d &ptr):
443  _pta(ptr.v0()),
444  _ptr(ptr.p()),
445  _type(SPT_double),
446  _updated(true),
447  _size(ptr.size() * 2)
448 {
449 }
450 
451 /**
452  *
453  */
454 INLINE Shader::ShaderPtrData::
455 ShaderPtrData(const LVecBase4d &vec) :
456  _type(SPT_double),
457  _updated(true),
458  _size(4)
459 {
460  PTA_double pta = PTA_double::empty_array(4);
461  _pta = pta.v0();
462  _ptr = pta.p();
463  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
464  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
465 }
466 
467 /**
468  *
469  */
470 INLINE Shader::ShaderPtrData::
471 ShaderPtrData(const LVecBase3d &vec) :
472  _type(SPT_double),
473  _updated(true),
474  _size(3)
475 {
476  PTA_double pta = PTA_double::empty_array(3);
477  _pta = pta.v0();
478  _ptr = pta.p();
479  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
480  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
481 }
482 
483 /**
484  *
485  */
486 INLINE Shader::ShaderPtrData::
487 ShaderPtrData(const LVecBase2d &vec) :
488  _type(SPT_double),
489  _updated(true),
490  _size(2)
491 {
492  PTA_double pta = PTA_double::empty_array(2);
493  _pta = pta.v0();
494  _ptr = pta.p();
495  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
496  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
497 }
498 
499 /**
500  *
501  */
502 INLINE Shader::ShaderPtrData::
503 ShaderPtrData(const LMatrix4d &mat) :
504  _type(SPT_double),
505  _updated(true),
506  _size(16)
507 {
508  PTA_double pta = PTA_double::empty_array(16);
509  _pta = pta.v0();
510  _ptr = pta.p();
511  nassertv(sizeof(mat(0, 0)) * mat.get_num_components() == pta.size() * sizeof(pta[0]));
512  memcpy(_ptr, mat.get_data(), sizeof(mat(0, 0)) * mat.get_num_components());
513 }
514 
515 /**
516  *
517  */
518 INLINE Shader::ShaderPtrData::
519 ShaderPtrData(const LMatrix3d &mat) :
520  _type(SPT_double),
521  _updated(true),
522  _size(9)
523 {
524  PTA_double pta = PTA_double::empty_array(9);
525  _pta = pta.v0();
526  _ptr = pta.p();
527  nassertv(sizeof(mat(0, 0)) * mat.get_num_components() == pta.size() * sizeof(pta[0]));
528  memcpy(_ptr, mat.get_data(), sizeof(mat(0, 0)) * mat.get_num_components());
529 }
530 
531 /**
532  *
533  */
534 INLINE Shader::ShaderPtrData::
535 ShaderPtrData(const PTA_int &ptr):
536  _pta(ptr.v0()),
537  _ptr(ptr.p()),
538  _type(SPT_int),
539  _updated(true),
540  _size(ptr.size())
541 {
542 }
543 
544 /**
545  *
546  */
547 INLINE Shader::ShaderPtrData::
548 ShaderPtrData(const PTA_LVecBase4i &ptr):
549  _pta(ptr.v0()),
550  _ptr(ptr.p()),
551  _type(SPT_int),
552  _updated(true),
553  _size(ptr.size() * 4)
554 {
555 }
556 
557 /**
558  *
559  */
560 INLINE Shader::ShaderPtrData::
561 ShaderPtrData(const PTA_LVecBase3i &ptr):
562  _pta(ptr.v0()),
563  _ptr(ptr.p()),
564  _type(SPT_int),
565  _updated(true),
566  _size(ptr.size() * 3)
567 {
568 }
569 
570 /**
571  *
572  */
573 INLINE Shader::ShaderPtrData::
574 ShaderPtrData(const PTA_LVecBase2i &ptr):
575  _pta(ptr.v0()),
576  _ptr(ptr.p()),
577  _type(SPT_int),
578  _updated(true),
579  _size(ptr.size() * 2)
580 {
581 }
582 
583 /**
584  *
585  */
586 INLINE Shader::ShaderPtrData::
587 ShaderPtrData(const LVecBase4i &vec) :
588  _type(SPT_int),
589  _updated(true),
590  _size(4)
591 {
592  PTA_int pta = PTA_int::empty_array(4);
593  _pta = pta.v0();
594  _ptr = pta.p();
595  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
596  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
597 }
598 
599 /**
600  *
601  */
602 INLINE Shader::ShaderPtrData::
603 ShaderPtrData(const LVecBase3i &vec) :
604  _type(SPT_int),
605  _updated(true),
606  _size(3)
607 {
608  PTA_int pta = PTA_int::empty_array(3);
609  _pta = pta.v0();
610  _ptr = pta.p();
611  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
612  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
613 }
614 
615 /**
616  *
617  */
618 INLINE Shader::ShaderPtrData::
619 ShaderPtrData(const LVecBase2i &vec) :
620  _type(SPT_int),
621  _updated(true),
622  _size(2)
623 {
624  PTA_int pta = PTA_int::empty_array(2);
625  _pta = pta.v0();
626  _ptr = pta.p();
627  nassertv(sizeof(vec[0]) * vec.get_num_components() == pta.size() * sizeof(pta[0]));
628  memcpy(_ptr, vec.get_data(), sizeof(vec[0]) * vec.get_num_components());
629 }
630 
631 /**
632  * Writes the contents of this object to the datagram for shipping out to a
633  * Bam file.
634  */
635 INLINE void Shader::ShaderPtrData::
637  dg.add_uint8(_type);
638  dg.add_uint32((uint32_t)_size);
639 
640  if (_type == SPT_double) {
641  const double *data = (const double *) _ptr;
642  for (size_t i = 0; i < _size; ++i) {
643  dg.add_float64(data[i]);
644  }
645 
646  } else if (_type == SPT_float) {
647  const float *data = (const float *) _ptr;
648  for (size_t i = 0; i < _size; ++i) {
649  dg.add_float32(data[i]);
650  }
651  } else if (_type == SPT_int) {
652  const int *data = (const int *) _ptr;
653  for (size_t i = 0; i < _size; ++i) {
654  dg.add_int32(data[i]);
655  }
656  }
657 }
658 
659 /**
660  * Reads the object from a Datagram.
661  */
662 INLINE void Shader::ShaderPtrData::
664  _type = (ShaderPtrType) scan.get_uint8();
665  _size = scan.get_uint32();
666 
667  if (_type == SPT_double) {
668  PTA_double pta = PTA_double::empty_array(_size);
669  for (size_t i = 0; i < _size; ++i) {
670  pta[i] = scan.get_float64();
671  }
672  _pta = pta.v0();
673  _ptr = pta.p();
674 
675  } else if (_type == SPT_float) {
676  PTA_float pta = PTA_float::empty_array(_size);
677  for (size_t i = 0; i < _size; ++i) {
678  pta[i] = scan.get_float32();
679  }
680  _pta = pta.v0();
681  _ptr = pta.p();
682 
683  } else if (_type == SPT_int) {
684  PTA_int pta = PTA_int::empty_array(_size);
685  for (size_t i = 0; i < _size; ++i) {
686  pta[i] = scan.get_int32();
687  }
688  _pta = pta.v0();
689  _ptr = pta.p();
690  }
691 }
692 
693 /**
694  *
695  */
696 INLINE Shader::ShaderFile::
697 ShaderFile(std::string shared) :
698  _separate(false),
699  _shared(std::move(shared))
700 {
701 }
702 
703 /**
704  *
705  */
706 INLINE Shader::ShaderFile::
707 ShaderFile(std::string vertex, std::string fragment, std::string geometry,
708  std::string tess_control, std::string tess_evaluation) :
709  _separate(true),
710  _vertex(std::move(vertex)),
711  _fragment(std::move(fragment)),
712  _geometry(std::move(geometry)),
713  _tess_control(std::move(tess_control)),
714  _tess_evaluation(std::move(tess_evaluation))
715 {
716 }
717 
718 /**
719  * Writes the contents of this object to the datagram for shipping out to a
720  * Bam file.
721  */
722 INLINE void Shader::ShaderFile::
724  if (_separate) {
725  dg.add_uint8(6);
726  dg.add_string(_vertex);
727  dg.add_string(_fragment);
728  dg.add_string(_geometry);
729  dg.add_string(_tess_control);
730  dg.add_string(_tess_evaluation);
731  dg.add_string(_compute);
732  } else {
733  dg.add_uint8(0);
734  dg.add_string(_shared);
735  }
736 }
737 
738 /**
739  * Reads the object from a Datagram.
740  */
741 INLINE void Shader::ShaderFile::
743  short count = scan.get_uint8();
744  if (count > 0) {
745  _separate = true;
746  if (count-- > 0) _vertex = scan.get_string();
747  if (count-- > 0) _fragment = scan.get_string();
748  if (count-- > 0) _geometry = scan.get_string();
749  if (count-- > 0) _tess_control = scan.get_string();
750  if (count-- > 0) _tess_evaluation = scan.get_string();
751  if (count-- > 0) _compute = scan.get_string();
752  while (count-- > 0) {
753  scan.get_string();
754  }
755  } else {
756  _separate = false;
757  _shared = scan.get_string();
758  }
759 }
760 
761 /**
762  * Ordering operator
763  */
764 INLINE bool Shader::ShaderFile::
765 operator < (const Shader::ShaderFile &other) const {
766  if (_separate != other._separate) {
767  return (!_separate && other._separate);
768  }
769  if (_shared != other._shared) {
770  return (_shared < other._shared);
771  }
772  if (_vertex != other._vertex) {
773  return (_vertex < other._vertex);
774  }
775  if (_fragment != other._fragment) {
776  return (_fragment < other._fragment);
777  }
778  if (_geometry != other._geometry) {
779  return (_geometry < other._geometry);
780  }
781  if (_tess_control != other._tess_control) {
782  return (_tess_control < other._tess_control);
783  }
784  if (_tess_evaluation != other._tess_evaluation) {
785  return (_tess_evaluation < other._tess_evaluation);
786  }
787  if (_compute != other._compute) {
788  return (_compute < other._compute);
789  }
790  return false;
791 }
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
void add_float64(PN_float64 value)
Adds a 64-bit floating-point number to the datagram.
Definition: datagram.I:123
void write_datagram(Datagram &dg) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: shader.I:636
void add_float32(PN_float32 value)
Adds a 32-bit single-precision floating-point number to the datagram.
Definition: datagram.I:114
bool operator<(const ShaderFile &other) const
Ordering operator.
Definition: shader.I:765
const std::string & get_text(ShaderType type=ST_none) const
Return the Shader's text for the given shader type.
Definition: shader.I:89
bool get_error_flag() const
Returns true if the shader contains a compile-time error.
Definition: shader.I:124
Filename get_filename(ShaderType type=ST_none) const
Return the Shader's filename for the given shader type.
Definition: shader.I:20
int32_t get_int32()
Extracts a signed 32-bit integer.
ShaderLanguage get_language() const
Returns the shader language in which this shader was written.
Definition: shader.I:132
std::string get_string()
Extracts a variable-length string.
void set_filename(ShaderType type, const Filename &filename)
Sets the Shader's filename for the given shader type.
Definition: shader.I:58
PN_float32 get_float32()
Extracts a 32-bit single-precision floating-point number.
bool has_fullpath() const
Returns true if the fullpath has been set and is available.
Definition: shader.I:141
void add_uint32(uint32_t value)
Adds an unsigned 32-bit integer to the datagram.
Definition: datagram.I:94
void set_cache_compiled_shader(bool flag)
Sets the cache_compiled_shader flag.
Definition: shader.I:173
void read_datagram(DatagramIterator &source)
Reads the object from a Datagram.
Definition: shader.I:742
const Filename & get_fullpath() const
Returns the fullpath that has been set.
Definition: shader.I:150
void read_datagram(DatagramIterator &source)
Reads the object from a Datagram.
Definition: shader.I:663
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
void write_datagram(Datagram &dg) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: shader.I:723
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
Definition: datagram.I:219
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
bool get_cache_compiled_shader() const
Returns the setting of the cache_compiled_shader flag.
Definition: shader.I:159
PN_float64 get_float64()
Extracts a 64-bit floating-point number.
void add_int32(int32_t value)
Adds a signed 32-bit integer to the datagram.
Definition: datagram.I:67
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
Definition: datagram.I:50
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38