Panda3D
|
Computes texture coordinates for geometry automatically based on vertex position and/or normal. More...
#include "texGenAttrib.h"
Classes | |
class | ModeDef |
Public Types | |
typedef pset< TextureStage * > | LightVectors |
typedef RenderAttrib::TexGenMode | Mode |
Public Member Functions | |
virtual int | complete_pointers (TypedWritable **plist, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). | |
CPT (RenderAttrib) add_stage(TextureStage *stage | |
CPT (RenderAttrib) add_stage(TextureStage *stage | |
CPT (RenderAttrib) remove_stage(TextureStage *stage) const | |
CPT (RenderAttrib) add_stage(TextureStage *stage | |
virtual TypeHandle | force_init_type () |
const LTexCoord3 & | get_constant_value (TextureStage *stage) const |
Returns the constant value associated with the named texture stage. | |
int | get_geom_rendering (int geom_rendering) const |
Returns the union of the Geom::GeomRendering bits that will be required once this TexGenAttrib is applied to a geom which includes the indicated geom_rendering bits. | |
NodePath | get_light (TextureStage *stage) const |
Returns the Light associated with the named texture stage, or the empty NodePath if no light is associated with the indicated stage. | |
const LightVectors & | get_light_vectors () const |
Returns the set of TextureStages that have M_light_vector in effect, as well as the associated Lights. | |
Mode | get_mode (TextureStage *stage) const |
Returns the generation mode associated with the named texture stage, or M_off if nothing is associated with the indicated stage. | |
virtual int | get_slot () const |
string | get_source_name (TextureStage *stage) const |
Returns the source name associated with the named texture stage, or the empty string if no name is associated with the indicated stage. | |
virtual TypeHandle | get_type () const |
bool | has_gen_texcoord_stage (TextureStage *stage) const |
Returns true if the indicated TextureStage will have texture coordinates generated for it automatically (and thus there is no need to upload the texture coordinates encoded in the vertices). | |
bool | has_stage (TextureStage *stage) const |
Returns true if there is a mode associated with the indicated stage, or false otherwise (in which case get_transform(stage) will return M_off). | |
bool | is_empty () const |
Returns true if no stages are defined in the TexGenAttrib, false if at least one is. | |
virtual void | output (ostream &out) const |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. | |
Static Public Member Functions | |
static | CPT (RenderAttrib) make() |
static | CPT (RenderAttrib) make(TextureStage *stage |
static | CPT (RenderAttrib) make_default() |
static int | get_class_slot () |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type TexGenAttrib. | |
Public Attributes | |
Mode mode | const |
Mode const string const NodePath &light | const |
Mode const LTexCoord3 &constant_value | const |
Mode | mode |
static Mode | mode |
Mode const string & | source_name |
Protected Member Functions | |
TexGenAttrib () | |
Use TexGenAttrib::make() to construct a new TexGenAttrib object. | |
TexGenAttrib (const TexGenAttrib ©) | |
Use TexGenAttrib::make() to construct a new TexGenAttrib object. | |
virtual int | compare_to_impl (const RenderAttrib *other) const |
Intended to be overridden by derived TexGenAttrib types to return a unique number indicating whether this TexGenAttrib is equivalent to the other one. | |
virtual | CPT (RenderAttrib) invert_compose_impl(const RenderAttrib *other) const |
virtual | CPT (RenderAttrib) compose_impl(const RenderAttrib *other) const |
virtual | CPT (RenderAttrib) get_auto_shader_attrib_impl(const RenderState *state) const |
void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new TexGenAttrib. | |
virtual size_t | get_hash_impl () const |
Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties. | |
Static Protected Member Functions | |
static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type TexGenAttrib is encountered in the Bam file. |
Computes texture coordinates for geometry automatically based on vertex position and/or normal.
This can be used to implement reflection and/or refraction maps, for instance to make shiny surfaces, as well as other special effects such as projective texturing.
Definition at line 36 of file texGenAttrib.h.
TexGenAttrib::TexGenAttrib | ( | ) | [inline, protected] |
Use TexGenAttrib::make() to construct a new TexGenAttrib object.
Definition at line 23 of file texGenAttrib.I.
Referenced by make_from_bam().
TexGenAttrib::TexGenAttrib | ( | const TexGenAttrib & | copy | ) | [inline, protected] |
Use TexGenAttrib::make() to construct a new TexGenAttrib object.
Definition at line 38 of file texGenAttrib.I.
int TexGenAttrib::compare_to_impl | ( | const RenderAttrib * | other | ) | const [protected, virtual] |
Intended to be overridden by derived TexGenAttrib types to return a unique number indicating whether this TexGenAttrib is equivalent to the other one.
This should return 0 if the two TexGenAttrib objects are equivalent, a number less than zero if this one should be sorted before the other one, and a number greater than zero otherwise.
This will only be called with two TexGenAttrib objects whose get_type() functions return the same.
Reimplemented from RenderAttrib.
Definition at line 374 of file texGenAttrib.cxx.
int TexGenAttrib::complete_pointers | ( | TypedWritable ** | p_list, |
BamReader * | manager | ||
) | [virtual] |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
Returns the number of pointers processed.
Reimplemented from TypedWritable.
Definition at line 680 of file texGenAttrib.cxx.
void TexGenAttrib::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new TexGenAttrib.
Reimplemented from RenderAttrib.
Definition at line 724 of file texGenAttrib.cxx.
References DatagramIterator::get_uint16(), DatagramIterator::get_uint8(), and BamReader::read_pointer().
Referenced by make_from_bam().
const LTexCoord3 & TexGenAttrib::get_constant_value | ( | TextureStage * | stage | ) | const |
Returns the constant value associated with the named texture stage.
This is only meaningful if the mode is M_constant.
Definition at line 286 of file texGenAttrib.cxx.
References LPoint3f::zero().
int TexGenAttrib::get_geom_rendering | ( | int | geom_rendering | ) | const [inline] |
Returns the union of the Geom::GeomRendering bits that will be required once this TexGenAttrib is applied to a geom which includes the indicated geom_rendering bits.
Definition at line 57 of file texGenAttrib.I.
Referenced by RenderState::get_geom_rendering().
size_t TexGenAttrib::get_hash_impl | ( | ) | const [protected, virtual] |
Intended to be overridden by derived RenderAttrib types to return a unique hash for these particular properties.
RenderAttribs that compare the same with compare_to_impl(), above, should return the same hash; RenderAttribs that compare differently should return a different hash.
Reimplemented from RenderAttrib.
Definition at line 425 of file texGenAttrib.cxx.
References sequence_hash< Key, Compare >::add_hash(), integer_hash< Key, Compare >::add_hash(), and pointer_hash::add_hash().
NodePath TexGenAttrib::get_light | ( | TextureStage * | stage | ) | const |
Returns the Light associated with the named texture stage, or the empty NodePath if no light is associated with the indicated stage.
This is only meaningful if the mode is M_light_vector.
Definition at line 270 of file texGenAttrib.cxx.
Referenced by NodePath::get_tex_gen_light().
const TexGenAttrib::LightVectors & TexGenAttrib::get_light_vectors | ( | ) | const [inline] |
Returns the set of TextureStages that have M_light_vector in effect, as well as the associated Lights.
Definition at line 73 of file texGenAttrib.I.
TexGenAttrib::Mode TexGenAttrib::get_mode | ( | TextureStage * | stage | ) | const |
Returns the generation mode associated with the named texture stage, or M_off if nothing is associated with the indicated stage.
Definition at line 219 of file texGenAttrib.cxx.
Referenced by ShaderGenerator::analyze_renderstate(), TinyGraphicsStateGuardian::begin_draw_primitives(), and NodePath::get_tex_gen().
string TexGenAttrib::get_source_name | ( | TextureStage * | stage | ) | const |
Returns the source name associated with the named texture stage, or the empty string if no name is associated with the indicated stage.
This is only meaningful if the mode is M_light_vector, in which case it indicates the name of the source texture coordinate set from which the tangent and binormal are derived.
Definition at line 253 of file texGenAttrib.cxx.
bool TexGenAttrib::has_gen_texcoord_stage | ( | TextureStage * | stage | ) | const |
Returns true if the indicated TextureStage will have texture coordinates generated for it automatically (and thus there is no need to upload the texture coordinates encoded in the vertices).
Definition at line 236 of file texGenAttrib.cxx.
bool TexGenAttrib::has_stage | ( | TextureStage * | stage | ) | const |
Returns true if there is a mode associated with the indicated stage, or false otherwise (in which case get_transform(stage) will return M_off).
Definition at line 206 of file texGenAttrib.cxx.
Referenced by ShaderGenerator::analyze_renderstate(), and NodePath::has_tex_gen().
bool TexGenAttrib::is_empty | ( | ) | const |
Returns true if no stages are defined in the TexGenAttrib, false if at least one is.
Definition at line 194 of file texGenAttrib.cxx.
TypedWritable * TexGenAttrib::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type TexGenAttrib is encountered in the Bam file.
It should create the TexGenAttrib and extract its information from the file.
Definition at line 705 of file texGenAttrib.cxx.
References fillin(), and TexGenAttrib().
Referenced by register_with_read_factory().
void TexGenAttrib::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type TexGenAttrib.
Definition at line 646 of file texGenAttrib.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from RenderAttrib.
Definition at line 657 of file texGenAttrib.cxx.
References Datagram::add_uint16(), Datagram::add_uint8(), and BamWriter::write_pointer().