Fixed cdf and added Standard Lit
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#include "Geometry/Mesh.h"
|
||||
#include "Common/String.h"
|
||||
#include "Material/SimpleLit.h"
|
||||
#include "Material/StandardLit.h"
|
||||
#include "assimp/cimport.h"
|
||||
#include "assimp/scene.h"
|
||||
#include "assimp/postprocess.h"
|
||||
|
||||
static texture_entity_t load_material_texture(const struct aiMaterial* material, enum aiTextureType type, const char* filename, scene_t* scene)
|
||||
static texture_handle_t load_material_texture(const struct aiMaterial* material, enum aiTextureType type, const char* filename, scene_t* scene)
|
||||
{
|
||||
struct aiString path;
|
||||
if (AI_SUCCESS == aiGetMaterialTexture(material, type, 0, &path, NULL, NULL, NULL, NULL, NULL, NULL))
|
||||
@@ -21,12 +21,12 @@ static texture_entity_t load_material_texture(const struct aiMaterial* material,
|
||||
|
||||
return texture_load(path.data, true, true, UINT_8, &scene->textures);
|
||||
}
|
||||
return invalid_texture_entity();
|
||||
return invalid_texture_handle();
|
||||
}
|
||||
|
||||
mesh_entity_t mesh_load(const char* filename, scene_t* scene)
|
||||
mesh_handle_t mesh_load(const char* filename, scene_t* scene)
|
||||
{
|
||||
mesh_entity_t entity = {0};
|
||||
mesh_handle_t entity = {0};
|
||||
|
||||
const struct aiScene* mesh_scene = aiImportFile(filename, aiProcessPreset_TargetRealtime_Quality);
|
||||
if (mesh_scene == NULL)
|
||||
@@ -51,12 +51,12 @@ mesh_entity_t mesh_load(const char* filename, scene_t* scene)
|
||||
float metallic = 0.0f;
|
||||
aiGetMaterialFloat(src, AI_MATKEY_METALLIC_FACTOR, &metallic);
|
||||
|
||||
texture_entity_t albedo_entity = load_material_texture(src, aiTextureType_DIFFUSE, filename, scene);
|
||||
texture_entity_t normal_entity = load_material_texture(src, aiTextureType_NORMALS, filename, scene);
|
||||
texture_entity_t roughness_entity = load_material_texture(src, aiTextureType_DIFFUSE_ROUGHNESS, filename, scene);
|
||||
texture_entity_t metallic_entity = load_material_texture(src, aiTextureType_METALNESS, filename, scene);
|
||||
texture_handle_t albedo_entity = load_material_texture(src, aiTextureType_DIFFUSE, filename, scene);
|
||||
texture_handle_t normal_entity = load_material_texture(src, aiTextureType_NORMALS, filename, scene);
|
||||
texture_handle_t roughness_entity = load_material_texture(src, aiTextureType_DIFFUSE_ROUGHNESS, filename, scene);
|
||||
texture_handle_t metallic_entity = load_material_texture(src, aiTextureType_METALNESS, filename, scene);
|
||||
|
||||
simple_lit_properties_t prop =
|
||||
standard_lit_properties_t prop =
|
||||
{
|
||||
.albedo = {base_color.r, base_color.g, base_color.b},
|
||||
.roughness = roughness,
|
||||
@@ -68,7 +68,7 @@ mesh_entity_t mesh_load(const char* filename, scene_t* scene)
|
||||
.metallic_texture = metallic_entity,
|
||||
};
|
||||
|
||||
material_create_simple_lit_default(&prop, &scene->materials);
|
||||
material_create_standard_lit_default(&prop, &scene->materials);
|
||||
entity.material_count++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user