HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  void getCode(UT_String &codestr,
30  const VOP_CodeGenContext &context
31  ) override;
32  void ensureParametersAreValid() override;
33 
34  virtual bool forceInputsToBool() const { return false; }
35 
36  const char *inputLabel(unsigned idx) const override;
37  const char *outputLabel(unsigned idx) const override;
38 
39  unsigned getNumVisibleInputs() const override;
40  unsigned orderedInputs() const override;
41 
42  // Get details that will vary from operator to operator.
43  virtual const char *getVariableOperator() const = 0;
44  virtual const char *getVariableOutputName() const = 0;
45  virtual const char *getVariableInputName() const
46  { return "input"; }
47 
48  // Return a list of VEX data types that expresses all the allowed
49  // data type combinations for this operator. The table should
50  // contain sets of LHS, then RHS, then Result data types.
51  virtual VOP_Type *getAllowedTypeCombinations() const = 0;
52 
53  /// Return the result type of the operation given the type of the first operant.
54  virtual VOP_Type getResultType(VOP_Type operand_type) const
55  { return operand_type; }
56 
58  const OP_ConnectorId &input_name,
59  OP_Node *op,
60  const OP_ConnectorId *output_name = 0
61  ) override;
63  const OP_ConnectorId& input_name,
64  const char *label,
65  int,
66  const OP_ConnectorId* output_name = 0
67  ) override;
68 
69 protected:
70  VOP_VariableInput(OP_Network *net, const char *name, OP_Operator *entry);
71  ~VOP_VariableInput() override;
72 
73  // Code to generate before and after the list:
74  virtual void getPreCode(UT_String &codestr) const;
75  virtual void getPostCode(UT_String &codestr) const;
76 
77  // Where do our variable inputs start? Index 0 by default.
78  virtual int getVariableOffset() const;
79 
80  // Where do our VEX function arguments start? Index 0 by default
81  virtual int getVexArgOffset() const;
82 
84  UT_String &in, int idx) const override;
86  const UT_String &in) const override;
88  VOP_TypeInfo &type_info, int idx) override;
89 
91  UT_String &out, int idx) const override;
93  VOP_TypeInfo &type_info, int idx) override;
94 
95  int nConnectedVariableInputs() const;
96 
98  unsigned idx,
99  VOP_VopTypeArray &voptypes) override;
100 
101  // These are semi-private. Only the RSL subtract operator really needs to
102  // fchange them.
103  virtual void computeAllowedTypes(int send_event=1);
104  void updateAllowedTypes() const;
105 
106  VOP_Type myAllowedInputTypes[VOP_MAX_TYPES];
109  mutable bool myInputInfoDirtyFlag;
110 };
111 
112 #endif
virtual int getInputFromNameSubclass(const UT_String &in) const
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
virtual void getAllowedInputTypesSubclass(unsigned idx, VOP_VopTypeArray &voptypes)
OP_ERROR setNamedInputReference(const OP_ConnectorId &input_name, const char *label, int, const OP_ConnectorId *output_name=nullptr) override
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:786
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
Enumeration of the built-in (basic) VOP data types.
Definition: VOP_Types.h:25
virtual void getInputNameSubclass(UT_String &in, int idx) const
virtual void ensureParametersAreValid()
OP_ERROR setNamedInput(const OP_ConnectorId &input_name, OP_Node *op, const OP_ConnectorId *output_name=nullptr) override
New input functions that use names instead of indices.