Skip to content

Commit

Permalink
triangle_drawing: moved GetTriggerColor and GetTriggerAlpha calls out…
Browse files Browse the repository at this point in the history
… of nummodelsurfaces loop for performance
  • Loading branch information
SmileyAG committed May 10, 2024
1 parent d28e700 commit 1f98048
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions BunnymodXT/triangle_drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,17 @@ namespace TriangleDrawing
continue;

const bool active = ent->v.solid != SOLID_NOT || std::strcmp(classname, "trigger_transition") == 0;
float r, g, b, a;
ServerDLL::GetTriggerColor(classname, r, g, b);
ServerDLL::GetTriggerAlpha(classname, !active, true, a);
r /= 255.0f;
g /= 255.0f;
b /= 255.0f;
a /= 255.0f;

for (int i = 0; i < model->nummodelsurfaces; ++i) {
// Offset to make each surface look slightly different
const float offset = i * float(M_PI) / 7;
float r, g, b, a;
ServerDLL::GetTriggerColor(classname, r, g, b);
ServerDLL::GetTriggerAlpha(classname, !active, true, a);
r /= 255.0f;
g /= 255.0f;
b /= 255.0f;
a /= 255.0f;
if (active)
a = GetPulsatingAlpha(a, svTime + offset);

Expand Down

0 comments on commit 1f98048

Please sign in to comment.