3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-27 00:55:42 +02:00
This commit is contained in:
Brad Hefta-Gaub 2016-10-24 14:47:10 -07:00
parent 0f8967970a
commit a25d50387e
3 changed files with 5 additions and 39 deletions
interface/src/scripting
libraries/display-plugins/src/display-plugins/hmd
scripts/system/controllers

View file

@ -155,12 +155,7 @@ bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enab
auto sensorToWorld = myAvatar->getSensorToWorldMatrix();
auto worldToSensor = glm::inverse(sensorToWorld);
auto sensorStart = ::transformPoint(worldToSensor, worldStart);
auto sensorDirection = ::transformVectorFast(worldToSensor, direction); // wrong
qDebug() << __FUNCTION__ << "worldStart:" << worldStart << "sensorStart:" << sensorStart;
qDebug() << __FUNCTION__ << "direction:" << direction << "sensorDirection:" << sensorDirection;
qDebug() << __FUNCTION__ << "enabled:" << enabled;
auto sensorDirection = ::transformVectorFast(worldToSensor, direction);
return qApp->getActiveDisplayPlugin()->setExtraLaser(enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None,
color, sensorStart, sensorDirection);

View file

@ -352,11 +352,6 @@ void HmdDisplayPlugin::updateFrameData() {
if (_currentFrame) {
auto batchPose = _currentFrame->pose;
// HACK o RAMA
//_handPoses[0] = _currentFrame->pose;
//_handPoses[1] = _currentFrame->pose;
auto currentPose = _currentPresentFrameInfo.presentPose;
auto correction = glm::inverse(batchPose) * currentPose;
getGLBackend()->setCameraCorrection(correction);
@ -474,9 +469,6 @@ void HmdDisplayPlugin::updateFrameData() {
_presentExtraLaserPoints.first = castStart;
_presentExtraLaserPoints.second = _presentExtraLaserPoints.first + (castDirection * distance);
qDebug() << __FUNCTION__ << "_presentExtraLaserPoints.first:" << _presentExtraLaserPoints.first;
qDebug() << __FUNCTION__ << "_presentExtraLaserPoints.second:" << _presentExtraLaserPoints.second;
vec3 intersectionPosition = castStart + (castDirection * distance) - _presentUiModelTransform.getTranslation();
intersectionPosition = glm::inverse(_presentUiModelTransform.getRotation()) * intersectionPosition;
@ -494,8 +486,6 @@ void HmdDisplayPlugin::updateFrameData() {
yawPitch /= CompositorHelper::VIRTUAL_UI_TARGET_FOV;
yawPitch += 0.5f;
extraGlowPoint = yawPitch;
} else {
qDebug() << "no extraGlowPoint...";
}
}
}
@ -508,8 +498,6 @@ void HmdDisplayPlugin::updateFrameData() {
// Setup the uniforms
{
qDebug() << __FUNCTION__ << "extraGlowPoint:" << extraGlowPoint;
auto& uniforms = _overlayRenderer.uniforms;
uniforms.alpha = _compositeOverlayAlpha;
uniforms.glowPoints = vec4(handGlowPoints[0], handGlowPoints[1]);
@ -716,7 +704,6 @@ bool HmdDisplayPlugin::setExtraLaser(HandLaserMode mode, const vec4& color, cons
_extraLaserStart = sensorSpaceStart;
});
qDebug() << __FUNCTION__ << "info.mode:" << (int)info.mode;
// FIXME defer to a child class plugin to determine if hand lasers are actually
// available based on the presence or absence of hand controllers
return true;
@ -725,11 +712,11 @@ bool HmdDisplayPlugin::setExtraLaser(HandLaserMode mode, const vec4& color, cons
void HmdDisplayPlugin::compositeExtra() {
// If neither hand laser is activated, exit
if (!_presentHandLasers[0].valid() && !_presentHandLasers[1].valid()) {
if (!_presentHandLasers[0].valid() && !_presentHandLasers[1].valid() && !_presentExtraLaser.valid()) {
return;
}
if (_presentHandPoses[0] == IDENTITY_MATRIX && _presentHandPoses[1] == IDENTITY_MATRIX) {
if (_presentHandPoses[0] == IDENTITY_MATRIX && _presentHandPoses[1] == IDENTITY_MATRIX && !_presentExtraLaser.valid()) {
return;
}
@ -752,17 +739,8 @@ void HmdDisplayPlugin::compositeExtra() {
if (_presentExtraLaser.valid()) {
const auto& points = _presentExtraLaserPoints;
qDebug() << __FUNCTION__ << "_presentExtraLaserPoints... points.first:" << points.first;
geometryCache->renderGlowLine(batch, points.first, points.second, _presentExtraLaser.color, _extraLaserID);
} else {
qDebug() << __FUNCTION__ << "INVALID LASER --- mode != HandLaserMode::None - " << (_presentExtraLaser.mode != HandLaserMode::None)
<< "mode:" << (int)_presentExtraLaser.mode
<< "color.a > 0.0f - " << (_presentExtraLaser.color.a > 0.0f) << "direction:" << _presentExtraLaser.direction;
}
});
}

View file

@ -457,11 +457,7 @@ function setColoredLaser() { // answer trigger state if lasers supported, else f
if (!HMD.isHandControllerAvailable()){
var position = MyAvatar.getHeadPosition();
//var direction = Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }));
var direction = { x: 1, y: -1, z: 0 };
Vec3.print("Calling HMD.setExtraLaser() position:", position);
Vec3.print("Calling HMD.setExtraLaser() direction:", direction);
var direction = Quat.getUp(Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 })));
return HMD.setExtraLaser(position,true, color, direction);
}
@ -508,10 +504,7 @@ function update() {
var color = (activeTrigger.state === 'full') ? LASER_TRIGGER_COLOR_XYZW : LASER_SEARCH_COLOR_XYZW;
var position = MyAvatar.getHeadPosition();
//var direction = Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 }));
var direction = { x: 1, y: -1, z: 0 };
Vec3.print("update().... Calling HMD.setExtraLaser() position:", position);
Vec3.print("update().... Calling HMD.setExtraLaser() direction:", direction);
var direction = Quat.getUp(Quat.multiply(MyAvatar.headOrientation, Quat.angleAxis(-90, { x: 1, y: 0, z: 0 })));
HMD.setExtraLaser(position,true, color, direction);
}