mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
618455500d
fixes #2255 and hopefully didn't break Jak 1
69 lines
1.4 KiB
C++
69 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "common/common_types.h"
|
|
#include "common/versions.h"
|
|
|
|
class Shader {
|
|
public:
|
|
static constexpr char shader_folder[] = "game/graphics/opengl_renderer/shaders/";
|
|
Shader(const std::string& shader_name, GameVersion version);
|
|
Shader() = default;
|
|
void activate() const;
|
|
bool okay() const { return m_is_okay; }
|
|
u64 id() const { return m_program; }
|
|
|
|
private:
|
|
std::string m_name;
|
|
u64 m_frag_shader = 0;
|
|
u64 m_vert_shader = 0;
|
|
u64 m_program = 0;
|
|
bool m_is_okay = false;
|
|
};
|
|
|
|
// note: update the constructor in Shader.cpp
|
|
enum class ShaderId {
|
|
SOLID_COLOR = 0,
|
|
DIRECT_BASIC = 1,
|
|
DIRECT_BASIC_TEXTURED = 2,
|
|
DEBUG_RED = 3,
|
|
SKY = 4,
|
|
SKY_BLEND = 5,
|
|
TFRAG3 = 6,
|
|
TFRAG3_NO_TEX = 7,
|
|
SPRITE = 8,
|
|
SPRITE3 = 9,
|
|
DIRECT2 = 10,
|
|
EYE = 11,
|
|
GENERIC = 12,
|
|
OCEAN_TEXTURE = 13,
|
|
OCEAN_TEXTURE_MIPMAP = 14,
|
|
OCEAN_COMMON = 15,
|
|
SHADOW = 16,
|
|
SHRUB = 17,
|
|
COLLISION = 18,
|
|
MERC2 = 19,
|
|
SPRITE_DISTORT = 20,
|
|
SPRITE_DISTORT_INSTANCED = 21,
|
|
POST_PROCESSING = 22,
|
|
DEPTH_CUE = 23,
|
|
EMERC = 24,
|
|
GLOW_PROBE = 25,
|
|
GLOW_PROBE_READ = 26,
|
|
GLOW_PROBE_READ_DEBUG = 27,
|
|
GLOW_PROBE_DOWNSAMPLE = 28,
|
|
GLOW_DRAW = 29,
|
|
MAX_SHADERS
|
|
};
|
|
|
|
class ShaderLibrary {
|
|
public:
|
|
ShaderLibrary(GameVersion version);
|
|
Shader& operator[](ShaderId id) { return m_shaders[(int)id]; }
|
|
Shader& at(ShaderId id) { return m_shaders[(int)id]; }
|
|
|
|
private:
|
|
Shader m_shaders[(int)ShaderId::MAX_SHADERS];
|
|
};
|