-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpushDeformer.h
75 lines (63 loc) · 1.72 KB
/
pushDeformer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef PUSHDEFORMER_H
#define PUSHDEFORMER_H
#include <maya/MPxDeformerNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MItGeometry.h>
#include <maya/MFloatArray.h>
#include <maya/MMatrix.h>
#include <maya/MDataBlock.h>
#include <maya/MGlobal.h>
#include <maya/MFnMesh.h>
#include <maya/MFloatVectorArray.h>
#include <maya/MPoint.h>
#include <maya/MPointArray.h>
#include <maya/MFnTypedAttribute.h>
#include <maya/MFnDoubleArrayData.h>
#include <vector>
#include <maya/MThreadPool.h>
#include <tbb/parallel_for.h>
#include <omp.h>
struct TaskData
{
MPointArray points;
//MDataBlock dataBlock;
MFloatVectorArray normals;
MDoubleArray stressV;
int geomIndex;
double bulgeAmount;
float envelope;
bool useStressV;
};
struct ThreadData
{
TaskData* pData;
unsigned int start;
unsigned int end;
unsigned int numTasks;
};
class PushDeformer : public MPxDeformerNode
{
public:
PushDeformer();
virtual ~PushDeformer();
static void* creator();
ThreadData* createThreadData( int numTasks, TaskData* pTaskData );
static void createTasks( void* data, MThreadRootTask *pRoot );
static MThreadRetVal threadEvaluate( void* pParam );
virtual MStatus deform(MDataBlock& dataBlock,
MItGeometry& itGeo,
const MMatrix& localToWorldMatrix,
unsigned int geoIndex);
static MStatus initialize();
static MTypeId id;
static MObject aDriverGeo;
static MObject aAmount;
static MObject aStressMap;
static MObject aUseStress;
static MObject aMultiThreadingType;
private:
TaskData m_taskData;
ThreadData* threadData;
double m_MThreadPoolTime;
};
#endif // !BULGEDEFORMER_H