mirror of
https://github.com/open-goal/jak-project
synced 2026-09-12 12:55:22 -04:00
5b04be2fa0
This adds hfrag, but with a few remaining issues: - The textures aren't animated. Instead, it just uses one texture. - The texture filtering isn't as good as at it could be. I also cleaned up a few issues with the background renderers: - Cleaned up some stuff that is common to hfrag, tie, tfrag, shrub - Moved time-of-day color packing stuff to FR3 creation, rather than at level load. This appears to reduce the frame time spikes when a level is first drawn by about 5 or 6 ms in big levels. - Cleaned up the x86 specific stuff used in time of day. Now there's only one place where we have an `ifdef`, rather than spreading it all over the rendering code.
78 lines
1.6 KiB
C++
78 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "common/common_types.h"
|
|
#include "common/versions/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,
|
|
ETIE_BASE = 30,
|
|
ETIE = 31,
|
|
SHADOW2 = 32,
|
|
DIRECT_BASIC_TEXTURED_MULTI_UNIT = 33,
|
|
TEX_ANIM = 34,
|
|
GLOW_DEPTH_COPY = 35,
|
|
GLOW_PROBE_ON_GRID = 36,
|
|
HFRAG = 37,
|
|
HFRAG_MONTAGE = 38,
|
|
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];
|
|
};
|