mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-29 06:07:57 +03:00
Calculate sr/cr only if right or up is specified
This commit is contained in:
parent
89133bf05d
commit
0147677412
1 changed files with 19 additions and 15 deletions
|
@ -2069,9 +2069,6 @@ void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up
|
||||||
angle = angles[ PITCH ] * ( M_PI * 2 / 360 );
|
angle = angles[ PITCH ] * ( M_PI * 2 / 360 );
|
||||||
sp = sin( angle );
|
sp = sin( angle );
|
||||||
cp = cos( angle );
|
cp = cos( angle );
|
||||||
angle = angles[ ROLL ] * ( M_PI * 2 / 360 );
|
|
||||||
sr = sin( angle );
|
|
||||||
cr = cos( angle );
|
|
||||||
|
|
||||||
if( forward )
|
if( forward )
|
||||||
{
|
{
|
||||||
|
@ -2079,17 +2076,24 @@ void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up
|
||||||
forward[ 1 ] = cp*sy;
|
forward[ 1 ] = cp*sy;
|
||||||
forward[ 2 ] = -sp;
|
forward[ 2 ] = -sp;
|
||||||
}
|
}
|
||||||
if( right )
|
if ( right || up )
|
||||||
{
|
{
|
||||||
right[ 0 ] = ( -1 * sr*sp*cy + -1 * cr*-sy );
|
angle = angles[ ROLL ] * ( M_PI * 2 / 360 );
|
||||||
right[ 1 ] = ( -1 * sr*sp*sy + -1 * cr*cy );
|
sr = sin( angle );
|
||||||
right[ 2 ] = -1 * sr*cp;
|
cr = cos( angle );
|
||||||
|
|
||||||
|
if ( right )
|
||||||
|
{
|
||||||
|
right[ 0 ] = ( -1 * sr * sp * cy + -1 * cr * -sy );
|
||||||
|
right[ 1 ] = ( -1 * sr * sp * sy + -1 * cr * cy );
|
||||||
|
right[ 2 ] = -1 * sr * cp;
|
||||||
}
|
}
|
||||||
if( up )
|
if ( up )
|
||||||
{
|
{
|
||||||
up[ 0 ] = ( cr*sp*cy + -sr*-sy );
|
up[ 0 ] = ( cr * sp * cy + -sr * -sy );
|
||||||
up[ 1 ] = ( cr*sp*sy + -sr*cy );
|
up[ 1 ] = ( cr * sp * sy + -sr * cy );
|
||||||
up[ 2 ] = cr*cp;
|
up[ 2 ] = cr * cp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue