History

more work on extra lasers

Brad Hefta-Gaub committed 10 years ago

Commit a282d831 parent 8a071f18 files · +107 −15Browse files

Showing the changes to interface/src/scripting/HMDScriptingInterface.cpp (1 of 8 files). Show all

Unified · Split

interface/src/scripting/HMDScriptingInterface.cpp+15−5
@@ -130,16 +130,26 @@ bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::ve · 129 unmodified lines
130 color, direction);130 color, direction);
131}131}
132 132
133bool HMDScriptingInterface::setExtraLaser(const vec3& worldStart, bool enabled, const vec4& color, const vec3& direction) const {133bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enabled, const glm::vec4& color, const glm::vec3& direction) const {
134 auto offscreenUi = DependencyManager::get<OffscreenUi>();134 auto offscreenUi = DependencyManager::get<OffscreenUi>();
135 offscreenUi->executeOnUiThread([offscreenUi, enabled] {135 offscreenUi->executeOnUiThread([offscreenUi, enabled] {
136 offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled);136 offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled);
137 });137 });
138 138
139 mat4 extraLaserPose;139
140 return qApp->getActiveDisplayPlugin()->setExtraLaser(extraLaserPose,140 auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
141 enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None,141 auto sensorToWorld = myAvatar->getSensorToWorldMatrix();
142 color, direction);142 auto worldToSensor = glm::inverse(sensorToWorld);
143 auto sensorStart = ::transformPoint(worldToSensor, worldStart);
144 auto sensorDirection = ::transformVectorFast(worldToSensor, direction); // wrong
145
146 qDebug() << __FUNCTION__ << "worldStart:" << worldStart << "sensorStart:" << sensorStart;
147 qDebug() << __FUNCTION__ << "direction:" << direction << "sensorDirection:" << sensorDirection;
148 qDebug() << __FUNCTION__ << "enabled:" << enabled;
149
150
151 return qApp->getActiveDisplayPlugin()->setExtraLaser(enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None,
152 color, sensorStart, sensorDirection);
143}153}
144 154
145void HMDScriptingInterface::disableExtraLaser() const {155void HMDScriptingInterface::disableExtraLaser() const {