Some fixes to whiteboard to get rid of gaps between lines and jagged lines

This commit is contained in:
ericrius1 2016-01-12 19:28:41 -08:00
parent 6f85ee135f
commit 9dae425bfd
2 changed files with 18 additions and 24 deletions

View file

@ -28,8 +28,7 @@
var PAINT_TRIGGER_THRESHOLD = 0.6; var PAINT_TRIGGER_THRESHOLD = 0.6;
var MIN_STROKE_WIDTH = 0.0005; var MIN_STROKE_WIDTH = 0.0005;
var MAX_STROKE_WIDTH = 0.03; var MAX_STROKE_WIDTH = 0.03;
var textureURL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/textures/paintStroke.png";
var textureURL = "https://s3.amazonaws.com/hifi-public/eric/textures/paintStrokes/paintStroke.png";
var TRIGGER_CONTROLS = [ var TRIGGER_CONTROLS = [
Controller.Standard.LT, Controller.Standard.LT,
@ -170,7 +169,7 @@
type: "PolyLine", type: "PolyLine",
name: "paintStroke", name: "paintStroke",
color: this.strokeColor, color: this.strokeColor,
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/paintStrokes/paintStroke.png", textures: textureURL,
dimensions: { dimensions: {
x: 50, x: 50,
y: 50, y: 50,
@ -249,7 +248,7 @@
unload: function() { unload: function() {
Overlays.deleteOverlay(this.laserPointer); Overlays.deleteOverlay(this.laserPointer);
// this.eraseBoard(); this.eraseBoard();
} }
}; };

View file

@ -41,6 +41,7 @@ var whiteboard = Entities.addEntity({
type: "Model", type: "Model",
shapeType: "box", shapeType: "box",
modelURL: modelURL, modelURL: modelURL,
dimensions: {x: 2, y: 2.67, z: 0.76},
name: "whiteboard base", name: "whiteboard base",
position: center, position: center,
rotation: rotation, rotation: rotation,
@ -53,8 +54,11 @@ var colorIndicatorPosition = {
}; };
colorIndicatorPosition.y += 1.55; colorIndicatorPosition.y += 1.55;
colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-0.1, Quat.getFront(rotation))); colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-0.1, Quat.getFront(rotation)));
var colorIndicatorBorderDimensions = {x: 1.84, y: 0.46, z: 0.04};
var colorIndicatorBorder = Entities.addEntity({ var colorIndicatorBorder = Entities.addEntity({
type: "Model", type: "Model",
name: "Whiteboard Color Indicator Border",
dimensions: colorIndicatorBorderDimensions,
position: colorIndicatorPosition, position: colorIndicatorPosition,
modelURL: colorIndicatorBorderModelURL, modelURL: colorIndicatorBorderModelURL,
rotation: rotation, rotation: rotation,
@ -63,10 +67,12 @@ var colorIndicatorBorder = Entities.addEntity({
var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation))); var surfaceCenter = Vec3.sum(center, Vec3.multiply(-0.1, Quat.getFront(rotation)));
surfaceCenter.y += 0.6; surfaceCenter.y += 0.6;
var whiteboardDimensions = {x: 1.8, y: 1.3, z: 0.01};
var drawingSurface = Entities.addEntity({ var drawingSurface = Entities.addEntity({
type: "Model", type: "Model",
modelURL: surfaceModelURL, modelURL: surfaceModelURL,
shapeType: "box", shapeType: "box",
dimensions: whiteboardDimensions,
name: "whiteboard surface", name: "whiteboard surface",
position: surfaceCenter, position: surfaceCenter,
script: scriptURL, script: scriptURL,
@ -111,6 +117,7 @@ var eraser = Entities.addEntity({
type: "Model", type: "Model",
modelURL: eraserModelURL, modelURL: eraserModelURL,
position: eraserPosition, position: eraserPosition,
dimensions: {x: 1.73, y: 0.47, z: 0.11},
name: "Eraser", name: "Eraser",
script: scriptURL, script: scriptURL,
rotation: rotation, rotation: rotation,
@ -122,11 +129,7 @@ var eraser = Entities.addEntity({
}) })
}); });
Script.setTimeout(function() { setUp();
whiteboardDimensions = Entities.getEntityProperties(whiteboard, "naturalDimensions").naturalDimensions;
colorIndicatorBorderDimensions = Entities.getEntityProperties(colorIndicatorBorder, "naturalDimensions").naturalDimensions;
setUp();
}, 2000)
function setUp() { function setUp() {
@ -138,6 +141,7 @@ function setUp() {
blockerPosition = Vec3.sum(blockerPosition, Vec3.multiply(-1, Quat.getFront(rotation))); blockerPosition = Vec3.sum(blockerPosition, Vec3.multiply(-1, Quat.getFront(rotation)));
blocker = Entities.addEntity({ blocker = Entities.addEntity({
type: "Box", type: "Box",
name: "Whiteboard Blocker",
rotation: rotation, rotation: rotation,
position: blockerPosition, position: blockerPosition,
dimensions: { dimensions: {
@ -148,26 +152,17 @@ function setUp() {
shapeType: "box", shapeType: "box",
visible: false visible: false
}); });
var eraseModelDimensions = Entities.getEntityProperties(eraser, "naturalDimensions").naturalDimensions;
Entities.editEntity(eraser, {
dimensions: eraseModelDimensions
});
Entities.editEntity(colorIndicatorBorder, {
dimensions: colorIndicatorBorderDimensions
});
scriptURL = Script.resolvePath("colorIndicatorEntityScript.js"); scriptURL = Script.resolvePath("colorIndicatorEntityScript.js");
var colorIndicatorPosition = Vec3.sum(center, { var colorIndicatorPosition = Vec3.sum(center, {
x: 0, x: 0,
y: whiteboardDimensions.y / 2 + colorIndicatorBorderDimensions.y / 2, y: whiteboardDimensions.y / 2 + colorIndicatorBorderDimensions.y * 2,
z: 0 z: 0
}); });
colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-.1, Quat.getFront(rotation))); colorIndicatorPosition = Vec3.sum(colorIndicatorPosition, Vec3.multiply(-0.1, Quat.getFront(rotation)));
var colorIndicatorBoxDimensions = Vec3.multiply(colorIndicatorBorderDimensions, 0.9); var colorIndicatorBoxDimensions = Vec3.multiply(colorIndicatorBorderDimensions, 0.9);
colorIndicatorBox = Entities.addEntity({ colorIndicatorBox = Entities.addEntity({
type: "Box", type: "Box",
name: "Color Indicator", name: "Whiteboard Color Indicator",
color: colors[0], color: colors[0],
rotation: rotation, rotation: rotation,
position: colorIndicatorPosition, position: colorIndicatorPosition,
@ -205,13 +200,13 @@ function setUp() {
colorBoxPosition = Vec3.sum(colorBoxPosition, Vec3.multiply(palleteDepthOffset, Quat.getFront(rotation))); colorBoxPosition = Vec3.sum(colorBoxPosition, Vec3.multiply(palleteDepthOffset, Quat.getFront(rotation)));
colorBoxPosition.y += palleteHeightOffset; colorBoxPosition.y += palleteHeightOffset;
var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 1.76); var spaceBetweenColorBoxes = Vec3.multiply(direction, colorSquareDimensions.x * 1.76);
var palleteXOffset = Vec3.multiply(direction, 0.43); var palleteXOffset = Vec3.multiply(direction, 0.33);
colorBoxPosition = Vec3.sum(colorBoxPosition, palleteXOffset); colorBoxPosition = Vec3.sum(colorBoxPosition, palleteXOffset);
var scriptURL = Script.resolvePath("colorSelectorEntityScript.js"); var scriptURL = Script.resolvePath("colorSelectorEntityScript.js");
for (var i = 0; i < colors.length; i++) { for (var i = 0; i < colors.length; i++) {
var colorBox = Entities.addEntity({ var colorBox = Entities.addEntity({
type: "Box", type: "Box",
name: "Color Selector", name: "Whiteboard Color Selector",
position: colorBoxPosition, position: colorBoxPosition,
dimensions: colorSquareDimensions, dimensions: colorSquareDimensions,
rotation: rotation, rotation: rotation,
@ -247,4 +242,4 @@ function cleanup() {
// Uncomment this line to delete whiteboard and all associated entity on script close // Uncomment this line to delete whiteboard and all associated entity on script close
// Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);