X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Favatar.cc;h=737d3a6e07cccbc2f0bd6cfed56f6389115e25bf;hp=0986d8a9a879492a8afed86239f01e220c82d50a;hb=01d6ef175190e649ecf7deb298f34f0e9bd3233e;hpb=2829b50d6b3d9e97fc9399f5b6929f7d64021366 diff --git a/src/avatar.cc b/src/avatar.cc index 0986d8a..737d3a6 100644 --- a/src/avatar.cc +++ b/src/avatar.cc @@ -2,6 +2,89 @@ Avatar::Avatar() { + mode = 0; body_rot = 0; head_alt = 0; } + +void Avatar::set_tracking_mode(unsigned int mode) +{ + this->mode = mode; +} + +unsigned int Avatar::get_tracking_mode() const +{ + return mode; +} + +void Avatar::set_position(const Vec3 &p) +{ + pos = p; +} + +const Vec3 &Avatar::get_position() const +{ + return pos; +} + +void Avatar::set_body_rotation(float rot) +{ + body_rot = rot; +} + +float Avatar::get_body_rotation() const +{ + return body_rot; +} + +const Vec3 &Avatar::get_body_fwd() const +{ + return fwd; +} + +const Vec3 &Avatar::get_body_right() const +{ + return right; +} + +const Quat &Avatar::get_head_rotation() const +{ + return head_rot; +} + +void Avatar::tracked_head_rotation(const Quat &q) +{ + head_rot = q; +} + +// TODO maybe transform from head-relative first +void Avatar::tracked_hand_position(int hand, const Vec3 &p) +{ + hand_pos[hand] = p; +} + +// TODO maybe transform from head-relative first +void Avatar::tracked_hand_rotation(int hand, const Quat &q) +{ + hand_rot[hand] = q; +} + +void Avatar::mouselook(float horiz, float vert) +{ + body_rot += horiz; + head_alt += vert; + if(head_alt > M_PI / 2.0) head_alt = M_PI / 2.0; + if(head_alt < -M_PI / 2.0) head_alt = -M_PI / 2.0; +} + +Vec3 Avatar::calc_walk_dir(float fwd, float right) const +{ + // TODO + return Vec3(0, 0, 0); +} + +void Avatar::walk(float fwd, float right) +{ + Vec3 wdir = calc_walk_dir(fwd, right); + pos += wdir; +}