Added Model and default shader; Organization

This commit is contained in:
grayson committed 2021-08-26 00:23:56 -05:00
1 parent 1c638bdcb9
commit d74f808a17
23 files changed
+293 -64

No files matched your search

+7 -7
View File
@@ -9,17 +9,17 @@ namespace nf {
enum class DrawableType {
NF_NONE, NF_GAME, NF_UI
};
Drawable(const char* vertexShader, const char* fragmentShader, const void* vertexBuffer, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount);
//TODO: Construct using Shader code and data from obj
Drawable();
unsigned int getIndexCount();
void bind();
virtual DrawableType identity();
virtual void bind();
unsigned int getIndexCount();
~Drawable();
protected:
//TODO: Add VAO, Shader, index buffer, etc.
Shader m_shader;
VertexArray m_vao;
IndexBuffer m_ib;
VertexArray* m_vao;
IndexBuffer* m_ib;
Shader* m_shader;
};
}
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include "Drawable.h"
namespace nf {
class Model : public Drawable {
public:
Model();
void create(const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount, const char* vertexShader = nullptr, const char* fragmentShader = nullptr);
DrawableType identity() override;
void bind() override;
bool hasCustomShader();
~Model();
private:
};
}
+1 -3
View File
@@ -2,6 +2,4 @@
#include "Application.h"
#include "Input.h"
#include "Utility.h"
using namespace nf;
#include "Utility.h"
+5 -2
View File
@@ -2,7 +2,7 @@
#include <vector>
#include <Windows.h>
#include "Drawable.h"
#include "Model.h"
namespace nf {
class Application;
@@ -11,7 +11,7 @@ namespace nf {
public:
Renderer(Application* app);
void render(Drawable* in);
void render(Drawable& in);
void doFrame();
@@ -24,5 +24,8 @@ namespace nf {
std::vector<Drawable*> m_lGame;
std::vector<Drawable*> m_lUI;
const char* m_defaultVertex;
const char* m_defaultFragment;
Shader* m_defaultShader;
};
}
-1
View File
@@ -15,6 +15,5 @@ namespace nf {
private:
unsigned int m_id;
std::unordered_map<const char*, unsigned int> m_uniformLocations;
//TODO: Load from resource
};
}
+7
View File
@@ -38,8 +38,15 @@ __debugbreak();}
std::exit(-1);}
#endif
struct Win32Res {
Win32Res(int id);
void* ptr;
size_t size;
};
const wchar_t* toWide(const char* in);
const wchar_t* toWide(const std::string& in);
bool writeFile(const char* filename, const std::string& in);
std::string readFile(const char* filename);
}
+1 -1
View File
@@ -18,7 +18,7 @@ namespace nf {
template<typename T>
void push(unsigned int count);
void finishBufferLayout();
void bind(unsigned int buffer = 1);
void bind();
~VertexArray();
private:
+17
View File
@@ -0,0 +1,17 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by NothinFancy.rc
//
#define IDR_DEFAULTVERTEX 201
#define IDR_DEFAULTFRAGMENT 202
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif