mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
Merge pull request #8255 from jherico/search_circle
Make search line termination a circle, like 2D UI
This commit is contained in:
commit
4925980cbb
2 changed files with 24 additions and 10 deletions
|
@ -71,28 +71,24 @@ void main() {
|
||||||
lineOrthogonal *= 0.02;
|
lineOrthogonal *= 0.02;
|
||||||
|
|
||||||
gl_Position = gl_PositionIn[0];
|
gl_Position = gl_PositionIn[0];
|
||||||
gl_Position.xy -= lineNormal;
|
|
||||||
gl_Position.xy -= lineOrthogonal;
|
gl_Position.xy -= lineOrthogonal;
|
||||||
outColor = inColor[0];
|
outColor = inColor[0];
|
||||||
outLineDistance = vec3(-1.02, -1, gl_Position.z);
|
outLineDistance = vec3(-1.02, -1, gl_Position.z);
|
||||||
EmitVertex();
|
EmitVertex();
|
||||||
|
|
||||||
gl_Position = gl_PositionIn[0];
|
gl_Position = gl_PositionIn[0];
|
||||||
gl_Position.xy -= lineNormal;
|
|
||||||
gl_Position.xy += lineOrthogonal;
|
gl_Position.xy += lineOrthogonal;
|
||||||
outColor = inColor[0];
|
outColor = inColor[0];
|
||||||
outLineDistance = vec3(-1.02, 1, gl_Position.z);
|
outLineDistance = vec3(-1.02, 1, gl_Position.z);
|
||||||
EmitVertex();
|
EmitVertex();
|
||||||
|
|
||||||
gl_Position = gl_PositionIn[1];
|
gl_Position = gl_PositionIn[1];
|
||||||
gl_Position.xy += lineNormal;
|
|
||||||
gl_Position.xy -= lineOrthogonal;
|
gl_Position.xy -= lineOrthogonal;
|
||||||
outColor = inColor[1];
|
outColor = inColor[1];
|
||||||
outLineDistance = vec3(1.02, -1, gl_Position.z);
|
outLineDistance = vec3(1.02, -1, gl_Position.z);
|
||||||
EmitVertex();
|
EmitVertex();
|
||||||
|
|
||||||
gl_Position = gl_PositionIn[1];
|
gl_Position = gl_PositionIn[1];
|
||||||
gl_Position.xy += lineNormal;
|
|
||||||
gl_Position.xy += lineOrthogonal;
|
gl_Position.xy += lineOrthogonal;
|
||||||
outColor = inColor[1];
|
outColor = inColor[1];
|
||||||
outLineDistance = vec3(1.02, 1, gl_Position.z);
|
outLineDistance = vec3(1.02, 1, gl_Position.z);
|
||||||
|
|
|
@ -224,6 +224,14 @@ function getTag() {
|
||||||
return "grab-" + MyAvatar.sessionUUID;
|
return "grab-" + MyAvatar.sessionUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function colorPow(color, power) {
|
||||||
|
return {
|
||||||
|
red: Math.pow(color.red / 255.0, power) * 255,
|
||||||
|
green: Math.pow(color.green / 255.0, power) * 255,
|
||||||
|
blue: Math.pow(color.blue / 255.0, power) * 255,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function entityHasActions(entityID) {
|
function entityHasActions(entityID) {
|
||||||
return Entities.getActionIDs(entityID).length > 0;
|
return Entities.getActionIDs(entityID).length > 0;
|
||||||
}
|
}
|
||||||
|
@ -759,23 +767,33 @@ function MyController(hand) {
|
||||||
|
|
||||||
var SEARCH_SPHERE_ALPHA = 0.5;
|
var SEARCH_SPHERE_ALPHA = 0.5;
|
||||||
this.searchSphereOn = function (location, size, color) {
|
this.searchSphereOn = function (location, size, color) {
|
||||||
|
|
||||||
|
var rotation = Quat.lookAt(location, Camera.getPosition(), Vec3.UP);
|
||||||
|
var brightColor = colorPow(color, 0.06);
|
||||||
if (this.searchSphere === null) {
|
if (this.searchSphere === null) {
|
||||||
var sphereProperties = {
|
var sphereProperties = {
|
||||||
position: location,
|
position: location,
|
||||||
size: size,
|
rotation: rotation,
|
||||||
color: color,
|
outerRadius: size * 1.2,
|
||||||
alpha: SEARCH_SPHERE_ALPHA,
|
innerColor: brightColor,
|
||||||
|
outerColor: color,
|
||||||
|
innerAlpha: 0.9,
|
||||||
|
outerAlpha: 0.0,
|
||||||
solid: true,
|
solid: true,
|
||||||
ignoreRayIntersection: true,
|
ignoreRayIntersection: true,
|
||||||
drawInFront: true, // Even when burried inside of something, show it.
|
drawInFront: true, // Even when burried inside of something, show it.
|
||||||
visible: true
|
visible: true
|
||||||
};
|
};
|
||||||
this.searchSphere = Overlays.addOverlay("sphere", sphereProperties);
|
this.searchSphere = Overlays.addOverlay("circle3d", sphereProperties);
|
||||||
} else {
|
} else {
|
||||||
Overlays.editOverlay(this.searchSphere, {
|
Overlays.editOverlay(this.searchSphere, {
|
||||||
position: location,
|
position: location,
|
||||||
size: size,
|
rotation: rotation,
|
||||||
color: color,
|
innerColor: brightColor,
|
||||||
|
outerColor: color,
|
||||||
|
innerAlpha: 1.0,
|
||||||
|
outerAlpha: 0.0,
|
||||||
|
outerRadius: size * 1.2,
|
||||||
visible: true
|
visible: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue