HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROP_Dumper.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 #ifndef __ROP_Dumper_h__
27 #define __ROP_Dumper_h__
28 
29 #include <ROP/ROP_Node.h>
30 
31 #define STR_PARM(name, idx, vi, t) \
32  { evalString(str, name, &ifdIndirect[idx], vi, t); }
33 #define INT_PARM(name, idx, vi, t) \
34  { return evalInt(name, &ifdIndirect[idx], vi, t); }
35 
36 #define STR_SET(name, idx, vi, t) \
37  { setString(str, name, ifdIndirect[idx], vi, t); }
38 #define STR_GET(name, idx, vi, t) \
39  { evalStringRaw(str, name, &ifdIndirect[idx], vi, t); }
40 
41 class OP_TemplatePair;
42 class OP_VariablePair;
43 
44 namespace HDK_Sample {
45 
46 class ROP_Dumper : public ROP_Node {
47 public:
48 
49  /// Provides access to our parm templates.
51  /// Provides access to our variables.
53  /// Creates an instance of this node.
54  static OP_Node *myConstructor(OP_Network *net, const char*name,
55  OP_Operator *op);
56 
57 protected:
58  ROP_Dumper(OP_Network *net, const char *name, OP_Operator *entry);
59  ~ROP_Dumper() override;
60 
61  /// Called at the beginning of rendering to perform any intialization
62  /// necessary.
63  /// @param nframes Number of frames being rendered.
64  /// @param s Start time, in seconds.
65  /// @param e End time, in seconds.
66  /// @return True of success, false on failure (aborts the render).
67  int startRender(int nframes, fpreal s, fpreal e) override;
68 
69  /// Called once for every frame that is rendered.
70  /// @param time The time to render at.
71  /// @param boss Interrupt handler.
72  /// @return Return a status code indicating whether to abort the
73  /// render, continue, or retry the current frame.
75 
76  /// Called after the rendering is done to perform any post-rendering steps
77  /// required.
78  /// @return Return a status code indicating whether to abort the
79  /// render, continue, or retry.
80  ROP_RENDER_CODE endRender() override;
81 
82 public:
83 
84  /// A convenience method to evaluate our custom file parameter.
85  void OUTPUT(UT_String &str, fpreal t)
86  { STR_PARM("file", 0, 0, t) }
87 
88 private:
89  static int *ifdIndirect;
90  fpreal myEndTime;
91 };
92 
93 } // End HDK_Sample namespace
94 
95 
96 #undef STR_PARM
97 #undef STR_SET
98 #undef STR_GET
99 
100 #endif
ROP_RENDER_CODE
Definition: ROP_Node.h:48
static OP_TemplatePair * getTemplatePair()
Provides access to our parm templates.
Definition: ROP_Dumper.C:76
GT_API const UT_StringHolder time
#define STR_PARM(name, idx, vi, t)
Definition: ROP_Dumper.h:31
ROP_Dumper(OP_Network *net, const char *name, OP_Operator *entry)
Definition: ROP_Dumper.C:104
GLdouble s
Definition: glad.h:3009
ROP_RENDER_CODE endRender() override
Definition: ROP_Dumper.C:165
GLuint const GLchar * name
Definition: glcorearb.h:786
~ROP_Dumper() override
Definition: ROP_Dumper.C:113
void OUTPUT(UT_String &str, fpreal t)
A convenience method to evaluate our custom file parameter.
Definition: ROP_Dumper.h:85
GLdouble t
Definition: glad.h:2397
static OP_VariablePair * getVariablePair()
Provides access to our variables.
Definition: ROP_Dumper.C:90
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *op)
Creates an instance of this node.
Definition: ROP_Dumper.C:99
int startRender(int nframes, fpreal s, fpreal e) override
Definition: ROP_Dumper.C:122
ROP_RENDER_CODE renderFrame(fpreal time, UT_Interrupt *boss) override
Definition: ROP_Dumper.C:143
fpreal64 fpreal
Definition: SYS_Types.h:277