Screen Draw
This commit is contained in:
@@ -36,6 +36,9 @@ namespace LearnOpenGL
|
|||||||
// Expects a filepath to a 3D model
|
// Expects a filepath to a 3D model
|
||||||
Model() {}
|
Model() {}
|
||||||
Model(const std::string& path, bool gamma = false);
|
Model(const std::string& path, bool gamma = false);
|
||||||
|
|
||||||
|
static Model LoadFromDAEFile(std::string& path, bool gamma = false);
|
||||||
|
static Model LoadFromOBJFile(std::string& path);
|
||||||
// Draws the model, and this all its meshes
|
// Draws the model, and this all its meshes
|
||||||
void Draw(Shader& shader);
|
void Draw(Shader& shader);
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#include <LearnOpenGL/Vertex.h>
|
#include <LearnOpenGL/Vertex.h>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
// TODO: Bring upstream of Re3D::VertexArray
|
||||||
namespace LearnOpenGL
|
namespace LearnOpenGL
|
||||||
{
|
{
|
||||||
class VertexArray {
|
class VertexArray {
|
||||||
|
7981
resources/entity/dancing_vampire.dae
Normal file
7981
resources/entity/dancing_vampire.dae
Normal file
File diff suppressed because one or more lines are too long
@@ -44,16 +44,24 @@ namespace LearnOpenGL
|
|||||||
vec.y = mesh->mTextureCoords[0][i].y;
|
vec.y = mesh->mTextureCoords[0][i].y;
|
||||||
|
|
||||||
// tangent
|
// tangent
|
||||||
vector.x = mesh->mTangents[i].x;
|
if (mesh->mTangents != nullptr)
|
||||||
vector.y = mesh->mTangents[i].y;
|
{
|
||||||
vector.z = mesh->mTangents[i].z;
|
vector.x = mesh->mTangents[i].x;
|
||||||
vertex.Tangent = vector;
|
vector.y = mesh->mTangents[i].y;
|
||||||
|
vector.z = mesh->mTangents[i].z;
|
||||||
|
vertex.Tangent = vector;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// bitangent
|
// bitangent
|
||||||
vector.x = mesh->mBitangents[i].x;
|
if (mesh->mBitangents != nullptr)
|
||||||
vector.y = mesh->mBitangents[i].y;
|
{
|
||||||
vector.z = mesh->mBitangents[i].z;
|
vector.x = mesh->mBitangents[i].x;
|
||||||
vertex.BiTangent = vector;
|
vector.y = mesh->mBitangents[i].y;
|
||||||
|
vector.z = mesh->mBitangents[i].z;
|
||||||
|
vertex.BiTangent = vector;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
vertex.TexCoords = {0, 0};
|
vertex.TexCoords = {0, 0};
|
||||||
}
|
}
|
||||||
@@ -134,7 +142,7 @@ namespace LearnOpenGL
|
|||||||
// after we've processed all of the meshes we then recursively process each of the children nodes
|
// after we've processed all of the meshes we then recursively process each of the children nodes
|
||||||
for (uint i = 0; i < node->mNumChildren; i++)
|
for (uint i = 0; i < node->mNumChildren; i++)
|
||||||
{
|
{
|
||||||
|
processNode(node->mChildren[i], scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,7 +37,6 @@ public:
|
|||||||
skeletal_animation_shader.setMat4("view", view_matrix);
|
skeletal_animation_shader.setMat4("view", view_matrix);
|
||||||
skeletal_animation_shader.setMat4("model", animation_model_matrix);
|
skeletal_animation_shader.setMat4("model", animation_model_matrix);
|
||||||
|
|
||||||
|
|
||||||
Grid grid{};
|
Grid grid{};
|
||||||
|
|
||||||
// TODO: support loading fbx files
|
// TODO: support loading fbx files
|
||||||
@@ -48,20 +47,18 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
camera = Camera3D();
|
camera = Camera3D();
|
||||||
|
animation = Animation("resources/entity/Wolf_One_dae.dae", &ourModel);
|
||||||
animator = Animator(&animation);
|
animator = Animator(&animation);
|
||||||
}
|
}
|
||||||
void OnRefresh(float dt) override
|
void OnRefresh(float dt) override
|
||||||
{
|
{
|
||||||
// draw in wireframe
|
std::cout << dt << std::endl;
|
||||||
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
|
||||||
// pretend there's code
|
|
||||||
|
|
||||||
animator.UpdateAnimations(dt);
|
animator.UpdateAnimations(1.f/60.f);
|
||||||
|
|
||||||
|
glClearColor(0.1f, 0.05f, 0.05f, 1.f);
|
||||||
glClearColor(0.05f, 0.05f, 0.05f, 1.f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
shader.use();
|
//shader.use();
|
||||||
|
|
||||||
|
|
||||||
//shader.setMat4("projection", Projection);
|
//shader.setMat4("projection", Projection);
|
||||||
@@ -74,6 +71,8 @@ public:
|
|||||||
model = model.Scale({.5f, .5f, .5f});
|
model = model.Scale({.5f, .5f, .5f});
|
||||||
shader.setMat4("model", model);
|
shader.setMat4("model", model);
|
||||||
ourModel.Draw(shader);
|
ourModel.Draw(shader);
|
||||||
|
|
||||||
|
glSwapBuffers();
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user