one shader for texture and color + Time's API change
This commit is contained in:
@@ -10,6 +10,7 @@ namespace OpenEngine {
|
||||
class OE_API Input
|
||||
{
|
||||
public:
|
||||
virtual ~Input() = default;
|
||||
Input(const Input&) = delete;
|
||||
Input& operator=(const Input&) = delete;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace OpenEngine {
|
||||
void UploadInt(const std::string &name, int value) const;
|
||||
void UploadFloat(const std::string &name, float value) const;
|
||||
void UploadMat4(const std::string &name, const glm::mat4& value) const;
|
||||
void UploadVec2(const std::string &name, const glm::vec2& value) const;
|
||||
void UploadVec3(const std::string &name, const glm::vec3& value) const;
|
||||
void UploadVec4(const std::string &name, const glm::vec4& value) const;
|
||||
|
||||
@@ -33,6 +34,7 @@ namespace OpenEngine {
|
||||
virtual void SetInt(const std::string &name, int value) const override;
|
||||
virtual void SetFloat(const std::string &name, float value) const override;
|
||||
virtual void SetMat4(const std::string &name, const glm::mat4& value) const override;
|
||||
virtual void SetVec2(const std::string &name, const glm::vec2& value) const override;
|
||||
virtual void SetVec3(const std::string &name, const glm::vec3& value) const override;
|
||||
virtual void SetVec4(const std::string &name, const glm::vec4& value) const override;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef OPENGL_TEXTURE_HPP
|
||||
#define OPENGL_TEXTURE_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <GL/gl.h>
|
||||
#include <renderer/texture.hpp>
|
||||
|
||||
namespace OpenEngine {
|
||||
@@ -9,6 +9,7 @@ namespace OpenEngine {
|
||||
{
|
||||
public:
|
||||
OpenGLTexture2D(const std::string& path);
|
||||
OpenGLTexture2D(uint32_t width, uint32_t height);
|
||||
virtual ~OpenGLTexture2D();
|
||||
|
||||
virtual uint32_t GetWidth() const override { return width; };
|
||||
@@ -16,11 +17,15 @@ namespace OpenEngine {
|
||||
|
||||
virtual void Bind(uint32_t slot = 0) const override;
|
||||
|
||||
virtual void SetData(void* data, uint32_t size) override;
|
||||
|
||||
private:
|
||||
std::string path;
|
||||
|
||||
uint32_t width, height;
|
||||
uint32_t id;
|
||||
|
||||
GLenum internal_format, data_format;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace OpenEngine {
|
||||
virtual void SetInt(const std::string &name, int value) const = 0;
|
||||
virtual void SetFloat(const std::string &name, float value) const = 0;
|
||||
virtual void SetMat4(const std::string &name, const glm::mat4& value) const = 0;
|
||||
virtual void SetVec2(const std::string &name, const glm::vec2& value) const = 0;
|
||||
virtual void SetVec3(const std::string &name, const glm::vec3& value) const = 0;
|
||||
virtual void SetVec4(const std::string &name, const glm::vec4& value) const = 0;
|
||||
};
|
||||
|
||||
@@ -14,11 +14,14 @@ namespace OpenEngine {
|
||||
virtual uint32_t GetHeight() const = 0;
|
||||
|
||||
virtual void Bind(uint32_t slot = 0) const = 0;
|
||||
|
||||
virtual void SetData(void* data, uint32_t size) = 0;
|
||||
};
|
||||
|
||||
class Texture2D : public Texture
|
||||
{
|
||||
public:
|
||||
static Ref<Texture2D> Create(uint32_t width, uint32_t height);
|
||||
static Ref<Texture2D> Create(const std::string& path);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user