summaryrefslogtreecommitdiff
path: root/Runtime/Filters/Mesh/MeshCombiner.h
blob: a6975a9679ed9273f80429d91484c34cb04f5aed (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
#ifndef MESHCOMBINER_H
#define MESHCOMBINER_H

#include "LodMesh.h"

class Renderer;

struct CombineInstance
{
	Mesh *mesh;
	int subMeshIndex;
	Matrix4x4f transform;
	
	Vector4f lightmapTilingOffset;
	int	vertexOffset;
	
	CombineInstance() :
		mesh(NULL),
		subMeshIndex(0),
		lightmapTilingOffset(1, 1, 0, 0),
		vertexOffset(0)
	{}
};

typedef std::vector<CombineInstance>	CombineInstances;

void CombineMeshes (const CombineInstances &in, Mesh& out, bool mergeSubMeshes, bool useTransforms);
// takes an array of meshes(their vertex data) and merges them into 1 combined mesh.
void CombineMeshVerticesForStaticBatching ( const CombineInstances& in, const string& combinedMeshName, Mesh& outCombinedMesh, bool useTransforms = true );
// takes an array of meshes(their indices) and merges them in 1 mesh (setups subsets) 
void CombineMeshIndicesForStaticBatching (const CombineInstances& in, Mesh& inoutMesh, bool mergeSubMeshes, bool useVertexOffsets);

#endif