| #pragma once |
| |
| #ifndef TRENDERRESOURCEMANAGER_INCLUDED |
| #define TRENDERRESOURCEMANAGER_INCLUDED |
| |
| #include "trasterfx.h" |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TFX_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| |
| |
| class TRenderer; |
| class TRenderResourceManager; |
| class TRenderResourceManagerGenerator; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class TRenderResourceManager { |
| public: |
| TRenderResourceManager() {} |
| virtual ~TRenderResourceManager() {} |
| |
| virtual void onRenderInstanceStart(unsigned long id) {} |
| virtual void onRenderInstanceEnd(unsigned long id) {} |
| |
| virtual void onRenderFrameStart(double f) {} |
| virtual void onRenderFrameEnd(double f) {} |
| |
| virtual void onRenderStatusStart(int renderStatus) {} |
| virtual void onRenderStatusEnd(int renderStatus) {} |
| |
| virtual bool renderHasOwnership() { return true; } |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TRenderResourceManagerGenerator { |
| int m_managerIndex; |
| bool m_instanceScope; |
| |
| public: |
| TRenderResourceManagerGenerator(bool renderInstanceScope = false); |
| ~TRenderResourceManagerGenerator() {} |
| |
| int getGeneratorIndex() const { return m_managerIndex; } |
| static std::vector<TRenderResourceManagerGenerator *> &generators(); |
| static std::vector<TRenderResourceManagerGenerator *> &generators( |
| bool instanceScope); |
| |
| virtual TRenderResourceManager *operator()(void) = 0; |
| |
| bool hasInstanceScope() const { return m_instanceScope; } |
| |
| TRenderResourceManager *getManager(const TRenderer &renderer) const; |
| TRenderResourceManager *getManager(unsigned long renderId) const; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #define T_RENDER_RESOURCE_MANAGER \ |
| \ |
| public: \ |
| static TRenderResourceManagerGenerator *gen(); \ |
| static TRenderResourceManagerGenerator *deps(); \ |
| \ |
| private: |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #define MANAGER_FILESCOPE_DECLARATION(managerClass, generatorClass) \ |
| \ |
| TRenderResourceManagerGenerator *managerClass::gen() { \ |
| static generatorClass theInstance; \ |
| return &theInstance; \ |
| } \ |
| TRenderResourceManagerGenerator *managerClass::deps() { \ |
| return managerClass::gen(); \ |
| } \ |
| \ |
| namespace { \ |
| generatorClass *generatorClass##Instance = \ |
| (generatorClass *)managerClass::deps(); \ |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #define MANAGER_FILESCOPE_DECLARATION_DEP(managerClass, generatorClass, \ |
| depsList) \ |
| \ |
| TRenderResourceManagerGenerator *managerClass::gen() { \ |
| static generatorClass theInstance; \ |
| return &theInstance; \ |
| } \ |
| TRenderResourceManagerGenerator *managerClass::deps() { \ |
| depsList; \ |
| return managerClass::gen(); \ |
| } \ |
| \ |
| namespace { \ |
| generatorClass *generatorClass##Instance = \ |
| (generatorClass *)managerClass::deps(); \ |
| } |
| |
| |
| |
| #endif |