Pass polymodel& to draw_model_picture, draw_polygon_model
This commit is contained in:
parent
910ac7fd4a
commit
acae546a90
|
@ -154,7 +154,8 @@ public:
|
|||
#ifdef dsx
|
||||
namespace dsx {
|
||||
// draw a polygon model
|
||||
void draw_polygon_model(grs_canvas &, const vms_vector &pos, const vms_matrix &orient, submodel_angles anim_angles, unsigned model_num, unsigned flags, g3s_lrgb light, const glow_values_t *glow_values, alternate_textures);
|
||||
void draw_polygon_model(const std::array<polymodel, MAX_POLYGON_MODELS> &, grs_canvas &, const vms_vector &pos, const vms_matrix &orient, submodel_angles anim_angles, const unsigned model_num, unsigned flags, g3s_lrgb light, const glow_values_t *glow_values, alternate_textures);
|
||||
void draw_polygon_model(grs_canvas &, const vms_vector &pos, const vms_matrix &orient, submodel_angles anim_angles, const polymodel &model_num, unsigned flags, g3s_lrgb light, const glow_values_t *glow_values, alternate_textures);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -162,7 +163,7 @@ void draw_polygon_model(grs_canvas &, const vms_vector &pos, const vms_matrix &o
|
|||
// more-or-less fill the canvas. Note that this routine actually renders
|
||||
// into an off-screen canvas that it creates, then copies to the current
|
||||
// canvas.
|
||||
void draw_model_picture(grs_canvas &, uint_fast32_t mn, const vms_angvec &orient_angles);
|
||||
void draw_model_picture(grs_canvas &, const polymodel &mn, const vms_angvec &orient_angles);
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II)
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
|
|
|
@ -69,16 +69,19 @@ public:
|
|||
|
||||
static object_dialog objpage_dialog;
|
||||
|
||||
//this is bad to have the extern, but this snapshot stuff is special
|
||||
static void draw_model_picture(const std::array<polymodel, MAX_POLYGON_MODELS> &Polygon_models, grs_canvas &canvas, const unsigned model_num, const vms_angvec &orient_angles)
|
||||
{
|
||||
draw_model_picture(canvas, Polygon_models[model_num], orient_angles);
|
||||
}
|
||||
|
||||
//canvas set
|
||||
void draw_object_picture(grs_canvas &canvas, const unsigned id, const vms_angvec &orient_angles, const unsigned type)
|
||||
{
|
||||
|
||||
if (id >= Num_object_subtypes)
|
||||
return;
|
||||
|
||||
auto &Robot_info = LevelSharedRobotInfoState.Robot_info;
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
switch (type) {
|
||||
|
||||
case OBJ_HOSTAGE:
|
||||
|
@ -94,18 +97,18 @@ void draw_object_picture(grs_canvas &canvas, const unsigned id, const vms_angvec
|
|||
break;
|
||||
|
||||
case OBJ_PLAYER:
|
||||
draw_model_picture(canvas, Player_ship->model_num, orient_angles); // Draw a poly model below
|
||||
draw_model_picture(Polygon_models, canvas, Player_ship->model_num, orient_angles); // Draw a poly model below
|
||||
break;
|
||||
|
||||
case OBJ_ROBOT:
|
||||
draw_model_picture(canvas, Robot_info[id].model_num, orient_angles); // Draw a poly model below
|
||||
draw_model_picture(Polygon_models, canvas, Robot_info[id].model_num, orient_angles); // Draw a poly model below
|
||||
break;
|
||||
|
||||
case OBJ_CNTRLCEN:
|
||||
draw_model_picture(canvas, get_reactor_model_number(id), orient_angles);
|
||||
draw_model_picture(Polygon_models, canvas, get_reactor_model_number(id), orient_angles);
|
||||
break;
|
||||
case OBJ_CLUTTER:
|
||||
draw_model_picture(canvas, id, orient_angles);
|
||||
draw_model_picture(Polygon_models, canvas, id, orient_angles);
|
||||
break;
|
||||
default:
|
||||
//Int3(); // Invalid type!!!
|
||||
|
|
|
@ -564,7 +564,8 @@ void draw_exit_model(grs_canvas &canvas)
|
|||
|
||||
auto model_pos = vm_vec_scale_add(mine_exit_point,mine_exit_orient.fvec,i2f(f));
|
||||
vm_vec_scale_add2(model_pos,mine_exit_orient.uvec,i2f(u));
|
||||
draw_polygon_model(canvas, model_pos, mine_exit_orient, nullptr, mine_destroyed ? destroyed_exit_modelnum : exit_modelnum, 0, lrgb, nullptr, nullptr);
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
draw_polygon_model(Polygon_models, canvas, model_pos, mine_exit_orient, nullptr, mine_destroyed ? destroyed_exit_modelnum : exit_modelnum, 0, lrgb, nullptr, nullptr);
|
||||
}
|
||||
|
||||
#define SATELLITE_DIST i2f(1024)
|
||||
|
|
|
@ -2935,7 +2935,8 @@ window_event_result polygon_models_viewer_window::event_handler(const d_event &e
|
|||
timer_delay(F1_0/60);
|
||||
{
|
||||
auto &canvas = *grd_curcanv;
|
||||
draw_model_picture(canvas, view_idx, ang);
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
draw_model_picture(canvas, Polygon_models[view_idx], ang);
|
||||
gr_set_fontcolor(canvas, BM_XRGB(255, 255, 255), -1);
|
||||
auto &game_font = *GAME_FONT;
|
||||
gr_printf(canvas, game_font, FSPACX(1), FSPACY(1), "ESC: leave\nSPACE/BACKSP: next/prev model (%i/%i)\nA/D: rotate y\nW/S: rotate x\nQ/E: rotate z\nR: reset orientation", view_idx, LevelSharedPolygonModelState.N_polygon_models - 1);
|
||||
|
|
|
@ -327,6 +327,7 @@ static void draw_cloaked_object(grs_canvas &canvas, const object_base &obj, cons
|
|||
}
|
||||
}
|
||||
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
if (fading) {
|
||||
g3s_lrgb new_light;
|
||||
|
||||
|
@ -334,7 +335,7 @@ static void draw_cloaked_object(grs_canvas &canvas, const object_base &obj, cons
|
|||
new_light.g = fixmul(light.g,light_scale);
|
||||
new_light.b = fixmul(light.b,light_scale);
|
||||
glow[0] = fixmul(glow[0],light_scale);
|
||||
draw_polygon_model(canvas, obj.pos,
|
||||
draw_polygon_model(Polygon_models, canvas, obj.pos,
|
||||
obj.orient,
|
||||
obj.rtype.pobj_info.anim_angles,
|
||||
obj.rtype.pobj_info.model_num, obj.rtype.pobj_info.subobj_flags,
|
||||
|
@ -345,7 +346,7 @@ static void draw_cloaked_object(grs_canvas &canvas, const object_base &obj, cons
|
|||
else {
|
||||
gr_settransblend(canvas, static_cast<gr_fade_level>(cloak_value), gr_blend::normal);
|
||||
g3_set_special_render(draw_tmap_flat); //use special flat drawer
|
||||
draw_polygon_model(canvas, obj.pos,
|
||||
draw_polygon_model(Polygon_models, canvas, obj.pos,
|
||||
obj.orient,
|
||||
obj.rtype.pobj_info.anim_angles,
|
||||
obj.rtype.pobj_info.model_num, obj.rtype.pobj_info.subobj_flags,
|
||||
|
@ -430,12 +431,13 @@ static void draw_polygon_object(grs_canvas &canvas, const d_level_unique_light_s
|
|||
}
|
||||
#endif
|
||||
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
if (obj->rtype.pobj_info.tmap_override != -1) {
|
||||
std::array<bitmap_index, 12> bm_ptrs;
|
||||
|
||||
//fill whole array, in case simple model needs more
|
||||
bm_ptrs.fill(Textures[obj->rtype.pobj_info.tmap_override]);
|
||||
draw_polygon_model(canvas, obj->pos,
|
||||
draw_polygon_model(Polygon_models, canvas, obj->pos,
|
||||
obj->orient,
|
||||
obj->rtype.pobj_info.anim_angles,
|
||||
obj->rtype.pobj_info.model_num,
|
||||
|
@ -487,7 +489,7 @@ static void draw_polygon_object(grs_canvas &canvas, const d_level_unique_light_s
|
|||
gr_settransblend(canvas, GR_FADE_OFF, gr_blend::additive_a);
|
||||
draw_simple_model = static_cast<fix>(vm_vec_dist_quick(Viewer->pos, obj->pos)) < Simple_model_threshhold_scale * F1_0*2;
|
||||
if (draw_simple_model)
|
||||
draw_polygon_model(canvas, obj->pos,
|
||||
draw_polygon_model(Polygon_models, canvas, obj->pos,
|
||||
obj->orient,
|
||||
obj->rtype.pobj_info.anim_angles,
|
||||
Weapon_info[get_weapon_id(obj)].model_num_inner,
|
||||
|
@ -497,7 +499,7 @@ static void draw_polygon_object(grs_canvas &canvas, const d_level_unique_light_s
|
|||
alt_textures);
|
||||
}
|
||||
|
||||
draw_polygon_model(canvas, obj->pos,
|
||||
draw_polygon_model(Polygon_models, canvas, obj->pos,
|
||||
obj->orient,
|
||||
obj->rtype.pobj_info.anim_angles,obj->rtype.pobj_info.model_num,
|
||||
obj->rtype.pobj_info.subobj_flags,
|
||||
|
@ -510,7 +512,7 @@ static void draw_polygon_object(grs_canvas &canvas, const d_level_unique_light_s
|
|||
#if !DXX_USE_OGL // in software rendering must draw inner model last
|
||||
gr_settransblend(canvas, GR_FADE_OFF, gr_blend::additive_a);
|
||||
if (draw_simple_model)
|
||||
draw_polygon_model(canvas, obj->pos,
|
||||
draw_polygon_model(Polygon_models, canvas, obj->pos,
|
||||
obj->orient,
|
||||
obj->rtype.pobj_info.anim_angles,
|
||||
Weapon_info[obj->id].model_num_inner,
|
||||
|
|
|
@ -392,10 +392,15 @@ void free_model(polymodel &po)
|
|||
|
||||
namespace dsx {
|
||||
|
||||
void draw_polygon_model(grs_canvas &canvas, const vms_vector &pos, const vms_matrix &orient, const submodel_angles anim_angles, const unsigned model_num, unsigned flags, const g3s_lrgb light, const glow_values_t *const glow_values, alternate_textures alt_textures)
|
||||
void draw_polygon_model(const std::array<polymodel, MAX_POLYGON_MODELS> &Polygon_models, grs_canvas &canvas, const vms_vector &pos, const vms_matrix &orient, const submodel_angles anim_angles, const unsigned model_num, const unsigned flags, const g3s_lrgb light, const glow_values_t *const glow_values, const alternate_textures alt_textures)
|
||||
{
|
||||
draw_polygon_model(canvas, pos, orient, anim_angles, Polygon_models[model_num], flags, light, glow_values, alt_textures);
|
||||
}
|
||||
|
||||
void draw_polygon_model(grs_canvas &canvas, const vms_vector &pos, const vms_matrix &orient, const submodel_angles anim_angles, const polymodel &pm, unsigned flags, const g3s_lrgb light, const glow_values_t *const glow_values, const alternate_textures alt_textures)
|
||||
{
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
const polymodel *po = &Polygon_models[model_num];
|
||||
const polymodel *po = ±
|
||||
|
||||
//check if should use simple model
|
||||
if (po->simpler_model ) //must have a simpler model
|
||||
|
@ -582,7 +587,7 @@ int load_polygon_model(const char *filename,int n_textures,int first_texture,rob
|
|||
//more-or-less fill the canvas. Note that this routine actually renders
|
||||
//into an off-screen canvas that it creates, then copies to the current
|
||||
//canvas.
|
||||
void draw_model_picture(grs_canvas &canvas, const uint_fast32_t mn, const vms_angvec &orient_angles)
|
||||
void draw_model_picture(grs_canvas &canvas, const polymodel &mn, const vms_angvec &orient_angles)
|
||||
{
|
||||
g3s_lrgb lrgb = { f1_0, f1_0, f1_0 };
|
||||
|
||||
|
@ -591,9 +596,8 @@ void draw_model_picture(grs_canvas &canvas, const uint_fast32_t mn, const vms_an
|
|||
vms_vector temp_pos{};
|
||||
g3_set_view_matrix(temp_pos,vmd_identity_matrix,0x9000);
|
||||
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
if (Polygon_models[mn].rad != 0)
|
||||
temp_pos.z = fixmuldiv(DEFAULT_VIEW_DIST,Polygon_models[mn].rad,BASE_MODEL_SIZE);
|
||||
if (mn.rad != 0)
|
||||
temp_pos.z = fixmuldiv(DEFAULT_VIEW_DIST, mn.rad, BASE_MODEL_SIZE);
|
||||
else
|
||||
temp_pos.z = DEFAULT_VIEW_DIST;
|
||||
|
||||
|
|
|
@ -1253,7 +1253,8 @@ static void show_spinning_robot_frame(briefing *br, int robot_num)
|
|||
br->robot_angles.h += 150;
|
||||
|
||||
Assert(Robot_info[robot_num].model_num != -1);
|
||||
draw_model_picture(*br->robot_canv.get(), Robot_info[robot_num].model_num, br->robot_angles);
|
||||
auto &Polygon_models = LevelSharedPolygonModelState.Polygon_models;
|
||||
draw_model_picture(*br->robot_canv.get(), Polygon_models[Robot_info[robot_num].model_num], br->robot_angles);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue