load basic 3d model
This commit is contained in:
@@ -29,7 +29,8 @@ public:
|
||||
static constexpr float m_MouseSensitivity = 200.0f;
|
||||
|
||||
struct Model {
|
||||
GL::VertexArray* vao;
|
||||
std::unique_ptr<GL::VertexArray> vao;
|
||||
std::unique_ptr<GL::Texture> texture;
|
||||
Vec3f positon;
|
||||
Vec3f color = { 1, 1, 1 };
|
||||
};
|
||||
|
||||
@@ -28,7 +28,8 @@ private:
|
||||
client::ClientGame* m_Client;
|
||||
Renderer* m_Renderer;
|
||||
game::World* m_World;
|
||||
std::unique_ptr<GL::VertexArray> m_WorldVao, m_MobVao, m_SelectTileVao;
|
||||
std::unique_ptr<GL::VertexArray> m_WorldVao;
|
||||
std::unique_ptr<Renderer::Model> m_MobModel, m_SelectTileModel;
|
||||
Vec2f m_CamPos;
|
||||
Vec2f m_CursorPos;
|
||||
Vec2f m_HoldCursorPos;
|
||||
|
||||
@@ -70,5 +70,24 @@ public:
|
||||
void Unbind() const;
|
||||
};
|
||||
|
||||
class Texture {
|
||||
private:
|
||||
unsigned int m_ID;
|
||||
public:
|
||||
REMOVE_COPY(Texture);
|
||||
|
||||
Texture(Texture&& other) {
|
||||
m_ID = other.m_ID;
|
||||
other.m_ID = 0;
|
||||
}
|
||||
|
||||
Texture(const char* textureData, int width, int height, int comp);
|
||||
~Texture();
|
||||
|
||||
unsigned int GetTextureID() const { return m_ID; }
|
||||
void Bind() const;
|
||||
static void Unbind();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
11
include/render/loader/MobLoader.h
Normal file
11
include/render/loader/MobLoader.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "GLLoader.h"
|
||||
|
||||
namespace td {
|
||||
namespace MobLoader {
|
||||
|
||||
GL::VertexArray LoadMobModel();
|
||||
|
||||
} // namespace loader
|
||||
} // namespace td
|
||||
@@ -8,9 +8,12 @@
|
||||
#ifndef RENDER_LOADER_TEXTURELOADER_H_
|
||||
#define RENDER_LOADER_TEXTURELOADER_H_
|
||||
|
||||
#include "render/loader/GLLoader.h"
|
||||
#include <string>
|
||||
|
||||
namespace TextureLoader {
|
||||
|
||||
unsigned int LoadGLTexture(const char* fileName);
|
||||
GL::Texture LoadTexture(const std::string& fileName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user