History

Merge master into out-of-body-experience

Andrew Meadows committed 10 years ago

Commit 38e4ac02 parents d86242a 8565f8781 files · +1191 −501Browse files

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

Unified · Split

interface/src/scripting/HMDScriptingInterface.cpp+21−0
@@ -159,6 +159,27 @@ bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::ve · 158 unmodified lines
159 color, direction);159 color, direction);
160}160}
161 161
162bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enabled, const glm::vec4& color, const glm::vec3& direction) const {
163 auto offscreenUi = DependencyManager::get<OffscreenUi>();
164 offscreenUi->executeOnUiThread([offscreenUi, enabled] {
165 offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled);
166 });
167
168
169 auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
170 auto sensorToWorld = myAvatar->getSensorToWorldMatrix();
171 auto worldToSensor = glm::inverse(sensorToWorld);
172 auto sensorStart = ::transformPoint(worldToSensor, worldStart);
173 auto sensorDirection = ::transformVectorFast(worldToSensor, direction);
174
175 return qApp->getActiveDisplayPlugin()->setExtraLaser(enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None,
176 color, sensorStart, sensorDirection);
177}
178
179void HMDScriptingInterface::disableExtraLaser() const {
180 setExtraLaser(vec3(0), false, vec4(0), vec3(0));
181}
182
162void HMDScriptingInterface::disableHandLasers(int hands) const {183void HMDScriptingInterface::disableHandLasers(int hands) const {
163 setHandLasers(hands, false, vec4(0), vec3(0));184 setHandLasers(hands, false, vec4(0), vec3(0));
164}185}