Skip to content

Commit 077da04

Browse files
committed
Use operator = instead of TransCopy
1 parent 58a11b1 commit 077da04

File tree

5 files changed

+8
-19
lines changed

5 files changed

+8
-19
lines changed

src/engine/qcommon/q_math.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,12 +3199,6 @@ void TransInit( transform_t *t )
31993199
t->scale = 1.0f;
32003200
}
32013201

3202-
// copy a transform
3203-
void TransCopy( const transform_t *in, transform_t *out )
3204-
{
3205-
memcpy( out, in, sizeof( transform_t ) );
3206-
}
3207-
32083202
// apply a transform to a point
32093203
void TransformPoint( const transform_t *t, const vec3_t in, vec3_t out )
32103204
{
@@ -3334,7 +3328,7 @@ void TransAddTranslation( const vec3_t vec, transform_t *t )
33343328
void TransCombine( const transform_t *a, const transform_t *b,
33353329
transform_t *out )
33363330
{
3337-
TransCopy( a, out );
3331+
*out = *a;
33383332

33393333
TransAddRotationQuat( b->rot, out );
33403334
TransAddScale( b->scale, out );
@@ -3345,15 +3339,15 @@ void TransCombine( const transform_t *a, const transform_t *b,
33453339
void TransInverse( const transform_t *in, transform_t *out )
33463340
{
33473341
quat_t inverse;
3348-
static transform_t tmp; // static for proper alignment in QVMs
3342+
transform_t tmp;
33493343

33503344
TransInit( &tmp );
33513345
VectorNegate( in->trans, tmp.trans );
33523346
TransAddScale( 1.0f / in->scale, &tmp );
33533347
QuatCopy( in->rot, inverse );
33543348
QuatInverse( inverse );
33553349
TransAddRotationQuat( inverse, &tmp );
3356-
TransCopy( &tmp, out );
3350+
*out = tmp;
33573351
}
33583352

33593353
// lerp between transforms

src/engine/qcommon/q_shared.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,10 +1274,6 @@ inline vec_t VectorNormalize2( const vec3_t v, vec3_t out )
12741274
t->sseRot = u;
12751275
t->sseTransScale = u;
12761276
}
1277-
inline void TransCopy( const transform_t *in, transform_t *out ) {
1278-
out->sseRot = in->sseRot;
1279-
out->sseTransScale = in->sseTransScale;
1280-
}
12811277
inline void TransformPoint(
12821278
const transform_t *t, const vec3_t in, vec3_t out ) {
12831279
__m128 ts = t->sseTransScale;
@@ -1426,7 +1422,6 @@ inline vec_t VectorNormalize2( const vec3_t v, vec3_t out )
14261422
#else
14271423
// The non-SSE variants are in q_math.cpp file.
14281424
void TransInit( transform_t *t );
1429-
void TransCopy( const transform_t *in, transform_t *out );
14301425

14311426
void TransformPoint( const transform_t *t, const vec3_t in, vec3_t out );
14321427
void TransformPointInverse( const transform_t *t, const vec3_t in, vec3_t out );

src/engine/renderer/tr_animation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ int RE_BlendSkeleton( refSkeleton_t *skel, const refSkeleton_t *blend, float fra
14971497
TransAddWeight( frac, &blend->bones[ i ].t, &trans );
14981498
TransEndLerp( &trans );
14991499

1500-
TransCopy( &trans, &skel->bones[ i ].t );
1500+
skel->bones[ i ].t = trans;
15011501
}
15021502

15031503
// calculate a bounding box in the current coordinate system

src/engine/renderer/tr_surface.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ static void Tess_SurfaceMD5( md5Surface_t *srf )
10021002
for ( ; bone < lastBone; bone++,
10031003
modelBone++ )
10041004
{
1005-
TransCopy( &modelBone->joint, bone );
1005+
*bone = modelBone->joint;
10061006
TransInsScale( modelScale, bone );
10071007
}
10081008
}
@@ -1149,7 +1149,7 @@ void Tess_SurfaceIQM( srfIQModel_t *surf ) {
11491149
for ( ; bone < lastBone; bone++,
11501150
modelJoint++ )
11511151
{
1152-
TransCopy( modelJoint, bone );
1152+
*bone = *modelJoint;
11531153
TransInsScale( modelScale, bone );
11541154
}
11551155
}
@@ -1491,7 +1491,7 @@ static void Tess_SurfaceVBOMD5Mesh( srfVBOMD5Mesh_t *srf )
14911491
for ( ; bone < lastBone; bone++,
14921492
modelBone++ )
14931493
{
1494-
TransCopy( &modelBone->joint, bone );
1494+
*bone = modelBone->joint;
14951495
TransInsScale( modelScale, bone );
14961496
}
14971497
}

src/shared/client/cg_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ int trap_R_BlendSkeleton( refSkeleton_t *skel, const refSkeleton_t *blend, float
528528
TransAddWeight( frac, &blend->bones[ i ].t, &trans );
529529
TransEndLerp( &trans );
530530

531-
TransCopy( &trans, &skel->bones[ i ].t );
531+
skel->bones[ i ].t = trans;
532532
}
533533

534534
// calculate a bounding box in the current coordinate system

0 commit comments

Comments
 (0)