HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ROP_RenderItem.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: ROP_RenderItem.h ( ROP Library, C++)
7  *
8  * COMMENTS:
9  * Defines a simple structure to describe what and how to render a ROP.
10  */
11 #ifndef ROP_RenderItem_h
12 #define ROP_RenderItem_h
13 
14 #include "ROP_API.h"
15 #include "ROP_Verbose.h"
16 
17 #include <UT/UT_Array.h>
18 #include <UT/UT_FloatArray.h>
19 #include <UT/UT_IntrusivePtr.h>
20 
21 
22 class ROP_Node;
23 
26 
27 
28 
29 class ROP_API ROP_RenderItem : public UT_IntrusiveRefCounter<ROP_RenderItem>
30 {
31 public:
32  explicit ROP_RenderItem(ROP_Node *node);
33  explicit ROP_RenderItem(const ROP_RenderItem &item);
34  ~ROP_RenderItem();
35 
36  // methods to set the frame range
37  void setSingleFrame(fpreal frame)
38  { mySingleFrame = true; myEndFrame = myStartFrame = frame; }
39 
40  void setFrameRange(fpreal start, fpreal end, fpreal finc);
41 
42  // Initially used.
43  void setUsed(bool used) { myUsedFlag = used; }
44 
45  // calling will render the ROP attached to this object.
46  bool render(ROP_Verbose *verbose=0, int count=0, int total=0) const;
47 
48  // returns true if 'item' would be covered by this ROP, making it a
49  // duplicate entry.
50  bool containedBy(const ROP_RenderItemHandle &item);
51 
52  // removes any overlapping frames. This should be called after contains(),
53  // which will remove any total overlaps.
54  void removeOverlap(const ROP_RenderItemHandle &item);
55 
56  bool mergeWith(const ROP_RenderItemHandle &item);
57 
58  // dump the render information to os.
59  void print(std::ostream &os, bool full_path, bool condense_range) const;
60 
61  // returns the number of frames that would be rendered by this item
62  int getNumFrames() const;
63 
64  // accessors
65  ROP_Node *getNode() const { return myNode; }
66  bool isSingleFrame() const { return mySingleFrame; }
67  fpreal getFrame() const { return myStartFrame; }
68  fpreal getStartFrame() const { return myStartFrame; }
69  fpreal getEndFrame() const { return myEndFrame; }
70  fpreal getFrameInc() const { return myFrameInc; }
71  bool getUsed() const { return myUsedFlag; }
72 
73  // a regular sequence is something that can be represented by
74  // start/end/finc. However, in removeOverlap(), removing overlapping
75  // frames may create a non-regular sequence, in which case, we need to
76  // render the frames individually.
77  bool isRegularSequence() const { return myRegularSequence; }
78  const UT_FprealArray &getFrameList() const { return myFrames; }
79 
80 
81  // Resets the render ids so that they start back at the beginning. Be
82  // careful where you call this from.
83  static void resetRenderIds() { ourRenderIdCount = 0; }
84 
85  int getRenderId() const { return myRenderId; }
86 
87  // Adds an item as a dependency, which means that this item must render
88  // before we do.
89  void addDependency(const ROP_RenderItemHandle &item) const;
90 
91  // Returns true if this item has a dependency on 'item'.
92  bool hasDependency(const ROP_RenderItemHandle &item) const;
93 
94  // clear all dependencies this item has.
95  void clearDependencies();
96 
97  // Take the dependencies of item and add them to our list
98  void mergeDependencies(const ROP_RenderItemHandle &item);
99 
100  // Removes all dependencies that have getUsed() == false
101  void removeUnusedDependencies();
102 
103  // Goes through our dependents and make them depend on with_item instead
104  // of this item.
105  void replaceDependencies(const ROP_RenderItemHandle &with_item);
106 
108  { return myDependencies; }
109 
111  { return myDependents; }
112 
113  // Returns true if this item depends on some other render item.
114  bool hasDependencies() const
115  { return myDependencies.entries() > 0; }
116 
117  // Returns true if some other render item depends on this item.
118  bool hasDependents() const
119  { return myDependents.entries() > 0; }
120 
121  // only to be used by ROP_RenderList to reindex dependendies for easier
122  // reading.
123  void setRenderId(int id) { myRenderId = id; }
124 
125 private:
126  ROP_Node *myNode;
127  bool mySingleFrame;
128  bool myRegularSequence;
129  fpreal myStartFrame;
130  fpreal myEndFrame;
131  fpreal myFrameInc;
132  UT_FprealArray myFrames;
133  bool myUsedFlag;
134 
135  int myRenderId;
136 
137  // This is the list of direct items that have to be rendered before this
138  // item. This list is usually very small.
139  mutable UT_Array<ROP_RenderItemHandle> myDependencies;
140 
141  // This is the list of direct items that have to be rendered after this
142  // item. This list is usually very small.
143  mutable UT_Array<ROP_RenderItemHandle> myDependents;
144 
145 
146  static int ourRenderIdCount;
147 };
148 
149 #endif
void setUsed(bool used)
fpreal getStartFrame() const
fpreal getEndFrame() const
bool hasDependencies() const
GLuint start
Definition: glcorearb.h:474
bool getUsed() const
fpreal getFrameInc() const
const UT_FprealArray & getFrameList() const
A reference counter base class for use with UT_IntrusivePtr.
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
#define ROP_API
Definition: ROP_API.h:10
UT_Array< ROP_RenderItemHandle > & getDependencies()
GLuint id
Definition: glcorearb.h:654
ROP_Node * getNode() const
bool isSingleFrame() const
int getRenderId() const
const UT_Array< ROP_RenderItemHandle > & getDependents() const
bool isRegularSequence() const
GLuint GLuint end
Definition: glcorearb.h:474
void setRenderId(int id)
GLint GLsizei count
Definition: glcorearb.h:404
double fpreal
Definition: SYS_Types.h:263
bool hasDependents() const
static void resetRenderIds()
fpreal getFrame() const
void setSingleFrame(fpreal frame)
UT_IntrusivePtr< ROP_RenderItem > ROP_RenderItemHandle