Cogs.Core
ResourceFlags.h
1#pragma once
2
3#include "Base.h"
4#include "Flags.h"
5
6#include "Foundation/Reflection/Name.h"
7
8namespace Cogs
9{
10 namespace Core
11 {
12 // Note that Flags here are also copied in enums "inheriting" from ResourceLoadFlags.
13
16 {
18 None = 0,
19
21 ForceSynchronous = 1 << 0,
22
24 Reload = 1 << 1,
25 AutoReload = 1 << 2,
26
28 NoDefaultName = 1 << 3,
29
31 ForceUnique = 1 << 4,
32
34 DoNotCache = 1 << 5,
35
37 DoNotStoreSource = 1 << 6,
38
40 KeepStorage = 1 << 7,
41
43 ResourceSpecificFlag = 1 << 16,
44 };
45
46 ENABLE_ENUM_FLAGS(ResourceLoadFlags);
47
50 {
51 // -- Begin Flags copied from ResourceLoadFlags
52
54 None = int(ResourceLoadFlags::None),
55
60 AutoReload = int(ResourceLoadFlags::AutoReload),
67
68 // -- End Flags copied from ResourceLoadFlags
69
72
81 Flip = First,
82
89
96 NoMipMaps = First << 3,
97
101 NoDelete = First << 4,
102
109
114 RenderTarget = First << 6,
115 };
116
117 ENABLE_ENUM_FLAGS(TextureLoadFlags);
118 ENABLE_DERIVED_FLAGS(TextureLoadFlags, ResourceLoadFlags);
119
121 enum class ModelLoadFlags
122 {
123 // -- Begin Flags copied from ResourceLoadFlags
124
126 None = int(ResourceLoadFlags::None),
127
132 AutoReload = int(ResourceLoadFlags::AutoReload),
139
140 // -- End Flags copied from ResourceLoadFlags
141
144
147
151
155
159
161 SkipMaterials = First << 4,
162
164 NoFlipTexcoords = First << 5,
165
168 };
169
170 ENABLE_ENUM_FLAGS(ModelLoadFlags);
171 ENABLE_DERIVED_FLAGS(ModelLoadFlags, ResourceLoadFlags);
172
174 enum class AssetLoadFlags
175 {
176 // -- Begin Flags copied from ResourceLoadFlags
177
179 None = int(ResourceLoadFlags::None),
180
185 AutoReload = int(ResourceLoadFlags::AutoReload),
192
193 // -- End Flags copied from ResourceLoadFlags
194
197
200
202 NoDefault = First << 1
203 };
204
205 ENABLE_ENUM_FLAGS(AssetLoadFlags);
206 ENABLE_DERIVED_FLAGS(AssetLoadFlags, ResourceLoadFlags);
207
208 void registerResourceFlagTypes();
209 }
210}
211
212template<> inline Cogs::StringView getName<Cogs::Core::ResourceLoadFlags>() { return "ResourceLoadFlags"; }
213template<> inline Cogs::StringView getName<Cogs::Core::TextureLoadFlags>() { return "TextureLoadFlags"; }
214template<> inline Cogs::StringView getName<Cogs::Core::ModelLoadFlags>() { return "ModelLoadFlags"; }
215template<> inline Cogs::StringView getName<Cogs::Core::AssetLoadFlags>() { return "AssetLoadFlags"; }
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:50
@ KeepStorage
Keep resource cpu storage after upload to the GPU.
ModelLoadFlags
Model loading flags. May be combined with resource loading flags.
@ NeedsTangents
The importer should generate tangent data if not present.
@ CustomExtensionFlag
Custom flag that can be used by an extension loader.
@ SkipMaterials
Tell the loader it may skip creating material instances during loading.
@ NoFlipTexcoords
Do not flip texture coordinates.
ResourceLoadFlags
Flags for describing how to load a resource.
Definition: ResourceFlags.h:16
@ ResourceSpecificFlag
DO NOT USE. Intenal: First available flag for resource specific flags.
@ None
No flags specified,.
@ NoDefaultName
No default name.
@ DoNotStoreSource
Don't store the source.
@ ForceUnique
Force unique resource load when source resolves to existing resource.
@ ForceSynchronous
Force loading the resource synchronously.
@ DoNotCache
Do not cache this resource for later retrieval.
TextureLoadFlags
Texture loading flags. May be combined with resource load flags.
Definition: ResourceFlags.h:50
@ LinearColorSpace
For textures with RGBA format without color space information, mark the data as being in linear color...
@ ColorSpaceFromLoadInfo
by default we want to retrieve colorspace info from the texture data, not from the format specified i...
@ First
DO NOT USE. Intenal: First available flag for resource specific flags.
@ NoDelete
Do not assume ownership of external texture so it won't be deleted by cogs.
@ Flip
Flip the texture data vertically before it is passed to the rendering backend.
@ NoMipMaps
Do not generate mipmaps.
AssetLoadFlags
Asset and Scene loading flags. May be combined with resource loading flags.
@ NoDefault
Don't load the default scene. Highly recommended as not setting this flag cause extra scene parse.
@ ClearScene
Clear the scene before loading the asset. NOT allowed for Bridge: loadAsset and loadAssetFromString.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23