Nvidia cards not yet supported, Nvidia drivers are so gosh darn strict
This commit is contained in:
176
src/camera.cpp
176
src/camera.cpp
@@ -1,88 +1,88 @@
|
||||
#include "camera.h"
|
||||
|
||||
Camera::Camera() {
|
||||
|
||||
}
|
||||
|
||||
void Camera::updateView() {
|
||||
//roll can be removed from here. because is not actually used in FPS camera
|
||||
glm::mat4 matRoll = glm::mat4(1.0f);//identity matrix;
|
||||
glm::mat4 matPitch = glm::mat4(1.0f);//identity matrix
|
||||
glm::mat4 matYaw = glm::mat4(1.0f);//identity matrix
|
||||
|
||||
//roll, pitch and yaw are used to store our angles in our class
|
||||
matRoll = glm::rotate(matRoll, roll, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
matPitch = glm::rotate(matPitch, pitch, glm::vec3(1.0f, 0.0f, 0.0f));
|
||||
matYaw = glm::rotate(matYaw, yaw, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
||||
//order matters
|
||||
glm::mat4 rotate = matRoll * matPitch * matYaw;
|
||||
|
||||
glm::mat4 translate = glm::mat4(1.0f);
|
||||
translate = glm::translate(translate, -eyeVector);
|
||||
|
||||
viewMatrix = rotate * translate;
|
||||
}
|
||||
|
||||
glm::mat4 Camera::getViewMatrix() {
|
||||
return viewMatrix;
|
||||
}
|
||||
|
||||
glm::vec3 Camera::getPos() {
|
||||
return eyeVector;
|
||||
}
|
||||
|
||||
void Camera::handleMouse(SDL_Event e) {
|
||||
if (e.type != SDL_MOUSEMOTION)
|
||||
return;
|
||||
|
||||
|
||||
float mouseDX = e.motion.xrel;
|
||||
float mouseDY = e.motion.yrel;
|
||||
|
||||
glm::vec2 mouseDelta {mouseDX, mouseDY};
|
||||
|
||||
mouseMoved(mouseDelta);
|
||||
}
|
||||
|
||||
void Camera::moveCamera() {
|
||||
float dx = 0; //how much we strafe on x
|
||||
float dz = 0; //how much we walk on z
|
||||
|
||||
const Uint8* state = SDL_GetKeyboardState(NULL);
|
||||
|
||||
if (state[SDL_SCANCODE_W])
|
||||
dz += 2;
|
||||
if (state[SDL_SCANCODE_S])
|
||||
dz += -2;
|
||||
if (state[SDL_SCANCODE_A])
|
||||
dx += -2;
|
||||
if (state[SDL_SCANCODE_D])
|
||||
dx += 2;
|
||||
// if (state[SDL_SCANCODE_Z])
|
||||
|
||||
// if (state[SDL_SCANCODE_LSHIFT])
|
||||
|
||||
|
||||
//get current view matrix
|
||||
glm::mat4 mat = getViewMatrix();
|
||||
//row major
|
||||
glm::vec3 forward(mat[0][2], mat[1][2], mat[2][2]);
|
||||
glm::vec3 strafe( mat[0][0], mat[1][0], mat[2][0]);
|
||||
|
||||
//forward vector must be negative to look forward.
|
||||
//read :http://in2gpu.com/2015/05/17/view-matrix/
|
||||
eyeVector += (-dz * forward + dx * strafe) * cameraSpeed;
|
||||
|
||||
//update the view matrix
|
||||
updateView();
|
||||
}
|
||||
|
||||
void Camera::mouseMoved(glm::vec2 mouseDelta) {
|
||||
//note that yaw and pitch must be converted to radians.
|
||||
//this is done in UpdateView() by glm::rotate
|
||||
yaw += mouseSensitivity * mouseDelta.x;
|
||||
pitch += mouseSensitivity * mouseDelta.y;
|
||||
|
||||
updateView();
|
||||
}
|
||||
#include "camera.h"
|
||||
|
||||
Camera::Camera() {
|
||||
|
||||
}
|
||||
|
||||
void Camera::updateView() {
|
||||
//roll can be removed from here. because is not actually used in FPS camera
|
||||
glm::mat4 matRoll = glm::mat4(1.0f);//identity matrix;
|
||||
glm::mat4 matPitch = glm::mat4(1.0f);//identity matrix
|
||||
glm::mat4 matYaw = glm::mat4(1.0f);//identity matrix
|
||||
|
||||
//roll, pitch and yaw are used to store our angles in our class
|
||||
matRoll = glm::rotate(matRoll, roll, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
matPitch = glm::rotate(matPitch, pitch, glm::vec3(1.0f, 0.0f, 0.0f));
|
||||
matYaw = glm::rotate(matYaw, yaw, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
||||
//order matters
|
||||
glm::mat4 rotate = matRoll * matPitch * matYaw;
|
||||
|
||||
glm::mat4 translate = glm::mat4(1.0f);
|
||||
translate = glm::translate(translate, -eyeVector);
|
||||
|
||||
viewMatrix = rotate * translate;
|
||||
}
|
||||
|
||||
glm::mat4 Camera::getViewMatrix() {
|
||||
return viewMatrix;
|
||||
}
|
||||
|
||||
glm::vec3 Camera::getPos() {
|
||||
return eyeVector;
|
||||
}
|
||||
|
||||
void Camera::handleMouse(SDL_Event e) {
|
||||
if (e.type != SDL_MOUSEMOTION)
|
||||
return;
|
||||
|
||||
|
||||
float mouseDX = e.motion.xrel;
|
||||
float mouseDY = e.motion.yrel;
|
||||
|
||||
glm::vec2 mouseDelta {mouseDX, mouseDY};
|
||||
|
||||
mouseMoved(mouseDelta);
|
||||
}
|
||||
|
||||
void Camera::moveCamera() {
|
||||
float dx = 0; //how much we strafe on x
|
||||
float dz = 0; //how much we walk on z
|
||||
|
||||
const Uint8* state = SDL_GetKeyboardState(NULL);
|
||||
|
||||
if (state[SDL_SCANCODE_W])
|
||||
dz += 2;
|
||||
if (state[SDL_SCANCODE_S])
|
||||
dz += -2;
|
||||
if (state[SDL_SCANCODE_A])
|
||||
dx += -2;
|
||||
if (state[SDL_SCANCODE_D])
|
||||
dx += 2;
|
||||
// if (state[SDL_SCANCODE_Z])
|
||||
|
||||
// if (state[SDL_SCANCODE_LSHIFT])
|
||||
|
||||
|
||||
//get current view matrix
|
||||
glm::mat4 mat = getViewMatrix();
|
||||
//row major
|
||||
glm::vec3 forward(mat[0][2], mat[1][2], mat[2][2]);
|
||||
glm::vec3 strafe (mat[0][0], mat[1][0], mat[2][0]);
|
||||
|
||||
//forward vector must be negative to look forward.
|
||||
//read :http://in2gpu.com/2015/05/17/view-matrix/
|
||||
eyeVector += (-dz * forward + dx * strafe) * cameraSpeed;
|
||||
|
||||
//update the view matrix
|
||||
updateView();
|
||||
}
|
||||
|
||||
void Camera::mouseMoved(glm::vec2 mouseDelta) {
|
||||
//note that yaw and pitch must be converted to radians.
|
||||
//this is done in UpdateView() by glm::rotate
|
||||
yaw += mouseSensitivity * mouseDelta.x;
|
||||
pitch += mouseSensitivity * mouseDelta.y;
|
||||
|
||||
updateView();
|
||||
}
|
||||
|
||||
66
src/camera.h
66
src/camera.h
@@ -1,31 +1,35 @@
|
||||
#ifndef SMHENGINE_SRC_CAMERA_H_
|
||||
#define SMHENGINE_SRC_CAMERA_H_
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
class Camera {
|
||||
public:
|
||||
Camera();
|
||||
|
||||
void updateView();
|
||||
glm::mat4 getViewMatrix();
|
||||
glm::vec3 getPos();
|
||||
|
||||
void handleMouse(SDL_Event e);
|
||||
void moveCamera();
|
||||
void mouseMoved(glm::vec2 mouseDelta);
|
||||
|
||||
float mouseSensitivity = 0.0025f;
|
||||
float cameraSpeed = 1.12f;
|
||||
|
||||
private:
|
||||
float roll, pitch, yaw;
|
||||
glm::vec3 eyeVector;
|
||||
glm::mat4 viewMatrix;
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef SMHENGINE_SRC_CAMERA_H_
|
||||
#define SMHENGINE_SRC_CAMERA_H_
|
||||
|
||||
#if _WIN32
|
||||
#include <SDL.h>
|
||||
#else
|
||||
#include <SDL2/SDL.h>
|
||||
#endif
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
class Camera {
|
||||
public:
|
||||
Camera();
|
||||
|
||||
void updateView();
|
||||
glm::mat4 getViewMatrix();
|
||||
glm::vec3 getPos();
|
||||
|
||||
void handleMouse(SDL_Event e);
|
||||
void moveCamera();
|
||||
void mouseMoved(glm::vec2 mouseDelta);
|
||||
|
||||
float mouseSensitivity = 0.0025f;
|
||||
float cameraSpeed = 1.12f;
|
||||
|
||||
private:
|
||||
float roll, pitch, yaw;
|
||||
glm::vec3 eyeVector;
|
||||
glm::mat4 viewMatrix;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
15
src/main.cpp
15
src/main.cpp
@@ -11,6 +11,7 @@
|
||||
#include <logger.h>
|
||||
|
||||
#include "display.h"
|
||||
#include "camera.h"
|
||||
#include "shader.h"
|
||||
#include "model.h"
|
||||
|
||||
@@ -38,12 +39,15 @@ int main (int argc, char** argv) {
|
||||
|
||||
SDL_Event e;
|
||||
while (!display.isClosed) {
|
||||
|
||||
camera.moveCamera();
|
||||
|
||||
while (SDL_PollEvent(&e)) {
|
||||
camera.handleMouse(e);
|
||||
if (e.type == SDL_QUIT || e.key.keysym.sym == SDLK_ESCAPE)
|
||||
if (e.type == SDL_QUIT)
|
||||
display.isClosed = true;
|
||||
if (e.key.keysym.sym == SDLK_t) {
|
||||
SDL_SetRelativeMouseMode(SDL_GetRelativeMouseMode() == SDL_TRUE ? SDL_FALSE : SDL_TRUE);
|
||||
}
|
||||
camera.handleMouse(e);
|
||||
}
|
||||
|
||||
const Uint8* state = SDL_GetKeyboardState(NULL);
|
||||
@@ -57,11 +61,12 @@ int main (int argc, char** argv) {
|
||||
}
|
||||
|
||||
mesh.bind();
|
||||
mesh.render(shader, camera);`
|
||||
mesh.render(shader, camera);
|
||||
mesh.unbind();
|
||||
|
||||
display.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "mesh.h"
|
||||
#include "camera.h"
|
||||
|
||||
Mesh::Mesh() {
|
||||
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
#include <tiny_obj_loader.h>
|
||||
|
||||
#include <logger.h>
|
||||
#include "camera.h"
|
||||
#include "shader.h"
|
||||
#include "./util/util.h"
|
||||
|
||||
class Camera;
|
||||
|
||||
// Not in use yet
|
||||
// Will be used as a vector, enabling
|
||||
// the use of strides when sending the
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#include "model.h"
|
||||
|
||||
|
||||
#include "model.h"
|
||||
|
||||
|
||||
|
||||
52
src/model.h
52
src/model.h
@@ -1,26 +1,26 @@
|
||||
#ifndef SMHENGINE_SRC_MODEL_H_
|
||||
#define SMHENGINE_SRC_MODEL_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glad/glad.hpp>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <logger.h>
|
||||
|
||||
#include "mesh.h"
|
||||
#include "material.h"
|
||||
|
||||
class Model {
|
||||
public:
|
||||
Model();
|
||||
Model(std::string loadPath);
|
||||
|
||||
std::vector<std::pair<Mesh, Material>> modelData;
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef SMHENGINE_SRC_MODEL_H_
|
||||
#define SMHENGINE_SRC_MODEL_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glad/glad.hpp>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <logger.h>
|
||||
|
||||
#include "mesh.h"
|
||||
#include "material.h"
|
||||
|
||||
class Model {
|
||||
public:
|
||||
Model();
|
||||
Model(std::string loadPath);
|
||||
|
||||
std::vector<std::pair<Mesh, Material>> modelData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
56
src/object.h
56
src/object.h
@@ -1,28 +1,28 @@
|
||||
#ifndef SMHENGINE_SRC_OBJECT_H_
|
||||
#define SMHENGINE_SRC_OBJECT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glad/glad.hpp>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <OBJLoader.h>
|
||||
|
||||
#include <logger.h>
|
||||
|
||||
#include "model.h"
|
||||
#include "shader.h"
|
||||
|
||||
class Object {
|
||||
public:
|
||||
Object();
|
||||
|
||||
std::vector<Model> models;
|
||||
std::vector<Shader> shaders;
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef SMHENGINE_SRC_OBJECT_H_
|
||||
#define SMHENGINE_SRC_OBJECT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glad/glad.hpp>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <OBJLoader.h>
|
||||
|
||||
#include <logger.h>
|
||||
|
||||
#include "model.h"
|
||||
#include "shader.h"
|
||||
|
||||
class Object {
|
||||
public:
|
||||
Object();
|
||||
|
||||
std::vector<Model> models;
|
||||
std::vector<Shader> shaders;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc
|
||||
#include "tiny_obj_loader.h"
|
||||
#define TINYOBJLOADER_IMPLEMENTATION // define this in only *one* .cc
|
||||
#include "tiny_obj_loader.h"
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
#include "util.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <logger.h>
|
||||
|
||||
#include "../mesh.h"
|
||||
|
||||
|
||||
void OBJLtoGLM(ObjLMesh& mesh,
|
||||
std::vector<glm::vec3>& outVert,
|
||||
std::vector<glm::vec3>& outNorm,
|
||||
std::vector<glm::vec3>& outTexCoord,
|
||||
std::vector<GLuint>& outIndices) {
|
||||
|
||||
std::unordered_map<glm::vec3, uint64_t> uniqueVertices {{{1.0f, 1.0f, 1.0f}, 1}};
|
||||
|
||||
for (const auto &shape : mesh.shapes) {
|
||||
for (const auto& index : shape.mesh.indices) {
|
||||
glm::vec3 vertex {
|
||||
mesh.attrib.vertices[3 * index.vertex_index + 0],
|
||||
mesh.attrib.vertices[3 * index.vertex_index + 1],
|
||||
mesh.attrib.vertices[3 * index.vertex_index + 2]
|
||||
};
|
||||
|
||||
// outNorm.push_back({
|
||||
// mesh.attrib.normals[3 * index.normal_index + 0],
|
||||
// mesh.attrib.normals[3 * index.normal_index + 1],
|
||||
// mesh.attrib.normals[3 * index.normal_index + 2]
|
||||
// });
|
||||
|
||||
// outTexCoord.push_back({
|
||||
// mesh.attrib.texcoords[2 * index.texcoord_index + 0],
|
||||
// mesh.attrib.texcoords[2 * index.texcoord_index + 1],
|
||||
// 0.0f
|
||||
// });
|
||||
|
||||
if (uniqueVertices.count(vertex) == 0) {
|
||||
uniqueVertices[vertex] = static_cast<uint32_t>(outVert.size());
|
||||
outVert.push_back(vertex);
|
||||
}
|
||||
|
||||
outIndices.push_back(uniqueVertices[vertex]);
|
||||
}
|
||||
}
|
||||
|
||||
ComputeNormals(outNorm, outVert, outIndices);
|
||||
}
|
||||
|
||||
void ComputeNormals(std::vector<glm::vec3>& normals,
|
||||
std::vector<glm::vec3>& vertices,
|
||||
std::vector<GLuint>& elements) {
|
||||
|
||||
normals.resize(vertices.size(), glm::vec3(0.0, 0.0, 0.0));
|
||||
for (int i = 0; i < elements.size(); i += 3) {
|
||||
GLushort ia = elements[i];
|
||||
GLushort ib = elements[i+1];
|
||||
GLushort ic = elements[i+2];
|
||||
glm::vec3 normal = glm::normalize(glm::cross(
|
||||
glm::vec3(vertices[ib]) - glm::vec3(vertices[ia]),
|
||||
glm::vec3(vertices[ic]) - glm::vec3(vertices[ia])));
|
||||
normals[ia] = normals[ib] = normals[ic] = normal;
|
||||
}
|
||||
}
|
||||
|
||||
void UintToGLuint(ObjLMesh& mesh,
|
||||
std::vector<GLuint>& outIndices) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// void OBJLVec3toGLM(objl::Vector3& inVec, glm::vec3& outVec) {
|
||||
|
||||
// outVec.x = inVec.X;
|
||||
// outVec.y = inVec.Y;
|
||||
// outVec.z = inVec.Z;
|
||||
|
||||
// }
|
||||
#include "util.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <logger.h>
|
||||
|
||||
#include "../mesh.h"
|
||||
|
||||
|
||||
void OBJLtoGLM(ObjLMesh& mesh,
|
||||
std::vector<glm::vec3>& outVert,
|
||||
std::vector<glm::vec3>& outNorm,
|
||||
std::vector<glm::vec3>& outTexCoord,
|
||||
std::vector<GLuint>& outIndices) {
|
||||
|
||||
std::unordered_map<glm::vec3, uint64_t> uniqueVertices {{{1.0f, 1.0f, 1.0f}, 1}};
|
||||
|
||||
for (const auto &shape : mesh.shapes) {
|
||||
for (const auto& index : shape.mesh.indices) {
|
||||
glm::vec3 vertex {
|
||||
mesh.attrib.vertices[3 * index.vertex_index + 0],
|
||||
mesh.attrib.vertices[3 * index.vertex_index + 1],
|
||||
mesh.attrib.vertices[3 * index.vertex_index + 2]
|
||||
};
|
||||
|
||||
// outNorm.push_back({
|
||||
// mesh.attrib.normals[3 * index.normal_index + 0],
|
||||
// mesh.attrib.normals[3 * index.normal_index + 1],
|
||||
// mesh.attrib.normals[3 * index.normal_index + 2]
|
||||
// });
|
||||
|
||||
// outTexCoord.push_back({
|
||||
// mesh.attrib.texcoords[2 * index.texcoord_index + 0],
|
||||
// mesh.attrib.texcoords[2 * index.texcoord_index + 1],
|
||||
// 0.0f
|
||||
// });
|
||||
|
||||
if (uniqueVertices.count(vertex) == 0) {
|
||||
uniqueVertices[vertex] = static_cast<uint32_t>(outVert.size());
|
||||
outVert.push_back(vertex);
|
||||
}
|
||||
|
||||
outIndices.push_back(uniqueVertices[vertex]);
|
||||
}
|
||||
}
|
||||
|
||||
ComputeNormals(outNorm, outVert, outIndices);
|
||||
}
|
||||
|
||||
void ComputeNormals(std::vector<glm::vec3>& normals,
|
||||
std::vector<glm::vec3>& vertices,
|
||||
std::vector<GLuint>& elements) {
|
||||
|
||||
normals.resize(vertices.size(), glm::vec3(0.0, 0.0, 0.0));
|
||||
for (int i = 0; i < elements.size(); i += 3) {
|
||||
GLushort ia = elements[i];
|
||||
GLushort ib = elements[i+1];
|
||||
GLushort ic = elements[i+2];
|
||||
glm::vec3 normal = glm::normalize(glm::cross(
|
||||
glm::vec3(vertices[ib]) - glm::vec3(vertices[ia]),
|
||||
glm::vec3(vertices[ic]) - glm::vec3(vertices[ia])));
|
||||
normals[ia] = normals[ib] = normals[ic] = normal;
|
||||
}
|
||||
}
|
||||
|
||||
void UintToGLuint(ObjLMesh& mesh,
|
||||
std::vector<GLuint>& outIndices) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// void OBJLVec3toGLM(objl::Vector3& inVec, glm::vec3& outVec) {
|
||||
|
||||
// outVec.x = inVec.X;
|
||||
// outVec.y = inVec.Y;
|
||||
// outVec.z = inVec.Z;
|
||||
|
||||
// }
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
#ifndef SMHENGINE_SRC_UTIL_UTIL_H_
|
||||
#define SMHENGINE_SRC_UTIL_UTUL_H_
|
||||
|
||||
#include <glad/glad.hpp>
|
||||
// This is so that i can use
|
||||
// glm::vec3 inside of an
|
||||
// std::unordered_map as it's
|
||||
// experimental for some reason
|
||||
// smh
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/hash.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include <tiny_obj_loader.h>
|
||||
|
||||
struct ObjLMesh;
|
||||
|
||||
void OBJLtoGLM(ObjLMesh& mesh,
|
||||
std::vector<glm::vec3>& outVert,
|
||||
std::vector<glm::vec3>& outNorm,
|
||||
std::vector<glm::vec3>& outTexCoord,
|
||||
std::vector<GLuint>& outIndices);
|
||||
|
||||
void ComputeNormals(std::vector<glm::vec3>& normals,
|
||||
std::vector<glm::vec3>& vertices,
|
||||
std::vector<GLuint>& elements);
|
||||
|
||||
void UintToGLuint(ObjLMesh& mesh,
|
||||
std::vector<GLuint>& outIndices);
|
||||
|
||||
// void OBJLVec3toGLM(objl::Vector3& inVec, glm::vec3& outVec);
|
||||
|
||||
#endif
|
||||
#ifndef SMHENGINE_SRC_UTIL_UTIL_H_
|
||||
#define SMHENGINE_SRC_UTIL_UTUL_H_
|
||||
|
||||
#include <glad/glad.hpp>
|
||||
// This is so that i can use
|
||||
// glm::vec3 inside of an
|
||||
// std::unordered_map as it's
|
||||
// experimental for some reason
|
||||
// smh
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/hash.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include <tiny_obj_loader.h>
|
||||
|
||||
struct ObjLMesh;
|
||||
|
||||
void OBJLtoGLM(ObjLMesh& mesh,
|
||||
std::vector<glm::vec3>& outVert,
|
||||
std::vector<glm::vec3>& outNorm,
|
||||
std::vector<glm::vec3>& outTexCoord,
|
||||
std::vector<GLuint>& outIndices);
|
||||
|
||||
void ComputeNormals(std::vector<glm::vec3>& normals,
|
||||
std::vector<glm::vec3>& vertices,
|
||||
std::vector<GLuint>& elements);
|
||||
|
||||
void UintToGLuint(ObjLMesh& mesh,
|
||||
std::vector<GLuint>& outIndices);
|
||||
|
||||
// void OBJLVec3toGLM(objl::Vector3& inVec, glm::vec3& outVec);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user