HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GU_SubDivCurve.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: GU_SubDivCurve.h (GU Library, C++)
7  *
8  * COMMENTS: Functions for evaluating subdivision curves, similar to
9  * subdivision surfaces.
10  */
11 
12 #pragma once
13 
14 #ifndef __GU_SubDivCurve__
15 #define __GU_SubDivCurve__
16 
17 #include "GU_API.h"
18 #include <GA/GA_Handle.h>
19 #include <GA/GA_Types.h>
20 #include <UT/UT_VectorTypes.h>
21 #include <stddef.h>
22 
23 class GA_Detail;
24 class GA_PrimitiveGroup;
25 class GEO_Face;
26 
27 /// Returns the number of open polygons in the given detail.
29  const GA_Detail &detail,
30  const GA_PrimitiveGroup *group=NULL);
31 
32 /// Creates new polygon curves in dest from any curves in src (srcgroup if
33 /// specified), that are subdivided levels times.
34 /// If dest==src and treatasindependent is false, it will reuse any points that
35 /// are used by primitives that are not being subdivided, to maintain
36 /// equivalent connectivity. Curves with zero vertices or one vertex
37 /// will be left untouched. Other points, vertices, and primitives will
38 /// usually be new.
39 /// Returns the number of polygon curves that were generated in dest.
40 /// NOTE: The number of vertices generated is exponential in levels, not linear!
42  GA_Detail &dest,
43  const GA_Detail &src,
44  int segmentsperedge,
45  bool treatasindependent=false,
46  const GA_PrimitiveGroup *srcgroup=NULL);
47 
48 /// Evaluates this curve (or face boundary if closed) as the specified
49 /// cubic spline at u (in [0,1]).
50 ///
51 /// If midbasis and startbasis are not specified, the bases for
52 /// subdivision curves will be used.
53 /// Column 0 of midbasis is the unit coefficients for p[-1],p[0],p[1],p[2].
54 /// Column 1 is the t coefficients; column 2 is the t^2 coefficients, and
55 /// column 3 is the t^3 coefficients. firstbasis is only used if the
56 /// face is open and has rows in the order p[0],p[1],p[2],p[3] for the
57 /// first edge, and is used in reverse for the last edge.
58 ///
59 /// attrib can have any owner, including primitive and detail,
60 /// in which case the value is constant. Otherwise, if this face has no
61 /// vertices, the output will be zeroed. If it has one vertex, the value
62 /// will be copied. If it has two vertices, the values will be lerped.
63 /// If it has 3 vertices and firstbasis has a non-zero row 3,
64 /// the quadratic interpolating basis will be used (this may change).
65 ///
66 /// This is instantiated for fpreal16, fpreal32, fpreal64, and the
67 /// corresponding UT_Vector2T, UT_Vector3T, UT_Vector4T, UT_Matrix2T,
68 /// UT_Matrix3T, and UT_Matrix4T types.
69 ///
70 /// If T is a scalar type and component=-1, all components of the attribute
71 /// will be evaluated into vals, instead of just one, so make sure
72 /// it's large enough. In the version that takes a T&val, only the
73 /// specified component is evaluated into val.
74 /// @{
75 template<typename T>
77  const GEO_Face &face,
78  float u, T &val, const GA_ROHandleT<T> &attrib,
79  const UT_Matrix4 *midbasis=NULL,
80  const UT_Matrix4 *firstbasis=NULL,
81  int component=0);
82 template<typename T>
84  const GEO_Face &face,
85  float startu, float endu, exint nus,
86  T *vals, const GA_ROHandleT<T> &attrib,
87  const UT_Matrix4 *midbasis=NULL,
88  const UT_Matrix4 *firstbasis=NULL,
89  int component=-1);
90 template<typename T>
92  const GEO_Face &face,
93  const float *us, exint nus,
94  T *vals, const GA_ROHandleT<T> &attrib,
95  const UT_Matrix4 *midbasis=NULL,
96  const UT_Matrix4 *firstbasis=NULL,
97  int component=-1);
98 /// @}
99 
100 /// This moves the values of the given attribute such that
101 /// if this polygon were subdivided as a subdivision curve,
102 /// the limit curve would interpolate the starting values.
103 /// In a sense, this "undoes" the subdivision so that it
104 /// can be done later to produce the same result.
105 ///
106 /// If T is a scalar type and component=-1, all components of the attribute
107 /// will be evaluated into vals, instead of just one, so make sure
108 /// it's large enough.
109 /// @{
110 template<typename T>
112  const GEO_Face &face,
113  const GA_RWHandleT<T> &attrib,
114  int component=-1);
115 template<typename ARRAY,typename T>
117  const ARRAY &offsets,
118  GA_AttributeOwner offsetowner,
119  const GA_RWHandleT<T> &attrib,
120  int component=-1,
121  bool closed=false);
122 /// @}
123 
124 #endif
void GUinterpolateCurveAsSubD(const GEO_Face &face, const GA_RWHandleT< T > &attrib, int component=-1)
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
GA_Size GU_API GUsubdivideCurves(GA_Detail &dest, const GA_Detail &src, int segmentsperedge, bool treatasindependent=false, const GA_PrimitiveGroup *srcgroup=NULL)
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2620
int64 exint
Definition: SYS_Types.h:109
#define GU_API
Definition: GU_API.h:11
GA_AttributeOwner
Definition: GA_Types.h:33
void GUevaluateCubicCurve(const GEO_Face &face, float u, T &val, const GA_ROHandleT< T > &attrib, const UT_Matrix4 *midbasis=NULL, const UT_Matrix4 *firstbasis=NULL, int component=0)
GLuint GLfloat * val
Definition: glcorearb.h:1607
Container class for all geometry.
Definition: GA_Detail.h:96
GA_Size GU_API GUcountOpenPolys(const GA_Detail &detail, const GA_PrimitiveGroup *group=NULL)
Returns the number of open polygons in the given detail.
GLenum src
Definition: glcorearb.h:1792