afVec3n.h
资源名称:AirForce.rar [点击查看]
上传用户:kaiguan
上传日期:2007-10-28
资源大小:1074k
文件大小:1k
源码类别:
其他游戏
开发平台:
Visual C++
- #ifndef AF_VEC3N
- #define AF_VEC3N
- #include "afVec3.h"
- /// 3D normalized vector class
- class afVec3n : public afVec3
- {
- public:
- bool valid;
- //constructors
- afVec3n() { x=y=0.0f;z=1.0f; valid = true; }
- afVec3n(float nX, float nY, float nZ) { set(nX,nY,nZ); }
- afVec3n(const afVec3n& tocopy) { *this = tocopy;}
- afVec3n(const afVec3& tocopy, bool nNormaize=true) { if(nNormaize) set(tocopy.x,tocopy.y,tocopy.z); else setNoNorm(tocopy.x,tocopy.y,tocopy.z); }
- bool
- isValid() const { return valid; }
- void
- set(float nX, float nY, float nZ);
- // setNoNorm lets you specify a unit vector
- // without normalization
- void
- setNoNorm(float nX, float nY, float nZ) { x = nX; y = nY; z = nZ; valid = true; }
- inline afVec3n&
- operator=(const afVec3n&);
- const afVec3n&
- getDifferentVector() const;
- //standard vectors
- static afVec3n ORIGIN;
- static afVec3n FRONT;
- static afVec3n BACK;
- static afVec3n LEFT;
- static afVec3n RIGHT;
- static afVec3n UP;
- static afVec3n DOWN;
- };
- typedef afVec3n *afVec3nPtr;
- inline afVec3n&
- afVec3n::operator=(const afVec3n& other)
- {
- x = other.x;
- y = other.y;
- z = other.z;
- valid = other.valid;
- return *this;
- }
- #endif