mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-17 16:17:02 +08:00
* refactor: update water texture * feat(gameplay): implement transparent block rendering with depth sorting * fix(world): use camera pos for distance calculations, make water passable * refactor(player): use ivec3 for block pass check * feat(camera): add underwater detection * feat(renderer): add underwater effect with framebuffer post-processing * feat(block): add gas property and refactor solid block check * fix(assets): set leaf block transparency to false * fix(block): set leaf as transparent
32 lines
885 B
C++
32 lines
885 B
C++
#pragma once
|
|
#include <glad/glad.h>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
namespace Cubed {
|
|
|
|
class Shader {
|
|
public:
|
|
Shader();
|
|
Shader(const std::string& name, const std::string& v_shader_path,
|
|
const std::string& f_shader_path);
|
|
~Shader();
|
|
Shader(const Shader&) = delete;
|
|
Shader& operator=(const Shader&) = delete;
|
|
Shader(Shader&& shader) noexcept;
|
|
Shader& operator=(Shader&& shader) noexcept;
|
|
|
|
void create(const std::string& name, const std::string& v_shader_path,
|
|
const std::string& f_shader_path);
|
|
std::size_t hash() const;
|
|
GLuint loc(const std::string& loc) const;
|
|
const std::string& name() const;
|
|
void use() const;
|
|
|
|
private:
|
|
GLuint m_program = 0;
|
|
std::size_t m_hash = 0;
|
|
std::string m_name = "-1";
|
|
mutable std::unordered_map<std::string, GLint> m_uniform_cache;
|
|
};
|
|
|
|
} // namespace Cubed
|