#include <gmath/gmath.h>
+#include "gfxapi.h"
+
#include "mesh.h"
#include "object.h"
#include "scene.h"
#include "texture.h"
-#include "opengl/mesh-gl.h"
-#include "vulkan/mesh-vk.h"
-
-#include "opengl/texture-gl.h"
-#include "vulkan/texture-vk.h"
-
-extern bool use_vulkan;
static Mesh *load_mesh(const aiScene *scene, unsigned int index);
static Material *load_material(const aiScene *ascene, Scene *scene, unsigned int index, const char *tex_fname);
return 0;
}
- Mesh *mesh;
- if(use_vulkan) {
- mesh = new MeshVK;
- }
- else {
- mesh = new MeshGL;
- }
-
+ Mesh *mesh = gfx_create_mesh();
mesh->name = std::string(amesh->mName.data);
for(unsigned int i=0; i<amesh->mNumVertices; i++) {
else
fprintf(stderr, "No faces found.\n");
- mesh->mat_idx = amesh->mMaterialIndex;
return mesh;
}
mat->dtex = scene->find_texture(tex_fname.c_str());
if(!mat->dtex) {
- printf("!mat->dtex\n");
- if(use_vulkan) {
- mat->dtex = new TextureVK;
- }
- else {
- mat->dtex = new TextureGL;
- }
+ mat->dtex = gfx_create_texture();
+
if(!mat->dtex->load(tex_fname.c_str())) {
fprintf(stderr, "Failed to load texture data: %s.\n", tex_fname.c_str());
delete mat->dtex;
return textures[i];
}
}
- fprintf(stderr, "Texture %s not found.\n", name);
return 0;
}
\ No newline at end of file