Remove unused members (Mostly mouse stuff)

This commit is contained in:
Atlante45 2015-10-02 19:42:06 -07:00
parent 35e2f8cd89
commit 60ebd3a544
3 changed files with 69 additions and 204 deletions

View file

@ -11,8 +11,6 @@
#include "Application.h"
#include <sstream>
#include <glm/glm.hpp>
#include <glm/gtx/component_wise.hpp>
#include <glm/gtx/quaternion.hpp>
@ -363,10 +361,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
_scaleMirror(1.0f),
_rotateMirror(0.0f),
_raiseMirror(0.0f),
_lastMouseMove(usecTimestampNow()),
_lastMouseMoveWasSimulated(false),
_isTouchPressed(false),
_mousePressed(false),
_enableProcessOctreeThread(true),
_runningScriptsWidget(NULL),
_runningScriptsWidgetWasVisible(false),
@ -1724,7 +1719,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (!event->isAutoRepeat()) {
// this starts an HFActionEvent
HFActionEvent startActionEvent(HFActionEvent::startType(),
computePickRay(getTrueMouseX(), getTrueMouseY()));
computePickRay(getTrueMouse().x, getTrueMouse().y));
sendEvent(this, &startActionEvent);
}
@ -1775,7 +1770,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
if (!event->isAutoRepeat()) {
// this ends the HFActionEvent
HFActionEvent endActionEvent(HFActionEvent::endType(),
computePickRay(getTrueMouseX(), getTrueMouseY()));
computePickRay(getTrueMouse().x, getTrueMouse().y));
sendEvent(this, &endActionEvent);
}
break;
@ -1817,9 +1812,6 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
PROFILE_RANGE(__FUNCTION__);
// Used by application overlay to determine how to draw cursor(s)
_lastMouseMoveWasSimulated = deviceID > 0;
if (!_lastMouseMoveWasSimulated) {
_lastMouseMove = usecTimestampNow();
}
if (_aboutToQuit) {
return;
@ -1897,9 +1889,6 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
}
if (event->button() == Qt::LeftButton) {
_mouseDragStarted = getTrueMouse();
_mousePressed = true;
// nobody handled this - make it an action event on the _window object
HFActionEvent actionEvent(HFActionEvent::startType(),
computePickRay(event->x(), event->y()));
@ -1955,8 +1944,6 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
}
if (event->button() == Qt::LeftButton) {
_mousePressed = false;
// fire an action end event
HFActionEvent actionEvent(HFActionEvent::endType(),
computePickRay(event->x(), event->y()));
@ -1982,24 +1969,6 @@ void Application::touchUpdateEvent(QTouchEvent* event) {
if (Menu::getInstance()->isOptionChecked(KeyboardMouseDevice::NAME)) {
_keyboardMouseDevice->touchUpdateEvent(event);
}
bool validTouch = false;
if (hasFocus()) {
const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
_touchAvg = vec2();
int numTouches = tPoints.count();
if (numTouches > 1) {
for (int i = 0; i < numTouches; ++i) {
_touchAvg += toGlm(tPoints[i].pos());
}
_touchAvg /= (float)(numTouches);
validTouch = true;
}
}
if (!_isTouchPressed) {
_touchDragStartedAvg = _touchAvg;
}
_isTouchPressed = validTouch;
}
void Application::touchBeginEvent(QTouchEvent* event) {
@ -2037,9 +2006,6 @@ void Application::touchEndEvent(QTouchEvent* event) {
}
// put any application specific touch behavior below here..
_touchDragStartedAvg = _touchAvg;
_isTouchPressed = false;
}
void Application::wheelEvent(QWheelEvent* event) {
@ -2230,19 +2196,6 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) {
InputDevice::setLowVelocityFilter(lowVelocityFilter);
}
bool Application::mouseOnScreen() const {
glm::ivec2 mousePosition = getTrueMouse();
return (glm::all(glm::greaterThanEqual(mousePosition, glm::ivec2(0))) &&
glm::all(glm::lessThanEqual(mousePosition, glm::ivec2(getCanvasSize()))));
}
ivec2 Application::getMouseDragStarted() const {
if (isHMDMode()) {
return _compositor.screenToOverlay(getTrueMouseDragStarted());
}
return getTrueMouseDragStarted();
}
ivec2 Application::getMouse() const {
if (isHMDMode()) {
return _compositor.screenToOverlay(getTrueMouse());
@ -2250,11 +2203,6 @@ ivec2 Application::getMouse() const {
return getTrueMouse();
}
ivec2 Application::getTrueMouseDragStarted() const {
return _mouseDragStarted;
}
FaceTracker* Application::getActiveFaceTracker() {
auto faceshift = DependencyManager::get<Faceshift>();
auto dde = DependencyManager::get<DdeFaceTracker>();
@ -2551,29 +2499,6 @@ void Application::updateLOD() {
}
}
void Application::updateMouseRay() {
PerformanceTimer perfTimer("mouseRay");
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateMouseRay()");
// make sure the frustum is up-to-date
loadViewFrustum(_myCamera, _viewFrustum);
PickRay pickRay = computePickRay(getTrueMouseX(), getTrueMouseY());
_mouseRayOrigin = pickRay.origin;
_mouseRayDirection = pickRay.direction;
// adjust for mirroring
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
glm::vec3 mouseRayOffset = _mouseRayOrigin - _viewFrustum.getPosition();
_mouseRayOrigin -= 2.0f * (_viewFrustum.getDirection() * glm::dot(_viewFrustum.getDirection(), mouseRayOffset) +
_viewFrustum.getRight() * glm::dot(_viewFrustum.getRight(), mouseRayOffset));
_mouseRayDirection -= 2.0f * (_viewFrustum.getDirection() * glm::dot(_viewFrustum.getDirection(), _mouseRayDirection) +
_viewFrustum.getRight() * glm::dot(_viewFrustum.getRight(), _mouseRayDirection));
}
}
// Called during Application::update immediately before AvatarManager::updateMyAvatar, updating my data that is then sent to everyone.
// (Maybe this code should be moved there?)
// The principal result is to call updateLookAtTargetAvatar() and then setLookAtPosition().
@ -2727,12 +2652,6 @@ void Application::rotationModeChanged() {
}
}
void Application::updateCamera(float deltaTime) {
PerformanceTimer perfTimer("updateCamera");
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateCamera()");
}
void Application::updateDialogs(float deltaTime) {
PerformanceTimer perfTimer("updateDialogs");
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
@ -2757,22 +2676,11 @@ void Application::updateDialogs(float deltaTime) {
}
}
void Application::updateCursor(float deltaTime) {
PerformanceTimer perfTimer("updateCursor");
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateCursor()");
static QPoint lastMousePos = QPoint();
_lastMouseMove = (lastMousePos == QCursor::pos()) ? _lastMouseMove : usecTimestampNow();
lastMousePos = QCursor::pos();
}
void Application::update(float deltaTime) {
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::update()");
updateLOD();
updateMouseRay(); // check what's under the mouse and update the mouse voxel
{
PerformanceTimer perfTimer("devices");
@ -2870,10 +2778,7 @@ void Application::update(float deltaTime) {
}
updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
updateCamera(deltaTime); // handle various camera tweaks like off axis projection
updateDialogs(deltaTime); // update various stats dialogs if present
updateCursor(deltaTime); // Handle cursor updates
{
PerformanceTimer perfTimer("physics");
@ -4334,14 +4239,6 @@ void Application::loadDefaultScripts() {
}
}
void Application::manageRunningScriptsWidgetVisibility(bool shown) {
if (_runningScriptsWidgetWasVisible && shown) {
_runningScriptsWidget->show();
} else if (_runningScriptsWidgetWasVisible && !shown) {
_runningScriptsWidget->hide();
}
}
void Application::toggleRunningScriptsWidget() {
if (_runningScriptsWidget->isVisible()) {
if (_runningScriptsWidget->hasFocus()) {
@ -4624,7 +4521,7 @@ QSize Application::getDeviceSize() const {
}
PickRay Application::computePickRay() const {
return computePickRay(getTrueMouseX(), getTrueMouseY());
return computePickRay(getTrueMouse().x, getTrueMouse().y);
}
bool Application::isThrottleRendering() const {

View file

@ -111,27 +111,6 @@ public:
void paintGL();
void resizeGL();
void resizeEvent(QResizeEvent * size);
void keyPressEvent(QKeyEvent* event);
void keyReleaseEvent(QKeyEvent* event);
void focusOutEvent(QFocusEvent* event);
void focusInEvent(QFocusEvent* event);
void mouseMoveEvent(QMouseEvent* event, unsigned int deviceID = 0);
void mousePressEvent(QMouseEvent* event, unsigned int deviceID = 0);
void mouseDoublePressEvent(QMouseEvent* event, unsigned int deviceID = 0);
void mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID = 0);
void touchBeginEvent(QTouchEvent* event);
void touchEndEvent(QTouchEvent* event);
void touchUpdateEvent(QTouchEvent* event);
void wheelEvent(QWheelEvent* event);
void dropEvent(QDropEvent* event);
void dragEnterEvent(QDragEnterEvent* event);
bool event(QEvent* event);
bool eventFilter(QObject* object, QEvent* event);
@ -162,25 +141,8 @@ public:
EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; }
EntityEditPacketSender* getEntityEditPacketSender() { return &_entityEditSender; }
bool isMousePressed() const { return _mousePressed; }
const glm::vec3& getMouseRayOrigin() const { return _mouseRayOrigin; }
const glm::vec3& getMouseRayDirection() const { return _mouseRayDirection; }
bool mouseOnScreen() const;
ivec2 getMouse() const;
ivec2 getTrueMouse() const;
ivec2 getMouseDragStarted() const;
ivec2 getTrueMouseDragStarted() const;
// TODO get rid of these and use glm types directly
int getMouseX() const { return getMouse().x; }
int getMouseY() const { return getMouse().y; }
int getTrueMouseX() const { return getTrueMouse().x; }
int getTrueMouseY() const { return getTrueMouse().y; }
int getMouseDragStartedX() const { return getMouseDragStarted().x; }
int getMouseDragStartedY() const { return getMouseDragStarted().y; }
int getTrueMouseDragStartedX() const { return getTrueMouseDragStarted().x; }
int getTrueMouseDragStartedY() const { return getTrueMouseDragStarted().y; }
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
FaceTracker* getActiveFaceTracker();
@ -199,8 +161,6 @@ public:
float getFieldOfView() { return _fieldOfView.get(); }
void setFieldOfView(float fov) { _fieldOfView.set(fov); }
bool importSVOFromURL(const QString& urlString);
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
ToolWindow* getToolWindow() { return _toolWindow ; }
@ -210,8 +170,6 @@ public:
QImage renderAvatarBillboard(RenderArgs* renderArgs);
void displaySide(RenderArgs* renderArgs, Camera& whichCamera, bool selfAvatarOnly = false, bool billboard = false);
virtual ViewFrustum* getCurrentViewFrustum() { return getDisplayViewFrustum(); }
virtual QThread* getMainThread() { return thread(); }
virtual float getSizeScale() const;
@ -237,7 +195,6 @@ public:
ScriptEngine* getScriptEngine(const QString& scriptHash) { return _scriptEnginesHash.value(scriptHash, NULL); }
float getRenderResolutionScale() const;
int getRenderAmbientLight() const;
bool isAboutToQuit() const { return _aboutToQuit; }
@ -258,7 +215,6 @@ public:
QString getScriptsLocation();
void setScriptsLocation(const QString& scriptsLocation);
void initializeAcceptedFiles();
bool canAcceptURL(const QString& url);
bool acceptURL(const QString& url);
@ -293,15 +249,6 @@ signals:
void activeDisplayPluginChanged();
public slots:
void setSessionUUID(const QUuid& sessionUUID);
void domainChanged(const QString& domainHostname);
void updateWindowTitle();
void nodeAdded(SharedNodePointer node);
void nodeKilled(SharedNodePointer node);
void packetSent(quint64 length);
void updateDisplayMode();
void updateInputModes();
QVector<EntityItemID> pasteEntities(float x, float y, float z);
bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
bool exportEntities(const QString& filename, float x, float y, float z, float scale);
@ -311,21 +258,15 @@ public slots:
void loadDialog();
void loadScriptURLDialog();
void toggleLogDialog();
bool acceptSnapshot(const QString& urlString);
bool askToSetAvatarUrl(const QString& url);
bool askToLoadScript(const QString& scriptFilenameOrURL);
ScriptEngine* loadScript(const QString& scriptFilename = QString(), bool isUserLoaded = true,
bool loadScriptFromEditor = false, bool activateMainWindow = false, bool reload = false);
void reloadScript(const QString& scriptName, bool isUserLoaded = true);
void scriptFinished(const QString& scriptName);
void stopAllScripts(bool restart = false);
bool stopScript(const QString& scriptHash, bool restart = false);
void reloadAllScripts();
void reloadOneScript(const QString& scriptName);
void loadDefaultScripts();
void toggleRunningScriptsWidget();
void saveScripts();
void showFriendsWindow();
@ -338,8 +279,6 @@ public slots:
void setRawAvatarUpdateThreading();
void setRawAvatarUpdateThreading(bool isThreaded);
void domainSettingsReceived(const QJsonObject& domainSettingsObject);
void resetSensors();
void setActiveFaceTracker();
@ -353,19 +292,16 @@ public slots:
void aboutApp();
void showEditEntitiesHelp();
void loadSettings();
void saveSettings();
void notifyPacketVersionMismatch();
void handleDomainConnectionDeniedPacket(QSharedPointer<NLPacket> packet);
void cameraMenuChanged();
void reloadResourceCaches();
void crashApplication();
void rotationModeChanged();
void runTests();
private slots:
void clearDomainOctreeDetails();
void checkFPS();
@ -377,17 +313,36 @@ private slots:
void connectedToDomain(const QString& hostname);
void rotationModeChanged();
void manageRunningScriptsWidgetVisibility(bool shown);
void runTests();
void audioMuteToggled();
void faceTrackerMuteToggled();
void activeChanged(Qt::ApplicationState state);
void domainSettingsReceived(const QJsonObject& domainSettingsObject);
void handleDomainConnectionDeniedPacket(QSharedPointer<NLPacket> packet);
void notifyPacketVersionMismatch();
void loadSettings();
void saveSettings();
void scriptFinished(const QString& scriptName);
void saveScripts();
void reloadScript(const QString& scriptName, bool isUserLoaded = true);
bool acceptSnapshot(const QString& urlString);
bool askToSetAvatarUrl(const QString& url);
bool askToLoadScript(const QString& scriptFilenameOrURL);
void setSessionUUID(const QUuid& sessionUUID);
void domainChanged(const QString& domainHostname);
void updateWindowTitle();
void nodeAdded(SharedNodePointer node);
void nodeKilled(SharedNodePointer node);
void packetSent(quint64 length);
void updateDisplayMode();
void updateInputModes();
private:
void initDisplay();
void init();
@ -403,11 +358,8 @@ private:
// Various helper functions called during update()
void updateLOD();
void updateMouseRay();
void updateThreads(float deltaTime);
void updateCamera(float deltaTime);
void updateDialogs(float deltaTime);
void updateCursor(float deltaTime);
void queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions);
void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum);
@ -418,7 +370,41 @@ private:
int sendNackPackets();
void takeSnapshot();
MyAvatar* getMyAvatar() const;
void initializeAcceptedFiles();
int getRenderAmbientLight() const;
void displaySide(RenderArgs* renderArgs, Camera& whichCamera, bool selfAvatarOnly = false, bool billboard = false);
bool importSVOFromURL(const QString& urlString);
int processOctreeStats(NLPacket& packet, SharedNodePointer sendingNode);
void trackIncomingOctreePacket(NLPacket& packet, SharedNodePointer sendingNode, bool wasStatsPacket);
void resizeEvent(QResizeEvent* size);
void keyPressEvent(QKeyEvent* event);
void keyReleaseEvent(QKeyEvent* event);
void focusOutEvent(QFocusEvent* event);
void focusInEvent(QFocusEvent* event);
void mouseMoveEvent(QMouseEvent* event, unsigned int deviceID = 0);
void mousePressEvent(QMouseEvent* event, unsigned int deviceID = 0);
void mouseDoublePressEvent(QMouseEvent* event, unsigned int deviceID = 0);
void mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID = 0);
void touchBeginEvent(QTouchEvent* event);
void touchEndEvent(QTouchEvent* event);
void touchUpdateEvent(QTouchEvent* event);
void wheelEvent(QWheelEvent* event);
void dropEvent(QDropEvent* event);
void dragEnterEvent(QDragEnterEvent* event);
bool _dependencyManagerIsSetup;
@ -476,21 +462,8 @@ private:
Environment _environment;
ivec2 _mouseDragStarted;
quint64 _lastMouseMove;
bool _lastMouseMoveWasSimulated;
glm::vec3 _mouseRayOrigin;
glm::vec3 _mouseRayDirection;
vec2 _touchAvg;
vec2 _touchDragStartedAvg;
bool _isTouchPressed; // true if multitouch has been pressed (clear when finished)
bool _mousePressed; // true if mouse has been pressed (clear when finished)
QSet<int> _keysPressed;
bool _enableProcessOctreeThread;
@ -501,9 +474,6 @@ private:
StDev _idleLoopStdev;
float _idleLoopMeasuredJitter;
int processOctreeStats(NLPacket& packet, SharedNodePointer sendingNode);
void trackIncomingOctreePacket(NLPacket& packet, SharedNodePointer sendingNode, bool wasStatsPacket);
NodeToJurisdictionMap _entityServerJurisdictions;
NodeToOctreeSceneStats _octreeServerSceneStats;
@ -513,8 +483,6 @@ private:
FileLogger* _logger;
void takeSnapshot();
TouchEvent _lastTouchEvent;
RunningScriptsWidget* _runningScriptsWidget;

View file

@ -429,7 +429,7 @@ void ApplicationCompositor::renderPointers(gpu::Batch& batch) {
//If we are in oculus, render reticle later
auto trueMouse = qApp->getTrueMouse();
trueMouse /= qApp->getCanvasSize();
QPoint position = QPoint(qApp->getTrueMouseX(), qApp->getTrueMouseY());
QPoint position = QPoint(qApp->getTrueMouse().x, qApp->getTrueMouse().y);
_reticlePosition[MOUSE] = position;
_reticleActive[MOUSE] = true;
_magActive[MOUSE] = _magnifier;