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

Function DrawVisFadingLine

Descent3/viseffect.cpp:934–988  ·  view source on GitHub ↗

Draws a weapons fading line

Source from the content-addressed store, hash-verified

932
933// Draws a weapons fading line
934void DrawVisFadingLine(vis_effect *vis) {
935 float norm_time;
936 float time_live = Gametime - vis->creation_time;
937 float size = vis->size;
938
939 int visnum = vis - VisEffects;
940 norm_time = time_live / vis->lifetime;
941
942 if (norm_time >= 1)
943 norm_time = .99999f; // don't go over!
944
945 rend_SetAlphaType(AT_SATURATE_VERTEX);
946 rend_SetTextureType(TT_FLAT);
947 rend_SetLighting(LS_GOURAUD);
948 rend_SetColorModel(CM_RGB);
949 rend_SetOverlayType(OT_NONE);
950
951 vector vecs[2];
952 g3Point pnts[2];
953 int i;
954
955 vecs[0] = vis->pos;
956 vecs[1] = vis->end_pos;
957
958 if (!(vis->flags & VF_WINDSHIELD_EFFECT)) // bash end position
959 {
960 vector vel = -vis->velocity;
961 vm_NormalizeVectorFast(&vel);
962 vecs[1] = vis->pos + (vel * vis->size);
963 }
964
965 ddgr_color color = GR_16_TO_COLOR(vis->lighting_color);
966 int r = GR_COLOR_RED(color);
967 int g = GR_COLOR_GREEN(color);
968 int b = GR_COLOR_BLUE(color);
969
970 for (i = 0; i < 2; i++) {
971 g3_RotatePoint(&pnts[i], &vecs[i]);
972 pnts[i].p3_flags |= PF_RGBA;
973 pnts[i].p3_r = (r / 255.0);
974 pnts[i].p3_g = (g / 255.0);
975 ;
976 pnts[i].p3_b = (b / 255.0);
977 ;
978 }
979
980 if (vis->flags & VF_WINDSHIELD_EFFECT)
981 pnts[0].p3_a = .3f;
982 else
983 pnts[0].p3_a = 1.0 - norm_time;
984
985 pnts[1].p3_a = 0.0;
986
987 g3_DrawSpecialLine(&pnts[0], &pnts[1]);
988}
989
990// Draws a blast ring vis effect
991void DrawVisBlastRing(vis_effect *vis) {

Callers 1

DrawVisEffectFunction · 0.85

Calls 12

vm_NormalizeVectorFastFunction · 0.85
GR_16_TO_COLORFunction · 0.85
GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85
g3_RotatePointFunction · 0.85
g3_DrawSpecialLineFunction · 0.85
rend_SetAlphaTypeFunction · 0.50
rend_SetTextureTypeFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetOverlayTypeFunction · 0.50

Tested by

no test coverage detected