From bab0824608498d1079d4e9522f3014d3d538aabe Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 27 Apr 2018 20:56:00 +0100 Subject: Implement basic model loading of FMD format. The FMD (Faqe Model Data) format is a format designed for faqe. It stores vertex, element and material information and mesh information. This patch provides the basic implementation and use of this format. This patch also implements perspective projection, depth testing and view and model matrices. An example fmd file is provided. --- model.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 model.h (limited to 'model.h') diff --git a/model.h b/model.h new file mode 100644 index 0000000..33db3b4 --- /dev/null +++ b/model.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ +#ifndef MODEL_H +#define MODEL_H + +#include "gl.h" +#include "fmd.h" + +struct mesh { + struct material { + GLuint diffuse; + } *mtl; + struct { + GLuint idx; + GLuint cnt; + } elems; +}; + +struct model { + struct mesh *meshes; + int nmeshes; + GLuint vao; +}; + +void model_load(struct model *mdl, const struct fmd *fmd); +void model_render(struct model *mdl); + +#endif // MODEL_H -- cgit v1.2.3-54-g00ecf