X-Git-Url: https://eleni.mutantstargoat.com/git/?p=demo;a=blobdiff_plain;f=src%2Fscene.cc;h=d033a8f70a820e229b1e4baddf16210daf728c13;hp=99c3b010903239db1897f48d82b45808548a64aa;hb=3bf3536271e4afa8a8a93c75e2ab1256c0bf718a;hpb=df336012c33f2993bdb80177a1f874ef81e7505f diff --git a/src/scene.cc b/src/scene.cc index 99c3b01..d033a8f 100644 --- a/src/scene.cc +++ b/src/scene.cc @@ -10,18 +10,13 @@ #include +#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); @@ -149,14 +144,7 @@ static Mesh *load_mesh(const aiScene *scene, unsigned int index) 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; imNumVertices; i++) { @@ -260,12 +248,9 @@ static Material *load_material(const aiScene *ascene, Scene *scene, unsigned int 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;