Remove replace obj with glb files, don't import materials (Not favoring that solution anymore, sensible defaults applied to keep demoes consistent)
This commit is contained in:
@@ -35,7 +35,10 @@ Texture Texture::FromFile(const char *filename) {
|
||||
Material::Material() {
|
||||
usesTex = false;
|
||||
|
||||
shininess = 8;
|
||||
ambient = Color(0.7, 0.7, 0.7);
|
||||
diffuse = Color(1.0, 1.0, 1.0);
|
||||
specular = Color(0.2, 0.2, 0.2);
|
||||
shininess = 1;
|
||||
|
||||
alphaScissor = 0.0f;
|
||||
unshaded = false;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <assimp/postprocess.h>
|
||||
|
||||
|
||||
SubMesh *aiMesh2SubMesh(aiMesh *mesh, aiMaterial *material);
|
||||
SubMesh *aiMesh2SubMesh(aiMesh *mesh);
|
||||
Color aiColor3D2Color(aiColor3D aicolor);
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ Mesh* Mesh::FromFile(const char *filename) {
|
||||
Mesh *my_mesh = new Mesh();
|
||||
for (int i = 0; i < root->mNumMeshes; i++) {
|
||||
aiMesh *mesh_to_import = scene->mMeshes[root->mMeshes[i]];
|
||||
my_mesh->submeshes.push_back(aiMesh2SubMesh(mesh_to_import, scene->mMaterials[mesh_to_import->mMaterialIndex]));
|
||||
my_mesh->submeshes.push_back(aiMesh2SubMesh(mesh_to_import));
|
||||
}
|
||||
|
||||
my_mesh->SetupMesh();
|
||||
@@ -173,7 +173,7 @@ void Mesh::SetupMesh() {
|
||||
}
|
||||
|
||||
|
||||
SubMesh *aiMesh2SubMesh(aiMesh *aimesh, aiMaterial* material){
|
||||
SubMesh *aiMesh2SubMesh(aiMesh *aimesh){
|
||||
SubMesh *sub = new SubMesh();
|
||||
for (int i = 0; i < aimesh->mNumVertices; i++) {
|
||||
aiVector3D aiPosition = aimesh->mVertices[i];
|
||||
@@ -190,24 +190,7 @@ SubMesh *aiMesh2SubMesh(aiMesh *aimesh, aiMaterial* material){
|
||||
Index index(face[0], face[1], face[2]);
|
||||
sub->indices.push_back(index);
|
||||
}
|
||||
|
||||
// Get material properties
|
||||
aiColor3D ambient;
|
||||
if (AI_SUCCESS == material->Get(AI_MATKEY_COLOR_AMBIENT, ambient))
|
||||
sub->material.ambient = aiColor3D2Color(ambient);
|
||||
|
||||
aiColor3D diffuse;
|
||||
if (AI_SUCCESS == material->Get(AI_MATKEY_COLOR_DIFFUSE, diffuse))
|
||||
sub->material.diffuse = aiColor3D2Color(diffuse);
|
||||
|
||||
aiColor3D specular;
|
||||
if (AI_SUCCESS == material->Get(AI_MATKEY_COLOR_SPECULAR, specular))
|
||||
sub->material.specular = aiColor3D2Color(specular);
|
||||
|
||||
float shininess;
|
||||
if(AI_SUCCESS == material->Get(AI_MATKEY_SHININESS, shininess))
|
||||
sub->material.shininess = (int) shininess;
|
||||
|
||||
|
||||
return sub;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user