fix flicker, scissor warning, and handControllerGrab sphere size

This commit is contained in:
SamGondelman 2017-07-27 11:17:30 -07:00
parent fcaa39b245
commit e3288a9004
3 changed files with 9 additions and 10 deletions

View file

@ -81,7 +81,7 @@ void LaserPointer::disable() {
}
void LaserPointer::setRenderState(const QString& state) {
if (!_currentRenderState.isEmpty()) {
if (!_currentRenderState.isEmpty() && state != _currentRenderState) {
if (_renderStates.contains(_currentRenderState)) {
disableRenderState(_renderStates[_currentRenderState]);
}
@ -125,15 +125,12 @@ void LaserPointer::updateRenderState(const RenderState& renderState, const Inter
glm::vec3 endVec;
if (defaultState || !_lockEnd || type == IntersectionType::HUD) {
endVec = pickRay.origin + pickRay.direction * distance;
}
else {
} else {
if (type == IntersectionType::ENTITY) {
endVec = DependencyManager::get<EntityScriptingInterface>()->getEntityTransform(objectID)[3];
}
else if (type == IntersectionType::OVERLAY) {
} else if (type == IntersectionType::OVERLAY) {
endVec = vec3FromVariant(qApp->getOverlays().getProperty(objectID, "position").value);
}
else if (type == IntersectionType::AVATAR) {
} else if (type == IntersectionType::AVATAR) {
endVec = DependencyManager::get<AvatarHashMap>()->getAvatar(objectID)->getPosition();
}
}
@ -150,8 +147,7 @@ void LaserPointer::updateRenderState(const RenderState& renderState, const Inter
QVariantMap endProps;
if (_centerEndY) {
endProps.insert("position", end);
}
else {
} else {
glm::vec3 dim = vec3FromVariant(qApp->getOverlays().getProperty(renderState.getEndID(), "dimensions").value);
endProps.insert("position", vec3toVariant(endVec + glm::vec3(0, 0.5f * dim.y, 0)));
}

View file

@ -628,6 +628,7 @@ void OpenGLDisplayPlugin::compositeLayers() {
// Clear the depth framebuffer after drawing the scene so that the HUD elements can depth test against each other
render([&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(_compositeFramebuffer);
batch.clearDepthFramebuffer((float) UINT32_MAX);
});
@ -657,6 +658,7 @@ void OpenGLDisplayPlugin::compositeLayers() {
// Clear the depth buffer again and draw the pointer last so it's on top of everything
render([&](gpu::Batch& batch) {
batch.enableStereo(false);
batch.setFramebuffer(_compositeFramebuffer);
batch.clearDepthFramebuffer((float) UINT32_MAX);
});

View file

@ -1410,7 +1410,8 @@ function MyController(hand) {
this.updateLaserPointer = function() {
var SEARCH_SPHERE_SIZE = 0.011;
var radius = 1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance;
var MIN_SPHERE_SIZE = 0.0005;
var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE);
var dim = {x: radius, y: radius, z: radius};
var mode = "hold";
if (this.state !== STATE_DISTANCE_HOLDING && this.state !== STATE_DISTANCE_ROTATING) {