Moved over from Win32 resources to purely nfpack; Included primitives and default shader in base.nfpack; Camera fixes

This commit is contained in:
grayson committed 2021-09-01 13:08:21 -05:00
1 parent 48821afd76
commit c0f7634b5f
32 files changed
+5062 -224

No files matched your search

+1
View File
@@ -77,6 +77,7 @@ namespace nf {
bool m_input[164];
int m_mouseX, m_mouseY;
bool m_trackingMouse;
bool m_mouseTrackFirst;
int m_mouseDiffX, m_mouseDiffY;
//Renderer object to use OpenGL to render the current state
+17 -2
View File
@@ -5,11 +5,12 @@ namespace nf {
class Model;
struct Asset {
char* data;
virtual ~Asset();
};
struct AModel : Asset {
char* data;
bool alreadyLoaded;
Model* loadedModel;
@@ -17,12 +18,15 @@ namespace nf {
};
struct ATexture : Asset {
unsigned char* data;
size_t size;
~ATexture() override;
};
struct AShader : Asset {
~AShader() override;
};
class AssetPack {
public:
AssetPack();
@@ -35,4 +39,15 @@ namespace nf {
private:
std::unordered_map<std::string, Asset*> m_assets;
};
struct BaseAssets {
static AModel* cube;
static AModel* plane;
static AModel* sphere;
static AModel* cone;
static AModel* cylinder;
static AModel* torus;
static ATexture* logo;
};
}
+2
View File
@@ -34,5 +34,7 @@ namespace nf {
Vec3 m_position;
Vec3 m_front;
float m_yaw;
float m_pitch;
};
}
+1 -1
View File
@@ -8,7 +8,7 @@ namespace nf {
public:
Model();
void create(const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount, const void* textureCoordinates, size_t textureCoordinatesBufferSize, const unsigned char* textureData, size_t textureSize);
void create(const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount, const void* textureCoordinates, size_t textureCoordinatesBufferSize, const char* textureData, size_t textureSize);
void bind() override;
~Model();
+1
View File
@@ -132,6 +132,7 @@ namespace nf {
bool m_input[164];
int m_mouseX, m_mouseY;
bool m_trackingMouse;
bool m_mouseTrackFirst;
int m_mouseDiffX, m_mouseDiffY;
//Renderer object to use OpenGL to render the current state
+2
View File
@@ -24,6 +24,8 @@ namespace nf {
HDC m_hdc;
HGLRC m_hglrc;
AssetPack baseAP;
std::vector<Entity*> m_lGame;
std::vector<Drawable*> m_lUI;
Shader* m_defaultShader;
+1 -1
View File
@@ -5,7 +5,7 @@ namespace nf {
public:
Texture();
void create(const unsigned char* textureData, size_t textureSize);
void create(const char* textureData, size_t textureSize);
void bind();
~Texture();
+13 -8
View File
@@ -39,20 +39,25 @@ __debugbreak();}
std::exit(-1);}
#endif
//TODO: Delete this after moving everything to base.nfpack
struct Win32Res {
Win32Res(int id);
void* ptr;
size_t size;
};
struct Vec3 {
Vec3() {}
Vec3() : x(0.0), y(0.0), z(0.0) {}
Vec3(double x1) : x(x1), y(x1), z(x1) {}
Vec3(double x1, double y1, double z1) : x(x1), y(y1), z(z1) {}
Vec3 operator*(const double scalar) {
return Vec3(x * scalar, y * scalar, z * scalar);
}
Vec3& operator+=(const Vec3& rhs) {
this->x += rhs.x;
this->y += rhs.y;
this->z += rhs.z;
return *this;
}
Vec3& operator-=(const Vec3& rhs) {
this->x -= rhs.x;
this->y -= rhs.y;
this->z -= rhs.z;
return *this;
}
double x, y, z;
};
-17
View File
@@ -1,17 +0,0 @@
//{{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