25 int TexGenAttrib::_attrib_slot;
    41   if (_empty_attrib == 
nullptr) {
    53   return DCAST(
TexGenAttrib, make())->add_stage(stage, mode);
    71 add_stage(
TextureStage *stage, TexGenAttrib::Mode mode)
 const {
    72   nassertr(mode != M_constant, 
this);
    77   ModeDef &mode_def = attrib->_stages[stage];
    78   mode_def._mode = mode;
    79   attrib->record_stage(stage, mode_def);
    81   return return_new(attrib);
    94           const LTexCoord3 &constant_value)
 const {
    95   nassertr(mode == M_constant, 
this);
   100   ModeDef &mode_def = attrib->_stages[stage];
   101   mode_def._mode = mode;
   102   mode_def._constant_value = constant_value;
   103   attrib->record_stage(stage, mode_def);
   105   return return_new(attrib);
   114   Stages::const_iterator si;
   115   si = _stages.find(stage);
   116   if (si == _stages.end()) {
   120   Mode mode = (*si).second._mode;
   122   attrib->_stages.erase(stage);
   123   attrib->_no_texcoords.erase(stage);
   124   if (mode == M_point_sprite) {
   125     attrib->_num_point_sprites--;
   126     if (attrib->_num_point_sprites == 0) {
   127       attrib->_point_geom_rendering &= ~
Geom::GR_point_sprite;
   130   return return_new(attrib);
   139   return _stages.empty();
   148   Stages::const_iterator mi = _stages.find(stage);
   149   return (mi != _stages.end());
   156 TexGenAttrib::Mode TexGenAttrib::
   158   Stages::const_iterator mi = _stages.find(stage);
   159   if (mi != _stages.end()) {
   160     return (*mi).second._mode;
   172   NoTexCoordStages::const_iterator mi = _no_texcoords.find(stage);
   173   return (mi != _no_texcoords.end());
   180 const LTexCoord3 &TexGenAttrib::
   182   Stages::const_iterator mi = _stages.find(stage);
   183   if (mi != _stages.end()) {
   184     return (*mi).second._constant_value;
   186   return LTexCoord3::zero();
   193 output(std::ostream &out)
 const {
   194   out << get_type() << 
":";
   196   Stages::const_iterator mi;
   197   for (mi = _stages.begin(); mi != _stages.end(); ++mi) {
   199     const ModeDef &mode_def = (*mi).second;
   200     out << 
" " << stage->
get_name() << 
"(";
   201     switch (mode_def._mode) {
   206     case M_eye_sphere_map:
   207       out << 
"eye_sphere_map";
   210     case M_world_cube_map:
   211       out << 
"world_cube_map";
   214       out << 
"eye_cube_map";
   218       out << 
"world_normal";
   224     case M_world_position:
   225       out << 
"world_position";
   228       out << 
"eye_position";
   232       out << 
"point_sprite";
   236       out << 
"constant: " << mode_def._constant_value;
   262   Stages::const_iterator ai, bi;
   263   ai = _stages.begin();
   264   bi = ta->_stages.begin();
   265   while (ai != _stages.end() && bi != ta->_stages.end()) {
   266     if ((*ai).first < (*bi).first) {
   270     } 
else if ((*bi).first < (*ai).first) {
   276       int compare = (*ai).second.compare_to((*bi).second);
   285   if (bi != ta->_stages.end()) {
   290   if (ai != _stages.end()) {
   304 size_t TexGenAttrib::
   305 get_hash_impl()
 const {
   307   Stages::const_iterator ri;
   308   for (ri = _stages.begin(); ri != _stages.end(); ++ri) {
   310     const ModeDef &mode_def = (*ri).second;
   315     hash = mode_def._light.add_hash(hash);
   316     hash = mode_def._constant_value.add_hash(hash);
   342   Stages::const_iterator ai, bi;
   343   ai = _stages.begin();
   344   bi = ta->_stages.begin();
   345   while (ai != _stages.end() && bi != ta->_stages.end()) {
   346     if ((*ai).first < (*bi).first) {
   348       attrib->_stages.insert(attrib->_stages.end(), *ai);
   351     } 
else if ((*bi).first < (*ai).first) {
   353       attrib->_stages.insert(attrib->_stages.end(), *bi);
   358       attrib->_stages.insert(attrib->_stages.end(), *bi);
   364   while (ai != _stages.end()) {
   366     attrib->_stages.insert(attrib->_stages.end(), *ai);
   370   while (bi != ta->_stages.end()) {
   372     attrib->_stages.insert(attrib->_stages.end(), *bi);
   376   attrib->filled_stages();
   378   return return_new(attrib);
   396   Stages::const_iterator ai, bi;
   397   ai = _stages.begin();
   398   bi = ta->_stages.begin();
   399   while (ai != _stages.end() && bi != ta->_stages.end()) {
   400     if ((*ai).first < (*bi).first) {
   402       attrib->_stages.insert(attrib->_stages.end(), Stages::value_type((*ai).first, ModeDef()));
   405     } 
else if ((*bi).first < (*ai).first) {
   407       attrib->_stages.insert(attrib->_stages.end(), *bi);
   412       attrib->_stages.insert(attrib->_stages.end(), *bi);
   418   while (ai != _stages.end()) {
   420     attrib->_stages.insert(attrib->_stages.end(), Stages::value_type((*ai).first, ModeDef()));
   424   while (bi != ta->_stages.end()) {
   426     attrib->_stages.insert(attrib->_stages.end(), *bi);
   430   attrib->filled_stages();
   432   return return_new(attrib);
   444   for (ri = _stages.begin(); ri != _stages.end(); ++ri) {
   446     ModeDef &mode_def = (*ri).second;
   447     record_stage(stage, mode_def);
   456 record_stage(
TextureStage *stage, TexGenAttrib::ModeDef &mode_def) {
   457   switch (mode_def._mode) {
   459     _no_texcoords.insert(stage);
   460     _point_geom_rendering |= Geom::GR_point_sprite;
   461     _num_point_sprites++;
   468     _no_texcoords.insert(stage);
   490   Stages::const_iterator si;
   491   for (si = _stages.begin(); si != _stages.end(); ++si) {
   493     Mode mode = (*si).second._mode;
   509   for (mi = _read_modes.begin(); mi != _read_modes.end(); ++mi) {
   513     _stages[stage]._mode = mode;
   533   attrib->fillin(scan, manager);
   544   RenderAttrib::fillin(scan, manager);
   552   _read_modes.reserve(num_stages);
   553   for (
size_t i = 0; i < num_stages; i++) {
   556     _read_modes.push_back(mode);
 static size_t add_hash(size_t start, const void *key)
Adds the indicated key into a running hash.
 
get_name
Returns the name of this texture stage.
 
This is the base class for a number of render attributes (other than transform) that may be set on sc...
 
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
 
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
Base class for objects that can be written to and read from Bam files.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
This is our own Panda specialization on the default STL vector.
 
static size_t add_hash(size_t start, const Key &key)
Adds the indicated key into a running hash.
 
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
 
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
 
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.
 
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().
 
static void register_with_read_factory()
Tells the BamReader how to create objects of type TexGenAttrib.
 
A container for geometry primitives.
 
An instance of this class is passed to the Factory when requesting it to do its business and construc...
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
CPT(RenderAttrib) TexGenAttrib
Constructs a TexGenAttrib that generates no stages at all.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
 
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
 
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
 
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
 
A class to retrieve the individual data elements previously stored in a Datagram.
 
TypeHandle is the identifier used to differentiate C++ class types.
 
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.
 
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
 
Computes texture coordinates for geometry automatically based on vertex position and/or normal.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
static size_t add_hash(size_t start, const Key &key)
Adds the elements of the indicated key into a running hash.
 
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
 
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.