]> icculus.org git repositories - taylor/freespace2.git/blob - include/neb.h
Initial revision
[taylor/freespace2.git] / include / neb.h
1 /*
2  * $Logfile: /Freespace2/code/Nebula/Neb.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Nebula effect
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  * 
13  * 
14  * 16    8/30/99 5:01p Dave
15  * Made d3d do less state changing in the nebula. Use new chat server for
16  * PXO.
17  * 
18  * 15    7/29/99 12:05a Dave
19  * Nebula speed optimizations.
20  * 
21  * 14    7/26/99 10:12a Dave
22  * Upped the max # of nebula backgrounds.
23  * 
24  * 13    5/24/99 5:45p Dave
25  * Added detail levels to the nebula, with a decent speedup. Split nebula
26  * lightning into its own section.
27  * 
28  * $NoKeywords: $
29  */
30
31 #ifndef _FS2_NEB2_EFFECT_HEADER_FILE
32 #define _FS2_NEB2_EFFECT_HEADER_FILE
33
34 // --------------------------------------------------------------------------------------------------------
35 // NEBULA DEFINES/VARS
36 //
37
38 struct ship;
39 struct object;
40 struct vector;
41
42 // fog near and far values for rendering the background nebula
43 extern float Neb_backg_fog_near;
44 extern float Neb_backg_fog_far;
45
46 // nebula rendering mode
47 #define NEB2_RENDER_NONE                                                                0                       // no rendering
48 #define NEB2_RENDER_POLY                                                                1                       // background is the old-school polygons
49 #define NEB2_RENDER_POF                                                                 2                       // background is the nice pof file
50 #define NEB2_RENDER_LAME                                                                3                       // super simple nebula effect 
51 extern int Neb2_render_mode;
52
53 // the AWACS suppresion level for the nebula
54 extern float Neb2_awacs;
55
56 #define MAX_NEB2_POOFS                          6
57
58 // poof names and flags (for fred)
59 extern char Neb2_poof_filenames[MAX_NEB2_POOFS][MAX_FILENAME_LEN];      
60 extern int Neb2_poof_flags;
61
62 #define MAX_NEB2_BITMAPS                        10
63
64 // pof texture filenames
65 extern char Neb2_bitmap_filenames[MAX_NEB2_BITMAPS][MAX_FILENAME_LEN];
66
67 // texture to use for this level
68 extern char Neb2_texture_name[MAX_FILENAME_LEN];
69
70 // how many "slices" are in the current player nebuls
71 extern int Neb2_slices;
72
73 // nebula poofs
74 typedef struct cube_poof {
75         vector  pt;                             // point in space
76         int             bmap;                           // bitmap in space
77         float           rot;                            // rotation angle
78         float           rot_speed;              // rotation speed
79         float           flash;                  // lightning flash
80 } cube_poof;
81 #define MAX_CPTS                5               // should always be <= slices
82 extern cube_poof Neb2_cubes[MAX_CPTS][MAX_CPTS][MAX_CPTS];
83
84
85 // --------------------------------------------------------------------------------------------------------
86 // NEBULA FUNCTIONS
87 //
88
89 // neb2 stuff (specific nebula densities) -----------------------------------
90
91 // initialize neb2 stuff at game startup
92 void neb2_init();
93
94 // set detail level
95 void neb2_set_detail_level(int level);
96
97 // initialize nebula stuff - call from game_post_level_init(), so the mission has been loaded
98 void neb2_level_init();
99
100 // shutdown nebula stuff
101 void neb2_level_close();
102
103 // create a nebula object, return objnum of the nebula or -1 on fail
104 // NOTE : in most cases you will want to pass -1.0f for outer_radius. Trust me on this
105 int neb2_create(vector *offset, int num_poofs, float inner_radius, float outer_radius, float max_poof_radius);
106
107 // delete a nebula object
108 void neb2_delete(object *objp);
109
110 // call before beginning all rendering
111 void neb2_render_setup(vector *eye_pos, matrix *eye_orient);
112
113 // renders a nebula object
114 void neb2_render(object *objp);
115
116 // preprocess the nebula object before simulation
117 void neb2_process_pre(object *objp);
118
119 // process the nebula object after simulating, but before rendering
120 void neb2_process_post(object *objp);
121
122 // render the player nebula
123 void neb2_render_player();
124
125 // call this when the player's viewpoint has changed, this will cause the code to properly reset
126 // the eye's local poofs
127 void neb2_eye_changed();
128
129 // get near and far fog values based upon object type and rendering mode
130 void neb2_get_fog_values(float *fnear, float *ffar, object *obj);
131
132 // given a position in space, return a value from 0.0 to 1.0 representing the fog level 
133 float neb2_get_fog_intensity(object *obj);
134
135 // should we not render this object because its obscured by the nebula?
136 int neb2_skip_render(object *objp, float z_depth);
137
138 // extend LOD 
139 float neb2_get_lod_scale(int objnum);
140
141 // fogging stuff --------------------------------------------------
142
143 // get the color of the pixel in the small pre-rendered background nebula
144 void neb2_get_pixel(int x, int y, int *r, int *g, int *b);
145
146 // set the background color
147 void neb2_set_backg_color(int r, int g, int b);
148
149 // get the color to fog the background color to
150 void neb2_get_backg_color(int *r, int *g, int *b);
151
152 #endif
153