Reorganising the game engine structure. Getting things ready for real development of the engine
This commit is contained in:
@ -1,50 +0,0 @@
|
||||
#include "Renderable.h"
|
||||
|
||||
Renderable Renderable::Load()
|
||||
{
|
||||
return Renderable();
|
||||
}
|
||||
|
||||
Renderable::Renderable()
|
||||
{
|
||||
|
||||
meshes = ModelImporter::Test();
|
||||
|
||||
transform.Scale = glm::vec3(1.0f);
|
||||
transform.Rotation = glm::vec3(0.0f, 90.0f, 0.0f);
|
||||
transform.Position = glm::vec3(0.0f, 0.0f, -10.0f);
|
||||
|
||||
|
||||
VAO.Create();
|
||||
VAO.Bind();
|
||||
|
||||
|
||||
vertexBuffer.createBuffer();
|
||||
vertexBuffer.Bind(false);
|
||||
vertexBuffer.setBufferData(&meshes[0].vertices[0], meshes[0].vertices.size() * sizeof(glm::vec3), false);
|
||||
|
||||
|
||||
elementBuffer.createBuffer();
|
||||
elementBuffer.Bind(true);
|
||||
elementBuffer.setBufferData(&meshes[0].elements[0], meshes[0].elements.size() * sizeof(unsigned int), true);
|
||||
|
||||
VAO.AttachAttribute(0, 3, 0);
|
||||
|
||||
vertexBuffer.Unbind(false);
|
||||
VAO.Unbind();
|
||||
|
||||
|
||||
}
|
||||
|
||||
Renderable::~Renderable()
|
||||
{
|
||||
}
|
||||
|
||||
void Renderable::Draw()
|
||||
{
|
||||
VAO.Bind();
|
||||
elementBuffer.Bind(true);
|
||||
glDrawElements(GL_TRIANGLES, static_cast<unsigned int>(meshes[0].elements.size()), GL_UNSIGNED_INT, NULL);
|
||||
VAO.Unbind();
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <MyGraphicsEngine/Mesh.h>
|
||||
#include <MyGraphicsEngine/Transform.h>
|
||||
#include <include/AssetManager/ModelImporter.h>
|
||||
#include <include/MyGraphicsEngine/Buffer.h>
|
||||
#include <include/MyGraphicsEngine/VertexArray.h>
|
||||
class Renderable {
|
||||
private:
|
||||
std::vector<BarinkEngine::Mesh> meshes;
|
||||
Renderable();
|
||||
|
||||
public:
|
||||
Buffer vertexBuffer;
|
||||
Buffer elementBuffer;
|
||||
VertexArray VAO;
|
||||
Transform transform;
|
||||
~Renderable();
|
||||
|
||||
static Renderable Load();
|
||||
void Draw();
|
||||
|
||||
};
|
@ -1,30 +1,18 @@
|
||||
#include <string>
|
||||
#include <BarinkEngine.h>
|
||||
|
||||
#include <MyGraphicsEngine/Shader.h>
|
||||
#include <MyGraphicsEngine/Window.h>
|
||||
#include <MyGraphicsEngine/Camera.h>
|
||||
void Start(int argc, char* argv[]) {
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
std::cout << "Hello start!" << std::endl;
|
||||
std::cout << "h" << std::endl;
|
||||
// BarinkWindow GameWindow(800, 600);
|
||||
|
||||
#include "imgui.h"
|
||||
#include "backends/imgui_impl_glfw.h"
|
||||
#include "backends/imgui_impl_opengl3.h"
|
||||
#include "Renderable.h"
|
||||
#include <filesystem>
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "lauxlib.h"
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
void UpdateApplication()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
#include <gorilla/gau.h>
|
||||
#include <gorilla/ga.h>
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
@ -33,8 +21,6 @@ int main(int argc, char* argv[]) {
|
||||
getcwd(cwd, 256);
|
||||
spdlog::info("Working directory: {}", cwd);
|
||||
|
||||
|
||||
BarinkWindow GameWindow(800, 600);
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
@ -61,21 +47,6 @@ int main(int argc, char* argv[]) {
|
||||
luaL_dofile(L,"build/SandboxApplication/Debug/script.lua");
|
||||
|
||||
|
||||
/*
|
||||
* gau_Manager* mgr;
|
||||
ga_Mixer* mixer;
|
||||
ga_Sound sound;
|
||||
ga_Handle handle;
|
||||
gau_SampleSourceLoop* loopSrc = 0;
|
||||
gau_SampleSourceLoop** pLoopSrc = &loopSrc;
|
||||
gc_int32 loop = 0;
|
||||
gc_int32 quit = 0;
|
||||
|
||||
|
||||
gc_initialize(0);
|
||||
mgr = gau_manager_create();
|
||||
mixer = gau_manager_mixer(mgr);
|
||||
*/
|
||||
|
||||
char* lua_code = new char[255];
|
||||
memset(lua_code, '\0', 255);
|
||||
@ -162,3 +133,4 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
}
|
||||
|
||||
*/
|
Reference in New Issue
Block a user