24 if (_filename._separate && type != ST_none) {
27 return _filename._vertex;
30 return _filename._fragment;
33 return _filename._geometry;
36 return _filename._tess_control;
38 case ST_tess_evaluation:
39 return _filename._tess_evaluation;
42 return _filename._compute;
45 return _filename._shared;
47 }
else if (!_filename._shared.empty()) {
48 return _filename._shared;
52 return _filename._vertex;
63 if (_text._separate) {
64 nassertr(type != ST_none || !_text._shared.empty(), _text._shared);
70 return _text._fragment;
73 return _text._geometry;
76 return _text._tess_control;
78 case ST_tess_evaluation:
79 return _text._tess_evaluation;
82 return _text._compute;
113 _shader_utilization = sut;
127 if (_shader_utilization == SUT_unspecified) {
128 return shader_utilization;
130 return _shader_utilization;
144 return (_shader_utilization != SUT_unspecified);
153 INLINE Shader::ShaderLanguage
Shader::
163 INLINE Shader::ShaderCaps::
173 INLINE
bool Shader::ShaderCaps::
174 operator == (
const ShaderCaps &other)
const {
176 if ((_active_vprofile != other._active_vprofile) ||
177 (_active_fprofile != other._active_fprofile) ||
178 (_active_gprofile != other._active_gprofile) ||
179 (_ultimate_vprofile != other._ultimate_vprofile) ||
180 (_ultimate_fprofile != other._ultimate_fprofile) ||
181 (_ultimate_gprofile != other._ultimate_gprofile)) {
193 INLINE Shader::ShaderPtrData::
207 INLINE Shader::ShaderPtrData::
208 ShaderPtrData(
const PTA_float &ptr):
222 INLINE Shader::ShaderPtrData::
223 ShaderPtrData(
const PTA_LMatrix4f &ptr):
228 _size(ptr.size() * 16)
237 INLINE Shader::ShaderPtrData::
238 ShaderPtrData(
const PTA_LMatrix3f &ptr):
243 _size(ptr.size() * 9)
252 INLINE Shader::ShaderPtrData::
253 ShaderPtrData(
const PTA_LVecBase4f &ptr):
258 _size(ptr.size() * 4)
267 INLINE Shader::ShaderPtrData::
268 ShaderPtrData(
const PTA_LVecBase3f &ptr):
273 _size(ptr.size() * 3)
282 INLINE Shader::ShaderPtrData::
283 ShaderPtrData(
const PTA_LVecBase2f &ptr):
288 _size(ptr.size() * 2)
297 INLINE Shader::ShaderPtrData::
303 PTA_float pta = PTA_float::empty_array(4);
315 INLINE Shader::ShaderPtrData::
321 PTA_float pta = PTA_float::empty_array(3);
333 INLINE Shader::ShaderPtrData::
339 PTA_float pta = PTA_float::empty_array(2);
351 INLINE Shader::ShaderPtrData::
357 PTA_float pta = PTA_float::empty_array(16);
360 nassertv(
sizeof(mat(0, 0)) * mat.
get_num_components() == pta.size() *
sizeof(pta[0]));
369 INLINE Shader::ShaderPtrData::
375 PTA_float pta = PTA_float::empty_array(9);
378 nassertv(
sizeof(mat(0, 0)) * mat.
get_num_components() == pta.size() *
sizeof(pta[0]));
387 INLINE Shader::ShaderPtrData::
388 ShaderPtrData(
const PTA_double &ptr):
402 INLINE Shader::ShaderPtrData::
403 ShaderPtrData(
const PTA_LMatrix4d &ptr):
408 _size(ptr.size() * 16)
417 INLINE Shader::ShaderPtrData::
418 ShaderPtrData(
const PTA_LMatrix3d &ptr):
423 _size(ptr.size() * 9)
432 INLINE Shader::ShaderPtrData::
433 ShaderPtrData(
const PTA_LVecBase4d &ptr):
438 _size(ptr.size() * 4)
447 INLINE Shader::ShaderPtrData::
448 ShaderPtrData(
const PTA_LVecBase3d &ptr):
453 _size(ptr.size() * 3)
462 INLINE Shader::ShaderPtrData::
463 ShaderPtrData(
const PTA_LVecBase2d &ptr):
468 _size(ptr.size() * 2)
477 INLINE Shader::ShaderPtrData::
483 PTA_double pta = PTA_double::empty_array(4);
495 INLINE Shader::ShaderPtrData::
501 PTA_double pta = PTA_double::empty_array(3);
513 INLINE Shader::ShaderPtrData::
519 PTA_double pta = PTA_double::empty_array(2);
531 INLINE Shader::ShaderPtrData::
537 PTA_double pta = PTA_double::empty_array(16);
540 nassertv(
sizeof(mat(0, 0)) * mat.
get_num_components() == pta.size() *
sizeof(pta[0]));
549 INLINE Shader::ShaderPtrData::
555 PTA_double pta = PTA_double::empty_array(9);
558 nassertv(
sizeof(mat(0, 0)) * mat.
get_num_components() == pta.size() *
sizeof(pta[0]));
567 INLINE Shader::ShaderPtrData::
568 ShaderPtrData(
const PTA_int &ptr):
582 INLINE Shader::ShaderPtrData::
583 ShaderPtrData(
const PTA_LVecBase4i &ptr):
588 _size(ptr.size() * 4)
597 INLINE Shader::ShaderPtrData::
598 ShaderPtrData(
const PTA_LVecBase3i &ptr):
603 _size(ptr.size() * 3)
612 INLINE Shader::ShaderPtrData::
613 ShaderPtrData(
const PTA_LVecBase2i &ptr):
618 _size(ptr.size() * 2)
627 INLINE Shader::ShaderPtrData::
633 PTA_int pta = PTA_int::empty_array(4);
645 INLINE Shader::ShaderPtrData::
651 PTA_int pta = PTA_int::empty_array(3);
663 INLINE Shader::ShaderPtrData::
669 PTA_int pta = PTA_int::empty_array(2);
687 if (_type == SPT_double) {
688 const double *data = (
const double *) _ptr;
689 for (
size_t i = 0; i < _size; ++i) {
693 }
else if (_type == SPT_float) {
694 const float *data = (
const float *) _ptr;
695 for (
size_t i = 0; i < _size; ++i) {
698 }
else if (_type == SPT_int) {
699 const int *data = (
const int *) _ptr;
700 for (
size_t i = 0; i < _size; ++i) {
713 _type = (ShaderPtrType) scan.
get_uint8();
716 if (_type == SPT_double) {
717 PTA_double pta = PTA_double::empty_array(_size);
718 for (
size_t i = 0; i < _size; ++i) {
724 }
else if (_type == SPT_float) {
725 PTA_float pta = PTA_float::empty_array(_size);
726 for (
size_t i = 0; i < _size; ++i) {
732 }
else if (_type == SPT_int) {
733 PTA_int pta = PTA_int::empty_array(_size);
734 for (
size_t i = 0; i < _size; ++i) {
747 INLINE Shader::ShaderFile::
748 ShaderFile(
const string &shared) :
759 INLINE Shader::ShaderFile::
760 ShaderFile(
const string &vertex,
761 const string &fragment,
762 const string &geometry,
763 const string &tess_control,
764 const string &tess_evaluation) :
769 _tess_control(tess_control),
770 _tess_evaluation(tess_evaluation)
806 if (count-- > 0) _fragment = scan.
get_string();
807 if (count-- > 0) _geometry = scan.
get_string();
808 if (count-- > 0) _tess_control = scan.
get_string();
809 if (count-- > 0) _tess_evaluation = scan.
get_string();
810 if (count-- > 0) _compute = scan.
get_string();
811 while (count-- > 0) {
826 if (_separate != other._separate) {
827 return (!_separate && other._separate);
829 if (_shared != other._shared) {
830 return (_shared < other._shared);
832 if (_vertex != other._vertex) {
833 return (_vertex < other._vertex);
835 if (_fragment != other._fragment) {
836 return (_fragment < other._fragment);
838 if (_geometry != other._geometry) {
839 return (_geometry < other._geometry);
841 if (_tess_control != other._tess_control) {
842 return (_tess_control < other._tess_control);
844 if (_tess_evaluation != other._tess_evaluation) {
845 return (_tess_evaluation < other._tess_evaluation);
847 if (_compute != other._compute) {
848 return (_compute < other._compute);
868 }
else if (glsl_preprocess && index >= 2048 &&
869 (index - 2048) < (int)_included_files.size()) {
870 return _included_files[(size_t)index - 2048];
874 sprintf(str,
"%d", index);
const double * get_data() const
Returns the address of the first of the four data elements in the vector.
const float * get_data() const
Returns the address of the first of the four data elements in the vector.
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
This is the base class for all three-component vectors and points.
static void set_shader_utilization(ShaderUtilization utl)
Set this flag to SUT_none, SUT_basic, or SUT_advanced to limit panda's automatic shader generation fa...
This is a 4-by-4 transform matrix.
void add_string(const string &str)
Adds a variable-length string to the datagram.
static bool have_shader_utilization()
If true, then get_shader_utilization has been set using set_shader_utilization.
const float * get_data() const
Returns the address of the first of the three data elements in the vector.
void add_float64(PN_float64 value)
Adds a 64-bit floating-point number to the datagram.
int get_num_components() const
Returns the number of elements in the matrix, 16.
int get_num_components() const
Returns the number of elements in the matrix, 16.
const double * get_data() const
Returns the address of the first of the nine data elements in the matrix.
This is the base class for all two-component vectors and points.
void add_float32(PN_float32 value)
Adds a 32-bit single-precision floating-point number to the datagram.
Filename get_filename(const ShaderType &type=ST_none) const
Return the Shader's filename for the given shader type.
int get_num_components() const
Returns the number of elements in the vector, two.
This is the base class for all two-component vectors and points.
This is the base class for all three-component vectors and points.
static ShaderUtilization get_shader_utilization()
This flag returns SUT_none, SUT_basic, or SUT_advanced and controls the automatic generation of shade...
PN_int32 get_int32()
Extracts a signed 32-bit integer.
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
int get_num_components() const
Returns the number of elements in the vector, three.
PN_uint32 get_uint32()
Extracts an unsigned 32-bit integer.
bool get_error_flag() const
Returns true if the shader contains a compile-time error.
void write_datagram(Datagram &dg) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is the base class for all three-component vectors and points.
const float * get_data() const
Returns the address of the first of the two data elements in the vector.
string get_string()
Extracts a variable-length string.
const float * get_data() const
Returns the address of the first of the nine data elements in the matrix.
PN_float32 get_float32()
Extracts a 32-bit single-precision floating-point number.
void read_datagram(DatagramIterator &source)
Reads the object from a Datagram.
This is a 3-by-3 transform matrix.
const int * get_data() const
Returns the address of the first of the two data elements in the vector.
Filename get_filename_from_index(int index, ShaderType type) const
Returns the filename of the included shader with the given source file index (as recorded in the #lin...
int get_num_components() const
Returns the number of elements in the vector, three.
const double * get_data() const
Returns the address of the first of the two data elements in the vector.
void read_datagram(DatagramIterator &source)
Reads the object from a Datagram.
The name of a file, such as a texture file or an Egg file.
int get_num_components() const
Returns the number of elements in the vector, two.
This is a 4-by-4 transform matrix.
const double * get_data() const
Returns the address of the first of the three data elements in the vector.
const string & get_text(const ShaderType &type=ST_none) const
Return the Shader's text for the given shader type.
const int * get_data() const
Returns the address of the first of the four data elements in the vector.
This is the base class for all two-component vectors and points.
int get_num_components() const
Returns the number of elements in the vector, four.
This is the base class for all three-component vectors and points.
const int * get_data() const
Returns the address of the first of the three data elements in the vector.
This is the base class for all three-component vectors and points.
This is the base class for all three-component vectors and points.
int get_num_components() const
Returns the number of elements in the matrix, nine.
PN_float64 get_float64()
Extracts a 64-bit floating-point number.
void add_uint32(PN_uint32 value)
Adds an unsigned 32-bit integer to the datagram.
int get_num_components() const
Returns the number of elements in the vector, four.
const float * get_data() const
Returns the address of the first of the nine data elements in the matrix.
bool operator<(const ShaderFile &other) const
Ordering operator.
int get_num_components() const
Returns the number of elements in the vector, three.
void write_datagram(Datagram &dg) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
void add_int32(PN_int32 value)
Adds a signed 32-bit integer to the datagram.
A class to retrieve the individual data elements previously stored in a Datagram. ...
This is a 3-by-3 transform matrix.
int get_num_components() const
Returns the number of elements in the matrix, nine.
ShaderLanguage get_language() const
Returns the shader language in which this shader was written.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
int get_num_components() const
Returns the number of elements in the vector, two.
const double * get_data() const
Returns the address of the first of the nine data elements in the matrix.
int get_num_components() const
Returns the number of elements in the vector, four.