#ifndef __EFFEKSEERRENDERER_LLGI_RENDERER_H__ #define __EFFEKSEERRENDERER_LLGI_RENDERER_H__ #include "../EffekseerRendererCommon/EffekseerRenderer.Renderer.h" #include "EffekseerRendererLLGI.Base.h" #include "GraphicsDevice.h" #include #include #include namespace EffekseerRendererLLGI { struct FixedShader { std::vector SpriteUnlit_VS; std::vector SpriteLit_VS; std::vector SpriteDistortion_VS; std::vector ModelUnlit_VS; std::vector ModelLit_VS; std::vector ModelDistortion_VS; std::vector ModelUnlit_PS; std::vector ModelLit_PS; std::vector ModelDistortion_PS; std::vector AdvancedSpriteUnlit_VS; std::vector AdvancedSpriteLit_VS; std::vector AdvancedSpriteDistortion_VS; std::vector AdvancedModelUnlit_VS; std::vector AdvancedModelLit_VS; std::vector AdvancedModelDistortion_VS; std::vector AdvancedModelUnlit_PS; std::vector AdvancedModelLit_PS; std::vector AdvancedModelDistortion_PS; }; /** @brief Renderer class */ class Renderer : public ::EffekseerRenderer::Renderer { protected: Renderer() { } virtual ~Renderer() { } public: virtual LLGI::Graphics* GetGraphics() const = 0; }; class SingleFrameMemoryPool : public ::EffekseerRenderer::SingleFrameMemoryPool, public ::Effekseer::ReferenceObject { LLGI::SingleFrameMemoryPool* memoryPool_ = nullptr; public: SingleFrameMemoryPool(LLGI::SingleFrameMemoryPool* memoryPool) { memoryPool_ = memoryPool; ES_SAFE_ADDREF(memoryPool_); } virtual ~SingleFrameMemoryPool() { ES_SAFE_RELEASE(memoryPool_); } void NewFrame() override { memoryPool_->NewFrame(); } LLGI::SingleFrameMemoryPool* GetInternal() { return memoryPool_; } virtual int GetRef() override { return ::Effekseer::ReferenceObject::GetRef(); } virtual int AddRef() override { return ::Effekseer::ReferenceObject::AddRef(); } virtual int Release() override { return ::Effekseer::ReferenceObject::Release(); } }; enum class CommandListState { Wait, Running, RunningWithPlatformCommandList, }; class CommandList : public ::EffekseerRenderer::CommandList, public ::Effekseer::ReferenceObject { private: LLGI::Graphics* graphics_ = nullptr; LLGI::CommandList* commandList_ = nullptr; LLGI::SingleFrameMemoryPool* memoryPool_ = nullptr; CommandListState state_ = CommandListState::Wait; public: CommandList(LLGI::Graphics* graphics, LLGI::CommandList* commandList, LLGI::SingleFrameMemoryPool* memoryPool) : graphics_(graphics) , commandList_(commandList) , memoryPool_(memoryPool) { ES_SAFE_ADDREF(graphics_); ES_SAFE_ADDREF(commandList_); ES_SAFE_ADDREF(memoryPool_); } virtual ~CommandList() { ES_SAFE_RELEASE(graphics_); ES_SAFE_RELEASE(commandList_); ES_SAFE_RELEASE(memoryPool_); } LLGI::Graphics* GetGraphics() { return graphics_; } LLGI::CommandList* GetInternal() { return commandList_; } LLGI::SingleFrameMemoryPool* GetMemoryPool() { return memoryPool_; } CommandListState GetState() const { return state_; } void SetState(CommandListState state) { state_ = state; } virtual int GetRef() override { return ::Effekseer::ReferenceObject::GetRef(); } virtual int AddRef() override { return ::Effekseer::ReferenceObject::AddRef(); } virtual int Release() override { return ::Effekseer::ReferenceObject::Release(); } }; } // namespace EffekseerRendererLLGI #endif // __EFFEKSEERRENDERER_LLGI_RENDERER_H__