Screen Draw
This commit is contained in:
@@ -36,6 +36,9 @@ namespace LearnOpenGL
|
||||
// Expects a filepath to a 3D model
|
||||
Model() {}
|
||||
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
|
||||
void Draw(Shader& shader);
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include <LearnOpenGL/Vertex.h>
|
||||
#include <glad/glad.h>
|
||||
|
||||
// TODO: Bring upstream of Re3D::VertexArray
|
||||
namespace LearnOpenGL
|
||||
{
|
||||
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;
|
||||
|
||||
// tangent
|
||||
vector.x = mesh->mTangents[i].x;
|
||||
vector.y = mesh->mTangents[i].y;
|
||||
vector.z = mesh->mTangents[i].z;
|
||||
vertex.Tangent = vector;
|
||||
if (mesh->mTangents != nullptr)
|
||||
{
|
||||
vector.x = mesh->mTangents[i].x;
|
||||
vector.y = mesh->mTangents[i].y;
|
||||
vector.z = mesh->mTangents[i].z;
|
||||
vertex.Tangent = vector;
|
||||
}
|
||||
|
||||
|
||||
// bitangent
|
||||
vector.x = mesh->mBitangents[i].x;
|
||||
vector.y = mesh->mBitangents[i].y;
|
||||
vector.z = mesh->mBitangents[i].z;
|
||||
vertex.BiTangent = vector;
|
||||
if (mesh->mBitangents != nullptr)
|
||||
{
|
||||
vector.x = mesh->mBitangents[i].x;
|
||||
vector.y = mesh->mBitangents[i].y;
|
||||
vector.z = mesh->mBitangents[i].z;
|
||||
vertex.BiTangent = vector;
|
||||
}
|
||||
|
||||
} else {
|
||||
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
|
||||
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("model", animation_model_matrix);
|
||||
|
||||
|
||||
Grid grid{};
|
||||
|
||||
// TODO: support loading fbx files
|
||||
@@ -48,20 +47,18 @@ public:
|
||||
|
||||
|
||||
camera = Camera3D();
|
||||
animation = Animation("resources/entity/Wolf_One_dae.dae", &ourModel);
|
||||
animator = Animator(&animation);
|
||||
}
|
||||
void OnRefresh(float dt) override
|
||||
{
|
||||
// draw in wireframe
|
||||
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
// pretend there's code
|
||||
std::cout << dt << std::endl;
|
||||
|
||||
animator.UpdateAnimations(dt);
|
||||
animator.UpdateAnimations(1.f/60.f);
|
||||
|
||||
|
||||
glClearColor(0.05f, 0.05f, 0.05f, 1.f);
|
||||
glClearColor(0.1f, 0.05f, 0.05f, 1.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
shader.use();
|
||||
//shader.use();
|
||||
|
||||
|
||||
//shader.setMat4("projection", Projection);
|
||||
@@ -74,6 +71,8 @@ public:
|
||||
model = model.Scale({.5f, .5f, .5f});
|
||||
shader.setMat4("model", model);
|
||||
ourModel.Draw(shader);
|
||||
|
||||
glSwapBuffers();
|
||||
}
|
||||
protected:
|
||||
private:
|
||||
|
Reference in New Issue
Block a user