bunch of const changes for glm::vec3 in Avatar and Orientation

This commit is contained in:
Stephen Birarda 2013-04-25 16:10:55 -07:00
parent 8370fd2d19
commit 215efe3b78
4 changed files with 18 additions and 57 deletions

View file

@ -557,11 +557,6 @@ float Avatar::getHeight() {
return COLLISION_HEIGHT; return COLLISION_HEIGHT;
} }
glm::vec3 Avatar::getBodyUpDirection() {
return _orientation.getUp();
}
// This is a workspace for testing avatar body collision detection and response // This is a workspace for testing avatar body collision detection and response
void Avatar::updateAvatarCollisionDetectionAndResponse(glm::vec3 collisionPosition, void Avatar::updateAvatarCollisionDetectionAndResponse(glm::vec3 collisionPosition,
float collisionGirth, float collisionGirth,
@ -1028,49 +1023,15 @@ void Avatar::updateBodySprings( float deltaTime ) {
} }
} }
glm::vec3 Avatar::getHeadLookatDirection() { const glm::vec3& Avatar::getHeadPosition() const {
return glm::vec3
(
_orientation.getFront().x,
_orientation.getFront().y,
_orientation.getFront().z
);
}
glm::vec3 Avatar::getHeadLookatDirectionUp() {
return glm::vec3
(
_orientation.getUp().x,
_orientation.getUp().y,
_orientation.getUp().z
);
}
glm::vec3 Avatar::getHeadLookatDirectionRight() {
return glm::vec3
(
_orientation.getRight().x,
_orientation.getRight().y,
_orientation.getRight().z
);
}
glm::vec3 Avatar::getHeadPosition() {
if ( _usingBodySprings ) { if (_usingBodySprings) {
return _bone[ AVATAR_BONE_HEAD ].springyPosition; return _bone[ AVATAR_BONE_HEAD ].springyPosition;
} }
return _bone[ AVATAR_BONE_HEAD ].position; return _bone[ AVATAR_BONE_HEAD ].position;
} }
glm::vec3 Avatar::getBonePosition( AvatarBoneID b ) {
return _bone[b].position;
}
void Avatar::updateHandMovement( float deltaTime ) { void Avatar::updateHandMovement( float deltaTime ) {
glm::vec3 transformedHandMovement; glm::vec3 transformedHandMovement;

View file

@ -178,12 +178,12 @@ class Avatar : public AvatarData {
float getBodyYaw() {return _bodyYaw;}; float getBodyYaw() {return _bodyYaw;};
void addBodyYaw(float y) {_bodyYaw += y;}; void addBodyYaw(float y) {_bodyYaw += y;};
glm::vec3 getHeadLookatDirection(); const glm::vec3& getHeadLookatDirection() const { return _orientation.getFront(); };
glm::vec3 getHeadLookatDirectionUp(); const glm::vec3& getHeadLookatDirectionUp() const { return _orientation.getUp(); };
glm::vec3 getHeadLookatDirectionRight(); const glm::vec3& getHeadLookatDirectionRight() const { return _orientation.getRight(); };
glm::vec3 getHeadPosition(); const glm::vec3& getHeadPosition() const ;
glm::vec3 getBonePosition( AvatarBoneID b ); const glm::vec3& getBonePosition(AvatarBoneID b) const { return _bone[b].position; };
glm::vec3 getBodyUpDirection(); const glm::vec3& getBodyUpDirection() const { return _orientation.getUp(); };
float getGirth(); float getGirth();
float getHeight(); float getHeight();

View file

@ -278,9 +278,9 @@ void drawGroundPlaneGrid( float size, int resolution )
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) { void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) {
glm::vec3 pRight = position + orientation.right * size; glm::vec3 pRight = position + orientation.getRight() * size;
glm::vec3 pUp = position + orientation.up * size; glm::vec3 pUp = position + orientation.getUp() * size;
glm::vec3 pFront = position + orientation.front * size; glm::vec3 pFront = position + orientation.getFront() * size;
glColor3f( 1.0f, 0.0f, 0.0f ); glColor3f( 1.0f, 0.0f, 0.0f );
glBegin( GL_LINE_STRIP ); glBegin( GL_LINE_STRIP );

View file

@ -25,6 +25,10 @@ private:
float _pitch; float _pitch;
float _roll; float _roll;
glm::vec3 right;
glm::vec3 up;
glm::vec3 front;
void update(); // actually updates the vectors from yaw, pitch, roll void update(); // actually updates the vectors from yaw, pitch, roll
public: public:
@ -41,13 +45,9 @@ public:
void set( Orientation ); void set( Orientation );
void setToIdentity(); void setToIdentity();
glm::vec3 right; const glm::vec3& getRight() const { return right; }
glm::vec3 up; const glm::vec3& getUp() const { return up; }
glm::vec3 front; const glm::vec3& getFront() const { return front; }
glm::vec3 getRight() { return right; }
glm::vec3 getUp() { return up; }
glm::vec3 getFront() { return front; }
void setRightUpFront( const glm::vec3 &, const glm::vec3 &, const glm::vec3 & ); void setRightUpFront( const glm::vec3 &, const glm::vec3 &, const glm::vec3 & );