HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GU_Muscle.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_Muscle.h
7
*
8
* COMMENTS: Meta-ball based muscle deformer, used by SOP_Muscle
9
*/
10
11
#ifndef __GU_Muscle_h__
12
#define __GU_Muscle_h__
13
14
#include "
GU_API.h
"
15
#include "
GU_Detail.h
"
16
#include <
GA/GA_Handle.h
>
17
18
class
OP_Context
;
19
class
GEO_PrimPoly
;
20
class
GU_PrimMetaball;
21
class
GU_PrimSphere
;
22
23
// Default values for group names
24
#define DEFAULT_CENTER_GROUP "center"
25
26
typedef
fpreal
gu_Cubic
[4];
27
28
enum
GU_MuscleType
29
{
30
GU_MUSCLE_META
= 0,
31
GU_MUSCLE_SPHERE
32
};
33
34
//-----------------------------------------------------------------------------
35
36
class
GU_API
GU_MuscleParms
37
{
38
public
:
39
40
GU_Detail
*
gdp
;
41
42
GU_Detail
*
myExtraGdp
;
43
44
// Parameters directly corresponding to those appearing in the UI:
45
46
// Muscle Name
47
UT_String
name
;
48
49
// Muscle scale
50
fpreal
fullscalex, fullscaley,
fullscalez
;
51
52
// Control positions
53
fpreal
pos2, pos3,
pos4
;
54
55
// Control scales
56
fpreal
sx1, sx2, sx3, sx4,
sx5
;
57
fpreal
sy1, sy2, sy3, sy4,
sy5
;
58
fpreal
sz1, sz2, sz3, sz4,
sz5
;
59
60
// Primitives per segment
61
int
primsPerSegment
;
62
63
// Muscle Type - Metaball Capture, Spheres Only
64
GU_MuscleType
type
;
65
66
// Center Line parameters
67
int
basis
;
68
int
sampledivs
;
69
int
firstcv
;
70
int
lastcv
;
71
float
cvtension
;
72
};
73
74
//-----------------------------------------------------------------------------
75
76
class
GU_API
GU_Muscle
77
{
78
public
:
79
80
GU_Muscle
();
81
~GU_Muscle
() {}
82
83
bool
build(
GU_MuscleParms
&parms,
84
const
UT_Array<UT_Matrix4>
85
&inputXforms);
86
87
GA_PointGroup
*
getCenterPoints
() {
return
myCenterPoints; }
88
GA_PrimitiveGroup
*
getPrimitiveGroup
() {
return
myPrimitives; }
89
int
getNumPrimitives
() {
return
myNumPrimitives; }
90
91
bool
getTranslates(
92
UT_Array<UT_Matrix4>
&translates);
93
94
bool
getRotates(
UT_Array<UT_Matrix4>
&rotates);
95
96
const
GEO_PrimPoly
*getCenterCurve();
97
98
private
:
99
100
// Computes the a set of cubics for the left hand side of the
101
// profile curve.
102
static
void
calcLeftCurve(
gu_Cubic
&curve1,
103
gu_Cubic
&curve2,
104
fpreal
y1
,
fpreal
y2,
fpreal
y3,
105
fpreal
x2,
fpreal
x3);
106
107
// Computes the set of cubics for the right hand side of the
108
// profile curve.
109
static
void
calcRightCurve(
gu_Cubic
&curve1,
110
gu_Cubic
&curve2,
111
fpreal
y3,
fpreal
y4,
fpreal
y5,
112
fpreal
x3,
fpreal
x4);
113
114
// Evaluates a profile curve using the given cubics and division information.
115
static
inline
fpreal
evalProfile(
fpreal
t
,
116
const
gu_Cubic
&curve1,
117
const
gu_Cubic
&curve2,
118
const
gu_Cubic
&curve3,
119
const
gu_Cubic
&curve4,
120
fpreal
x2,
fpreal
x3,
fpreal
x4);
121
122
// This function takes the existing centre line and uses it to
123
// construct a new centre line with points at the given positions
124
// along the curve. It is needed to make point distribution uniform.
125
GEO_PrimPoly
*resampleCenterLine(
const
UT_FloatArray
126
&positions);
127
128
// Adds primitives depending on the muscle type
129
void
addPrimitives(
int
numPrimitives);
130
131
// Sets up scale transforms using an array of scale values
132
void
setupScaleXforms(
const
UT_Vector3Array
133
&scales);
134
135
// Returns a list of muscle primitive positions (ie. u values 0 <= u <= 1)
136
// along the center line as well as three dimensional scale values for
137
// each muscle primitive.
138
bool
getPrimitiveInfo(
UT_FloatArray
&positions,
139
UT_Vector3Array
&scales,
140
bool
controlPointsOnly=
false
);
141
142
143
// Transforms each muscle primitive to place it along the
144
// center line and orient it appropriately
145
void
transformPrimitives(
GEO_PrimPoly
*guide);
146
147
// Builds the center line for this muscle.
148
bool
buildCenterLine(
const
UT_Array<UT_Matrix4>
149
&inputXforms);
150
151
void
CENTERGROUP(
UT_String
&str)
152
{
153
str =
DEFAULT_CENTER_GROUP
;
154
}
155
156
// A function to be called by subdivide point groups, used to create
157
// polygons interpolating between our anchor points.
158
void
addPoly(
GA_PointGroup
*
group
);
159
160
// Adds metaball primitives (and a group to store them) if necessary.
161
void
addMetaPrimitives(
int
numMeta);
162
163
//Adds sphere primitives (and a group to store them) if necessary.
164
void
addSpherePrimitives(
int
numSpheres);
165
166
void
getPrimitiveTranslates(
GEO_PrimPoly
*guide,
167
int
numPrimitives,
168
UT_Array<UT_Matrix4>
&translates);
169
170
private
:
171
172
GU_MuscleParms
*myParms;
173
174
// Stores the centre curve for this muscle
175
GEO_PrimPoly
*myCenterCurve;
176
177
// Stores the centre curve points for this
178
// muscle
179
GA_PointGroup
*myCenterPoints;
180
181
// Stores the primitives (spheres or metaballs)
182
// currently used by this muscle
183
GA_PrimitiveGroup
*myPrimitives;
184
185
// Stores the number of primitives we are currently
186
// storing
187
int
myNumPrimitives;
188
189
// Since we never duplicate any input sources,
190
// we should be able to just store the normal
191
// offset
192
GA_RWHandleV3
myNormalAttrib;
193
194
// Array used to cache the scale transforms for our metaballs
195
// so that we don't have to evaluate them unless the profile
196
// channels have actually changed
197
UT_Array<UT_Matrix4>
myCachedScaleXforms;
198
199
// Transforms that can be used by muscle handles
200
// to position/scale/orient themselves
201
UT_Array<UT_Matrix4>
mySavedRotates;
202
UT_Array<UT_Matrix4>
mySavedTranslates;
203
};
204
205
206
207
#endif
GU_Muscle::getNumPrimitives
int getNumPrimitives()
Definition:
GU_Muscle.h:89
GA_PrimitiveGroup
Definition:
GA_ElementGroup.h:74
GU_PrimSphere
Definition:
GU_PrimSphere.h:63
GU_Muscle::getPrimitiveGroup
GA_PrimitiveGroup * getPrimitiveGroup()
Definition:
GU_Muscle.h:88
GU_MuscleParms::gdp
GU_Detail * gdp
Definition:
GU_Muscle.h:40
GU_MUSCLE_META
Definition:
GU_Muscle.h:30
GU_MuscleParms::primsPerSegment
int primsPerSegment
Definition:
GU_Muscle.h:61
GU_MuscleParms::fullscalez
fpreal fullscalez
Definition:
GU_Muscle.h:50
GU_MuscleParms::myExtraGdp
GU_Detail * myExtraGdp
Definition:
GU_Muscle.h:42
UT_ValArray< float >
GU_Detail.h
t
GLdouble GLdouble t
Definition:
glew.h:1403
UT_Array
Definition:
BV_KDOPTree.h:18
GA_PointGroup
Definition:
GA_ElementGroup.h:33
GEO_PrimPoly
Definition:
GEO_PrimPoly.h:25
OP_Context
Definition:
OP_Context.h:44
GU_MuscleParms::sy5
fpreal sy5
Definition:
GU_Muscle.h:57
GU_MuscleParms::sz5
fpreal sz5
Definition:
GU_Muscle.h:58
GU_MuscleParms::sampledivs
int sampledivs
Definition:
GU_Muscle.h:68
gu_Cubic
fpreal gu_Cubic[4]
Definition:
GU_Muscle.h:26
GA_RWHandleT< UT_Vector3F >
GU_MuscleType
GU_MuscleType
Definition:
GU_Muscle.h:28
GA_Handle.h
GU_MuscleParms::pos4
fpreal pos4
Definition:
GU_Muscle.h:53
GU_MuscleParms
Definition:
GU_Muscle.h:36
GU_API
#define GU_API
Definition:
GU_API.h:14
GU_MuscleParms::cvtension
float cvtension
Definition:
GU_Muscle.h:71
y1
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition:
glew.h:12900
GU_MuscleParms::type
GU_MuscleType type
Definition:
GU_Muscle.h:64
GU_Muscle::getCenterPoints
GA_PointGroup * getCenterPoints()
Definition:
GU_Muscle.h:87
DEFAULT_CENTER_GROUP
#define DEFAULT_CENTER_GROUP
Definition:
GU_Muscle.h:24
fpreal
fpreal64 fpreal
Definition:
SYS_Types.h:277
GU_MuscleParms::lastcv
int lastcv
Definition:
GU_Muscle.h:70
GU_Muscle
Definition:
GU_Muscle.h:76
GU_Detail
Definition:
GU_Detail.h:153
GU_MuscleParms::basis
int basis
Definition:
GU_Muscle.h:67
group
GLboolean GLuint group
Definition:
glew.h:2750
GU_MUSCLE_SPHERE
Definition:
GU_Muscle.h:31
UT_String
Definition:
UT_String.h:72
GU_API.h
GU_Muscle::~GU_Muscle
~GU_Muscle()
Definition:
GU_Muscle.h:81
GU_MuscleParms::sx5
fpreal sx5
Definition:
GU_Muscle.h:56
GU_MuscleParms::name
UT_String name
Definition:
GU_Muscle.h:47
GU_MuscleParms::firstcv
int firstcv
Definition:
GU_Muscle.h:69
GU
GU_Muscle.h
Generated on Tue Aug 16 2022 02:48:22 for HDK by
1.8.6