summaryrefslogtreecommitdiff
path: root/Runtime/Filters/Mesh/MeshSkinning.h
blob: b56efa99426cea042259bbd6df0d310e7b472e17 (plain)
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
#ifndef MESHSKINNING_H
#define MESHSKINNING_H

#include "Runtime/Math/Vector3.h"
#include "Runtime/Math/Quaternion.h"
#include "Mesh.h"
#include "Runtime/Geometry/AABB.h"
#include "Runtime/GfxDevice/GfxDeviceTypes.h"
#include <vector>
#include <list>

class GPUSkinningInfo;

typedef std::vector<BoneInfluence> CompactSkin;
struct BlendShapeData;

enum TransformInstruction { kNormalizeFastest = 0, kNormalizeFast = 1, kNoNormalize = 3 };
class VertexData;

struct SkinMeshInfo
{
	int bonesPerVertex;
	
	void* compactSkin;
	int boneCount;

	const void* inVertices;
	void*	outVertices;
	int		inStride;
	int		outStride;

	int		normalOffset;
	int		tangentOffset;
	bool	skinNormals;
	bool	skinTangents;

	int   vertexCount;

	// This is instance data and must be double buffered so the render thread can work in paralell.
	UInt8*                      allocatedBuffer;
	Matrix4x4f*                 cachedPose;
	float*                      blendshapeWeights;

	int                         blendshapeCount;
	const BlendShapeData*       blendshapes;

	bool memExport; // Is set up for memexport (Xbox) or streamout (DX11)

#if UNITY_PS3
	const VertexData* vertexData;
#endif

	GPUSkinningInfo *mei;

	SkinMeshInfo();
	
	void Allocate();
	void Release () const;
};

void DeformSkinnedMesh (SkinMeshInfo& info);
void* DeformSkinnedMeshJob (void* rawData);

#endif