laser color matches paint color

This commit is contained in:
ericrius1 2015-10-01 09:50:58 -07:00
parent 2899962d43
commit 191a4740a3
2 changed files with 15 additions and 8 deletions

View file

@ -18,7 +18,7 @@ var RainSquall = function (properties) {
dropFallSpeed = 1, // m/s
dropLifetime = 60, // Seconds
dropSpinMax = 0, // Maximum angular velocity per axis; deg/s
debug = false, // Display origin circle; don't use running on Stack Manager
debug = true, // Display origin circle; don't use running on Stack Manager
// Other
squallCircle,
SQUALL_CIRCLE_COLOR = { red: 255, green: 0, blue: 0 },
@ -151,8 +151,10 @@ var RainSquall = function (properties) {
};
};
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation())));
center.y += 10;
var rainSquall1 = new RainSquall({
origin: { x: 1195, y: 1223, z: 1020 },
origin:center,
radius: 25,
dropsPerMinute: 120,
dropSize: { x: 0.1, y: 0.1, z: 0.1 },

View file

@ -34,7 +34,7 @@ var RIGHT_2_ACTION = 16;
var LEFT_4_ACTION = 17;
var LEFT_2_ACTION = 16;
var HUE_INCREMENT = 0.01;
var HUE_INCREMENT = 0.02;
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(Camera.getOrientation())));
@ -61,16 +61,17 @@ function MyController(hand, triggerAction) {
this.strokeColor = {
h: 0.8,
s: 0.9,
s: 0.8,
l: 0.4
};
this.laserPointer = Overlays.addOverlay("circle3d", {
size: {
x: STROKE_WIDTH / 2,
y: STROKE_WIDTH / 2
},
color: hslToRgb(this.strokeColor),
color: hslToRgb(this.strokeColor ),
solid: true,
position: center
})
@ -78,7 +79,6 @@ function MyController(hand, triggerAction) {
this.prevTriggerValue = 0;
var _this = this;
this.update = function() {
this.updateControllerState()
this.search();
@ -232,6 +232,9 @@ function MyController(hand, triggerAction) {
if (this.strokeColor.h < 0) {
this.strokeColor = 1;
}
Overlays.editOverlay(this.laserPointer, {
color: hslToRgb(this.strokeColor)
});
}
this.cycleColorUp = function() {
@ -239,6 +242,9 @@ function MyController(hand, triggerAction) {
if (this.strokeColor.h > 1) {
this.strokeColor.h = 0;
}
Overlays.editOverlay(this.laserPointer, {
color: hslToRgb(this.strokeColor)
});
}
}
@ -308,9 +314,8 @@ function orientationOf(vector) {
* @param Number l The lightness
* @return Array The RGB representation
*/
function hslToRgb(hsl) {
function hslToRgb(hsl, hueOffset) {
var r, g, b;
if (hsl.s == 0) {
r = g = b = hsl.l; // achromatic
} else {