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