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