From de7ec424c7c5e2c2dcb9344fa19b24ef9994fd44 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 9 Feb 2014 16:45:08 +0000 Subject: [PATCH] Add get_tangent_name and get_binormal_name --- panda/src/gobj/textureStage.I | 35 ++++++++++++++++++++++++++++++++++- panda/src/gobj/textureStage.h | 23 +++++++++++------------ 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/panda/src/gobj/textureStage.I b/panda/src/gobj/textureStage.I index e5ca4d94d8..cb5c6c0504 100755 --- a/panda/src/gobj/textureStage.I +++ b/panda/src/gobj/textureStage.I @@ -141,13 +141,46 @@ set_texcoord_name(const string &name) { //////////////////////////////////////////////////////////////////// // Function: TextureStage::get_texcoord_name // Access: Published -// Description: Returns the InternalName +// Description: See set_texcoord_name. The default is +// InternalName::get_texcoord(). //////////////////////////////////////////////////////////////////// INLINE InternalName *TextureStage:: get_texcoord_name() const { return _texcoord_name; } +//////////////////////////////////////////////////////////////////// +// Function: TextureStage::get_tangent_name +// Access: Published +// Description: Returns the set of tangents this texture stage will +// use. This is the same as get_texcoord_name(), +// except that the first part is "tangent". +//////////////////////////////////////////////////////////////////// +INLINE InternalName *TextureStage:: +get_tangent_name() const { + if (_texcoord_name->get_parent() == NULL) { + return InternalName::get_tangent(); + } else { + return InternalName::get_tangent_name(_texcoord_name->get_basename()); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: TextureStage::get_binormal_name +// Access: Published +// Description: Returns the set of binormals this texture stage will +// use. This is the same as get_binormal_name(), +// except that the first part is "binormal". +//////////////////////////////////////////////////////////////////// +INLINE InternalName *TextureStage:: +get_binormal_name() const { + if (_texcoord_name->get_parent() == NULL) { + return InternalName::get_binormal(); + } else { + return InternalName::get_binormal_name(_texcoord_name->get_basename()); + } +} + //////////////////////////////////////////////////////////////////// // Function: TextureStage::set_mode // Access: Published diff --git a/panda/src/gobj/textureStage.h b/panda/src/gobj/textureStage.h index ff1734e7cf..9831124864 100644 --- a/panda/src/gobj/textureStage.h +++ b/panda/src/gobj/textureStage.h @@ -45,7 +45,7 @@ PUBLISHED: enum Mode { // Modes that pertain to the fixed-function pipeline. - + M_modulate, M_decal, M_blend, @@ -53,12 +53,12 @@ PUBLISHED: M_add, M_combine, M_blend_color_scale, - + M_modulate_glow, // When fixed-function, equivalent to modulate. M_modulate_gloss, // When fixed-function, equivalent to modulate. - + // Modes that are only relevant to shader-based rendering. - + M_normal, M_normal_height, M_glow, // Rarely used: modulate_glow is more efficient. @@ -67,7 +67,7 @@ PUBLISHED: M_selector, M_normal_gloss, }; - + enum CombineMode { CM_undefined, CM_replace, @@ -113,12 +113,14 @@ PUBLISHED: INLINE void set_texcoord_name(InternalName *name); INLINE void set_texcoord_name(const string &texcoord_name); INLINE InternalName *get_texcoord_name() const; - + INLINE InternalName *get_tangent_name() const; + INLINE InternalName *get_binormal_name() const; + INLINE void set_mode(Mode mode); INLINE Mode get_mode() const; - + INLINE bool is_fixed_function() const; - + INLINE void set_color(const LColor &color); INLINE LColor get_color() const; @@ -231,7 +233,7 @@ private: static PT(TextureStage) _default_stage; static UpdateSeq _sort_seq; - + public: // Datagram stuff static void register_with_read_factory(); @@ -272,6 +274,3 @@ EXPCL_PANDA_GOBJ ostream &operator << (ostream &out, TextureStage::CombineOperan #include "textureStage.I" #endif - - -