forked from smcameron/space-nerds-in-space
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity_private.h
111 lines (97 loc) · 2.77 KB
/
entity_private.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
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
/*
Copyright (C) 2010 Stephen M. Cameron
Author: Stephen M. Cameron
This file is part of Spacenerds In Space.
Spacenerds in Space is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Spacenerds in Space 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Spacenerds in Space; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ENTITY_PRIVATE_H__
#define ENTITY_PRIVATE_H__
struct entity {
int visible;
struct mesh *m;
float x, y, z; /* world coords */
float cx, cy, cz; /* camera coords */
unsigned char onscreen; /* if screen coords are valid */
float sx, sy; /* screen coords */
union vec3 scale;
float dist3dsqrd;
int color;
int shadecolor;
float alpha;
int render_style;
void *user_data;
union quat orientation;
struct material *material_ptr;
int e_visible;
union vec3 e_pos;
union vec3 e_scale;
union quat e_orientation;
struct entity *parent;
int entity_child_index;
};
struct entity_child {
int child_entity_index;
int next_entity_child_index;
};
struct frustum {
float near, far;
float top, bottom, left, right;
struct mat44d v_matrix;
struct mat44d vp_matrix;
struct mat44d p_matrix;
struct mat44 vp_matrix_no_translate;
float planes[6][4];
};
struct camera_info {
float x, y, z; /* position of camera */
float lx, ly, lz; /* where camera is looking */
float ux, uy, uz; /* up vector */
float near, far;
float angle_of_view;
int xvpixels, yvpixels;
int renderer;
struct frustum frustum;
};
struct entity_context {
int maxobjs;
struct snis_object_pool *entity_pool;
struct entity *entity_list; /* array, [maxobjs] */
int maxchildren;
struct snis_object_pool *entity_child_pool;
struct entity_child *entity_child_list; /* array, [maxchildren] */
int nfar_to_near_entity_depth;
int *far_to_near_entity_depth; /* array [maxobjs] */
int nnear_to_far_entity_depth;
int *near_to_far_entity_depth; /* array [maxobjs] */
struct camera_info camera;
struct entity *fake_stars;
struct mesh *fake_stars_mesh;
int nfakestars; /* = 0; */
float fakestars_radius;
struct mat41 light;
float window_offset_x, window_offset_y;
#ifdef WITH_ILDA_SUPPORT
int framenumber;
FILE *f;
#endif
};
struct entity_transform {
struct mat44d m_no_scale;
struct mat44d m;
struct mat44 mvp;
struct mat44 mv;
struct mat33 normal;
struct mat44d *vp;
struct mat44d *v;
};
#endif