Moved over from Win32 resources to purely nfpack; Included primitives and default shader in base.nfpack; Camera fixes
This commit is contained in:
1 parent
48821afd76
commit
c0f7634b5f
32 files changed
+5062
-224
No files matched your search
@@ -1,71 +0,0 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "src/include/resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"src/include/resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SHADER
|
||||
//
|
||||
|
||||
IDR_DEFAULTVERTEX RCDATA "res\\defaultShader\\vertex.shader"
|
||||
|
||||
IDR_DEFAULTFRAGMENT RCDATA "res\\defaultShader\\fragment.shader"
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -112,10 +112,7 @@
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command>
|
||||
<Message>Copying default NF resources</Message>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
@@ -143,10 +140,7 @@
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command>
|
||||
<Message>Copying default NF resources</Message>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
@@ -170,10 +164,7 @@
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command>
|
||||
<Message>Copying default NF resources</Message>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
@@ -201,10 +192,7 @@
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(IntDir)$(ProjectName).res" "$(SolutionDir)Game\dep\nf.res"</Command>
|
||||
<Message>Copying default NF resources</Message>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Application.cpp" />
|
||||
@@ -227,7 +215,6 @@
|
||||
<ClInclude Include="src\include\Assets.h" />
|
||||
<ClInclude Include="src\include\Camera.h" />
|
||||
<ClInclude Include="src\include\Entity.h" />
|
||||
<ClInclude Include="src\include\resource.h" />
|
||||
<ClInclude Include="src\include\Application.h" />
|
||||
<ClInclude Include="src\include\Config.h" />
|
||||
<ClInclude Include="src\include\Drawable.h" />
|
||||
@@ -251,9 +238,6 @@
|
||||
<None Include="res\defaultShader\fragment.shader" />
|
||||
<None Include="res\defaultShader\vertex.shader" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="NothinFancy.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -104,9 +104,6 @@
|
||||
<ClInclude Include="src\include\Model.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\include\resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\include\Entity.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -127,9 +124,4 @@
|
||||
<None Include="res\defaultShader\vertex.shader" />
|
||||
<None Include="res\defaultShader\fragment.shader" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="NothinFancy.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
#version 330 core
|
||||
|
||||
out vec4 color;
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
color = texture(tex, texCoord);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 pos;
|
||||
layout(location = 1) in vec2 texCoords;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 proj;
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = proj * view * model * vec4(pos, 1.0);
|
||||
texCoord = texCoords;
|
||||
}
|
||||
@@ -137,6 +137,8 @@ namespace nf {
|
||||
|
||||
void Application::trackMouse(bool track) {
|
||||
m_trackingMouse = track;
|
||||
if (m_trackingMouse == true)
|
||||
m_mouseTrackFirst = true;
|
||||
}
|
||||
|
||||
void Application::getMouseDiff(int& x, int& y) {
|
||||
@@ -183,7 +185,7 @@ namespace nf {
|
||||
x = monX - (m_currentConfig.width / 2);
|
||||
y = monY - (m_currentConfig.height / 2);
|
||||
}
|
||||
//TODO: Test fullscreen graphics
|
||||
|
||||
void Application::toggleFullscreen() {
|
||||
DWORD wndStyle = GetWindowLong(m_window, GWL_STYLE);
|
||||
if (wndStyle & WS_OVERLAPPEDWINDOW) {
|
||||
@@ -223,15 +225,14 @@ namespace nf {
|
||||
m_mouseY = 0;
|
||||
|
||||
if (m_trackingMouse) {
|
||||
static bool first = true;
|
||||
int middleX = m_currentConfig.width / 2;
|
||||
int middleY = m_currentConfig.height / 2;
|
||||
m_mouseDiffX += m_mouseX - middleX;
|
||||
m_mouseDiffY += middleY - m_mouseY;
|
||||
if (first) {
|
||||
if (m_mouseTrackFirst) {
|
||||
m_mouseDiffX = 0;
|
||||
m_mouseDiffY = 0;
|
||||
first = false;
|
||||
m_mouseTrackFirst = false;
|
||||
}
|
||||
POINT middle = { middleX, middleY };
|
||||
ClientToScreen(m_window, &middle);
|
||||
@@ -286,7 +287,7 @@ namespace nf {
|
||||
m_currentState = m_states[m_nextState];
|
||||
m_currentState->onEnter();
|
||||
}
|
||||
//TODO: mouse position input
|
||||
|
||||
LRESULT CALLBACK Application::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
Application* app = (Application*)GetProp(hWnd, L"App");
|
||||
switch (uMsg) {
|
||||
|
||||
@@ -16,6 +16,10 @@ namespace nf {
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
AShader::~AShader() {
|
||||
|
||||
}
|
||||
|
||||
AssetPack::AssetPack() {
|
||||
|
||||
}
|
||||
@@ -55,12 +59,20 @@ namespace nf {
|
||||
}
|
||||
if (extension == "png") {
|
||||
ATexture* texture = new ATexture;
|
||||
texture->data = new unsigned char[assetSize];
|
||||
texture->data = new char[assetSize];
|
||||
std::memcpy(texture->data, &assetContents[0], assetSize);
|
||||
texture->size = assetSize;
|
||||
m_assets[assetName] = texture;
|
||||
continue;
|
||||
}
|
||||
if (extension == "shader") {
|
||||
AShader* shader = new AShader;
|
||||
shader->data = new char[assetSize + 1];
|
||||
std::memcpy(shader->data, &assetContents[0], assetSize);
|
||||
shader->data[assetSize] = '\0';
|
||||
m_assets[assetName] = shader;
|
||||
continue;
|
||||
}
|
||||
Error("Invalid asset extention in pack \"" + (std::string)packName + (std::string)"\"!");
|
||||
}
|
||||
}
|
||||
@@ -81,4 +93,11 @@ namespace nf {
|
||||
delete curr.second;
|
||||
}
|
||||
}
|
||||
|
||||
AModel* BaseAssets::cube;
|
||||
AModel* BaseAssets::plane;
|
||||
AModel* BaseAssets::sphere;
|
||||
AModel* BaseAssets::cone;
|
||||
AModel* BaseAssets::cylinder;
|
||||
AModel* BaseAssets::torus;
|
||||
}
|
||||
@@ -7,17 +7,26 @@
|
||||
|
||||
namespace nf {
|
||||
Camera::Camera(Application* app) :
|
||||
m_app(app)
|
||||
m_app(app),
|
||||
m_type(Type::NF_CAMERA_UI),
|
||||
m_position(0.0),
|
||||
m_front(0.0, 0.0, -1.0),
|
||||
m_yaw(-90.0f),
|
||||
m_pitch(0.0)
|
||||
{
|
||||
m_type = Type::NF_CAMERA_UI;
|
||||
|
||||
}
|
||||
|
||||
void Camera::setType(Type cameraType) {
|
||||
m_type = cameraType;
|
||||
if (m_type == Type::NF_CAMERA_FIRST_PERSON || m_type == Type::NF_CAMERA_ORBIT)
|
||||
m_app->trackMouse(true);
|
||||
else
|
||||
m_app->trackMouse(false);
|
||||
if (cameraType != m_type) {
|
||||
m_type = cameraType;
|
||||
if (m_type == Type::NF_CAMERA_FIRST_PERSON || m_type == Type::NF_CAMERA_ORBIT)
|
||||
m_app->trackMouse(true);
|
||||
else
|
||||
m_app->trackMouse(false);
|
||||
m_yaw = -90.0f;
|
||||
m_pitch = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
Camera::Type Camera::getType() const {
|
||||
@@ -26,24 +35,26 @@ namespace nf {
|
||||
|
||||
void Camera::moveForward(double speed) {
|
||||
Vec3 temp = m_front * speed;
|
||||
m_position = { m_position.x + temp.x, m_position.y + temp.y, m_position.z + temp.z };
|
||||
m_position += temp;
|
||||
}
|
||||
|
||||
void Camera::moveBackward(double speed) {
|
||||
Vec3 temp = m_front * speed;
|
||||
m_position = { m_position.x - temp.x, m_position.y - temp.y, m_position.z - temp.z };
|
||||
m_position -= temp;
|
||||
}
|
||||
|
||||
void Camera::moveRight(double speed) {
|
||||
glm::vec3 front = { m_front.x, m_front.y, m_front.z };
|
||||
glm::vec3 temp = glm::normalize(glm::cross(front, glm::vec3(0.0, 1.0, 0.0))) * (float)speed;
|
||||
m_position = { m_position.x + temp.x, m_position.y + temp.y, m_position.z + temp.z };
|
||||
Vec3 move = { temp.x, temp.y, temp.z };
|
||||
m_position += move;
|
||||
}
|
||||
|
||||
void Camera::moveLeft(double speed) {
|
||||
glm::vec3 front = { m_front.x, m_front.y, m_front.z };
|
||||
glm::vec3 temp = glm::normalize(glm::cross(front, glm::vec3(0.0, 1.0, 0.0))) * (float)speed;
|
||||
m_position = { m_position.x - temp.x, m_position.y - temp.y, m_position.z - temp.z };
|
||||
Vec3 move = { temp.x, temp.y, temp.z };
|
||||
m_position -= move;
|
||||
}
|
||||
|
||||
void Camera::setPosition(double x, double y, double z) {
|
||||
@@ -68,18 +79,16 @@ namespace nf {
|
||||
m_app->getMouseDiff(mouseDiffx, mouseDiffy);
|
||||
float mouseX = (float)mouseDiffx * 0.1f;
|
||||
float mouseY = (float)mouseDiffy * 0.1f;
|
||||
static float yaw = -90.0f;
|
||||
static float pitch = 0.0f;
|
||||
yaw += mouseX;
|
||||
pitch += mouseY;
|
||||
if (pitch > 89.0f)
|
||||
pitch = 89.0f;
|
||||
if (pitch < -89.0f)
|
||||
pitch = -89.0f;
|
||||
m_yaw += mouseX;
|
||||
m_pitch += mouseY;
|
||||
if (m_pitch > 89.0f)
|
||||
m_pitch = 89.0f;
|
||||
if (m_pitch < -89.0f)
|
||||
m_pitch = -89.0f;
|
||||
glm::vec3 rotation;
|
||||
rotation.x = std::cos(glm::radians(yaw)) * std::cos(glm::radians(pitch));
|
||||
rotation.y = std::sin(glm::radians(pitch));
|
||||
rotation.z = std::sin(glm::radians(yaw)) * std::cos(glm::radians(pitch));
|
||||
rotation.x = std::cos(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
|
||||
rotation.y = std::sin(glm::radians(m_pitch));
|
||||
rotation.z = std::sin(glm::radians(m_yaw)) * std::cos(glm::radians(m_pitch));
|
||||
rotation = glm::normalize(rotation);
|
||||
m_front = { rotation.x, rotation.y, rotation.z };
|
||||
glm::vec3 position(m_position.x, m_position.y, m_position.z);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace nf {
|
||||
|
||||
void Entity::create(Asset* modelAsset, Asset* textureAsset) {
|
||||
AModel& model = *(AModel*)modelAsset;
|
||||
if (model.alreadyLoaded) {
|
||||
if (model.alreadyLoaded && textureAsset == nullptr) {
|
||||
m_model = model.loadedModel;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace nf {
|
||||
Model::Model() {
|
||||
}
|
||||
|
||||
void Model::create(const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount, const void* textureCoordinatesBufferData, size_t textureCoordinatesBufferSize, const unsigned char* textureData, size_t textureSize) {
|
||||
void Model::create(const void* vertexBufferData, const size_t vertexBufferSize, const void* indexBufferData, size_t indexBufferCount, const void* textureCoordinatesBufferData, size_t textureCoordinatesBufferSize, const char* textureData, size_t textureSize) {
|
||||
m_vao = new VertexArray;
|
||||
m_vao->addBuffer(vertexBufferData, vertexBufferSize);
|
||||
m_vao->push<float>(3);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "Application.h"
|
||||
#include "Utility.h"
|
||||
#include "resource.h"
|
||||
|
||||
namespace nf {
|
||||
Renderer::Renderer(Application* app) {
|
||||
@@ -55,19 +54,24 @@ namespace nf {
|
||||
glEnable(GL_CULL_FACE);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
Win32Res vs(IDR_DEFAULTVERTEX);
|
||||
const char* defaultVertex = (const char*)vs.ptr;
|
||||
Win32Res fs(IDR_DEFAULTFRAGMENT);
|
||||
const char* defaultFragment = (const char*)fs.ptr;
|
||||
if (defaultVertex == nullptr || defaultFragment == nullptr)
|
||||
Error("Default engine resources not found! Please link nf.res to your application!");
|
||||
baseAP.load("base.nfpack");
|
||||
const char* defaultVertex = baseAP["defaultVertex.shader"]->data;
|
||||
const char* defaultFragment = baseAP["defaultFragment.shader"]->data;
|
||||
m_defaultShader = new Shader(defaultVertex, defaultFragment);
|
||||
|
||||
BaseAssets::cube = (AModel*)baseAP["cube.obj"];
|
||||
BaseAssets::plane = (AModel*)baseAP["plane.obj"];
|
||||
BaseAssets::sphere = (AModel*)baseAP["sphere.obj"];
|
||||
BaseAssets::cone = (AModel*)baseAP["cone.obj"];
|
||||
BaseAssets::cylinder = (AModel*)baseAP["cylinder.obj"];
|
||||
BaseAssets::torus = (AModel*)baseAP["torus.obj"];
|
||||
}
|
||||
|
||||
void Renderer::render(Entity& in) {
|
||||
if (&in == nullptr)
|
||||
Error("Tried to render Entity before being created!");
|
||||
m_lGame.push_back(&in);
|
||||
//TODO: Sort transparent objects by distance; Farthest first
|
||||
}
|
||||
|
||||
void Renderer::doFrame(Camera* camera) {
|
||||
|
||||
@@ -11,10 +11,10 @@ namespace nf {
|
||||
glGenTextures(1, &m_id);
|
||||
}
|
||||
|
||||
void Texture::create(const unsigned char* textureData, size_t textureSize) {
|
||||
void Texture::create(const char* textureData, size_t textureSize) {
|
||||
int width, height, nChannels;
|
||||
stbi_set_flip_vertically_on_load(true);
|
||||
unsigned char* texture = stbi_load_from_memory(textureData, textureSize, &width, &height, &nChannels, 0);
|
||||
unsigned char* texture = stbi_load_from_memory((unsigned char*)textureData, textureSize, &width, &height, &nChannels, 0);
|
||||
if (!texture)
|
||||
Error("Texture failed to load from memory!");
|
||||
glBindTexture(GL_TEXTURE_2D, m_id);
|
||||
|
||||
@@ -53,20 +53,6 @@ namespace nf {
|
||||
}
|
||||
#endif
|
||||
|
||||
Win32Res::Win32Res(int id) :
|
||||
ptr(nullptr),
|
||||
size(0)
|
||||
{
|
||||
HRSRC src = FindResource(NULL, MAKEINTRESOURCE(id), RT_RCDATA);
|
||||
if (src) {
|
||||
HGLOBAL temp = LoadResource(NULL, src);
|
||||
if (temp) {
|
||||
ptr = LockResource(temp);
|
||||
size = (size_t)SizeofResource(NULL, src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const wchar_t* toWide(const char* in) {
|
||||
int length = std::strlen(in) + 1;
|
||||
wchar_t* out = new wchar_t[length];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
@@ -34,5 +34,7 @@ namespace nf {
|
||||
|
||||
Vec3 m_position;
|
||||
Vec3 m_front;
|
||||
float m_yaw;
|
||||
float m_pitch;
|
||||
};
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user