Skip to content

Commit

Permalink
Use VectorRotate() macro in more places.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet committed Oct 12, 2024
1 parent 13c2c9b commit 61324ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 3 additions & 5 deletions src/common/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,12 @@ void SetupRotationMatrix(vec3_t matrix[3], const vec3_t dir, float degrees)
void RotatePointAroundVector(vec3_t out, const vec3_t dir, const vec3_t in, float degrees)
{
vec3_t matrix[3];
vec3_t tmp;
vec3_t temp;

SetupRotationMatrix(matrix, dir, degrees);

VectorCopy(in, tmp);
out[0] = DotProduct(tmp, matrix[0]);
out[1] = DotProduct(tmp, matrix[1]);
out[2] = DotProduct(tmp, matrix[2]);
VectorCopy(in, temp);
VectorRotate(temp, matrix, out);
}

#if USE_MD5
Expand Down
8 changes: 2 additions & 6 deletions src/refresh/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ static void GL_TransformLights(const mmodel_t *model)

for (i = 0, light = glr.fd.dlights; i < glr.fd.num_dlights; i++, light++) {
VectorSubtract(light->origin, glr.ent->origin, temp);
light->transformed[0] = DotProduct(temp, glr.entaxis[0]);
light->transformed[1] = DotProduct(temp, glr.entaxis[1]);
light->transformed[2] = DotProduct(temp, glr.entaxis[2]);
VectorRotate(temp, glr.entaxis, light->transformed);
GL_MarkLights_r(model->headnode, light, BIT_ULL(i));
}
}
Expand Down Expand Up @@ -425,9 +423,7 @@ void GL_DrawBspModel(mmodel_t *model)
}
}
VectorSubtract(glr.fd.vieworg, ent->origin, temp);
transformed[0] = DotProduct(temp, glr.entaxis[0]);
transformed[1] = DotProduct(temp, glr.entaxis[1]);
transformed[2] = DotProduct(temp, glr.entaxis[2]);
VectorRotate(temp, glr.entaxis, transformed);
} else {
VectorAdd(model->mins, ent->origin, bounds[0]);
VectorAdd(model->maxs, ent->origin, bounds[1]);
Expand Down

0 comments on commit 61324ff

Please sign in to comment.