MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RenderObject_DrawPolymodel

Function RenderObject_DrawPolymodel

Descent3/renderobject.cpp:1492–1751  ·  view source on GitHub ↗

Actually draws a polygon model based on the light parameters set by the above functions

Source from the content-addressed store, hash-verified

1490// Actually draws a polygon model based on the light parameters set by the above
1491// functions
1492void RenderObject_DrawPolymodel(object *obj, float *normalized_times) {
1493 int model_num;
1494 int use_effect = 0;
1495 vector obj_pos = obj->pos;
1496 polymodel_effect pe = {0};
1497
1498 // Do cloak effect on player
1499 if (UseHardware) {
1500 if (obj->effect_info && (obj->effect_info->type_flags & EF_FADING_OUT)) {
1501 pe.type = PEF_ALPHA;
1502 pe.alpha = .08 + (.92 * (obj->effect_info->fade_time / obj->effect_info->fade_max_time));
1503 use_effect = 1;
1504 }
1505 if (obj->effect_info && (obj->effect_info->type_flags & EF_FADING_IN)) {
1506 pe.type = PEF_ALPHA;
1507 pe.alpha = .08 + (.92 * (1.0 - (obj->effect_info->fade_time / obj->effect_info->fade_max_time)));
1508 use_effect = 1;
1509 }
1510 if (obj->effect_info && (obj->effect_info->type_flags & EF_CLOAKED)) {
1511 pe.type = PEF_ALPHA | PEF_DEFORM;
1512 pe.alpha = .13f;
1513 pe.deform_range = .1f;
1514
1515 use_effect = 1;
1516 }
1517 if (obj->type == OBJ_PLAYER) {
1518 // Draw thrust/afterburner cooler
1519 pe.type |= PEF_GLOW_SCALAR;
1520 pe.glow_length_scalar = (Players[obj->id].thrust_mag);
1521 pe.glow_size_scalar = (Players[obj->id].thrust_mag);
1522
1523 pe.glow_length_scalar += (Players[obj->id].afterburner_mag * 3);
1524 pe.glow_size_scalar += (Players[obj->id].afterburner_mag * .5);
1525 float adjustment = (ps_rand() % 100 - 50);
1526 adjustment /= 50.0;
1527 pe.glow_length_scalar += (.2 * adjustment);
1528
1529 use_effect = 1;
1530 // Make Katmai glows longer
1531 if (Katmai) {
1532 pe.glow_length_scalar *= 1.5;
1533 }
1534 // hack to make multiplayer demos work!
1535 if (is_multi_demo || (Game_mode & GM_MULTI)) {
1536 if (Num_teams > 1) {
1537 int teamnum = PlayerGetTeam(obj->id);
1538
1539 pe.type |= PEF_CUSTOM_COLOR | PEF_CUSTOM_GLOW;
1540 pe.custom_color = Player_colors[teamnum];
1541 pe.glow_r = GR_COLOR_RED(pe.custom_color) / 255.0;
1542 pe.glow_g = GR_COLOR_GREEN(pe.custom_color) / 255.0;
1543 pe.glow_b = GR_COLOR_BLUE(pe.custom_color) / 255.0;
1544
1545 use_effect = 1;
1546 } else {
1547 pe.type |= PEF_CUSTOM_COLOR;
1548 pe.custom_color = Player_colors[obj->id];
1549

Callers 1

RenderObjectFunction · 0.85

Calls 8

ps_randFunction · 0.85
PlayerGetTeamFunction · 0.85
GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85
g3_RotatePointFunction · 0.85
SetPolymodelEffectFunction · 0.85
DrawPolygonModelFunction · 0.85

Tested by

no test coverage detected