-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjFile.h
70 lines (58 loc) · 2.18 KB
/
ObjFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* 3dObjLib: OBJ file generation
* Copyright (C) 2018 Christopher Bazley
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* History:
CJB: 05-Aug-18: Copied this source file from SF3KtoObj.
CJB: 11-Dec-20: Removed redundant uses of the 'extern' keyword.
CJB: 06-Apr-25: Dogfooding the _Optional qualifier.
CJB: 11-Apr-25: Allow null argument to get_colour and get_material.
CJB: 13-Apr-25: Rename output_primitives_get_(colour|material) types.
*/
#ifndef OBJFILE_H
#define OBJFILE_H
#include <stdio.h>
#include <stdbool.h>
#include "Primitive.h"
#include "Vertex.h"
#include "Group.h"
#if !defined(USE_OPTIONAL) && !defined(_Optional)
#define _Optional
#endif
typedef enum {
VertexStyle_Positive,
VertexStyle_Negative
} VertexStyle;
typedef enum {
MeshStyle_NoChange,
MeshStyle_TriangleFan,
MeshStyle_TriangleStrip
} MeshStyle;
bool output_vertices(
FILE *out, int vobject, const VertexArray *varray,
int rot);
typedef int OutputPrimitivesGetColourFn(const Primitive *pp, _Optional void *arg);
typedef int OutputPrimitivesGetMaterialFn(char *buf, size_t buf_size,
int colour, _Optional void *arg);
bool output_primitives(
FILE *out, const char *object_name,
int vtotal, int vobject, const VertexArray *varray,
Group const *groups, int ngroups,
_Optional OutputPrimitivesGetColourFn *get_colour,
_Optional OutputPrimitivesGetMaterialFn *get_material,
_Optional void *arg, VertexStyle vstyle, MeshStyle mstyle);
#endif /* OBJFILE_H */