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/GfxDevice/BatchRendering.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Runtime/GfxDevice/BatchRendering.h (limited to 'Runtime/GfxDevice/BatchRendering.h') diff --git a/Runtime/GfxDevice/BatchRendering.h b/Runtime/GfxDevice/BatchRendering.h new file mode 100644 index 0000000..a12bdbb --- /dev/null +++ b/Runtime/GfxDevice/BatchRendering.h @@ -0,0 +1,34 @@ +#pragma once + +#include "GfxDeviceConfigure.h" +#include "Runtime/Camera/BaseRenderer.h" +#include "Runtime/Utilities/dynamic_array.h" +#include "Runtime/Math/Color.h" + +struct BatchInstanceData; +class Matrix4x4f; +struct SubMesh; +struct VertexBufferData; +class BaseRenderer; +class ChannelAssigns; +#if ENABLE_SPRITES +struct SpriteRenderData; +#endif +struct BatchRenderer +{ + dynamic_array m_BatchInstances; + ChannelAssigns const* m_ActiveChannels; + RendererType m_ActiveType; + + BatchRenderer(); + + void Add(BaseRenderer* renderer, int subsetIndex, ChannelAssigns const* channels, const Matrix4x4f& xform, int xformType); + void Flush(); +}; + +void AppendMeshIndices(UInt16* dstIndices, size_t& dstIndexCount, const UInt16* srcIndices, size_t srcIndexCount, bool isTriStrip); +size_t TransformIndices(UInt16* dst, const void* srcIB, size_t firstByte, size_t indexCount, size_t firstVertex, size_t batchVertexOffset, bool isTriStrip); +size_t TransformVertices(UInt8* dst, Matrix4x4f const& m, const VertexBufferData& src, size_t firstVertex, size_t vertexCount, UInt32 channelsInVBO); +#if ENABLE_SPRITES +void TransformSprite (UInt8* vb, UInt16* ib, const Matrix4x4f* m, const SpriteRenderData* rd, ColorRGBA32 color, size_t firstVertex); +#endif -- cgit v1.1-26-g67d0