diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2018-04-27 20:56:00 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2018-04-27 20:56:00 +0100 |
commit | bab0824608498d1079d4e9522f3014d3d538aabe (patch) | |
tree | 932f082b58fd48f85fbbdfa3f7419d2b3b03eedb /fmd.h | |
parent | 3d73622dbd5a9ddc687fe6f42268c760695d7226 (diff) | |
download | faqe-bab0824608498d1079d4e9522f3014d3d538aabe.tar.gz faqe-bab0824608498d1079d4e9522f3014d3d538aabe.tar.xz faqe-bab0824608498d1079d4e9522f3014d3d538aabe.zip |
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.
Diffstat (limited to 'fmd.h')
-rw-r--r-- | fmd.h | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com> + * SPDX-License-Identifier: MIT + */ +#ifndef FMD_H +#define FMD_H + +#include <stdio.h> + +#include "gl.h" +#include "vertex.h" + +typedef GLuint tri[3]; +struct fmd { + int nverts; + struct vertex *verts; + int ntris; + tri *tris; + int nmtls; + char **mtls; + int nmeshes; + struct fmd_mesh { + int midx; + int tidx; + int tcnt; + } *meshes; +}; + +void fmd_load(struct fmd *fmd, FILE *f); +void fmd_free(struct fmd *fmd); + +#endif // FMD_H |