Panda3D
 All Classes Functions Variables Enumerations
shaderInput.cxx
1 // Filename: shaderInput.cxx
2 // Created by: jyelon (01Sep05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "shaderInput.h"
16 #include "paramNodePath.h"
17 
18 TypeHandle ShaderInput::_type_handle;
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: ShaderInput::get_blank
22 // Access: Public, Static
23 // Description: Returns a static ShaderInput object with
24 // name NULL, priority zero, type INVALID, and
25 // all value-fields cleared.
26 ////////////////////////////////////////////////////////////////////
29  static CPT(ShaderInput) blank;
30  if (blank == 0) {
31  blank = new ShaderInput(NULL, 0);
32  }
33  return blank;
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: ShaderInput::Constructor
38 // Access: Published
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 ShaderInput::
42 ShaderInput(CPT_InternalName name, const NodePath &np, int priority) :
43  _name(MOVE(name)),
44  _type(M_nodepath),
45  _priority(priority),
46  _value(new ParamNodePath(np)),
47  _bind_layer(0),
48  _bind_level(0),
49  _access(A_read)
50 {
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function: ShaderInput::get_nodepath
55 // Access: Published
56 // Description: Warning: no error checking is done. This *will*
57 // crash if get_value_type() is not M_nodepath.
58 ////////////////////////////////////////////////////////////////////
60 get_nodepath() const {
61  return DCAST(ParamNodePath, _value)->get_value();
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: ShaderInput::register_with_read_factory
66 // Access: Public, Static
67 // Description:
68 ////////////////////////////////////////////////////////////////////
69 void ShaderInput::
70 register_with_read_factory() {
71  // IMPLEMENT ME
72 }
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
Definition: internalName.h:197
A class object for storing a NodePath as a parameter.
Definition: paramNodePath.h:26
This is a small container class that can hold any one of the value types that can be passed as input ...
Definition: shaderInput.h:41
static const ShaderInput * get_blank()
Returns a static ShaderInput object with name NULL, priority zero, type INVALID, and all value-fields...
Definition: shaderInput.cxx:28
const NodePath & get_nodepath() const
Warning: no error checking is done.
Definition: shaderInput.cxx:60
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165