// Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors. // All rights reserved. // Code licensed under the BSD License. // http://www.anki3d.org/LICENSE #pragma once #include #include #include #include #include #include namespace anki { // Forward class GrManager; class ResourceManager; class ResourceFilesystem; template class ResourcePointer; class TransferGpuAllocatorHandle; /// @addtogroup resource /// @{ #define ANKI_RESOURCE_LOGI(...) ANKI_LOG("RSRC", NORMAL, __VA_ARGS__) #define ANKI_RESOURCE_LOGE(...) ANKI_LOG("RSRC", ERROR, __VA_ARGS__) #define ANKI_RESOURCE_LOGW(...) ANKI_LOG("RSRC", WARNING, __VA_ARGS__) #define ANKI_RESOURCE_LOGF(...) ANKI_LOG("RSRC", FATAL, __VA_ARGS__) /// @name Constants /// @{ enum class RayType : U8 { SHADOWS, GI, REFLECTIONS, PATH_TRACING, COUNT, FIRST = 0 }; ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(RayType) enum class RayTypeBit : U8 { NONE, SHADOWS = 1 << 0, GI = 1 << 1, REFLECTIONS = 1 << 2, PATH_TRACING = 1 << 3, ALL = SHADOWS | GI | REFLECTIONS | PATH_TRACING }; ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(RayTypeBit) /// @} /// Deleter for ResourcePtr. template class ResourcePtrDeleter { public: void operator()(T* ptr); }; /// Smart pointer for resources. template using ResourcePtr = IntrusivePtr>; // NOTE: Add resources in 3 places #define ANKI_INSTANTIATE_RESOURCE(rsrc_, name_) \ class rsrc_; \ using name_ = ResourcePtr; #define ANKI_INSTANSIATE_RESOURCE_DELIMITER() #include #undef ANKI_INSTANTIATE_RESOURCE #undef ANKI_INSTANSIATE_RESOURCE_DELIMITER template using ResourceAllocator = HeapAllocator; template using TempResourceAllocator = StackAllocator; /// An alias that denotes a ResourceFilesystem path. using ResourceFilename = CString; /// @} } // end namespace anki