-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAsset.hpp
29 lines (25 loc) · 945 Bytes
/
Asset.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include "EngineCommon.hpp"
typedef u32 AssetIndex;
struct TextureAsset {
const u32 width, height;
const u32 glId;
};
class AssetManager {
static std::vector< TextureAsset > textureAssets;
static u32 compileShaderStage( const char* source, const GLenum stage );
public:
static void initialize();
static void shutdown();
static AssetIndex loadTexture( const char* name );
// using #ifdef technique described in https://software.intel.com/en-us/blogs/2012/03/26/using-ifdef-in-opengl-es-20-shaders
// so on a single shaderName.glsl file every stage goes between #ifdef and #endif, like:
// #ifdef STAGE_NAME
// stage code ...
// #endif
// STAGE_NAME can be one of VERTEX, GEOMETRY, or FRAGMENT
static u32 loadShader( const char* name );
static void destroyTexture( AssetIndex texture );
static bool isTextureAlive( AssetIndex texture );
static TextureAsset getTexture( AssetIndex texture );
};