Skip to content

Commit

Permalink
Logs in import
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgegh2 committed Oct 27, 2019
1 parent 43dfa88 commit b66494b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions Weep Engine/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

GameObject::GameObject()
{
LOG("New Game Object created!");
AddComponent(ComponentType::TRANSFORM);
}

Expand Down
17 changes: 12 additions & 5 deletions Weep Engine/ModuleImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool ModuleImporter::LoadFBX(const char* path)
}
else
{
LOG("Error loading scene %s", path);
LOG("Error loading scene %s.", path);
ret = false;
}

Expand Down Expand Up @@ -130,7 +130,7 @@ void ModuleImporter::LoadAllMeshes(const aiScene * scene)
}
else
{
LOG("The component Mesh was not created correctly, it is possible that such a component already exists in this game objects. Only is posible to have 1 component mesh by Game Object");
LOG("The component Mesh was not created correctly, it is possible that such a component already exists in this game objects. Only is posible to have 1 component mesh by Game Object.");
}

}
Expand All @@ -149,7 +149,7 @@ void ModuleImporter::LoadVertices(ComponentMesh * model, aiMesh * mesh)

memcpy(model->mesh_data->vertexs.buffer, mesh->mVertices, sizeof(float) * model->mesh_data->vertexs.buffer_size); // copy the vertices of the mesh to the arrey of vertices

LOG("New mesh with %d vertices", model->mesh_data->vertexs.num);
LOG("New mesh with %i vertices.", model->mesh_data->vertexs.num);
}

// ----------------------------Indexs----------------------------
Expand All @@ -168,7 +168,7 @@ void ModuleImporter::LoadIndexs(ComponentMesh * model, aiMesh * mesh)
{
if (mesh->mFaces[i].mNumIndices != 3) // if the face is not a triangle don't load it.
{
LOG("This face don't have 3 index, only can load faces with 3 indexs");
LOG("This face don't have 3 index, only can load faces with 3 indexs.");
memset(&model->mesh_data->indexs.buffer[i * 3], 0, sizeof(uint) * 3);
}
else
Expand All @@ -180,6 +180,8 @@ void ModuleImporter::LoadIndexs(ComponentMesh * model, aiMesh * mesh)
memcpy(&model->mesh_data->indexs.buffer[i * 3], mesh->mFaces[i].mIndices, 3 * sizeof(uint)); // Copy the Indices of the mesh to the array of indices.
}
}

LOG("New mesh with %i faces and %i indexs.", model->num_faces, model->mesh_data->indexs.num);
}

// ----------------------------Normals----------------------------
Expand All @@ -199,6 +201,8 @@ void ModuleImporter::LoadNormals(ComponentMesh * model, aiMesh * mesh)
model->mesh_data->normals_direction.buffer = new float[model->mesh_data->normals_direction.buffer_size];
memcpy(model->mesh_data->normals_direction.buffer, mesh->mNormals, sizeof(float) * model->mesh_data->normals_direction.buffer_size); //It could be QNaN?

LOG("Normals loaded correcly.");

model->CalculateNormals();
}

Expand Down Expand Up @@ -229,22 +233,25 @@ void ModuleImporter::LoadUVs(ComponentMesh * model, aiMesh * mesh)
}
else // if the channel don't have 2 components by vector, don't save it and fill it with 0.
{
LOG("This channel of the UVs don't have 2 components by vector.");
memset(&model->mesh_data->uvs.buffer[channel * model->channel_buffer_size], 0, sizeof(float) * model->channel_buffer_size);
}
}
}
LOG("UVs loaded correcly.")
}

//----------------------------Materials----------------------------

void ModuleImporter::LoadMaterials(const aiScene * scene, aiMesh * mesh, ComponentTexture * model)
{
model->has_texture = true;

aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];
uint numTextures = material->GetTextureCount(aiTextureType_DIFFUSE); //only load DIFFUSE textures.

if (numTextures > 0)
{
model->has_texture = true;
aiString path;
material->GetTexture(aiTextureType_DIFFUSE, 0, &path);

Expand Down
9 changes: 6 additions & 3 deletions Weep Engine/ModuleTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ uint ModuleTexture::LoadTexture(const char* path, int& width, int& height)
{
if (path == (*iter)->path)
{
LOG("The texture had already been loaded. returning saved texture...");
LOG("The texture had already been loaded. returning saved texture...The texture was %s", path);
width = (*iter)->width;
height = (*iter)->height;
return (*iter)->id;
Expand All @@ -95,14 +95,17 @@ uint ModuleTexture::LoadTexture(const char* path, int& width, int& height)

if (ilLoadImage(path))
{
LOG("Image Loaded correctly");
LOG("Image Loaded correctly. The texture was %s", path);

ret = ilutGLBindTexImage();
if (ret > 0)
{

width = ilGetInteger(IL_IMAGE_WIDTH);
height = ilGetInteger(IL_IMAGE_HEIGHT);

LOG("Size texture: %i x %i", width, height);

TextureInfo* new_texture = new TextureInfo();
new_texture->width = width;
new_texture->height = height;
Expand All @@ -119,7 +122,7 @@ uint ModuleTexture::LoadTexture(const char* path, int& width, int& height)
}
else
{
LOG("Image Don't loaded correctly");
LOG("Image Don't loaded correctly. the path %s is not found", path);
}

return ret;
Expand Down

0 comments on commit b66494b

Please sign in to comment.