HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_Bucket.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_Bucket__
19 #define __HUSD_Bucket__
20 
21 #include "HUSD_API.h"
22 #include <UT/UT_Options.h>
23 #include <UT/UT_StringArray.h>
24 
25 // ============================================================================
26 /// Represents a value associated with the bucket
27 /// Note, the keyword could be part of options structure, but many situations
28 /// benefit from having a single default bucketing string, such as a keyword.
30 {
31 public:
32  /// @{ Sets and gets the keyword (a string).
33  void setKeyword( const UT_StringRef &keyword )
34  { myKeyword = keyword; }
35  const UT_StringHolder & getKeyword() const
36  { return myKeyword; }
37  /// @}
38 
39  /// @{ Sets and gets the options (ie, parameters and their values).
40  void setOptions( const UT_Options &options )
41  { myOptions = options; }
42  const UT_Options & getOptions() const
43  { return myOptions; }
44  /// @}
45 
46 private:
47  UT_StringHolder myKeyword;
48  UT_Options myOptions;
49 };
50 
51 // ============================================================================
52 /// A class for grouping entities that belong to (or yield) the same value.
54 {
55 public:
56  /// @{ Accessor for the value associated with the bucket
58  { return myBucketValue; }
60  { return myBucketValue; }
61  /// @}
62 
63 private:
64  HUSD_BucketValue myBucketValue;
65 };
66 
67 // ============================================================================
68 /// Represents a group of primitives in a bucket.
69 /// The primitives can be represented using paths and/or indices.
71 {
72 public:
73  /// @{ Set and get primitives in the bucket, using path as prim identifier.
74  void setPrimPaths( const UT_StringArray &paths )
75  { myPrimPaths = paths; }
76  void addPrimPath( const UT_StringRef &path )
77  { myPrimPaths.append( path ); }
78  const UT_StringArray & getPrimPaths() const
79  { return myPrimPaths; }
80  /// @}
81 
82  /// @{ Set and get primitives in the bucket, using index as prim identifier.
84  { myPrimIndices = indices; }
86  { myPrimIndices.append( index ); }
87  const UT_ExintArray & getPrimIndices() const
88  { return myPrimIndices; }
89  /// @}
90 
91 private:
92  UT_StringArray myPrimPaths; // paths of prims in the bucket
93  UT_ExintArray myPrimIndices; // indices of prims in the bucket
94 };
95 
96 // ============================================================================
97 /// Represents a group of primitive faces (ie, a geometry subset) in a bucket.
98 /// The faces are represented by indices into a primitive of a given path.
100 {
101 public:
102  /// @{ Set and get the primitive path to which the faces belong.
104  { myPrimPath = path; }
105  const UT_StringHolder & getPrimPath() const
106  { return myPrimPath; }
107  /// @}
108 
109  /// @{ Set and get the faces in the bucket.
111  { myFaceIndices = indices; }
113  { myFaceIndices.append( index ); }
115  { return myFaceIndices; }
116  /// @}
117 
118 private:
119  UT_StringHolder myPrimPath; // path of the geo prim containing faces
120  UT_ExintArray myFaceIndices; // indices of faces in the bucket
121 };
122 
123 #endif
124 
GLsizei GLenum const void * indices
Definition: glcorearb.h:406
void addPrimPath(const UT_StringRef &path)
Set and get primitives in the bucket, using path as prim identifier.
Definition: HUSD_Bucket.h:76
const UT_ExintArray & getPrimIndices() const
Set and get primitives in the bucket, using index as prim identifier.
Definition: HUSD_Bucket.h:87
void setKeyword(const UT_StringRef &keyword)
Sets and gets the keyword (a string).
Definition: HUSD_Bucket.h:33
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
int64 exint
Definition: SYS_Types.h:125
#define HUSD_API
Definition: HUSD_API.h:32
void setPrimPath(const UT_StringRef &path)
Set and get the primitive path to which the faces belong.
Definition: HUSD_Bucket.h:103
void addPrimIndex(exint index)
Set and get primitives in the bucket, using index as prim identifier.
Definition: HUSD_Bucket.h:85
const UT_StringHolder & getPrimPath() const
Set and get the primitive path to which the faces belong.
Definition: HUSD_Bucket.h:105
const UT_StringArray & getPrimPaths() const
Set and get primitives in the bucket, using path as prim identifier.
Definition: HUSD_Bucket.h:78
HUSD_BucketValue & getBucketValue()
Accessor for the value associated with the bucket.
Definition: HUSD_Bucket.h:59
void setPrimPaths(const UT_StringArray &paths)
Set and get primitives in the bucket, using path as prim identifier.
Definition: HUSD_Bucket.h:74
const HUSD_BucketValue & getBucketValue() const
Accessor for the value associated with the bucket.
Definition: HUSD_Bucket.h:57
void setPrimIndices(const UT_ExintArray &indices)
Set and get primitives in the bucket, using index as prim identifier.
Definition: HUSD_Bucket.h:83
void setOptions(const UT_Options &options)
Sets and gets the options (ie, parameters and their values).
Definition: HUSD_Bucket.h:40
A class for grouping entities that belong to (or yield) the same value.
Definition: HUSD_Bucket.h:53
A map of string to various well defined value types.
Definition: UT_Options.h:84
const UT_StringHolder & getKeyword() const
Sets and gets the keyword (a string).
Definition: HUSD_Bucket.h:35
const UT_ExintArray & getFaceIndices() const
Set and get the faces in the bucket.
Definition: HUSD_Bucket.h:114
GLuint index
Definition: glcorearb.h:786
void addFaceIndex(exint index)
Set and get the faces in the bucket.
Definition: HUSD_Bucket.h:112
void setFaceIndices(const UT_ExintArray &indices)
Set and get the faces in the bucket.
Definition: HUSD_Bucket.h:110
const UT_Options & getOptions() const
Sets and gets the options (ie, parameters and their values).
Definition: HUSD_Bucket.h:42