.
This commit is contained in:
parent
1c13514a4d
commit
5d1fa53405
11 changed files with 396 additions and 121 deletions
39
src/obj.h
Normal file
39
src/obj.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
#include "libs/sokol_gfx.h"
|
||||
#include "libs/handmademath.h"
|
||||
#include "libs/cgltf.h"
|
||||
#include "colla/colla.h"
|
||||
|
||||
|
||||
#define MAX_SCENE_OBJECTS 64
|
||||
|
||||
typedef struct vertex_t vertex_t;
|
||||
struct vertex_t {
|
||||
vec3 pos;
|
||||
vec3 norm;
|
||||
vec2 tex;
|
||||
vec2 lightmap;
|
||||
};
|
||||
|
||||
typedef struct obj_t obj_t;
|
||||
struct obj_t {
|
||||
char name[16];
|
||||
sg_bindings bindings;
|
||||
u16 draw_count;
|
||||
};
|
||||
|
||||
typedef struct scene_t scene_t;
|
||||
struct scene_t {
|
||||
obj_t objects[MAX_SCENE_OBJECTS];
|
||||
int object_count;
|
||||
};
|
||||
|
||||
typedef bool (*obj_material_cb)(arena_t scratch, cgltf_material *material, sg_image *out, void *userdata);
|
||||
typedef struct obj_desc_t obj_desc_t;
|
||||
struct obj_desc_t {
|
||||
obj_material_cb material_cb;
|
||||
void *userdata;
|
||||
};
|
||||
|
||||
scene_t obj_load_gltf(arena_t scratch, strview_t filename, obj_desc_t *desc);
|
||||
Loading…
Add table
Add a link
Reference in a new issue