move Avatar goHome to Avatar slot

This commit is contained in:
Stephen Birarda 2013-08-15 11:36:12 -07:00
parent ce3afbcb32
commit bbe239694e
5 changed files with 20 additions and 21 deletions

View file

@ -72,11 +72,6 @@ static char STAR_CACHE_FILE[] = "cachedStars.txt";
static const int BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH = 6; // farther dragged clicks are ignored
// Where one's own Avatar begins in the world (will be overwritten if avatar data file is found)
// this is basically in the center of the ground plane. Slightly adjusted. This was asked for by
// Grayson as he's building a street around here for demo dinner 2
const glm::vec3 START_LOCATION(0.485f * TREE_SCALE, 0.f, 0.5f * TREE_SCALE);
const int IDLE_SIMULATE_MSECS = 16; // How often should call simulate and other stuff
// in the idle loop? (60 FPS is default)
static QTimer* idleTimer = NULL;
@ -3365,12 +3360,6 @@ void Application::eyedropperVoxelUnderCursor() {
}
}
void Application::goHome() {
qDebug("Going Home!\n");
_myAvatar.setPosition(START_LOCATION);
}
void Application::toggleFollowMode() {
glm::vec3 mouseRayOrigin, mouseRayDirection;
_viewFrustum.computePickRay(_pieMenu.getX() / (float)_glWidget->width(),

View file

@ -187,7 +187,6 @@ private slots:
void renderCoverageMapsV2Recursively(CoverageMapV2* map);
glm::vec2 getScaledScreenPoint(glm::vec2 projectedPoint);
void goHome();
void toggleFollowMode();

View file

@ -110,7 +110,11 @@ Menu::Menu() :
appInstance->getWebcam()->getGrabber(),
SLOT(setDepthOnly(bool)));
addActionToQMenuAndActionHash(optionsMenu, MenuOption::GoHome, Qt::CTRL | Qt::Key_G, appInstance, SLOT(goHome()));
addActionToQMenuAndActionHash(optionsMenu,
MenuOption::GoHome,
Qt::CTRL | Qt::Key_G,
appInstance->getAvatar(),
SLOT(goHome()));
QMenu* audioMenu = addMenu("Audio");
addCheckableActionToQMenuAndActionHash(audioMenu, MenuOption::EchoAudio);

View file

@ -1654,6 +1654,11 @@ void Avatar::renderJointConnectingCone(glm::vec3 position1, glm::vec3 position2,
glEnd();
}
void Avatar::goHome() {
qDebug("Going Home!\n");
setPosition(START_LOCATION);
}
void Avatar::setNewScale(const float scale) {
_newScale = scale;
}

View file

@ -58,8 +58,7 @@ const float BODY_BALL_RADIUS_RIGHT_KNEE = 0.025;
const float BODY_BALL_RADIUS_RIGHT_HEEL = 0.025;
const float BODY_BALL_RADIUS_RIGHT_TOES = 0.025;
enum AvatarBodyBallID
{
enum AvatarBodyBallID {
BODY_BALL_NULL = -1,
BODY_BALL_PELVIS,
BODY_BALL_TORSO,
@ -91,8 +90,7 @@ enum AvatarBodyBallID
NUM_AVATAR_BODY_BALLS
};
enum DriveKeys
{
enum DriveKeys {
FWD = 0,
BACK,
LEFT,
@ -104,16 +102,14 @@ enum DriveKeys
MAX_DRIVE_KEYS
};
enum AvatarMode
{
enum AvatarMode {
AVATAR_MODE_STANDING = 0,
AVATAR_MODE_WALKING,
AVATAR_MODE_INTERACTING,
NUM_AVATAR_MODES
};
enum ScreenTintLayer
{
enum ScreenTintLayer {
SCREEN_TINT_BEFORE_LANDSCAPE = 0,
SCREEN_TINT_BEFORE_AVATARS,
SCREEN_TINT_BEFORE_MY_AVATAR,
@ -121,6 +117,11 @@ enum ScreenTintLayer
NUM_SCREEN_TINT_LAYERS
};
// Where one's own Avatar begins in the world (will be overwritten if avatar data file is found)
// this is basically in the center of the ground plane. Slightly adjusted. This was asked for by
// Grayson as he's building a street around here for demo dinner 2
const glm::vec3 START_LOCATION(0.485f * TREE_SCALE, 0.f, 0.5f * TREE_SCALE);
class Avatar : public AvatarData {
Q_OBJECT
public:
@ -213,6 +214,7 @@ public:
public slots:
void setWantCollisionsOn(bool wantCollisionsOn) { _isCollisionsOn = wantCollisionsOn; }
void goHome();
private:
// privatize copy constructor and assignment operator to avoid copying