From 1ba1b56b2c406a03828b6b79d79529f9eb53a712 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 17 May 2013 12:15:19 -0700 Subject: [PATCH] disallow copying of Avatar objects --- interface/src/Avatar.cpp | 62 ---------------------------------------- interface/src/Avatar.h | 7 +++-- 2 files changed, 4 insertions(+), 65 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 954a4a38bc..704deaf9fe 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -58,7 +58,6 @@ bool usingBigSphereCollisionTest = true; float chatMessageScale = 0.0015; float chatMessageHeight = 0.45; - Avatar::Avatar(bool isMine) { _orientation.setToIdentity(); @@ -107,49 +106,6 @@ Avatar::Avatar(bool isMine) { else { _balls = NULL; } } -Avatar::Avatar(const Avatar &otherAvatar) : _head(otherAvatar._head) { //include the copy constructor for head - - _velocity = otherAvatar._velocity; - _thrust = otherAvatar._thrust; - _rotation = otherAvatar._rotation; - _bodyYaw = otherAvatar._bodyYaw; - _bodyPitch = otherAvatar._bodyPitch; - _bodyRoll = otherAvatar._bodyRoll; - _bodyPitchDelta = otherAvatar._bodyPitchDelta; - _bodyYawDelta = otherAvatar._bodyYawDelta; - _bodyRollDelta = otherAvatar._bodyRollDelta; - _mousePressed = otherAvatar._mousePressed; - _mode = otherAvatar._mode; - _isMine = otherAvatar._isMine; - _renderYaw = otherAvatar._renderYaw; - _maxArmLength = otherAvatar._maxArmLength; - _transmitterTimer = otherAvatar._transmitterTimer; - _transmitterIsFirstData = otherAvatar._transmitterIsFirstData; - _transmitterTimeLastReceived = otherAvatar._transmitterTimeLastReceived; - _transmitterHz = otherAvatar._transmitterHz; - _transmitterInitialReading = otherAvatar._transmitterInitialReading; - _transmitterPackets = otherAvatar._transmitterPackets; - _isTransmitterV2Connected = otherAvatar._isTransmitterV2Connected; - _TEST_bigSphereRadius = otherAvatar._TEST_bigSphereRadius; - _TEST_bigSpherePosition = otherAvatar._TEST_bigSpherePosition; - _movedHandOffset = otherAvatar._movedHandOffset; - - _orientation.set(otherAvatar._orientation); - - initializeSkeleton(); - - for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = otherAvatar._driveKeys[i]; - - _distanceToNearestAvatar = otherAvatar._distanceToNearestAvatar; - - initializeSkeleton(); - -} - -Avatar* Avatar::clone() const { - return new Avatar(*this); -} - void Avatar::reset() { _headPitch = _headYaw = _headRoll = 0; _head.leanForward = _head.leanSideways = 0; @@ -460,8 +416,6 @@ void Avatar::simulate(float deltaTime) { } } - - void Avatar::checkForMouseRayTouching() { for (int b = 0; b < NUM_AVATAR_JOINTS; b++) { @@ -477,13 +431,10 @@ void Avatar::checkForMouseRayTouching() { } } - void Avatar::setMouseRay(const glm::vec3 &origin, const glm::vec3 &direction ) { _mouseRayOrigin = origin; _mouseRayDirection = direction; } - - void Avatar::updateHandMovementAndTouching(float deltaTime) { // reset hand and arm positions according to hand movement @@ -600,12 +551,10 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) { } } - float Avatar::getHeight() { return _height; } - void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float deltaTime) { float myBodyApproximateBoundingRadius = 1.0f; glm::vec3 vectorFromMyBodyToBigSphere(_position - position); @@ -644,9 +593,6 @@ void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float d } } - - - void Avatar::updateAvatarCollisions(float deltaTime) { // Reset detector for nearest avatar @@ -677,9 +623,6 @@ void Avatar::updateAvatarCollisions(float deltaTime) { } } - - - //detect collisions with other avatars and respond void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) { @@ -735,8 +678,6 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime otherAvatar->_velocity *= bodyMomentum; } - - void Avatar::setDisplayingHead(bool displayingHead) { _displayingHead = displayingHead; } @@ -1136,9 +1077,6 @@ glm::vec3 Avatar::getApproximateEyePosition() { return _head.getApproximateEyePosition(); } - - - void Avatar::updateArmIKAndConstraints(float deltaTime) { // determine the arm vector diff --git a/interface/src/Avatar.h b/interface/src/Avatar.h index a3f46cc542..303aca66f6 100644 --- a/interface/src/Avatar.h +++ b/interface/src/Avatar.h @@ -76,9 +76,7 @@ enum AvatarJointID class Avatar : public AvatarData { public: Avatar(bool isMine); - Avatar(const Avatar &otherAvatar); - Avatar* clone() const; - + void reset(); void updateHeadFromGyros(float frametime, SerialInterface * serialInterface, glm::vec3 * gravity); void updateFromMouse(int mouseX, int mouseY, int screenWidth, int screenHeight); @@ -139,6 +137,9 @@ public: void readAvatarDataFromFile(); private: + // privatize copy constructor and assignment operator to avoid copying + Avatar(const Avatar&); + Avatar& operator= (const Avatar&); struct AvatarJoint {