From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Filters/Mesh/MeshCombiner.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Runtime/Filters/Mesh/MeshCombiner.h (limited to 'Runtime/Filters/Mesh/MeshCombiner.h') diff --git a/Runtime/Filters/Mesh/MeshCombiner.h b/Runtime/Filters/Mesh/MeshCombiner.h new file mode 100644 index 0000000..a6975a9 --- /dev/null +++ b/Runtime/Filters/Mesh/MeshCombiner.h @@ -0,0 +1,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 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 -- cgit v1.1-26-g67d0