From 159f6874045aeafcf8e393acaf3d954891d650d6 Mon Sep 17 00:00:00 2001 From: durswd Date: Sun, 15 Mar 2020 20:01:34 +0900 Subject: [PATCH] Update a header and add an error --- Dev/Cpp/CreateHeader.py | 1 + .../EffekseerRendererGL.MaterialLoader.cpp | 5 +- .../EffekseerRendererGL/EffekseerRendererGL.h | 51 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/Dev/Cpp/CreateHeader.py b/Dev/Cpp/CreateHeader.py index 8715829b03..a8394f1395 100644 --- a/Dev/Cpp/CreateHeader.py +++ b/Dev/Cpp/CreateHeader.py @@ -103,6 +103,7 @@ def output(self,path): effekseerRendererGLHeader = CreateHeader() effekseerRendererGLHeader.readLines('EffekseerRendererGL/EffekseerRenderer/EffekseerRendererGL.Base.Pre.h') +effekseerRendererGLHeader.readLines('EffekseerRendererGL/EffekseerRenderer/EffekseerRendererGL.DeviceObjectCollection.h') effekseerRendererGLHeader.readLines('EffekseerRendererCommon/EffekseerRenderer.Renderer.h') effekseerRendererGLHeader.readLines('EffekseerRendererGL/EffekseerRenderer/EffekseerRendererGL.Renderer.h') effekseerRendererGLHeader.output('EffekseerRendererGL/EffekseerRendererGL.h') diff --git a/Dev/Cpp/EffekseerRendererGL/EffekseerRenderer/EffekseerRendererGL.MaterialLoader.cpp b/Dev/Cpp/EffekseerRendererGL/EffekseerRenderer/EffekseerRendererGL.MaterialLoader.cpp index 7cf6a31d5e..c44380c67e 100644 --- a/Dev/Cpp/EffekseerRendererGL/EffekseerRenderer/EffekseerRendererGL.MaterialLoader.cpp +++ b/Dev/Cpp/EffekseerRendererGL/EffekseerRenderer/EffekseerRendererGL.MaterialLoader.cpp @@ -440,7 +440,10 @@ ::Effekseer::MaterialData* MaterialLoader::Load(const void* data, int32_t size, else { Effekseer::Material material; - material.Load((const uint8_t*)data, size); + if (!material.Load((const uint8_t*)data, size)) + { + std::cout << "Error : Invalid material is loaded." << std::endl; + } auto compiler = ::Effekseer::CreateUniqueReference(new Effekseer::MaterialCompilerGL()); auto binary = ::Effekseer::CreateUniqueReference(compiler->Compile(&material)); diff --git a/Dev/Cpp/EffekseerRendererGL/EffekseerRendererGL.h b/Dev/Cpp/EffekseerRendererGL/EffekseerRendererGL.h index 1ea941dd2f..f0397d0c9d 100644 --- a/Dev/Cpp/EffekseerRendererGL/EffekseerRendererGL.h +++ b/Dev/Cpp/EffekseerRendererGL/EffekseerRendererGL.h @@ -76,6 +76,57 @@ enum class OpenGLDeviceType #endif // __EFFEKSEERRENDERER_GL_BASE_PRE_H__ +#ifndef __EFFEKSEERRENDERER_GL_DEVICEOBJECT_COLLECTION_H__ +#define __EFFEKSEERRENDERER_GL_DEVICEOBJECT_COLLECTION_H__ + +#include +#include + +namespace EffekseerRendererGL +{ + +class DeviceObject; + +class DeviceObjectCollection : public ::Effekseer::ReferenceObject +{ + friend class DeviceObject; + +private: + std::set deviceObjects_; + + /** + @brief register an object + */ + void Register(DeviceObject* device); + + /** + @brief unregister an object + */ + void Unregister(DeviceObject* device); + +public: + DeviceObjectCollection() = default; + + ~DeviceObjectCollection() = default; + + /** + @brief + \~english Call when device lost causes + \~japanese デバイスロストが発生した時に実行する。 + */ + void OnLostDevice(); + + /** + @brief + \~english Call when device reset causes + \~japanese デバイスがリセットされた時に実行する。 + */ + void OnResetDevice(); +}; + +} // namespace EffekseerRendererGL + +#endif // __EFFEKSEERRENDERER_GL_DEVICEOBJECT_H__ #ifndef __EFFEKSEERRENDERER_RENDERER_H__ #define __EFFEKSEERRENDERER_RENDERER_H__