HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VOP_VariableInput.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: VOP Library (C++)
7  *
8  */
9 
10 #ifndef __VOP_VariableInput_h__
11 #define __VOP_VariableInput_h__
12 
13 #include "VOP_API.h"
14 #include "VOP_Node.h"
15 
16 #define VOP_UNIFORM_VARYING_COMBO(vtype, utype) \
17  vtype, vtype, \
18  vtype, utype, \
19  utype, utype,
20 
21 #define VOP_UNIFORM_VARYING_COMBO2(vtype1, utype1, vtype2, utype2) \
22  vtype1, vtype2, \
23  vtype1, utype2, \
24  utype1, utype2,
25 
27 {
28 public:
29  virtual void getCode(UT_String &codestr,
30  const VOP_CodeGenContext &context);
31  virtual void ensureParametersAreValid();
32 
33  virtual bool forceInputsToBool() const { return false; }
34 
35  virtual const char *inputLabel(unsigned idx) const;
36  virtual const char *outputLabel(unsigned idx) const;
37 
38  virtual unsigned getNumVisibleInputs() const;
39  virtual unsigned orderedInputs() const;
40 
41  // Get details that will vary from operator to operator.
42  virtual const char *getVariableOperator() const = 0;
43  virtual const char *getVariableOutputName() const = 0;
44  virtual const char *getVariableInputName() const
45  { return "input"; }
46 
47  // Return a list of VEX data types that expresses all the allowed
48  // data type combinations for this operator. The table should
49  // contain sets of LHS, then RHS, then Result data types.
50  virtual VOP_Type *getAllowedTypeCombinations() const = 0;
51 
52  /// Return the result type of the operation given the type of the first operant.
53  virtual VOP_Type getResultType(VOP_Type operand_type) const
54  { return operand_type; }
55 
56  virtual OP_ERROR setNamedInput(const OP_ConnectorId& input_name, OP_Node *op,
57  const OP_ConnectorId* output_name = NULL);
58  virtual OP_ERROR setNamedInputReference(const OP_ConnectorId& input_name,
59  const char *label, int, const OP_ConnectorId* output_name = NULL);
60 
61 protected:
62  VOP_VariableInput(OP_Network *net, const char *name, OP_Operator *entry);
63  virtual ~VOP_VariableInput();
64 
65  // Code to generate before and after the list:
66  virtual void getPreCode(UT_String &codestr) const;
67  virtual void getPostCode(UT_String &codestr) const;
68 
69  // Where do our variable inputs start? Index 0 by default.
70  virtual int getVariableOffset(void) const;
71 
72  // Where do our VEX function arguments start? Index 0 by default
73  virtual int getVexArgOffset(void) const;
74 
75  virtual void getInputNameSubclass(UT_String &in, int idx) const;
76  virtual int getInputFromNameSubclass(const UT_String &in) const;
77  virtual void getInputTypeInfoSubclass(VOP_TypeInfo &type_info,
78  int idx);
79 
80  virtual void getOutputNameSubclass(UT_String &out, int idx) const;
81  virtual void getOutputTypeInfoSubclass(VOP_TypeInfo &type_info,
82  int idx);
83 
84  int nConnectedVariableInputs() const;
85 
86  virtual void getAllowedInputTypesSubclass(unsigned idx,
87  VOP_VopTypeArray &voptypes);
88 
89  // These are semi-private. Only the RSL subtract operator really needs to
90  // fchange them.
91  virtual void computeAllowedTypes(int send_event=1);
92  void updateAllowedTypes() const;
93 
94  VOP_Type myAllowedInputTypes[VOP_MAX_TYPES];
97  mutable bool myInputInfoDirtyFlag;
98 };
99 
100 #endif
virtual int getInputFromNameSubclass(const UT_String &in) const
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
virtual void getAllowedInputTypesSubclass(unsigned idx, VOP_VopTypeArray &voptypes)
virtual unsigned getNumVisibleInputs() const
virtual const char * inputLabel(unsigned idx) const
virtual const char * getVariableInputName() const
virtual VOP_Type getResultType(VOP_Type operand_type) const
Return the result type of the operation given the type of the first operant.
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual bool forceInputsToBool() const
virtual void getInputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx)
#define VOP_API
Definition: VOP_API.h:10
virtual unsigned orderedInputs() const
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual OP_ERROR setNamedInputReference(const OP_ConnectorId &input_name, const char *label, int, const OP_ConnectorId *output_name=NULL)
virtual OP_ERROR setNamedInput(const OP_ConnectorId &input_name, OP_Node *op, const OP_ConnectorId *output_name=NULL)
New input functions that use names instead of indices.
virtual void getCode(UT_String &codestr, const VOP_CodeGenContext &context)
Get the code fragment to be included in the shader code.
virtual const char * outputLabel(unsigned idx) const
virtual void getOutputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx)
virtual void getOutputNameSubclass(UT_String &out, int idx) const
VOP_Type
Definition: VOP_Types.h:24
virtual void getInputNameSubclass(UT_String &in, int idx) const
virtual void ensureParametersAreValid()