Browse Source

Int shader inputs

rdb 11 years ago
parent
commit
44aea55a66
2 changed files with 128 additions and 19 deletions
  1. 101 0
      panda/src/pgraph/shaderInput.I
  2. 27 19
      panda/src/pgraph/shaderInput.h

+ 101 - 0
panda/src/pgraph/shaderInput.I

@@ -377,6 +377,107 @@ ShaderInput(const InternalName *name, const LMatrix3d &mat, int priority) :
 {
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderInput::Constructor
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE ShaderInput::
+ShaderInput(const InternalName *name, const PTA_int &ptr, int priority) : 
+  _name(name),
+  _type(M_numeric),
+  _priority(priority),
+  _stored_ptr(ptr)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderInput::Constructor
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE ShaderInput::
+ShaderInput(const InternalName *name, const PTA_LVecBase4i &ptr, int priority) : 
+  _name(name),
+  _type(M_numeric),
+  _priority(priority),
+  _stored_ptr(ptr)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderInput::Constructor
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE ShaderInput::
+ShaderInput(const InternalName *name, const PTA_LVecBase3i &ptr, int priority) : 
+  _name(name),
+  _type(M_numeric),
+  _priority(priority),
+  _stored_ptr(ptr)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderInput::Constructor
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE ShaderInput::
+ShaderInput(const InternalName *name, const PTA_LVecBase2i &ptr, int priority) :
+  _name(name),
+  _type(M_numeric),
+  _priority(priority),
+  _stored_ptr(ptr)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderInput::Constructor
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE ShaderInput::
+ShaderInput(const InternalName *name, const LVecBase4i &vec, int priority) :
+  _name(name),
+  _type(M_numeric),
+  _priority(priority),
+  _stored_ptr(vec),
+  _stored_vector((int)vec.get_x(), (int)vec.get_y(), (int)vec.get_z(), (int)vec.get_w())
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderInput::Constructor
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE ShaderInput::
+ShaderInput(const InternalName *name, const LVecBase3i &vec, int priority) :
+  _name(name),
+  _type(M_numeric),
+  _priority(priority),
+  _stored_ptr(vec),
+  _stored_vector((int)vec.get_x(), (int)vec.get_y(), (int)vec.get_z(), 0.0)
+{
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: ShaderInput::Constructor
+//       Access: Published
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE ShaderInput::
+ShaderInput(const InternalName *name, const LVecBase2i &vec, int priority) :
+  _name(name),
+  _type(M_numeric),
+  _priority(priority),
+  _stored_ptr(vec),
+  _stored_vector((int)vec.get_x(), (int)vec.get_y(), 0.0, 0.0)
+{
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: ShaderInput::get_name
 //       Access: Published

+ 27 - 19
panda/src/pgraph/shaderInput.h

@@ -48,29 +48,37 @@ PUBLISHED:
   INLINE ShaderInput(const InternalName *id, const NodePath &np, int priority=0);
   INLINE ShaderInput(const InternalName *id, Texture *tex, int priority=0);
   INLINE ShaderInput(const InternalName *id, const PTA_float &ptr, int priority=0);
-  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4f &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3f &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2f &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4f &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3f &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LVecBase4f &vec, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LVecBase3f &vec, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LVecBase2f &vec, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LMatrix4f &mat, int priority=0); 
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4f &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3f &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2f &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4f &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3f &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase4f &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase3f &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase2f &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LMatrix4f &mat, int priority=0);
   INLINE ShaderInput(const InternalName *id, const LMatrix3f &mat, int priority=0);
 
-  INLINE ShaderInput(const InternalName *id, const PTA_double &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4d &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3d &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2d &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4d &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3d &ptr, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LVecBase4d &vec, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LVecBase3d &vec, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LVecBase2d &vec, int priority=0); 
-  INLINE ShaderInput(const InternalName *id, const LMatrix4d &mat, int priority=0); 
+  INLINE ShaderInput(const InternalName *id, const PTA_double &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4d &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3d &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2d &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4d &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3d &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase4d &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase3d &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase2d &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LMatrix4d &mat, int priority=0);
   INLINE ShaderInput(const InternalName *id, const LMatrix3d &mat, int priority=0);
 
+  INLINE ShaderInput(const InternalName *id, const PTA_int &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4i &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3i &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2i &ptr, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase4i &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase3i &vec, int priority=0);
+  INLINE ShaderInput(const InternalName *id, const LVecBase2i &vec, int priority=0);
+
   enum ShaderInputType {
     M_invalid = 0,
     M_texture,