File: v3dmh.h

package info (click to toggle)
searchandrescue 0.8.2-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,656 kB
  • ctags: 6,111
  • sloc: ansic: 89,072; cpp: 7,691; sh: 90; makefile: 80
file content (124 lines) | stat: -rw-r--r-- 2,829 bytes parent folder | download | duplicates (7)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
			  V3D Model Header Items

	Data types for basic 3D model header items.

	When adding new types, make sure you update V3DMHCreate() to
	allocate the correct size of the data type structure and
	update MV3DHDestroy() to deallocate and members that may point to
	allocated resources. Externally, you may need to update 
	other functions.

 */

#ifndef V3DMH_H
#define V3DMH_H

#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


/*
 *	Model header item types:
 */
#define V3DMH_TYPE_COMMENT			1

#define V3DMH_TYPE_VERSION			10
#define V3DMH_TYPE_CREATOR			11
#define V3DMH_TYPE_AUTHOR			12

#define V3DMH_TYPE_HEIGHTFIELD_BASE_DIRECTORY	20
#define V3DMH_TYPE_TEXTURE_BASE_DIRECTORY	21
#define V3DMH_TYPE_TEXTURE_LOAD			22

#define V3DMH_TYPE_COLOR_SPECIFICATION		30


/*
 *	Model header item structures:
 */

/* Comment. */
typedef struct {
	int type;       /* Must be V3DMH_TYPE_COMMENT. */
	char **line;
	int total_lines;
} mh_comment_struct;

/* Version. */
typedef struct {
	int type;	/* Must be V3DMH_TYPE_VERSION. */
	int major, minor;
} mh_version_struct;
/* Creator. */
typedef struct {
	int type;	/* Must be V3DMH_TYPE_CREATOR. */
	char *creator;
} mh_creator_struct;
/* Author. */
typedef struct {
	int type;	/* Must be V3DMH_TYPE_AUTHOR. */
	char *author;
} mh_author_struct;


/* Heightfield base directory. */
typedef struct {
	int type;	/* Must be V3DMH_TYPE_HEIGHTFIELD_BASE_DIRECTORY. */
	char *path;
} mh_heightfield_base_directory_struct;

/* Texture base directory. */
typedef struct {
	int type;       /* Must be V3DMH_TYPE_TEXTURE_BASE_DIRECTORY. */
	char *path;
} mh_texture_base_directory_struct;

/* Texture load. */
typedef struct {
	int type;       /* Must be V3DMH_TYPE_TEXTURE_LOAD. */
	char *name, *path;
	double priority;		/* 0.0 to 1.0. */
} mh_texture_load_struct;

/* Color specification. */
typedef struct {
	int type;       /* Must be V3DMH_TYPE_COLOR_SPECIFICATION. */
	char *name;
	double a, r, g, b;
	double ambient, diffuse, specular, shininess, emission;
} mh_color_specification_struct;



extern void *V3DMHCreate(int type);
extern void V3DMHDestroy(void *p);  

#define V3DMHGetType(p)		(*(int *)p)
extern void *V3DMHListGetPtr(void **list, int total, int i);
extern void *V3DMHListInsert(
	void ***list, int *total, int i,
	int type
);
extern void V3DMHListDelete(void ***list, int *total, int i);
extern void V3DMHListDeleteAll(void ***list, int *total);

extern int V3DMHTextureBaseDirectorySet(
	void ***list, int *total, const char *path
);
extern char *V3DMHTextureBaseDirectoryGet(void **list, int total);
 
extern int V3DMHHeightfieldBaseDirectorySet(
	void ***list, int *total, const char *path
); 
extern char *V3DMHHeightfieldBaseDirectoryGet(void **list, int total);


#ifdef __cplusplus
}  
#endif /* __cplusplus */

#endif	/* V3DMH_H */