HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_WindingNumber.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024
3  * Side Effects Software Inc. All rights reserved.
4  *
5  * Redistribution and use of Houdini Development Kit samples in source and
6  * binary forms, with or without modification, are permitted provided that the
7  * following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. The name of Side Effects Software may not be used to endorse or
11  * promote products derived from this software without specific prior
12  * written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17  * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *----------------------------------------------------------------------------
26  * This SOP computes the winding number induced by a mesh at the specified points.
27  */
28 
29 #pragma once
30 
31 #ifndef __HDK_SOP_WindingNumber_h__
32 #define __HDK_SOP_WindingNumber_h__
33 
34 #include <SOP/SOP_Node.h>
35 #include <UT/UT_StringHolder.h>
36 
37 class PRM_Template;
38 
39 namespace HDK_Sample {
40 /// This is the SOP class definition. It doesn't need to be in a separate
41 /// file like this. This is just an example of a header file, in case
42 /// another file needs to reference something in here.
43 /// You shouldn't have to change anything in here except the name of the class.
45 {
46 public:
47  static PRM_Template *buildTemplates();
48  static OP_Node *myConstructor(OP_Network *net, const char *name, OP_Operator *op)
49  {
50  return new SOP_WindingNumber(net, name, op);
51  }
52 
53  const SOP_NodeVerb *cookVerb() const override;
54 
55 protected:
56  SOP_WindingNumber(OP_Network *net, const char *name, OP_Operator *op)
57  : SOP_Node(net, name, op)
58  {
59  // All verb SOPs must manage data IDs, to track what's changed
60  // from cook to cook.
62  }
63 
64  ~SOP_WindingNumber() override {}
65 
66  /// Since this SOP implements a verb, cookMySop just delegates to the verb.
67  OP_ERROR cookMySop(OP_Context &context) override
68  {
69  return cookMyselfAsVerb(context);
70  }
71 
72  /// These are the labels that appear when hovering over the inputs.
73  const char *inputLabel(unsigned idx) const override
74  {
75  switch (idx)
76  {
77  case 0: return "Query Points";
78  case 1: return "Occlusion Mesh";
79  default: return "Invalid Source";
80  }
81  }
82 
83  /// This just indicates whether an input wire gets drawn with a dotted line
84  /// in the network editor. If something is usually copied directly
85  /// into the output, a solid line (false) is used.
86  int isRefInput(unsigned i) const override
87  {
88  // Second input uses dotted line
89  return (i == 1);
90  }
91 };
92 } // End HDK_Sample namespace
93 
94 #endif
OP_ERROR cookMySop(OP_Context &context) override
Since this SOP implements a verb, cookMySop just delegates to the verb.
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *op)
const char * inputLabel(unsigned idx) const override
These are the labels that appear when hovering over the inputs.
UT_ErrorSeverity
Definition: UT_Error.h:25
const SOP_NodeVerb * cookVerb() const override
SOP_WindingNumber(OP_Network *net, const char *name, OP_Operator *op)
int isRefInput(unsigned i) const override
OP_ERROR cookMyselfAsVerb(OP_Context &context)
SOP_NodeFlags mySopFlags
Definition: SOP_Node.h:1628
GLuint const GLchar * name
Definition: glcorearb.h:786
void setManagesDataIDs(bool onOff)
Definition: SOP_NodeFlags.h:36
static PRM_Template * buildTemplates()