summaryrefslogtreecommitdiff
path: root/Runtime/GfxDevice/opengles30/TransformFeedbackSkinnedMesh.h
blob: 3e0c0945481dc7d4b66e388ea5217db9866827cb (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
#ifndef __TRANSFORMFEEDBACKSKINNEDMESH_H__
#define __TRANSFORMFEEDBACKSKINNEDMESH_H__

#include "Runtime/GfxDevice/GPUSkinningInfo.h"
#include "Runtime/GfxDevice/opengles30/IncludesGLES30.h"
#include "Runtime/GfxDevice/opengles30/DataBuffersGLES30.h"
#include <vector>

class GfxDeviceGLES30;

// Transform Feedback mesh skinning data.
// Source and destination VBO formats must match.
class TransformFeedbackSkinningInfo : public GPUSkinningInfo
{
	friend class GfxDeviceGLES30;
private:
	GLuint m_SourceVBO;
	GLsizei m_SourceVBOSize;

	std::vector<float> m_CachedPose;

	DataBufferGLES30 *m_MatrixBuffer;

	//! Stores the bone count from the previous call to UpdateSourceBones. Used to select the most suitable shader version.
	int m_BoneCount;

	UInt32 GetVertexSize();

	bool EnsureBuffer();

	TransformFeedbackSkinningInfo() : GPUSkinningInfo(),
		m_SourceVBO(0), m_SourceVBOSize(0), m_MatrixBuffer(0), m_BoneCount(0)
	{}

	virtual ~TransformFeedbackSkinningInfo();

	virtual void UpdateSourceData(const void *vertData, const BoneInfluence *skinData, bool dirty);
	virtual void UpdateSourceBones(const int boneCount, const Matrix4x4f* cachedPose);
	virtual void SkinMesh(bool last);

public:

	//! Release shaders that have been created for transform feedback use.
	static void CleanupTransformFeedbackShaders(void);
};

#endif