mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Marker basics working, now just need to tweak
This commit is contained in:
parent
8e9cd3ae2a
commit
ddce8d5a3a
1 changed files with 40 additions and 3 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
MarkerTip = function() {
|
MarkerTip = function() {
|
||||||
_this = this;
|
_this = this;
|
||||||
|
_this.MARKER_TEXTURE_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/textures/paintStroke.png";
|
||||||
};
|
};
|
||||||
|
|
||||||
MarkerTip.prototype = {
|
MarkerTip.prototype = {
|
||||||
|
@ -42,12 +43,48 @@
|
||||||
var intersection = Entities.findRayIntersection(pickRay, true);
|
var intersection = Entities.findRayIntersection(pickRay, true);
|
||||||
|
|
||||||
if (intersection.intersects) {
|
if (intersection.intersects) {
|
||||||
var name = Entities.getEntityProperties(intersection.entityID);
|
|
||||||
|
|
||||||
this.paint()
|
this.paint(intersection.intersection)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
newStroke: function(position) {
|
||||||
|
_this.strokeBasePosition = position;
|
||||||
|
_this.currentStroke = Entities.addEntity({
|
||||||
|
type: "PolyLine",
|
||||||
|
name: "marker stroke",
|
||||||
|
dimensions: {
|
||||||
|
x: 10,
|
||||||
|
y: 10,
|
||||||
|
z: 10
|
||||||
|
},
|
||||||
|
position: position,
|
||||||
|
textures: _this.MARKER_TEXTURE_URL,
|
||||||
|
color: {red: 0, green: 10, blue: 200}
|
||||||
|
});
|
||||||
|
|
||||||
|
_this.linePoints = [];
|
||||||
|
_this.normals = [];
|
||||||
|
_this.strokeWidths = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
paint: function(position) {
|
||||||
|
if (!_this.currentStroke) {
|
||||||
|
_this.newStroke(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
var localPoint = Vec3.subtract(position, this.strokeBasePosition);
|
||||||
|
_this.linePoints.push(localPoint);
|
||||||
|
_this.normals.push(_this._whiteboardNormal);
|
||||||
|
this.strokeWidths.push(0.02);
|
||||||
|
|
||||||
|
Entities.editEntity(_this.currentStroke, {
|
||||||
|
linePoints: _this.linePoints,
|
||||||
|
normals: _this.normals,
|
||||||
|
strokeWidths: _this.strokeWidths
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
print("EBL PRELOAD");
|
print("EBL PRELOAD");
|
||||||
|
@ -56,7 +93,7 @@
|
||||||
setWhiteboard: function(myId, data) {
|
setWhiteboard: function(myId, data) {
|
||||||
_this.whiteboard = JSON.parse(data[0]);
|
_this.whiteboard = JSON.parse(data[0]);
|
||||||
var props = Entities.getEntityProperties(_this.whiteboard, ["rotation"]);
|
var props = Entities.getEntityProperties(_this.whiteboard, ["rotation"]);
|
||||||
Entities.editEntity(_this.whiteboard, {position: {x: 0, y: 1, z: 0}});
|
this._whiteboardNormal = Vec3.multiply(Quat.getFront(props.rotation), -1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue