Goldsrc MathLib

本文探讨了Goldsrc MathLib的相关内容,重点介绍了参考仓库FWGS/regamelite, rpasta42/csgo, sharplife和xash,并提及了Matrix模块。" 115610219,5877516,寻找数组的最大值与次大值算法,"['算法', '数据结构', '编程', '数组处理']
摘要由CSDN通过智能技术生成

reference repos

FWGS/regamelite
rpasta42/csgo
sharplife
xash

Matrix

void AngleQuaternion(float* angles, float* quaternion)
{
   
	float sy, cy, sp_, cp;
	float angle;
	float sr, cr;

	float ftmp0;
	float ftmp1;
	float ftmp2;

	angle = angles[ROLL] * 0.5;
	sy = sin(angle);
	cy = cos(angle);

	angle = angles[YAW] * 0.5;
	sp_ = sin(angle);
	cp = cos(angle);

	angle = angles[PITCH] * 0.5;
	sr = sin(angle);
	cr = cos(angle);

	ftmp0 = sr * cp;
	ftmp1 = cr * sp_;

	*quaternion = ftmp0 * cy - ftmp1 * sy;
	quaternion[1] = ftmp1 * cy + ftmp0 * sy;

	ftmp2 = cr * cp;
	quaternion[2] = ftmp2 * sy - sp_ * sr * cy;
	quaternion[3] = sp_ * sr * sy + ftmp2 * cy;
} 

void QuaternionMatrix(vec_t *quaternion, float (*matrix)[4])
{
   
	matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];
	matrix[1][0] = 2.0 * quaternion[0] * quaternion[1] + 2.0 * quaternion[3] * quaternion[2];
	matrix[2]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值