add basic texture

This commit is contained in:
2026-01-04 13:07:56 +01:00
parent 45c9e5180f
commit 1ab2377f8e
7 changed files with 139 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
#pragma once
#include <sp/common/NonCopyable.h>
#include <string>
namespace td {
namespace GL {
class Texture : private sp::NonCopyable {
public:
Texture(const char* a_Data, int a_Width, int a_Height, int a_Comp);
Texture(Texture&& a_Other);
~Texture();
void Bind() const;
void Unbind() const;
private:
unsigned int m_ID;
};
} // namespace GL
namespace TextureLoader {
GL::Texture LoadTexture(const std::string& fileName);
}
} // namespace td

View File

@@ -1,5 +1,6 @@
#pragma once
#include <td/render/loader/TextureLoader.h>
#include <td/render/loader/FbxLoader.h>
#include <td/render/Renderer.h>
#include <td/render/shader/EntityShader.h>
@@ -12,6 +13,7 @@ class EntityRenderer : public Renderer<shader::EntityShader> {
private:
game::WorldPtr m_World;
Model m_EntityModel;
std::unique_ptr<GL::Texture> m_EntityTexture;
public:
EntityRenderer(Camera& a_Camera, const game::WorldPtr& a_World);