aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveTextureStore.h
blob: 3799a70089a4fdc9b4406b6cdb93cf4cea2431ec (plain) (blame)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef _STS_
// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include <maya/MString.h>
#include <maya/MSelectionList.h>
#include <maya/MFnMesh.h>
#include <maya/MObjectArray.h>
#include <maya/MPxCommand.h>
#include <maya/MSyntax.h>
#include "shaveSDK.h"

#if MAYA_API_VERSION < 20180000
class MDataBlock;
#endif

class shaveHairShape;

#define PER_NODE_TEXLOOKUP


typedef struct {
	shaveHairShape*	node;
	int				count;
	VERT**			displacement;
	int				maxIndex[SHAVE_NUM_PARAMS];
	int				maxPasses;
	bool			textured[SHAVE_NUM_PARAMS];
	float***		textureLookup;
	float**			u;
	float**			v;
} NODETEXINFO;

typedef struct {
	float* us;
	float* vs;
	int passes;
	char* uvset;
} HAIRUVS;

bool IsBuildingLookups();


float			applyVertTexValue(
					long shaveID, int vertID, int paramID, float baseValue
				);

unsigned int	findObjectIndex(int, MIntArray);
MStatus			freeTextureLookup(void);
MStatus			freeTextureLookup(NODETEXINFO* lookup);

void			getDisplacement(
					MDagPath&	surface,
					CURVEINFO&	ci,
					VERT&		rootPos,
					float		rootU,
					float		rootV,
					int			surfaceStartFaceIndex,
					VERT&		displacement
				);

NODETEXINFO*	getTexInfoLookup(unsigned nodeID);

void			initTexInfoLookup(
					const MObjectArray&	shaveNodes,
					MString				defaultUVSet,
					bool				verbose,
					bool				displayHairsOnly = false
				);

void			initTexInfoLookup2(
					const MObjectArray&	shaveNodes,
					MString				defaultUVSet,
					bool				verbose,
					bool				displayHairsOnly = false,
					MObject				onlythis = MObject()
				);

void			initVertTexInfoLookup(
					shaveHairShape* sNode, MObject node, MDataBlock* block=NULL
				);

void			initVertTexInfoLookup(MObjectArray& shaveNodes);
MStatus			shaveConnectNode(MString, MString, int, MStringArray&);

MStatus			tesselateGrowthSurfaces(
					const MDagPathArray&	growthSurfaces,
					short					uTess,
					short					vTess,
					short					sDept, 
					short					sSamp
				);


class ShavePreprocTex : public MPxCommand
{
public:
							ShavePreprocTex() {};
	virtual					~ShavePreprocTex(); 

	MStatus     			doIt( const MArgList& args );
	static void*			createCmd();
	static MSyntax			createSyntax();
	static const MString	commandName;
};

#define _STS_
#endif