101 void process_defpoints(
int off,
ubyte* bsp_data);
102 void process_sortnorm(
int offset,
ubyte* bsp_data);
103 void process_tmap(
int offset,
ubyte* bsp_data);
104 void process_flat(
int offset,
ubyte* bsp_data);
119 static int Num_interp_verts_allocated = 0;
121 static vertex *Interp_points = NULL;
122 static vertex *Interp_splode_points = NULL;
124 static int Interp_num_verts = 0;
126 static vertex **Interp_list = NULL;
127 static int Num_interp_list_verts_allocated = 0;
129 static float Interp_box_scale = 1.0f;
144 static int Num_interp_norms_allocated = 0;
145 static vec3d **Interp_norms = NULL;
146 static ubyte *Interp_light_applied = NULL;
147 static int Interp_num_norms = 0;
148 static ubyte *Interp_lights;
150 static float Interp_fog_level = 0.0f;
153 static color Interp_outline_color;
154 static int Interp_detail_level_locked = -1;
155 static uint Interp_flags = 0;
156 static uint Interp_tmap_flags = 0;
162 static float Interp_thrust_scale_x = 0.0f;
163 static float Interp_thrust_scale_y = 0.0f;
165 static int Interp_thrust_bitmap = -1;
166 static int Interp_thrust_glow_bitmap = -1;
167 static float Interp_thrust_glow_noise = 1.0f;
168 static bool Interp_afterburner =
false;
171 static int Interp_secondary_thrust_glow_bitmap = -1;
172 static int Interp_tertiary_thrust_glow_bitmap = -1;
173 static int Interp_distortion_thrust_bitmap = -1;
174 static float Interp_thrust_glow_rad_factor = 1.0f;
175 static float Interp_secondary_thrust_glow_rad_factor = 1.0f;
176 static float Interp_tertiary_thrust_glow_rad_factor = 1.0f;
177 static float Interp_distortion_thrust_rad_factor = 1.0f;
178 static float Interp_distortion_thrust_length_factor = 1.0f;
179 static float Interp_thrust_glow_len_factor = 1.0f;
181 static bool Interp_draw_distortion =
true;
184 static float Interp_warp_scale_x = 1.0f;
185 static float Interp_warp_scale_y = 1.0f;
186 static float Interp_warp_scale_z = 1.0f;
187 static int Interp_warp_bitmap = -1;
188 static float Interp_warp_alpha = -1.0f;
190 static int Interp_objnum = -1;
193 static int Interp_insignia_bitmap = -1;
197 static int *Interp_new_replacement_textures = NULL;
199 static fix Interp_base_frametime = 0;
202 static int Interp_forced_bitmap = -1;
205 static float Interp_xparent_alpha = 1.0f;
215 static int FULLCLOAK = -1;
245 if (Interp_verts != NULL)
248 if (Interp_points != NULL)
251 if (Interp_splode_points != NULL)
254 if (Interp_splode_verts != NULL)
257 if (Interp_norms != NULL)
260 if (Interp_light_applied != NULL)
263 if (Interp_lighting_temp.
lights != NULL)
266 Num_interp_verts_allocated = 0;
267 Num_interp_norms_allocated = 0;
275 static ubyte dealloc = 0;
283 Assert( (n_verts >= 0) && (n_norms >= 0) && (n_list_verts >= 0) );
284 Assert( (n_verts || Num_interp_verts_allocated) && (n_norms || Num_interp_norms_allocated) );
286 if (n_verts > Num_interp_verts_allocated) {
287 if (Interp_verts != NULL) {
298 Num_interp_verts_allocated = n_verts;
304 if (n_norms > Num_interp_norms_allocated) {
305 if (Interp_norms != NULL) {
313 if (Interp_light_applied != NULL) {
315 Interp_light_applied = NULL;
318 if (Interp_lighting_temp.
lights != NULL) {
320 Interp_lighting_temp.
lights = NULL;
326 memset( Interp_light_applied, 0, n_norms *
sizeof(
ubyte) );
329 Num_interp_norms_allocated = n_norms;
333 if ( n_list_verts > Num_interp_list_verts_allocated ) {
334 if (Interp_list != NULL) {
340 Verify( Interp_list != NULL );
342 Num_interp_list_verts_allocated = n_list_verts;
346 Interp_num_verts = n_verts;
347 Interp_num_norms = n_norms;
350 Verify( Interp_points != NULL );
351 Verify( Interp_splode_points != NULL );
352 Verify( Interp_verts != NULL );
353 Verify( Interp_splode_verts != NULL );
354 Verify( Interp_norms != NULL );
355 Verify( Interp_light_applied != NULL );
360 FULLCLOAK=full_cloak;
397 Interp_thrust_scale_x = 0.0f;
398 Interp_thrust_scale_y = 0.0f;
399 Interp_thrust_bitmap = -1;
400 Interp_thrust_glow_bitmap = -1;
401 Interp_thrust_glow_noise = 1.0f;
402 Interp_insignia_bitmap = -1;
403 Interp_afterburner =
false;
407 Interp_thrust_glow_rad_factor = 1.0f;
409 Interp_secondary_thrust_glow_bitmap = -1;
410 Interp_secondary_thrust_glow_rad_factor = 1.0f;
412 Interp_tertiary_thrust_glow_bitmap = -1;
413 Interp_tertiary_thrust_glow_rad_factor = 1.0f;
415 Interp_thrust_glow_len_factor = 1.0f;
420 Interp_box_scale = 1.0f;
429 Interp_detail_level_locked = -1;
431 Interp_forced_bitmap = -1;
445 Interp_thrust_scale_x = mst->
length.
xyz.x;
446 Interp_thrust_scale_y = mst->
length.
xyz.y;
457 Interp_afterburner = mst->
use_ab;
459 Interp_thrust_rotvel = mst->
rotvel;
487 if(dist==0.0
f)
return;
489 if(dist<0.0
f)dist*=-1.0f;
496 ubyte * normcount = p+20;
497 vertex *dest = Interp_splode_points;
500 for (n = 0; n < nverts; n++) {
501 nnorms += normcount[
n];
508 for (n=0; n<nverts; n++ ) {
509 Interp_splode_verts[
n] = *
src;
516 for(
int i=0;
i<normcount[
n];
i++)src++;
546 ubyte * normcount = p+20;
551 Interp_lights = p+20+nverts;
553 for (i = 0; i < nverts; i++) {
554 nnorms += normcount[
i];
560 dest = Interp_points;
574 float min_thruster_dist = -1.5f;
577 min_thruster_dist = 0.5f;
580 for (n=0; n<nverts; n++ ) {
583 Interp_verts[
n] =
src;
588 if ( src->
xyz.z < min_thruster_dist ) {
589 tmp.
xyz.x = src->
xyz.x * 1.0f;
590 tmp.
xyz.y = src->
xyz.y * 1.0f;
600 for (i=0; i<normcount[
n]; i++ ) {
601 Interp_light_applied[next_norm] = 0;
602 Interp_norms[next_norm] =
src;
609 }
else if ( (Interp_warp_scale_x != 1.0
f) || (Interp_warp_scale_y != 1.0
f) || (Interp_warp_scale_z != 1.0
f)) {
610 for (n=0; n<nverts; n++ ) {
613 Interp_verts[
n] =
src;
615 tmp.
xyz.x = (src->
xyz.x) * Interp_warp_scale_x;
616 tmp.
xyz.y = (src->
xyz.y) * Interp_warp_scale_y;
617 tmp.
xyz.z = (src->
xyz.z) * Interp_warp_scale_z;
623 for (i=0; i<normcount[
n]; i++ ) {
624 Interp_light_applied[next_norm] = 0;
625 Interp_norms[next_norm] =
src;
635 for (n=0; n<nverts; n++ ) {
641 Interp_verts[
n] =
src;
648 Interp_verts[
n] =
src;
653 Interp_verts[
n] =
src;
660 for (i=0; i<normcount[
n]; i++ ) {
661 Interp_light_applied[next_norm] = 0;
662 Interp_norms[next_norm] =
src;
671 Interp_num_norms = next_norm;
706 short * verts = (
short *)(p+44);
712 for (i = 0; i < nv; i++) {
713 max_n_verts =
MAX(verts[i*2+0] + 1, max_n_verts);
714 max_n_norms =
MAX(verts[i*2+1] + 1, max_n_norms);
719 for (i = 0; i < nv; i++) {
720 Interp_list[
i] = &Interp_points[verts[i*2]];
723 Interp_list[
i]->
r = 191;
724 Interp_list[
i]->
g = 191;
725 Interp_list[
i]->
b = 191;
727 int vertnum = verts[i*2+0];
728 int norm = verts[i*2+1];
736 Interp_light_applied[norm] = 1;
739 Interp_list[
i]->
r = Interp_lighting->
lights[norm].
r;
740 Interp_list[
i]->
g = Interp_lighting->
lights[norm].
g;
741 Interp_list[
i]->
b = Interp_lighting->
lights[norm].
b;
762 for (i = 0; i < nv; i++) {
782 *param_r = *param_g = *param_b =
ubyte(
fl2i((1.0
f - d) * 254.0
f * alpha));
784 *param_r = *param_g = *param_b =
ubyte(
fl2i(d * 254.0
f * alpha) );
813 int tmap_num =
w(p+40);
819 int is_invisible = 0;
821 if (Interp_warp_bitmap < 0) {
848 for (i = 0; i < nv; i++) {
849 max_n_verts =
MAX(verts[i].vertnum + 1, max_n_verts);
850 max_n_norms =
MAX(verts[i].normnum + 1, max_n_norms);
856 if (Interp_warp_bitmap < 0) {
865 Interp_list[
i] = &Interp_splode_points[verts[
i].
vertnum];
868 Interp_list[
i]->
r = (
unsigned char)(255*salpha);
869 Interp_list[
i]->
g = (
unsigned char)(250*salpha);
870 Interp_list[
i]->
b = (
unsigned char)(200*salpha);
871 model_interp_edge_alpha(&Interp_list[i]->
r, &Interp_list[i]->
g, &Interp_list[i]->
b, Interp_verts[verts[i].vertnum], Interp_norms[verts[i].normnum], salpha,
false);
882 Interp_list[
i] = &Interp_points[verts[
i].
vertnum];
895 Interp_list[
i]->
r = 191;
896 Interp_list[
i]->
g = 191;
897 Interp_list[
i]->
b = 191;
904 model_interp_edge_alpha(&Interp_list[i]->
r, &Interp_list[i]->
g, &Interp_list[i]->
b, Interp_verts[verts[i].vertnum], Interp_norms[verts[i].normnum], Interp_warp_alpha,
false);
908 model_interp_edge_alpha(&Interp_list[i]->
r, &Interp_list[i]->
g, &Interp_list[i]->
b, Interp_verts[verts[i].vertnum], Interp_norms[verts[i].normnum], Interp_warp_alpha,
true);
917 int vertnum = verts[
i].vertnum;
918 int norm = verts[
i].normnum;
932 Interp_light_applied[norm] = 1;
939 Interp_list[
i]->
r = Interp_lighting->
lights[norm].
r;
940 Interp_list[
i]->
g = Interp_lighting->
lights[norm].
g;
941 Interp_list[
i]->
b = Interp_lighting->
lights[norm].
b;
952 if ( is_invisible ) {
963 uint tflags = Interp_tmap_flags;
967 }
else if (Interp_warp_bitmap >= 0) {
982 if(Interp_forced_bitmap >= 0){
983 texture = Interp_forced_bitmap;
984 }
else if((Interp_new_replacement_textures != NULL) && (Interp_new_replacement_textures[rt_begin_index +
TM_BASE_TYPE] >= 0)){
1014 if(Interp_new_replacement_textures != NULL)
1019 int tex = Interp_new_replacement_textures[rt_begin_index + tmn];
1090 for (i=0; i<nv; i++ ) {
1091 int j = (i + 1) % nv;
1115 int frontlist =
w(p+36);
1116 int backlist =
w(p+40);
1117 int prelist =
w(p+44);
1118 int postlist =
w(p+48);
1119 int onlist =
w(p+52);
1163 int frontlist =
w(p+36);
1164 int backlist =
w(p+40);
1165 int prelist =
w(p+44);
1166 int postlist =
w(p+48);
1167 int onlist =
w(p+52);
1205 if ( submodel && (submodel->
parent==-1) ) {
1221 for (i=0; i<8; i++ ) {
1243 for (j=0; j<8; j++ ) {
1245 vec3d bounding_box[8];
1248 for (i=0; i<8; i++ ) {
1289 for (i=0; i<pm->
n_paths; i++ ) {
1342 for (i=0; i<pm->
n_paths; i++ ) {
1391 for(idx=0; idx<pm->
n_docks; idx++){
1406 for (idx = 0; idx<pm->
n_paths; idx++) {
1436 for(idx=0; idx<pm->
n_docks; idx++){
1455 for (idx = 0; idx<pm->
n_paths; idx++) {
1480 const float scaler = 0.30f;
1482 if ( (d < scaler) || (depth > 4) ) {
1492 tmp.
xyz.x += (
frand() - 0.5f) * d * scaler;
1493 tmp.
xyz.y += (
frand() - 0.5f) * d * scaler;
1494 tmp.
xyz.z += (
frand() - 0.5f) * d * scaler;
1546 color primary, secondary;
1548 Assert( sm->num_arcs > 0 );
1559 if (pm->rad < 500.0f) {
1560 width *= (pm->rad * 0.01f);
1566 for (i=0; i<sm->num_arcs; i++ ) {
1568 switch(sm->arc_type[i]){
1571 if ( (rand()>>4) & 1 ) {
1582 if ( (rand()>>4) & 1 ) {
1596 interp_render_arc( &sm->arc_pts[i][0], &sm->arc_pts[i][1], &primary, &secondary, width );
1605 if ( (mn < 0) || (mn>=pm->
n_models) )
1609 Assert( mn < pm->n_models );
1671 #define IBOX_ALL_OFF 0
1672 #define IBOX_ALL_ON 1
1673 #define IBOX_SOME_ON_SOME_OFF 2
1692 ubyte and_codes = 0xff;
1693 ubyte or_codes = 0xff;
1696 for (i=0; i<8; i++ ) {
1728 int chunk_type, chunk_size;
1732 chunk_size =
w(p+4);
1735 while ( chunk_type !=
OP_EOF ) {
1737 switch (chunk_type) {
1745 if ( do_box_check ) {
1782 mprintf((
"Bad chunk type %d, len=%d in model_interp_sub\n", chunk_type, chunk_size ));
1788 chunk_size =
w(p+4);
1825 for (j=0; j<3; j++ ) {
1844 if ( (pm->
num_ins <= 0) || (bitmap_num < 0) )
1849 vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };
1858 for(idx=0; idx<pm->
num_ins; idx++){
1935 width = height = rad;
1937 v[0].world.xyz.x = (-width*ca - height*sa)*
Matrix_scale.
xyz.x + pnt->world.xyz.x;
1938 v[0].world.xyz.y = (-width*sa + height*ca)*
Matrix_scale.
xyz.y + pnt->world.xyz.y;
1939 v[0].world.xyz.z = pnt->world.xyz.z;
1940 v[0].screen.xyw.w = 0.0f;
1941 v[0].texture_position.u = 0.0f;
1942 v[0].texture_position.v = 0.0f;
1944 v[1].world.xyz.x = (width*ca - height*sa)*
Matrix_scale.
xyz.x + pnt->world.xyz.x;
1945 v[1].world.xyz.y = (width*sa + height*ca)*
Matrix_scale.
xyz.y + pnt->world.xyz.y;
1946 v[1].world.xyz.z = pnt->world.xyz.z;
1947 v[1].screen.xyw.w = 0.0f;
1948 v[1].texture_position.u = 1.0f;
1949 v[1].texture_position.v = 0.0f;
1951 v[2].world.xyz.x = (width*ca + height*sa)*
Matrix_scale.
xyz.x + pnt->world.xyz.x;
1952 v[2].world.xyz.y = (width*sa - height*ca)*
Matrix_scale.
xyz.y + pnt->world.xyz.y;
1953 v[2].world.xyz.z = pnt->world.xyz.z;
1954 v[2].screen.xyw.w = 0.0f;
1955 v[2].texture_position.u = 1.0f;
1956 v[2].texture_position.v = 1.0f;
1958 v[3].world.xyz.x = (-width*ca + height*sa)*
Matrix_scale.
xyz.x + pnt->world.xyz.x;
1959 v[3].world.xyz.y = (-width*sa - height*ca)*
Matrix_scale.
xyz.y + pnt->world.xyz.y;
1960 v[3].world.xyz.z = pnt->world.xyz.z;
1961 v[3].screen.xyw.w = 0.0f;
1962 v[3].texture_position.u = 0.0f;
1963 v[3].texture_position.v = 1.0f;
1965 ubyte codes_and=0xff;
1968 z = pnt->world.xyz.z - rad / 4.0f;
1969 if ( z < 0.0
f ) z = 0.0f;
1972 for (i=0; i<4; i++ ) {
1977 v[
i].screen.xyw.w = sw;
1988 DCF(model_darkening,
"Makes models darker with distance")
1991 dc_printf(
"Usage: model_darkening <float>\n" );
1992 dc_printf(
"Sets the distance at which to start blacking out models (namely asteroids).\n");
2020 bool override_all =
false;
2033 override_all =
true;
2041 if(!override_all && sip) {
2074 Interp_base_frametime = 0;
2082 }
else if (is_skybox) {
2090 Interp_objnum = objnum;
2117 if ( !(flags & MR_NO_LIGHTING ) && !Deferred_lighting ) {
2123 if ( !(flags & MR_NO_LIGHTING ) && !Deferred_lighting ) {
2128 if(flags & MR_NO_CULL){
2137 if (flags & MR_FORCE_CLAMP)
2148 #if MAX_DETAIL_LEVEL != 4
2149 #error MAX_DETAIL_LEVEL is assumed to be 4 in ModelInterp.cpp
2159 float *origin = (
float *)&p0->
xyz.x;
2160 float *minB = (
float *)min;
2161 float *maxB = (
float *)max;
2162 float *
coord = (
float *)&hitpt->
xyz.x;
2167 if ( origin[
i] < minB[
i] ) {
2170 }
else if (origin[i] > maxB[i] ) {
2174 coord[
i] = origin[
i];
2199 vec3d closest_pos, tempv, eye_rel_pos;
2203 if ( submodel_num < 0 ) {
2204 submodel_num = pm->
detail[0];
2215 DCF(
tiling,
"Toggles rendering of tiled textures (default is on)")
2257 vec3d norm, norm2, fvec, pnt, npnt;
2260 bool do_render =
false;
2282 if (Interp_thrust_glow_bitmap >= 0) {
2287 if (Interp_secondary_thrust_glow_bitmap >= 0) {
2292 if (Interp_tertiary_thrust_glow_bitmap >= 0) {
2296 if (do_render ==
false) {
2305 norm.
xyz.x *= Interp_thrust_rotvel.
xyz.y/2;
2306 norm.
xyz.y *= Interp_thrust_rotvel.
xyz.x/2;
2314 vec3d submodel_static_offset;
2315 bool submodel_rotation =
false;
2332 submodel_rotation =
true;
2346 if ( submodel_rotation ) {
2347 vm_vec_sub(&loc_offset, &gpt->
pnt, &submodel_static_offset);
2359 vec3d warp_pnt, tmp;
2372 vec3d warp_pnt, tmp;
2391 #define NOISE_SCALE 0.5f
2392 #define MIN_SCALE 3.4f
2393 #define MAX_SCALE 4.7f
2396 vec3d scale_vec = { { { 1.0f, 0.0f, 0.0f } } };
2403 (scale_vec.
xyz.x *= Interp_thrust_scale_x) -= 0.1
f;
2404 (scale_vec.
xyz.y *= Interp_thrust_scale_y) -= 0.1
f;
2411 if (magnitude < 0.0
f)
2424 float fog_int = 1.0f;
2452 if ( (Interp_thrust_glow_bitmap >= 0) && (d > 0.0
f) ) {
2455 Interp_thrust_glow_bitmap,
2459 (w * 0.5
f * Interp_thrust_glow_rad_factor),
2466 if (Interp_tertiary_thrust_glow_bitmap >= 0) {
2468 p.
r = p.
g = p.
b = p.
a = (
ubyte)(255.0
f * fog_int);
2470 Interp_tertiary_thrust_glow_bitmap,
2474 (w * 0.6
f * Interp_tertiary_thrust_glow_rad_factor),
2481 if (Interp_secondary_thrust_glow_bitmap >= 0) {
2497 float wVal = gpt->
radius * scale * 2;
2499 vm_vec_scale_add(&norm2, &pnt, &fvec, wVal * 2 * Interp_thrust_glow_len_factor);
2508 &pnt, &norm2, wVal*Interp_secondary_thrust_glow_rad_factor*0.5
f, d
2510 if (Scene_framebuffer_in_frame && Interp_draw_distortion) {
2511 vm_vec_scale_add(&norm2, &pnt, &fvec, wVal * 2 * Interp_distortion_thrust_length_factor);
2513 if (Interp_distortion_thrust_bitmap > 0) {
2514 dist_bitmap = Interp_distortion_thrust_bitmap;
2517 dist_bitmap = Interp_secondary_thrust_glow_bitmap;
2520 mag -= (
float)((
int)mag);
2523 &pnt, &norm2, wVal*Interp_distortion_thrust_rad_factor*0.5f, 1.0f, mag
2534 size_t num_particles = 0;
2536 if (Interp_afterburner)
2541 for (k = 0; k < num_particles; k++) {
2542 if (Interp_afterburner)
2592 bool override_all =
false;
2602 override_all =
true;
2610 if(!override_all && sip) {
2647 vec3d submodel_static_offset;
2648 bool submodel_rotation =
false;
2653 submodel_rotation =
true;
2656 if ( submodel_rotation ) {
2657 vm_vec_sub(&loc_offset, &gpt->
pnt, &submodel_static_offset);
2668 if ( shipp != NULL ) {
2670 vec3d warp_pnt, tmp;
2683 vec3d warp_pnt, tmp;
2700 float d,pulse = 1.0f;
2745 if (use_depth_buffer)
2792 if( x > period / 2) {
2797 if( x > period / 4) {
2809 vec3d cone_dir_model;
2810 vec3d cone_dir_world;
2811 vec3d cone_dir_screen;
2821 cone_dir_screen.
xyz.z = -cone_dir_screen.
xyz.z;
2822 light_add_cone(&world_pnt, &cone_dir_screen, gpo->
cone_angle, gpo->
cone_inner_angle, gpo->
dualcone, 1.0f, w * gpo->
radius_multi, 1, pulse * gpo->
light_color.
xyz.x + (1.0f-pulse) * gpo->
light_mix_color.
xyz.x, pulse * gpo->
light_color.
xyz.y + (1.0f-pulse) * gpo->
light_mix_color.
xyz.y, pulse * gpo->
light_color.
xyz.z + (1.0f-pulse) * gpo->
light_mix_color.
xyz.z, -1);
2835 memset(verts, 0,
sizeof(verts));
2856 for (idx = 0; idx < 4; idx++) {
2910 uint save_gr_zbuffering_mode;
2913 object *
objp = NULL;
2914 bool set_autocen =
false;
2915 bool draw_thrusters =
false;
2922 if (objnum >= 0 && !(flags & MR_DEPRECATED_ATTACHED_MODEL)) {
2954 Interp_flags =
flags;
3000 if ( !(Interp_flags & MR_DEPRECATED_SHOW_OUTLINE_PRESET) ) {
3013 #if MAX_DETAIL_LEVEL != 4
3014 #error Code in modelInterp.cpp assumes MAX_DETAIL_LEVEL == 4
3036 if (Interp_flags & MR_DEPRECATED_ATTACHED_MODEL) {
3037 if (depth >
Ship_info[
Ships[
Objects[objnum].instance].ship_info_index].weapon_model_draw_distance) {
3045 if ( Interp_flags & MR_DEPRECATED_LOCK_DETAIL ) {
3046 i = Interp_detail_level_locked+1;
3091 Interp_box_scale = 0.2f;
3096 Interp_box_scale = 0.5f;
3101 Interp_box_scale = 0.8f;
3106 Interp_box_scale = 1.0f;
3111 Interp_box_scale = 1.2f;
3139 float fog_near = 10.0f, fog_far = 1000.0f;
3141 unsigned char r,
g,
b;
3146 if (is_outlines_only_htl) {
3175 if ( (Interp_flags &
MR_DEPRECATED_NO_CULL) || (Interp_flags & MR_DEPRECATED_ALL_XPARENT) || (Interp_warp_bitmap >= 0) ) {
3186 if ( !(Interp_flags & MR_DEPRECATED_NO_LIGHTING) ) {
3193 if ( !(Interp_flags & MR_DEPRECATED_NO_LIGHTING) && (is_outlines_only_htl || (!
Cmdline_nohtl && !is_outlines_only)) ) {
3197 if (is_outlines_only_htl || (!
Cmdline_nohtl && !is_outlines_only)) {
3203 if(Rendering_to_shadow_map)
3210 if (is_outlines_only_htl || (!
Cmdline_nohtl && !is_outlines_only)) {
3216 draw_thrusters =
true;
3229 if (is_outlines_only_htl || (!
Cmdline_nohtl && !is_outlines_only)) {
3236 if (draw_thrusters) {
3242 if (is_outlines_only_htl || (!
Cmdline_nohtl && !is_outlines_only)) {
3255 if (is_outlines_only_htl || (!
Cmdline_nohtl && !is_outlines_only)) {
3260 if (is_outlines_only_htl) {
3264 if ( !(Interp_flags & MR_DEPRECATED_NO_LIGHTING) ) {
3312 if ( (Interp_flags & MR_DEPRECATED_AUTOCENTER) && (set_autocen) ) {
3324 if ( !is_outlines_only && !is_outlines_only_htl ) {
3325 if ( ( Interp_flags & MR_DEPRECATED_AUTOCENTER ) && set_autocen ) {
3326 vec3d autoback_rotated;
3360 Interp_flags =
flags;
3391 bool set_autocen =
false;
3412 if (is_outlines_only_htl) {
3441 Interp_base_frametime = 0;
3459 float fog_near, fog_far;
3466 unsigned char r,
g,
b;
3470 if(Rendering_to_shadow_map)
3483 if ( !(Interp_flags & MR_NO_LIGHTING) ) {
3499 if ( !(Interp_flags & MR_NO_LIGHTING ) ) {
3524 if ( submodel_num < 0 ) {
3525 submodel_num = pm->
detail[0];
3529 int chunk_type, chunk_size;
3532 chunk_size =
w(p+4);
3534 while (chunk_type !=
OP_EOF) {
3535 switch (chunk_type) {
3538 int nverts =
w(p+8);
3542 ubyte * normcount = p+20;
3545 for (n = 0; n < nverts; n++) {
3546 nnorms += normcount[
n];
3553 vec3d **norms = Interp_norms;
3555 for (n=0; n<nverts; n++ ) {
3559 src += normcount[
n]+1;
3569 mprintf((
"Bad chunk type %d, len=%d in submodel_get_points\n", chunk_type, chunk_size ));
3575 chunk_size =
w(p+4);
3585 int nv = submodel_get_points_internal(model_num, submodel_num);
3590 Error(
LOCATION,
"Model %d ('%s') must have at least one point from submodel_get_points_internal!", model_num, (pm == NULL) ?
"<null model?!?>" : pm->
filename);
3607 static int submodel_get_two_random_points_warned =
false;
3608 if (!submodel_get_two_random_points_warned)
3611 Warning(
LOCATION,
"RAND_MAX is only %d, but submodel %d for model %s has %d vertices! Explosions will not propagate through the entire model!\n", RAND_MAX, submodel_num, pm->
filename, nv);
3612 submodel_get_two_random_points_warned =
true;
3620 *v1 = *Interp_verts[vn1];
3621 *v2 = *Interp_verts[vn2];
3624 *n1 = *Interp_norms[vn1];
3627 *n2 = *Interp_norms[vn2];
3636 if ( submodel_num < 0 ) {
3637 submodel_num = pm->
detail[0];
3646 Error(
LOCATION,
"Model %d ('%s') must have at least one point from submodel_get_points_internal!", model_num, (pm == NULL) ?
"<null model?!?>" : pm->
filename);
3658 static int submodel_get_two_random_points_warned =
false;
3659 if (!submodel_get_two_random_points_warned)
3661 Warning(
LOCATION,
"RAND_MAX is only %d, but submodel %d for model %s has %d vertices! Explosions will not propagate through the entire model!\n", RAND_MAX, submodel_num, pm->
filename, nv);
3662 submodel_get_two_random_points_warned =
true;
3687 Interp_outline_color = *((
color*)(outline_color));
3694 Interp_detail_level_locked =
n;
3707 int chunk_type, chunk_size;
3710 chunk_size =
w(p+4);
3712 while (chunk_type !=
OP_EOF) {
3713 switch (chunk_type) {
3724 mprintf((
"Bad chunk type %d, len=%d in submodel_get_num_verts\n", chunk_type, chunk_size ));
3730 chunk_size =
w(p+4);
3740 int chunk_type =
w(p);
3741 int chunk_size =
w(p+4);
3744 while (chunk_type !=
OP_EOF) {
3745 switch (chunk_type) {
3750 int frontlist =
w(p+36);
3751 int backlist =
w(p+40);
3752 int prelist =
w(p+44);
3753 int postlist =
w(p+48);
3754 int onlist =
w(p+52);
3764 mprintf((
"Bad chunk type %d, len=%d in submodel_get_num_polys\n", chunk_type, chunk_size ));
3770 chunk_size =
w(p+4);
3808 if ( show_damaged ) {
3827 Interp_insignia_bitmap = bmap;
3832 Interp_new_replacement_textures = replacement_textures;
3840 Interp_forced_bitmap = bmap;
3848 Interp_xparent_alpha =
alpha;
3886 vec3d box_point, ray_direction, *extremes;
3887 float dist, best_dist;
3890 int masks[6] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20};
3891 int mask_inside = 0x3f;
3893 best_dist = FLT_MAX;
3896 for (i=0; i<6; i++) {
3903 extremes = &pm->
mins;
3906 extremes = &pm->
maxs;
3910 dist =
fvi_ray_plane(&box_point, extremes, &ray_direction, start_point, &ray_direction, 0.0
f);
3914 if (fabs(dist) < fabs(best_dist)) {
3916 if (closest_box_point) {
3924 *is_inside = (inside == mask_inside);
3951 if (closest_box_point) {
3961 Interp_fog_level = l;
3987 if (ship_info_index >= 0)
4045 int nverts =
w(off+bsp_data+8);
4046 int offset =
w(off+bsp_data+16);
4049 ubyte *normcount = off+bsp_data+20;
4053 Interp_lights = off+bsp_data+20+nverts;
4059 for (n = 0; n < nverts; n++) {
4060 Interp_verts[
n] =
src;
4063 for (i = 0; i < normcount[
n]; i++) {
4064 Interp_norms[next_norm] =
src;
4090 int pof_tex =
w(bsp_data+offset+40);
4091 int n_vert =
w(bsp_data+offset+36);
4093 ubyte *p = &bsp_data[offset+8];
4102 int problem_count = 0;
4104 for (
int i = 1;
i < (n_vert-1);
i++) {
4105 V = &polygon_list[pof_tex].
vert[(polygon_list[pof_tex].
n_verts)];
4106 N = &polygon_list[pof_tex].
norm[(polygon_list[pof_tex].
n_verts)];
4107 v = Interp_verts[(
int)tverts[0].vertnum];
4114 *N = *Interp_norms[(
int)tverts[0].normnum];
4122 V = &polygon_list[pof_tex].
vert[(polygon_list[pof_tex].
n_verts)+1];
4123 N = &polygon_list[pof_tex].
norm[(polygon_list[pof_tex].
n_verts)+1];
4124 v = Interp_verts[(
int)tverts[
i].vertnum];
4131 *N = *Interp_norms[(
int)tverts[
i].normnum];
4139 V = &polygon_list[pof_tex].
vert[(polygon_list[pof_tex].
n_verts)+2];
4140 N = &polygon_list[pof_tex].
norm[(polygon_list[pof_tex].
n_verts)+2];
4141 v = Interp_verts[(
int)tverts[
i+1].vertnum];
4148 *N = *Interp_norms[(
int)tverts[
i+1].normnum];
4156 polygon_list[pof_tex].
n_verts += 3;
4159 Parse_normal_problem_count += problem_count;
4166 int id =
w(bsp_data+offset);
4167 int size =
w(bsp_data+offset+4);
4195 id =
w(bsp_data+offset);
4196 size =
w(bsp_data+offset+4);
4205 int frontlist, backlist, prelist, postlist, onlist;
4207 frontlist =
w(bsp_data+offset+36);
4208 backlist =
w(bsp_data+offset+40);
4209 prelist =
w(bsp_data+offset+44);
4210 postlist =
w(bsp_data+offset+48);
4211 onlist =
w(bsp_data+offset+52);
4213 if (prelist)
parse_bsp(offset+prelist,bsp_data);
4214 if (backlist)
parse_bsp(offset+backlist, bsp_data);
4215 if (onlist)
parse_bsp(offset+onlist, bsp_data);
4216 if (frontlist)
parse_bsp(offset+frontlist, bsp_data);
4217 if (postlist)
parse_bsp(offset+postlist, bsp_data);
4222 int pof_tex =
w(bsp_data+offset+40);
4223 int n_vert =
w(bsp_data+offset+36);
4225 tri_count[pof_tex] += n_vert-2;
4231 int nverts =
w(off+bsp_data+8);
4233 ubyte * normcount = off+bsp_data+20;
4236 Interp_lights = off+bsp_data+20+nverts;
4244 for (n = 0; n < nverts; n++) {
4245 norm_num += normcount[
n];
4248 Interp_num_verts = nverts;
4249 Interp_num_norms = norm_num;
4257 int id =
w(bsp_data+offset);
4258 int size =
w(bsp_data+offset+4);
4286 id =
w(bsp_data+offset);
4287 size =
w(bsp_data+offset+4);
4296 int frontlist, backlist, prelist, postlist, onlist;
4298 frontlist =
w(bsp_data+offset+36);
4299 backlist =
w(bsp_data+offset+40);
4300 prelist =
w(bsp_data+offset+44);
4301 postlist =
w(bsp_data+offset+48);
4302 onlist =
w(bsp_data+offset+52);
4314 Assert( (mn >= 0) && (mn < pm->n_models) );
4335 int i, j, first_index;
4336 uint total_verts = 0;
4339 Assert( (mn >= 0) && (mn < pm->n_models) );
4352 tri_count[
i] = vert_count / 3;
4353 total_verts += vert_count;
4358 polygon_list[
i].
n_verts = vert_count;
4362 for ( j = 0; j < polygon_list[
i].
n_verts; ++j ) {
4368 if (total_verts > INT_MAX) {
4369 Error(
LOCATION,
"Unable to generate vertex buffer data because model '%s' with %i verts is over the maximum of %i verts!\n", pm->
filename, total_verts, INT_MAX);
4376 if ( outline_n_lines > 0 ) {
4386 if (total_verts < 1) {
4393 total_verts += polygon_list[
i].
n_verts;
4398 if ( !model_list ) {
4399 Error(
LOCATION,
"Unable to allocate memory for poly_list!\n" );
4404 model_list->
allocate( (
int)total_verts );
4407 if ( !polygon_list[i].n_verts )
4427 vertex_list.clear();
4431 if (model_list->
tsb != NULL) {
4444 if ( !polygon_list[i].n_verts )
4451 for (j = 0; j < polygon_list[
i].
n_verts; j++) {
4453 Assert(first_index != -1);
4455 new_buffer.
assign(j, first_index);
4460 new_buffer.
flags = 0;
4462 if (polygon_list[i].n_verts >= USHRT_MAX) {
4479 size_t src_buff_size;
4485 for ( i = 0; i < dest->
tex_buf.size(); ++
i ) {
4488 for ( j = 0; j < src->
tex_buf.size(); ++j ) {
4493 src_buffer = &src->
tex_buf[j];
4494 src_buff_size = (size_t)src_buffer->
n_verts;
4496 for ( k = 0; k < src_buff_size; ++k ) {
4513 index_counts[
i] = 0;
4523 for ( i = 0; i < (
int)submodel_list.size(); ++
i ) {
4524 model_num = submodel_list[
i];
4534 for ( j = 0; j < num_buffers; ++j ) {
4543 if ( index_counts[i] <= 0 ) {
4554 for ( i = 0; i < (
int)buffer->
tex_buf.size(); ++
i ) {
4559 for ( i = 0; i < (
int)submodel_list.size(); ++
i ) {
4560 model_num = submodel_list[
i];
4570 for ( i = 0; i < (
int)buffer->
tex_buf.size(); ++
i ) {
4571 if ( buffer->
tex_buf[i].i_last >= USHRT_MAX ) {
4581 submodel_list.clear();
4585 if ( submodel_list.size() < 1 ) {
4603 const int NUM_VERTS_PER_TRI = 3;
4617 if ( model_list == NULL || model_list->
n_verts < 1 ) {
4622 uint current_tri[NUM_VERTS_PER_TRI];
4623 bool transparent_tri =
false;
4626 for (
int i = 0;
i < (
int)tex_buffers.size(); ++
i ) {
4650 if ( !texture_lookup.
valid() ) {
4656 transparent_tri =
false;
4659 for (
int j = 0; j < tex_buf->
n_verts; ++j ) {
4667 transparent_tri =
true;
4670 current_tri[num_tris] =
index;
4673 if ( num_tris == NUM_VERTS_PER_TRI ) {
4674 if ( transparent_tri ) {
4677 transparent_indices.push_back(current_tri[0]);
4678 transparent_indices.push_back(current_tri[1]);
4679 transparent_indices.push_back(current_tri[2]);
4682 transparent_tri =
false;
4687 if ( transparent_indices.empty() ) {
4699 for (
int j = 0; j < (
int)transparent_indices.size(); ++j ) {
4700 new_buff.
assign(j, transparent_indices[j]);
4713 if ( (mn < 0) || (mn >= pm->
n_models) ) {
4839 if ( (mn < 0) || (mn >= pm->
n_models) ) {
4864 if ( !is_child && !(Interp_flags & MR_FULL_DETAIL) && model->
use_render_sphere ) {
4888 scale.
xyz.x = Interp_warp_scale_x;
4889 scale.
xyz.y = Interp_warp_scale_y;
4890 scale.
xyz.z = Interp_warp_scale_z;
4899 int forced_texture = -2;
4900 float forced_alpha = 1.0f;
4903 if ( Interp_forced_bitmap >= 0 ) {
4904 forced_texture = Interp_forced_bitmap;
4905 }
else if (Interp_warp_bitmap >= 0) {
4906 forced_texture = Interp_warp_bitmap;
4907 forced_alpha = Interp_warp_alpha;
4911 forced_texture = Interp_thrust_bitmap;
4913 forced_texture = -1;
4916 forced_alpha = 1.2f;
4919 forced_alpha = Interp_xparent_alpha;
4929 for (
size_t i = 0;
i < buffer_size;
i++) {
4937 if (forced_texture != -2) {
4938 texture = forced_texture;
4939 alpha = forced_alpha;
4941 else if ( !no_texturing ) {
4946 }
else if ( (Interp_new_replacement_textures != NULL) && (Interp_new_replacement_textures[rt_begin_index +
TM_BASE_TYPE] >= 0) ) {
4963 if ( (Interp_new_replacement_textures != NULL) && (Interp_new_replacement_textures[rt_begin_index +
TM_GLOW_TYPE] >= 0) ) {
4982 if (Interp_new_replacement_textures != NULL) {
4983 if (Interp_new_replacement_textures[rt_begin_index +
TM_SPECULAR_TYPE] >= 0) {
4988 if (Interp_new_replacement_textures[rt_begin_index +
TM_NORMAL_TYPE] >= 0) {
4993 if (Interp_new_replacement_textures[rt_begin_index +
TM_HEIGHT_TYPE] >= 0) {
5006 if (Interp_new_replacement_textures != NULL) {
5007 if (Interp_new_replacement_textures[rt_begin_index +
TM_MISC_TYPE] >= 0) {
5015 alpha = forced_alpha;
5018 if ( (Interp_new_replacement_textures != NULL) && (Interp_new_replacement_textures[rt_begin_index +
TM_BASE_TYPE] >= 0) ) {
5033 if ( (texture == -1) && !no_texturing ) {
5040 alpha = (Interp_warp_alpha != -1.0f) ? Interp_warp_alpha : 0.8
f;
5046 blend_filter = forced_blend_filter;
5060 object_had_transparency =
true;
5086 if ((bank_obj <= -1) || (objnum <= -1))
5096 Assert( bank_obj < sip->n_subsystems );
5130 int texture, frame, num_frames;
5131 float cur_time, total_time;
5139 if (texture >= 0 && num_frames > 1)
5147 frame =
fl2i((cur_time * num_frames) / total_time);
5148 CLAMP(frame, 0, num_frames - 1);
5160 Interp_warp_scale_x = scale_x;
5161 Interp_warp_scale_y = scale_y;
5162 Interp_warp_scale_z = scale_z;
5164 Interp_warp_bitmap = bitmap_id;
5165 Interp_warp_alpha =
alpha;
5170 dest->
base.
r = a->
base.
r * (1.0f - mix_factor) + b->
base.
r * mix_factor;
5171 dest->
base.
g = a->
base.
g * (1.0f - mix_factor) + b->
base.
g * mix_factor;
5172 dest->
base.
b = a->
base.
b * (1.0f - mix_factor) + b->
base.
b * mix_factor;
5183 if ( !
stricmp(secondaryteam.c_str(),
"none") ) {
5197 start.
base.
r = 0.0f;
5198 start.
base.
g = 0.0f;
5199 start.
base.
b = 0.0f;
5207 float time_remaining = 0.0f;
5210 CLAMP(time_remaining, 0.0
f, 1.0
f);
5229 if ( pos == NULL || normal == NULL ) {
5234 Interp_clip_normal = *normal;
5235 Interp_clip_pos = *
pos;
5259 this->original_texture = bm_handle;
5264 texture = original_texture = -1;
5274 return original_texture;
5288 mprintf((
"Generated texture name %s is too long. Skipping...\n", filename));
5292 if(this->original_texture < 0)
5293 nprintf((
"Maps",
"For \"%s\" I couldn't find %s.ani\n", dbg_name, filename));
5338 this->num_frames = 1;
5342 this->total_time = (num_frames / ((fps > 0) ? (
float)fps : 1.0f));
5356 if (this->
textures[
i].GetTexture() == bm_handle)
5363 if(fname == NULL || !strlen(fname))
5406 Polygon_vertices.clear();
5415 Num_flat_polies = 0;
5417 process_bsp(0, bsp_data);
5420 void bsp_polygon_data::process_bsp(
int offset,
ubyte* bsp_data)
5422 int id =
w(bsp_data + offset);
5423 int size =
w(bsp_data + offset + 4);
5429 process_defpoints(offset, bsp_data);
5433 process_sortnorm(offset, bsp_data);
5437 process_flat(offset, bsp_data);
5441 process_tmap(offset, bsp_data);
5452 id =
w(bsp_data + offset);
5453 size =
w(bsp_data + offset + 4);
5460 void bsp_polygon_data::process_defpoints(
int off,
ubyte* bsp_data)
5463 int nverts =
w(off + bsp_data + 8);
5464 int offset =
w(off + bsp_data + 16);
5466 ubyte *normcount = off + bsp_data + 20;
5470 Lights = off + bsp_data + 20 + nverts;
5476 Vertex_list.clear();
5477 Normal_list.clear();
5479 for (n = 0; n < nverts; n++) {
5480 Vertex_list.push_back(*src);
5483 for (i = 0; i < normcount[
n]; i++) {
5484 Normal_list.push_back(*src);
5490 void bsp_polygon_data::process_sortnorm(
int offset,
ubyte* bsp_data)
5492 int frontlist, backlist, prelist, postlist, onlist;
5494 frontlist =
w(bsp_data + offset + 36);
5495 backlist =
w(bsp_data + offset + 40);
5496 prelist =
w(bsp_data + offset + 44);
5497 postlist =
w(bsp_data + offset + 48);
5498 onlist =
w(bsp_data + offset + 52);
5500 if (prelist) process_bsp(offset + prelist, bsp_data);
5501 if (backlist) process_bsp(offset + backlist, bsp_data);
5502 if (onlist) process_bsp(offset + onlist, bsp_data);
5503 if (frontlist) process_bsp(offset + frontlist, bsp_data);
5504 if (postlist) process_bsp(offset + postlist, bsp_data);
5507 void bsp_polygon_data::process_tmap(
int offset,
ubyte* bsp_data)
5509 int pof_tex =
w(bsp_data + offset + 40);
5510 int n_vert =
w(bsp_data + offset + 36);
5517 ubyte *p = &bsp_data[offset + 8];
5522 int problem_count = 0;
5533 Num_polies[pof_tex]++;
5534 Num_verts[pof_tex] += n_vert;
5537 for (
int i = 0; i < n_vert; ++
i ) {
5540 vert.
position = Vertex_list[(
int)tverts[i].vertnum];
5545 vert.
normal = Normal_list[(
int)tverts[i].normnum];
5554 Polygon_vertices.push_back(vert);
5557 Polygons.push_back(polygon);
5559 Parse_normal_problem_count += problem_count;
5562 void bsp_polygon_data::process_flat(
int offset,
ubyte* bsp_data)
5564 int n_vert =
w(bsp_data + offset + 36);
5571 short * verts = (
short *)(bsp_data + offset + 44);
5573 ubyte r = *(bsp_data + offset + 40);
5574 ubyte g = *(bsp_data + offset + 41);
5575 ubyte b = *(bsp_data + offset + 42);
5584 Num_flat_verts += n_vert;
5586 for (
int i = 0; i < n_vert; i++) {
5589 int vertnum = verts[i * 2 + 0];
5590 int norm = verts[i * 2 + 1];
5592 vert.
position = Vertex_list[vertnum];
5593 vert.
normal = Normal_list[norm];
5600 Polygon_vertices.push_back(vert);
5603 Polygons.push_back(polygon);
5608 if ( texture < 0 ) {
5609 return MAX(Num_flat_verts - 2 * Num_flat_polies, 0);
5612 return MAX(Num_verts[texture] - 2 * Num_polies[texture], 0);
5618 return Num_flat_verts;
5628 for (
uint i = 0; i < Polygons.size(); ++
i ) {
5629 if ( Polygons[i].texture != texture ) {
5633 uint start_index = Polygons[
i].Start_index;
5634 uint end_index = Polygons[
i].Start_index + Polygons[
i].Num_verts;
5636 for (
uint j = start_index + 1; j < end_index - 1; ++j ) {
5638 vertex* vert = &vert_ptr[num_verts];
5639 vert->
world = Polygon_vertices[start_index].position;
5642 vec3d* norm = &norm_ptr[num_verts];
5643 *norm = Polygon_vertices[start_index].normal;
5646 vert = &vert_ptr[num_verts + 1];
5647 vert->
world = Polygon_vertices[j].position;
5650 norm = &norm_ptr[num_verts + 1];
5651 *norm = Polygon_vertices[j].normal;
5654 vert = &vert_ptr[num_verts + 2];
5655 vert->
world = Polygon_vertices[j+1].position;
5658 norm = &norm_ptr[num_verts + 2];
5659 *norm = Polygon_vertices[j+1].normal;
5670 for (
uint i = 0; i < Polygons.size(); ++
i) {
5671 if (Polygons[i].texture != texture) {
5675 uint start_index = Polygons[
i].Start_index;
5676 uint end_index = Polygons[
i].Start_index + Polygons[
i].Num_verts;
5678 for (
uint j = start_index; j < end_index; ++j) {
5680 vertex* vert = &vert_ptr[num_verts];
5681 vert->
world = Polygon_vertices[j].position;
5682 vert->
r = Polygon_vertices[j].r;
5683 vert->
g = Polygon_vertices[j].g;
5684 vert->
b = Polygon_vertices[j].b;
5685 vert->
a = Polygon_vertices[j].a;
5687 if ( j == end_index - 1 ) {
5688 vert = &vert_ptr[num_verts + 1];
5689 vert->
world = Polygon_vertices[start_index].position;
5690 vert->
r = Polygon_vertices[start_index].r;
5691 vert->
g = Polygon_vertices[start_index].g;
5692 vert->
b = Polygon_vertices[start_index].b;
5693 vert->
a = Polygon_vertices[start_index].a;
5695 vert = &vert_ptr[num_verts + 1];
5696 vert->
world = Polygon_vertices[j + 1].position;
5697 vert->
r = Polygon_vertices[j + 1].r;
5698 vert->
g = Polygon_vertices[j + 1].g;
5699 vert->
b = Polygon_vertices[j + 1].b;
5700 vert->
a = Polygon_vertices[j + 1].a;
void model_interp_set_clip_plane(vec3d *pos, vec3d *normal)
void interp_configure_vertex_buffers(polymodel *pm, int mn)
struct team_color::@238 stripe
#define TMAP_FLAG_PIXEL_FOG
int model_should_render_engine_glow(int objnum, int bank_obj)
int timestamp(int delta_ms)
struct screen3d::@234::@236 xyw
#define gr_translate_texture_matrix
void model_interp_sortnorm_f2b(ubyte *p, polymodel *pm, bsp_info *sm, int do_box_check)
vec3d render_sphere_offset
float get_model_closest_box_point_with_delta(vec3d *closest_box_point, vec3d *start_point, int modelnum, int *is_inside, float delta)
model_subsystem * system_info
#define MR_SHOW_OUTLINE_HTL
float Interp_thrust_scale
void model_interp_set_team_color(const SCP_string &team, const SCP_string &secondaryteam, fix timestamp, int fadetime)
#define TMAP_FLAG_SOFT_QUAD
int in_sphere(vec3d *pos, float radius, vec3d *view_pos)
void model_collide_free_point_list()
#define MR_SHOW_INVISIBLE_FACES
float vm_vec_mag_quick(const vec3d *v)
matrix * vm_matrix_x_matrix(matrix *dest, const matrix *src0, const matrix *src1)
void vm_vec_scale_add(vec3d *dest, const vec3d *src1, const vec3d *src2, float k)
#define MISSION_FLAG_FULLNEB
int interp_box_offscreen(vec3d *min, vec3d *max)
struct model_light_object model_light_object
float frand_range(float min, float max)
Return a floating point number in the range min..max.
SCP_vector< thruster_particles > normal_thruster_particles
#define gr_pop_scale_matrix
polymodel * model_get(int model_num)
void model_render_glow_points_DEPRECATED(polymodel *pm, ship *shipp, matrix *orient, vec3d *pos, bool use_depth_buffer=true)
void model_set_thrust(int model_num, mst_info *mst)
void model_interp_splode_defpoints(ubyte *p, polymodel *pm, bsp_info *sm, float dist)
fix game_get_overall_frametime()
int batch_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, float width, float intensity)
insignia ins[MAX_MODEL_INSIGNIAS]
float vm_vec_mag(const vec3d *v)
void submodel_get_two_random_points_better(int model_num, int submodel_num, vec3d *v1, vec3d *v2)
#define gr_set_texture_panning
#define MR_DEPRECATED_SHOW_OUTLINE
bool Interp_team_color_set
void parse_tmap(int offset, ubyte *bsp_data)
void vm_rotate_matrix_by_angles(matrix *orient, const angles *tangles)
void model_really_render(int model_num, matrix *orient, vec3d *pos, uint flags, int render, int objnum=-1)
ubyte g3_transfer_vertex(vertex *dest, const vec3d *src)
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
void interp_create_detail_index_buffer(polymodel *pm, int detail_num)
void interp_copy_index_buffer(vertex_buffer *src, vertex_buffer *dest, int *index_counts)
#define MAX_MODEL_TEXTURES
int light_filter_push(int objnum, const vec3d *pos, float rad)
int detail[MAX_MODEL_DETAIL_LEVELS]
float detail_depth[MAX_MODEL_DETAIL_LEVELS]
void light_add_point(const vec3d *pos, float r1, float r2, float intensity, float r, float g, float b, int light_ignore_objnum, float spec_r, float spec_g, float spec_b, bool specular)
int g3_draw_rod(int num_points, const vec3d *vecs, float width, uint tmap_flags)
GLint GLint GLsizei GLsizei GLsizei depth
virtual int getWarpOrientation(matrix *output)
float u[MAX_INS_FACES][MAX_INS_FACE_VECS]
void find_tri_counts(int offset, ubyte *bsp_data)
#define MR_DEPRECATED_SHOW_PIVOTS
#define MR_SHOW_OUTLINE_PRESET
void interp_render_arc(vec3d *v1, vec3d *v2, color *primary, color *secondary, float arc_width)
#define MR_DEPRECATED_CENTER_ALPHA
void assign(int i, uint j)
#define PM_FLAG_TRANS_BUFFER
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
struct vec3d::@225::@227 xyz
void model_deallocate_interp_data()
void neb2_get_fog_color(ubyte *r, ubyte *g, ubyte *b)
#define TMAP_HTL_3D_UNLIT
#define MR_DEPRECATED_SHOW_OUTLINE_HTL
float tertiary_glow_rad_factor
vec3d * vm_vec_avg_n(vec3d *dest, int n, const vec3d src[])
#define MR_DEPRECATED_LOCK_DETAIL
__inline void gr_render_buffer(int start, const vertex_buffer *bufferp, int texi, int flags=TMAP_FLAG_TEXTURED)
void light_set_all_relevent()
matrix * vm_copy_transpose(matrix *dest, const matrix *src)
#define gr_set_light_factor
vec3d * vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m)
#define END_OF_LIST(head)
#define PM_FLAG_ALLOW_TILING
bsp_collision_tree * model_get_bsp_collision_tree(int tree_index)
model_subsystem * subsystems
ubyte g3_code_vertex(vertex *point)
#define MR_DEPRECATED_ATTACHED_MODEL
bool pulse_period_override
void model_page_out_textures(int model_num, bool release)
int get_num_lines(int texture)
void ship_page_in_textures(int ship_index)
DCF(model_darkening,"Makes models darker with distance")
void vm_vec_scale_add2(vec3d *dest, const vec3d *src, float k)
void model_mix_two_team_colors(team_color *dest, team_color *a, team_color *b, float mix_factor)
void interp_clear_instance()
void gr_set_color_fast(color *dst)
void generate_triangles(int texture, vertex *vert_ptr, vec3d *norm_ptr)
#define GR_FILL_MODE_SOLID
int Num_arc_segment_points
int g3_draw_line(vertex *p0, vertex *p1)
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
int batch_add_bitmap_rotated(int texture, int tmap_flags, vertex *pnt, float angle, float rad, float alpha, float depth)
void find_submodel_instance_point_normal(vec3d *outpnt, vec3d *outnorm, int model_instance_num, int submodel_num, const vec3d *submodel_pnt, const vec3d *submodel_norm)
#define MODEL_RENDER_TRANS
GLenum GLenum GLenum GLenum GLenum scale
void model_setup_cloak(vec3d *shift, int full_cloak, int alpha)
void model_render_shields(polymodel *pm, uint flags)
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
GLfloat GLfloat GLfloat v2
void g3_draw_htl_sphere(const vec3d *position, float radius)
#define MODEL_RENDER_OPAQUE
bool bm_has_alpha_channel(int handle)
Checks to see if the indexed bitmap has an alpha channel.
void model_render_children_buffers_DEPRECATED(polymodel *pm, int mn, int detail_level, int render)
GLenum GLuint GLenum GLsizei const GLchar * buf
#define MR_DEPRECATED_NO_GLOWMAPS
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
int NORMMAP
Normal mapping.
float gun_submodel_rotation
void particle_emit(particle_emitter *pe, int type, int optional_data, float range)
thruster_bank * thrusters
#define TMAP_ANIMATED_SHADER
#define MR_ATTACHED_MODEL
std::deque< bool > glow_point_bank_active
void interp_fill_detail_index_buffer(SCP_vector< int > &submodel_list, polymodel *pm, vertex_buffer *buffer)
bool model_get_team_color(team_color *clr, const SCP_string &team, const SCP_string &secondaryteam, fix timestamp, int fadetime)
#define IS_VEC_NULL_SQ_SAFE(v)
#define CLAMP(x, min, max)
int HEIGHTMAP
Height map for normal mapping.
void model_show_damaged(int model_num, int show_damaged)
void model_set_detail_level(int n)
void g3_done_instance(bool set_api=false)
void gr_set_color(int r, int g, int b)
void model_draw_debug_points(polymodel *pm, bsp_info *submodel, uint flags)
int bm_is_valid(int handle)
Checks if the bitmap indexed by handle is valid.
SCP_vector< buffer_data > tex_buf
void model_allocate_interp_data(int n_verts=0, int n_norms=0, int n_list_verts=0)
void model_find_submodel_offset(vec3d *outpnt, int model_num, int sub_model_num)
int strextcmp(const char *s1, const char *s2)
void interp_render_arc_segment(vec3d *v1, vec3d *v2, int depth)
int model_interp_sub(void *model_ptr, polymodel *pm, bsp_info *sm, int do_box_check)
team_color Interp_team_color
int Interp_use_saved_lighting
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define MR_DEPRECATED_NO_CULL
void vm_vec_add2(vec3d *dest, const vec3d *src)
#define GR_ALPHABLEND_FILTER
WarpEffect * warpout_effect
float model_find_closest_point(vec3d *outpnt, int model_num, int submodel_num, matrix *orient, vec3d *pos, vec3d *eye_pos)
GLdouble GLdouble GLdouble r
struct matrix::@228::@230 vec
float neb2_get_fog_intensity(object *obj)
void model_set_replacement_textures(int *replacement_textures)
int LoadTexture(char *filename, char *dbg_name)
#define MR_DEPRECATED_NO_POLYS
virtual int getWarpPosition(vec3d *output)
int model_find_texture(int model_num, int bitmap)
void vm_vec_scale(vec3d *dest, float s)
bool Scene_framebuffer_in_frame
#define TMAP_FLAG_GOURAUD
int g3_draw_sphere(vertex *pnt, float rad)
int gameseq_get_state_idx(char *s)
struct model_light model_light
#define gr_deferred_lighting_end
GLboolean GLboolean GLboolean GLboolean a
#define VB_FLAG_LARGE_INDEX
#define gr_set_thrust_scale
float Interp_animated_timer
void PageOut(bool release)
int ship_subsys_disrupted(ship_subsys *ss)
ai_profile_t * ai_profile
vec3d Arc_segment_points[MAX_ARC_SEGMENT_POINTS]
float get_world_closest_box_point_with_delta(vec3d *closest_box_point, object *box_obj, vec3d *start_point, int *is_inside, float delta)
void PageOut(bool release)
#define strnicmp(s1, s2, n)
int GLOWMAP
References a map that is a fully lit version of its index -Bobboau.
texture_map maps[MAX_MODEL_TEXTURES]
void interp_pack_vertex_buffers(polymodel *pm, int mn)
int model_get_rotated_bitmap_points(vertex *pnt, float angle, float rad, vertex *v)
int light_filter_push_box(const vec3d *min, const vec3d *max)
bool use_render_box_offset
const int MAX_ARC_SEGMENT_POINTS
int FindTexture(int bm_handle)
void model_draw_paths(int model_num, uint flags)
void vm_rot_point_around_line(vec3d *out, const vec3d *in, float angle, const vec3d *line_point, const vec3d *line_dir)
#define MR_DEPRECATED_EDGE_ALPHA
const char * bm_get_filename(int handle)
Gets the filename of the bitmap indexed by handle, which must exist.
void model_collide_allocate_point_list(int n_points)
vertex_buffer detail_buffers[MAX_MODEL_DETAIL_LEVELS]
vec3d * Interp_splode_verts
void model_interp_sortnorm_b2f(ubyte *p, polymodel *pm, bsp_info *sm, int do_box_check)
vertex_buffer trans_buffer
float distortion_length_factor
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
vec3d norm[MAX_DOCK_SLOTS]
#define TMAP_FLAG_DESATURATE
void model_set_fog_level(float l)
#define MR_DEPRECATED_NO_CORRECT
float vm_vec_dist(const vec3d *v0, const vec3d *v1)
#define gr_pop_texture_matrix
int Interp_thrust_scale_subobj
void model_calc_bound_box(vec3d *box, vec3d *big_mn, vec3d *big_mx)
bool use_render_sphere_offset
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
#define MONITOR(function_name)
float get_channel_alpha(float u, float v)
#define MR_DEPRECATED_ALL_XPARENT
void make_index_buffer(SCP_vector< int > &vertex_list)
void parse_sortnorm(int offset, ubyte *bsp_data)
void parse_bsp(int offset, ubyte *bsp_data)
int find_index_fast(poly_list *plist, int idx)
int submodel_get_num_polys_sub(ubyte *p)
int Interp_multitex_cloakmap
void model_interp_set_animated_effect_and_timer(int effect_num, float effect_timer)
int get_num_triangles(int texture)
void interp_create_transparency_index_buffer(polymodel *pm, int mn)
float vm_vec_normalize_safe(vec3d *v)
int modelstats_num_polys_drawn
int g3_project_vertex(vertex *point)
#define MR_DEPRECATED_BAY_PATHS
void(* model_interp_sortnorm)(ubyte *p, polymodel *pm, bsp_info *sm, int do_box_check)
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
void submodel_get_two_random_points(int model_num, int submodel_num, vec3d *v1, vec3d *v2, vec3d *n1, vec3d *n2)
SCP_vector< thruster_particles > afterburner_thruster_particles
float neb2_get_lod_scale(int objnum)
int tri_count[MAX_MODEL_TEXTURES]
#define REPLACE_WITH_INVISIBLE
GLint GLint GLint GLint GLint x
object Objects[MAX_OBJECTS]
for(int idx=0;idx< i;idx++)
bsp_polygon_data(ubyte *bsp_data)
bool Glowpoint_use_depth_buffer
#define MR_SHOW_THRUSTERS
#define MONITOR_INC(function_name, inc)
#define MR_DEPRECATED_NO_ZBUFFER
int g3_check_normal_facing(const vec3d *v, const vec3d *norm)
int modelstats_num_sortnorms
#define gr_push_scale_matrix
void model_interp_tmappoly(ubyte *p, polymodel *pm)
model_light_object * Interp_lighting
#define gr_push_texture_matrix
void model_interp_flatpoly(ubyte *p, polymodel *pm)
void find_defpoint(int off, ubyte *bsp_data)
int submodel_get_num_verts(int model_num, int submodel_num)
#define gr_set_texture_addressing
SCP_unordered_map< int, void * > glowpoint_bank_override_map
void vm_vec_copy_scale(vec3d *dest, const vec3d *src, float s)
#define MR_DEPRECATED_ANIMATED_SHADER
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
#define TMAP_ADDRESS_WRAP
#define TMAP_FLAG_CORRECT
void dc_stuff_float(float *f)
Stuffs a float to the given variable.
int is_valid_vec(const vec3d *vec)
int faces[MAX_INS_FACES][MAX_INS_FACE_VECS]
float detail_distance_mult[MAX_DETAIL_LEVEL+1]
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
int Parse_normal_problem_count
int Interp_animated_effect
void find_sortnorm(int offset, ubyte *bsp_data)
int SetTexture(int n_tex)
bool Rendering_to_shadow_map
#define MR_DEPRECATED_SHOW_SHIELDS
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
#define vm_realloc(ptr, size)
void model_set_forced_texture(int bmap)
GLboolean GLboolean GLboolean b
__inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near=-1.0f, float fog_far=-1.0f)
poly_list polygon_list[MAX_MODEL_TEXTURES]
#define MR_DEPRECATED_NO_TEXTURING
#define MR_DEPRECATED_AUTOCENTER
int shockwave_get_framenum(int index, int num_frames)
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
float v[MAX_INS_FACES][MAX_INS_FACE_VECS]
void model_interp_edge_alpha(ubyte *param_r, ubyte *param_g, ubyte *param_b, vec3d *pnt, vec3d *norm, float alpha, bool invert=false)
#define IBOX_SOME_ON_SOME_OFF
void model_draw_bay_paths_htl(int model_num)
void submodel_render_DEPRECATED(int model_num, int submodel_num, matrix *orient, vec3d *pos, uint flags, int objnum, int *replacement_textures, int render)
#define DCF_BOOL(function_name, bool_variable)
struct team_color::@237 base
fix base_texture_anim_frametime
void model_set_warp_globals(float scale_x, float scale_y, float scale_z, int bitmap_id, float alpha)
glow_point_bank * glow_point_banks
GLint GLsizei GLsizei height
float vm_vec_dist_quick(const vec3d *v0, const vec3d *v1)
#define MR_DEPRECATED_SHOW_OUTLINE_PRESET
float frand()
Return random value in range 0.0..1.0- (1.0- means the closest number less than 1.0)
GLuint GLuint GLsizei GLenum const GLvoid * indices
GLubyte GLubyte GLubyte GLubyte w
const uint * get_index() const
void model_set_insignia_bitmap(int bmap)
void bm_page_in_texture(int bitmapnum, int nframes)
Marks a texture as being used for this level.
float Interp_subspace_offset_u
int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float rad, float alpha, float depth)
void light_add_cone(const vec3d *pos, const vec3d *dir, float angle, float inner_angle, bool dual_cone, float r1, float r2, float intensity, float r, float g, float b, int light_ignore_objnum, float spec_r, float spec_g, float spec_b, bool specular)
int Interp_saved_lighting_full
#define SF2_GLOWMAPS_DISABLED
char subobj_name[MAX_NAME_LEN]
void model_set_alpha(float alpha)
float vm_vec_copy_normalize(vec3d *dest, const vec3d *src)
void model_set_outline_color_fast(void *outline_color)
float render_sphere_radius
void model_draw_bay_paths(int model_num)
void neb2_get_adjusted_fog_values(float *fnear, float *ffar, object *objp)
void generate_lines(int texture, vertex *vert_ptr)
int check_values(vec3d *N)
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
texture_info textures[TM_NUM_TYPES]
ubyte keyd_pressed[NUM_KEYS]
void model_render_insignias(polymodel *pm, int detail_level, int bitmap_num)
SCP_vector< ship_info > Ship_info
vec3d * vm_vec_avg(vec3d *dest, const vec3d *src0, const vec3d *src1)
void g3_start_instance_matrix(const vec3d *pos, const matrix *orient, bool set_api=true)
#define TMAP_FLAG_TEXTURED
#define gr_deferred_lighting_begin
int static_rand(int num)
Return a pseudo random 32 bit value given a reasonably small number.
void model_render_DEPRECATED(int model_num, matrix *orient, vec3d *pos, uint flags, int objnum, int lighting_skip, int *replacement_textures, int render, const bool is_skybox)
int model_interp_get_texture(texture_info *tinfo, fix base_frametime)
#define MR_DEPRECATED_SHOW_RADIUS
#define MAX_MODEL_DETAIL_LEVELS
int secondary_glow_bitmap
GLsizei GLsizei GLuint * obj
float Interp_subspace_offset_v
#define DETAIL_FLAG_MODELS
bool object_had_transparency
#define MR_DEPRECATED_IS_MISSILE
#define gr_reset_lighting
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
#define TMAP_FLAG_TRISTRIP
void model_page_in_textures(int modelnum, int ship_info_index)
void light_apply_rgb(ubyte *param_r, ubyte *param_g, ubyte *param_b, const vec3d *pos, const vec3d *norm, float static_light_level)
void model_interp_subcall(polymodel *pm, int mn, int detail_level)
#define GR_BITBLT_MODE_NORMAL
void light_apply_specular(ubyte *param_r, ubyte *param_g, ubyte *param_b, const vec3d *pos, const vec3d *norm, const vec3d *cam)
float secondary_glow_rad_factor
void parse_defpoint(int off, ubyte *bsp_data)
int SPECMAP
References a map that is for specular mapping -Bobboau.
void opengl_change_active_lights(int pos, int d_offset)
void model_set_outline_color(int r, int g, int b)
void model_draw_paths_htl(int model_num, uint flags)
int in_box(vec3d *min, vec3d *max, vec3d *pos, vec3d *view_pos)
model_light_object Interp_lighting_temp
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
int bm_load_either(const char *filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads either animation (bm_load_animation) or still image (bm_load)
void model_render_thrusters(polymodel *pm, int objnum, ship *shipp, matrix *orient, vec3d *pos)
WarpEffect * warpin_effect
void find_tmap(int offset, ubyte *bsp_data)
#define MR_DEPRECATED_NO_LIGHTING
SCP_map< SCP_string, team_color > Team_Colors
float fvi_ray_plane(vec3d *new_pnt, const vec3d *plane_pnt, const vec3d *plane_norm, const vec3d *ray_origin, const vec3d *ray_direction, float rad)
int Interp_cloakmap_alpha
int g3_draw_sphere_ez(const vec3d *pnt, float rad)
int bm_unload(int handle, int clear_render_targets, bool nodebug)
Unloads a bitmap's data, but not the bitmap info.
int submodel_get_num_polys(int model_num, int submodel_num)
vec3d * vm_vec_cross(vec3d *dest, const vec3d *src0, const vec3d *src1)
#define TMAP_FLAG_DISTORTION_THRUSTER
#define GR_ALPHABLEND_NONE
int distortion_add_beam(int texture, int tmap_flags, vec3d *start, vec3d *end, float width, float intensity, float offset)
#define TMAP_ADDRESS_CLAMP
int MISCMAP
Utility map, to be utilized for various things shader authors can come up with.
void model_render_buffers_DEPRECATED(polymodel *pm, int mn, int render, bool is_child=false)
int g3_draw_poly(int nv, vertex **pointlist, uint tmap_flags)
void model_interp_defpoints(ubyte *p, polymodel *pm, bsp_info *sm)
void moldel_calc_facing_pts(vec3d *top, vec3d *bot, vec3d *fvec, vec3d *pos, float w, float z_add, vec3d *Eyeposition)
GLclampf GLclampf GLclampf alpha
float distortion_rad_factor
GLdouble GLdouble GLdouble GLdouble top
char filename[FILESPEC_LENGTH]
bool glow_bitmap_override
vec3d pnt[MAX_DOCK_SLOTS]
void vm_vec_add(vec3d *dest, const vec3d *src0, const vec3d *src1)
void gr_init_color(color *c, int r, int g, int b)
matrix vmd_identity_matrix
void interp_render_lightning(polymodel *pm, bsp_info *sm)
#define MR_DEPRECATED_NO_FOGGING
float interp_closest_dist_to_box(vec3d *hitpt, vec3d *p0, vec3d *min, vec3d *max)
#define GR_FILL_MODE_WIRE
void model_finish_cloak(int full_cloak)
float vm_vec_normalize(vec3d *v)
void model_get_submodel_tree_list(SCP_vector< int > &submodel_vector, polymodel *pm, int mn)
#define MR_DEPRECATED_SHOW_PATHS
generic_anim thruster_bitmap
void g3_draw_htl_line(const vec3d *start, const vec3d *end)