HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_BuildPrimitives.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: GEO_BuildPrimitives.h (GEO Library, C++)
7  *
8  * COMMENTS: Declarations of functions for building primitives in bulk
9  */
10 
11 #pragma once
12 
13 #ifndef __GEO_BuildPrimitives_h__
14 #define __GEO_BuildPrimitives_h__
15 
16 #include "GEO_API.h"
17 #include <GA/GA_PolyCounts.h>
18 #include <GA/GA_Types.h>
19 #include <SYS/SYS_Types.h>
20 #include <utility>
21 
22 class GEO_Detail;
23 
24 /// Function for building primitives in bulk, returning the first primitive offset.
25 /// This sets up the primitive list, vertices, and topology attributes,
26 /// parallelizing as much as possible. Any primitive content other than the
27 /// contents of the GA_Primitive base class will be left at default values,
28 /// so other data may still need to be initialized in other ways.
29 ///
30 /// Instantiated for INT_T of int (int32) and exint (int64)
31 ///
32 /// Despiate vertexlistsizelist being a GA_PolyCounts, (a run-length encoded
33 /// array of vertex list sizes), this function works for any primitive types
34 /// specified in the first component of each pair in primtype_count_pairs.
35 ///
36 /// If ncopies > 1, startpt will have npoints_per_copy added to it between each copy.
37 ///
38 /// Values in vertexpointnumbers are offsets, but relative to startpt,
39 /// so if constructing from point offsets, be sure to subtract off startpt
40 /// or specify startpt of GA_Offset(0).
41 ///
42 /// vertexpointnumbers can optionally be nullptr, in which case, vertices will
43 /// be wired to consecutive point offsets. (This implies that there are no
44 /// shared points.) This is a fairly common case for separate curve primitives,
45 /// packed primitives, or polygon soup primitives.
46 ///
47 /// Even if vertexpointnumbers is non-null, hassharedpoints being false can
48 /// save time (if it applies), because not having shared points
49 /// avoids the need to ensure a deterministic order of the linked list
50 /// topology attributes: vertex-to-next-vertex and vertex-to-previous-vertex.
51 ///
52 /// First value of closed_span_lengths is the number with closed false.
53 /// To start with closed true, have a value of 0 first, then the number with closed true.
54 /// nullptr means closed false for all primitives.
55 template<typename INT_T>
57  GEO_Detail *detail,
58  const std::pair<int,exint> *primtype_count_pairs,
59  const GA_Offset init_startpt,
60  const GA_Size npoints_per_copy,
61  const GA_PolyCounts &vertexlistsizelist,
62  const INT_T *vertexpointnumbers,
63  const bool hassharedpoints,
64  const exint *closed_span_lengths,
65  const exint ncopies = 1);
66 
67 #endif
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:231
GA_Size GA_Offset
Definition: GA_Types.h:637
int64 exint
Definition: SYS_Types.h:120
GEO_API GA_Offset GEObuildPrimitives(GEO_Detail *detail, const std::pair< int, exint > *primtype_count_pairs, const GA_Offset init_startpt, const GA_Size npoints_per_copy, const GA_PolyCounts &vertexlistsizelist, const INT_T *vertexpointnumbers, const bool hassharedpoints, const exint *closed_span_lengths, const exint ncopies=1)
#define GEO_API
Definition: GEO_API.h:14