22 #define MAX_POINTS 300
24 static int num_pts = 0;
29 static float scale_factor = 1.0f;
31 static int num_tris = 0;
34 static int Nebula_loaded = 0;
36 static matrix Nebula_orient;
44 if (!Nebula_loaded)
return;
49 #define NEBULA_FILE_ID NOX("NEBU")
50 #define NEBULA_MAJOR_VERSION 1 // Can be 1-?
51 #define NEBULA_MINOR_VERSION 0 // Can be 0-99
60 a =
PI * (2.0f * u - 1.0f );
62 s = scale_factor *
fl_sqrt( 1.0
f - z*z );
82 fp =
cfopen(filename,
"rb");
91 mprintf((
"Not a valid nebula file.\n" ));
94 cfread( &version,
sizeof(
int), 1, fp );
95 major = version / 100;
98 mprintf((
"An out of date nebula file.\n" ));
102 cfread( &num_pts,
sizeof(
int), 1, fp );
104 cfread( &num_tris,
sizeof(
int), 1, fp );
108 for (i=0; i<num_pts; i++ ) {
112 cfread( &xf,
sizeof(
float), 1, fp );
113 cfread( &yf,
sizeof(
float), 1, fp );
114 cfread( &l,
sizeof(
int), 1, fp );
117 nebula_verts[
i].
b =
ubyte((l*255)/31);
122 for (i=0; i<num_tris; i++ ) {
123 cfread( &tri[i][0],
sizeof(
int), 1, fp );
124 cfread( &tri[i][1],
sizeof(
int), 1, fp );
125 cfread( &tri[i][2],
sizeof(
int), 1, fp );
145 if ( Nebula_loaded ) {
175 if ( !Nebula_loaded ) {
186 for (i=0; i<num_pts; i++ ) {
195 for (i=0; i<num_tris; i++ ) {
199 verts[0] = &nebula_verts[tri[
i][0]];
200 verts[1] = &nebula_verts[tri[
i][1]];
201 verts[2] = &nebula_verts[tri[
i][2]];
216 DCF(nebula,
"Loads a different nebula")
222 dc_printf(
"Loads the nebula file (without filename extension). No filename takes away nebula\n" );
#define MISSION_FLAG_FULLNEB
void nebula_init(const char *filename, int pitch, int bank, int heading)
int cfread(void *buf, int elsize, int nelem, CFILE *fp)
matrix * vm_angles_2_matrix(matrix *m, const angles *a)
struct vec3d::@225::@227 xyz
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
void g3_done_instance(bool set_api=false)
#define NEBULA_MAJOR_VERSION
void vm_vec_scale(vec3d *dest, float s)
#define TMAP_FLAG_GOURAUD
GLboolean GLboolean GLboolean GLboolean a
int load_nebula_sub(char *filename)
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
int g3_project_vertex(vertex *point)
GLint GLint GLint GLint GLint x
char * cf_add_ext(const char *filename, const char *ext)
__inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near=-1.0f, float fog_far=-1.0f)
void project_2d_onto_sphere(vec3d *pnt, float u, float v)
ubyte g3_rotate_faraway_vertex(vertex *dest, const vec3d *src)
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
void g3_start_instance_matrix(const vec3d *pos, const matrix *orient, bool set_api=true)
DCF(nebula,"Loads a different nebula")
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
int g3_draw_poly(int nv, vertex **pointlist, uint tmap_flags)
int cfclose(CFILE *cfile)
matrix vmd_identity_matrix
bool dc_maybe_stuff_string_white(char *str, size_t len)
Tries to stuff a whitespace delimited string to out_str from the command line, stopping at the end of...