projects
/
opengl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Load cameras and shuffle about model stuff
[opengl.git]
/
model.cpp
diff --git
a/model.cpp
b/model.cpp
index f68db4b6407f2096c4313794e1bb3d1c00e569f1..a11a0745dd9d4b8d41da1c8a3809fa34384e1037 100644
(file)
--- a/
model.cpp
+++ b/
model.cpp
@@
-1,16
+1,8
@@
#include "model.hpp"
#include <iostream>
#include "model.hpp"
#include <iostream>
-#include <assimp/postprocess.h>
#include <assimp/quaternion.h>
#include <glm/gtc/type_ptr.hpp>
#include <assimp/quaternion.h>
#include <glm/gtc/type_ptr.hpp>
-glm::mat4 aiMatrixToMat4(aiMatrix4x4 from) {
- glm::mat4 to;
- for (int i = 0; i < 4; i++)
- for (int j = 0; j < 4; j++)
- to[i][j] = from[j][i];
- return to;
-}
Model::Mesh::Mesh(const aiMesh *aiMesh, GLuint progId) {
Model::Mesh::Mesh(const aiMesh *aiMesh, GLuint progId) {
@@
-300,16
+292,9
@@
void Model::Node::draw( const std::vector<Mesh> &meshes,
for (Node *child: children) child->draw(meshes, materials, skybox, tick, m, boneTransforms);
}
for (Node *child: children) child->draw(meshes, materials, skybox, tick, m, boneTransforms);
}
-Model::Model(const
std::string &path
, Program p): program(p) {
+Model::Model(const
aiScene *scene
, Program p): program(p) {
glUseProgram(p.progId);
glUseProgram(p.progId);
- const aiScene *scene = importer.ReadFile(path,
- aiProcess_Triangulate | aiProcess_CalcTangentSpace | aiProcess_GenNormals | aiProcess_FlipUVs);
- if (!scene) {
- std::cerr << importer.GetErrorString() << std::endl;
- exit(1);
- }
-
for (int i = 0; i < scene->mNumMeshes; i++) {
const aiMesh *mesh = scene->mMeshes[i];
meshes.push_back(Mesh(mesh, p.progId));
for (int i = 0; i < scene->mNumMeshes; i++) {
const aiMesh *mesh = scene->mMeshes[i];
meshes.push_back(Mesh(mesh, p.progId));