HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GABC_PackedGT.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) COPYRIGHTYEAR
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  */
27 
28 #ifndef __GABC_PackedGT__
29 #define __GABC_PackedGT__
30 
31 #include "GABC_API.h"
32 #include "GABC_Types.h"
34 #include <GT/GT_PackedAlembic.h>
35 #include <GT/GT_PrimInstance.h>
36 
37 class GU_PrimPacked;
38 
39 namespace GABC_NAMESPACE
40 {
41 
42 /// Collector for packed primitives.
44 {
45 public:
47  virtual ~GABC_CollectPacked();
48 
49  /// @{
50  /// Interface defined for GT_GEOPrimCollect
51  virtual GT_GEOPrimCollectData *
53  const GT_RefineParms *parms) const;
54  virtual GT_PrimitiveHandle
56  const GEO_Primitive *const* prim_list,
57  int nsegments,
59  virtual GT_PrimitiveHandle
60  endCollecting(const GT_GEODetailListHandle &geometry,
62  /// @}
63 private:
64 };
65 
66 /// Collection class for a single archive's worth of Alembic primitives.
67 /// This is generally only useful for the viewport.
69 {
70 public:
71  GABC_PackedArchive(const UT_StringHolder &archive_name,
72  const GT_GEODetailListHandle &source_list,
73  const GABC_NAMESPACE::GABC_IArchivePtr &archive,
74  int index);
75 
76  virtual const char *className() const { return "GABC_PackedArchive"; }
77 
78  virtual bool bucketPrims(const GT_PackedAlembicArchive *prev_archive,
79  const GT_RefineParms *ref_parms,
80  bool force_update);
81 
82  virtual GT_PrimitiveHandle doSoftCopy() const { return nullptr; }
83 
84  int getIndex() const { return myIndex; }
85 
86 private:
87  virtual bool archiveMatch(const GT_PackedAlembicArchive *archive) const;
88 
90  int myIndex;
91 };
92 
93 /// Single Alembic shape (non-instanced)
95 {
96 public:
98  const GU_PrimPacked *prim,
99  const GT_DataArrayHandle &vp_mat,
100  const GT_DataArrayHandle &vp_remap,
101  bool build_packed_attribs = false);
102 
104  virtual ~GABC_PackedAlembic();
105 
106  virtual void initVisAnim();
107 
108  virtual const char *className() const { return "GABC_PackedAlembic"; }
110  { return new GABC_PackedAlembic(*this); }
111 
112  virtual GT_PrimitiveHandle getPointCloud(const GT_RefineParms *p,
113  bool &xform) const;
114  virtual GT_PrimitiveHandle getFullGeometry(const GT_RefineParms *p,
115  bool &xform) const;
116  virtual GT_PrimitiveHandle getBoxGeometry(const GT_RefineParms *p) const;
117  virtual GT_PrimitiveHandle getCentroidGeometry(const GT_RefineParms *p) const;
118 
119  virtual bool canInstance() const { return true; }
120  virtual bool getInstanceKey(UT_Options &options) const;
121  virtual GT_PrimitiveHandle getInstanceGeometry(const GT_RefineParms *p,
122  bool ignore_visibility=false) const;
123  virtual GT_TransformHandle getInstanceTransform() const;
124 
125  virtual bool isVisible();
126 
127  virtual bool refine(GT_Refine &refiner,
128  const GT_RefineParms *parms=NULL) const;
129 
130  virtual bool getCachedGeometry(GT_PrimitiveHandle &ph) const;
131 
132  virtual void cacheTransform(const GT_TransformHandle &ph);
133  virtual bool getCachedTransform(GT_TransformHandle &ph) const;
134  virtual void cacheVisibility(bool visible);
135  virtual bool getCachedVisibility(bool &visible) const;
136 
137  virtual GT_TransformHandle getLocalTransform() const;
138 
139  virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
140  const GT_RefineParms &refine);
141 private:
142  int64 myColorID;
143 };
144 
145 /// Packed instance with alembic extensions
147 {
148 public:
151  GABC_PackedInstance(const GT_PrimitiveHandle &geometry,
153  GEO_AnimationType animation,
154  const GT_GEOOffsetList &packed_prim_offsets=GT_GEOOffsetList(),
158  virtual ~GABC_PackedInstance();
159 
160  virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
161  const GT_RefineParms &refine);
162 };
163 
164 }; // GABC_NAMESPACE
165 
166 #endif
Single Alembic shape (non-instanced)
png_infop int transforms
Definition: png.h:2591
virtual GT_PrimitiveHandle endCollecting(const GT_GEODetailListHandle &geometry, GT_GEOPrimCollectData *data) const
UT_IntrusivePtr< GT_AttributeList > GT_AttributeListHandle
Definition: GT_Handles.h:24
Collector for packed primitives.
Definition: GABC_PackedGT.h:43
virtual GT_PrimitiveHandle collect(const GT_GEODetailListHandle &geo, const GEO_Primitive *const *prim_list, int nsegments, GT_GEOPrimCollectData *data) const
Packed instance with alembic extensions.
Single Alembic shape (non-instanced)
Definition: GABC_PackedGT.h:94
#define GABC_NAMESPACE
Definition: GABC_API.h:42
Collection data container.
Instanced alembic primitive.
long long int64
Definition: SYS_Types.h:100
virtual GT_GEOPrimCollectData * beginCollecting(const GT_GEODetailListHandle &geometry, const GT_RefineParms *parms) const
GEO_AnimationType
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
GLboolean * data
Definition: glcorearb.h:130
virtual GT_PrimitiveHandle doSoftCopy() const
Definition: GABC_PackedGT.h:82
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
A map of string to various well defined value types.
Definition: UT_Options.h:42
GLuint index
Definition: glcorearb.h:785
#define GABC_API
Definition: GABC_API.h:37
virtual GT_PrimitiveHandle doSoftCopy() const
virtual const char * className() const
Definition: GABC_PackedGT.h:76
virtual bool canInstance() const
UT_SharedPtr< GT_GEODetailList > GT_GEODetailListHandle
virtual const char * className() const
GLenum src
Definition: glcorearb.h:1792