HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SHOP_VopShaderAdapter.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: SHOP_VopShaderAdapter.h ( SHOP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __SHOP_VopShaderAdapter__
12 #define __SHOP_VopShaderAdapter__
13 
14 #include "SHOP_API.h"
15 #include "SHOP_NodeTypes.h"
16 #include <OP/OP_DataTypes.h>
17 #include <UT/UT_BoundingBox.h>
18 #include <SYS/SYS_Types.h>
19 
20 
21 class SHOP_ReData;
22 class VOP_Node;
23 class OP_Node;
24 class UT_String;
25 class UT_StringArray;
26 class UT_Options;
27 
28 
29 /// A layer over VOP shaders that allows tapping into the SHOP clerks for
30 /// shader parameter evaluation. This allows treating VOP shaders the same way
31 /// as SHOP node shaders, with respect to shader aspect evaluation calls.
33 {
34 public:
36 
37  /// Registers some callback for use of VOP lib.
38  static void installCallbacks();
39 
40  /// Returns a shader node of a given type.
41  // The options may contain:
42  // rendertype: The the shader for a specific renderer
43  OP_Node *findShader(SHOP_TYPE shader_type, fpreal now,
44  const UT_Options *options);
45 
46  /// Returns the actual shader type reported by the underlying VOP.
47  SHOP_TYPE getShaderType();
48 
49  /// Builds shader call representation as a string
50  /// (ie, shader "command" name followed by the argument name/value pairs).
51  bool buildShaderString(UT_String &result, fpreal now,
52  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
53  SHOP_TYPE interpret_type = SHOP_INVALID);
54 
55  /// Returns the shader handle by which the shader instance is known
56  /// to the renderer or to other shaders wanting to reference this one.
57  bool buildShaderHandle(UT_String &result, fpreal now,
58  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
59  SHOP_TYPE interpret_type = SHOP_INVALID);
60 
61  /// Returns the name of a language in which the shader is written.
62  bool buildShaderLanguage(UT_String &result, fpreal now,
63  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
64  SHOP_TYPE interpret_type = SHOP_INVALID);
65 
66  /// Returns the shader data for the viewport rendering.
67  bool buildShaderData(SHOP_ReData &data, fpreal now,
68  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
69  SHOP_TYPE interpret_type = SHOP_INVALID);
70 
71  /// Builds the shader bounds for the displacement shader.
72  bool buildShaderBounds(UT_BoundingBox &box, fpreal now,
73  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
74  SHOP_TYPE interpret_type = SHOP_INVALID);
75 
76  /// Returns the list of co-shaders used by this shader.
77  bool buildCoShaderStrings(UT_StringArray &result,
78  OP_NodeList &coshaders, fpreal now,
79  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
80  SHOP_TYPE interpret_type = SHOP_INVALID);
81 
82  /// Returns the list of co-shader handles used to reference the co-shaders
83  /// used by this shader.
84  bool buildCoShaderHandles(UT_StringArray &result, fpreal now,
85  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
86  SHOP_TYPE interpret_type = SHOP_INVALID);
87 
88  /// Returns the list of language names in which co-shaders are written.
89  bool buildCoShaderLanguages(UT_StringArray &result, fpreal now,
90  const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0,
91  SHOP_TYPE interpret_type = SHOP_INVALID);
92 
93  /// Returns shader string for procedural node 'proc'.
94  bool buildVopShaderString(VOP_Node *proc, UT_String &result, fpreal now,
95  const UT_Options *options, OP_Node *obj, OP_Node *sop,
96  SHOP_TYPE interpret_type = SHOP_INVALID);
97 
98  /// Returns ture if the given parameter has a corresponding input wired in.
99  bool hasCoShaderInputNode(const char* parm_name);
100 
101 private:
102  /// Gets the input node corresponding to the given parameter.
103  /// When shader input is wired, it means that output parameter of another
104  /// shader (co-shader) is used as input value for this shader.
105  VOP_Node * getCoShaderInputNode(const char* parm_name);
106 
107 private:
108  /// An underlying VOP shader node.
109  VOP_Node * myShaderVop;
110 };
111 
112 #endif
113 
#define SHOP_API
Definition: SHOP_API.h:10
SHOP_TYPE
GLboolean * data
Definition: glcorearb.h:130
double fpreal
Definition: SYS_Types.h:263
A map of string to various well defined value types.
Definition: UT_Options.h:42