Greatly improved performance of railgun core "high" setting

also, make sure only the HUD is decoupled, keep other things coupled to view angles (like intermission scoreboard)
This commit is contained in:
Simon 2022-04-03 17:45:56 +01:00
parent 90059c4bbc
commit cbd1850cd6
2 changed files with 40 additions and 26 deletions

View File

@ -2909,22 +2909,32 @@ void CG_DrawActive( void ) {
float dist = (trap_Cvar_VariableValue("vr_hudDepth")+2) * 6 * scale;
float radius = dist / 3.0f;
float viewYaw = SHORT2ANGLE(cg.predictedPlayerState.delta_angles[YAW]) + (vr->clientviewangles[YAW] - vr->hmdorientation[YAW]);
static float hmd_yaw_x = 0.0f;
static float hmd_yaw_y = 1.0f;
if (cg.snap->ps.stats[STAT_HEALTH] > 0 &&
cg.snap->ps.pm_type != PM_INTERMISSION)
{
hmd_yaw_x = 0.95f * hmd_yaw_x + 0.05f * cosf(DEG2RAD(vr->hmdorientation[YAW]));
hmd_yaw_y = 0.95f * hmd_yaw_y + 0.05f * sinf(DEG2RAD(vr->hmdorientation[YAW]));
float viewYaw = SHORT2ANGLE(cg.predictedPlayerState.delta_angles[YAW]) +
(vr->clientviewangles[YAW] - vr->hmdorientation[YAW]);
static float hmd_yaw_x = 0.0f;
static float hmd_yaw_y = 1.0f;
{
hmd_yaw_x = 0.97f * hmd_yaw_x + 0.03f * cosf(DEG2RAD(vr->hmdorientation[YAW]));
hmd_yaw_y = 0.97f * hmd_yaw_y + 0.03f * sinf(DEG2RAD(vr->hmdorientation[YAW]));
}
angles[YAW] = viewYaw + RAD2DEG(atan2(hmd_yaw_y, hmd_yaw_x));
angles[PITCH] = 0;
angles[ROLL] = 0;
AngleVectors(angles, forward, right, up);
VectorMA(cg.refdef.vieworg, dist, forward, endpos);
VectorMA(endpos, trap_Cvar_VariableValue("vr_hudYOffset") / 20, up, endpos);
}
else
{
//Lock to face
VectorMA(cg.refdef.vieworg, dist, cg.refdef.viewaxis[0], endpos);
}
angles[YAW] = viewYaw + RAD2DEG(atan2(hmd_yaw_y, hmd_yaw_x));
angles[PITCH] = 0;
angles[ROLL] = 0;
AngleVectors(angles, forward, right, up);
VectorMA(cg.refdef.vieworg, dist, forward, endpos);
VectorMA(endpos, trap_Cvar_VariableValue("vr_hudYOffset") / 20, up, endpos);
memset(&ent, 0, sizeof(ent));
ent.reType = RT_SPRITE;

View File

@ -534,7 +534,9 @@ CG_RailTrail
==========================
*/
void CG_RailTrail (clientInfo_t *ci, vec3_t start, vec3_t end) {
vec3_t axis[36], move, move2, vec, temp;
#define NUM_PARTICLE_PER_ROTATION 18
vec3_t axis[NUM_PARTICLE_PER_ROTATION], move, move2, vec, vec2, temp;
float len;
int i, j, skip;
@ -586,33 +588,35 @@ void CG_RailTrail (clientInfo_t *ci, vec3_t start, vec3_t end) {
VectorSubtract (end, start, vec);
len = VectorNormalize (vec);
PerpendicularVector(temp, vec);
for (i = 0 ; i < 36; i++)
for (i = 0 ; i < NUM_PARTICLE_PER_ROTATION; i++)
{
RotatePointAroundVector(axis[i], vec, temp, i * 10);//banshee 2.4 was 10
RotatePointAroundVector(axis[i], vec, temp, i * (360.0f / NUM_PARTICLE_PER_ROTATION));//banshee 2.4 was 10
}
VectorMA(move, 20, vec, move);
VectorScale (vec, SPACING, vec);
VectorMA(move, (360.0f / NUM_PARTICLE_PER_ROTATION), vec, move);
VectorScale (vec, SPACING, vec2);
skip = -1;
j = 18;
for (i = 0; i < len; i += SPACING)
j = 0;
int spacing = SPACING;
for (i = 0; i < len; i += spacing, spacing++)
{
if (i != skip)
{
skip = i + SPACING;
VectorScale (vec, spacing, vec2);
skip = i + spacing;
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leFlags = LEF_PUFF_DONT_SCALE;
le->leType = LE_MOVE_SCALE_FADE;
le->startTime = cg.time;
le->endTime = cg.time + (i>>1) + 600;
le->endTime = cg.time + (i>>1) + 500;
le->lifeRate = 1.0 / (le->endTime - le->startTime);
re->shaderTime = cg.time / 1000.0f;
re->reType = RT_SPRITE;
re->radius = 1.1f;
re->radius = 1.2f;
re->customShader = cgs.media.railRingsShader;
re->shaderRGBA[0] = ci->color2[0] * 255;
@ -637,9 +641,9 @@ void CG_RailTrail (clientInfo_t *ci, vec3_t start, vec3_t end) {
le->pos.trDelta[2] = axis[j][2]*6;
}
VectorAdd (move, vec, move);
VectorAdd (move, vec2, move);
j = (j + ROTATION) % 36;
j = (j + ROTATION) % NUM_PARTICLE_PER_ROTATION;
}
}