Changeset 1270
 Timestamp:
 Apr 22, 2012, 3:03:54 PM (9 years ago)
 Location:
 trunk/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/lol/math/vector.h
r1264 r1270 1562 1562 static Mat4<T> translate(T x, T y, T z); 1563 1563 static Mat4<T> translate(Vec3<T> v); 1564 static Mat4<T> rotate(T angle, T x, T y, T z);1565 static Mat4<T> rotate(T angle, Vec3<T> v);1566 static Mat4<T> rotate(Quat<T> q);1567 1564 1568 1565 static inline Mat4<T> translate(Mat4<T> const &mat, Vec3<T> v) 1569 1566 { 1570 1567 return translate(v) * mat; 1568 } 1569 1570 static inline Mat4<T> rotate(T angle, T x, T y, T z) 1571 { 1572 return Mat4<T>(Mat3<T>::rotate(angle, x, y, z), (T)1); 1573 } 1574 1575 static inline Mat4<T> rotate(T angle, Vec3<T> v) 1576 { 1577 return Mat4<T>(Mat3<T>::rotate(angle, v), (T)1); 1578 } 1579 1580 static inline Mat4<T> rotate(Quat<T> q) 1581 { 1582 return Mat4<T>(Mat3<T>::rotate(q), (T)1); 1571 1583 } 1572 1584 
trunk/src/math/vector.cpp
r1257 r1270 321 321 } 322 322 323 template<> mat4 mat4::rotate(float angle, float x, float y, float z) 323 template<> mat2 mat2::rotate(float angle) 324 { 325 angle *= (M_PI / 180.0f); 326 327 float st = sinf(angle); 328 float ct = cosf(angle); 329 330 mat2 ret; 331 332 ret[0][0] = ct; 333 ret[0][1] = st; 334 335 ret[1][0] = st; 336 ret[1][1] = ct; 337 338 return ret; 339 } 340 341 template<> mat3 mat3::rotate(float angle, float x, float y, float z) 324 342 { 325 343 angle *= (M_PI / 180.0f); … … 338 356 float mtz = (1.0f  ct) * z; 339 357 340 mat 4 ret(1.0f);358 mat3 ret; 341 359 342 360 ret[0][0] = x * mtx + ct; … … 355 373 } 356 374 357 template<> mat 4 mat4::rotate(float angle, vec3 v)375 template<> mat3 mat3::rotate(float angle, vec3 v) 358 376 { 359 377 return rotate(angle, v.x, v.y, v.z); 360 378 } 361 379 362 template<> mat4 mat4::rotate(quat q) 363 { 364 mat4 ret(1.0f); 380 template<> mat3 mat3::rotate(quat q) 381 { 365 382 float n = norm(q); 366 383 367 384 if (!n) 368 return ret; 369 385 return mat3(1.0f); 386 387 mat3 ret; 370 388 float s = 2.0f / n; 371 389
Note: See TracChangeset
for help on using the changeset viewer.