Changed arrow size
This commit is contained in:
parent
afe2b4a662
commit
e82ce7fa57
|
@ -29,11 +29,14 @@ var ArrowCamera = function(arg1, arg2, arg3, arg4, position, target) {
|
|||
|
||||
this.arrow = new THREE.Mesh(new THREE.Geometry(), new THREE.MeshLambertMaterial({color: 0x0000ff, side:THREE.BackSide}));
|
||||
|
||||
this.size = 0.4;
|
||||
|
||||
this.object3D = new THREE.Object3D();
|
||||
this.object3D.add(this.initExtremity());
|
||||
this.object3D.add(this.arrow);
|
||||
|
||||
this.fullArrow = false;
|
||||
|
||||
}
|
||||
ArrowCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
|
||||
ArrowCamera.prototype.constructor = ArrowCamera;
|
||||
|
@ -51,8 +54,8 @@ ArrowCamera.prototype.initExtremity = function() {
|
|||
|
||||
left.normalize();
|
||||
other.normalize();
|
||||
left = Tools.mul(left, 0.2);
|
||||
other = Tools.mul(other, 0.2);
|
||||
left = Tools.mul(left, this.size);
|
||||
other = Tools.mul(other, this.size);
|
||||
|
||||
geometry.vertices.push(Tools.sum( Tools.sum( this.position, left), other),
|
||||
Tools.diff(Tools.sum( this.position, other), left),
|
||||
|
@ -120,7 +123,7 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) {
|
|||
|
||||
// First point of curve
|
||||
var f0 = mainCamera.position.clone();
|
||||
f0.add(Tools.sum(Tools.mul(this.up,-1), Tools.diff(this.target, this.position).normalize()));
|
||||
f0.add(Tools.mul(Tools.sum(new THREE.Vector3(0,-0.5,0), Tools.diff(this.target, this.position).normalize()),2));
|
||||
|
||||
// Last point of curve
|
||||
var f1 = this.position.clone();
|
||||
|
@ -128,6 +131,7 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) {
|
|||
// Last derivative of curve
|
||||
var fp1 = Tools.diff(this.target, this.position);
|
||||
fp1.normalize();
|
||||
fp1.multiplyScalar(2);
|
||||
|
||||
// Camera direction
|
||||
var dir = Tools.diff(this.position, mainCamera.position);
|
||||
|
@ -160,7 +164,7 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) {
|
|||
var limit = this.fullArrow ? 0.1 : 0.3;
|
||||
|
||||
// for (var i = this.fullArrow ? 0 : 0.5; i <= 1.001; i += 0.05) {
|
||||
for (var i = 1; i > limit; i -= 0.05) {
|
||||
for (var i = 1; i > limit; i -= 0.1) {
|
||||
point = hermite.eval(i);
|
||||
deriv = hermite.prime(i);
|
||||
up.cross(deriv);
|
||||
|
@ -168,7 +172,7 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) {
|
|||
up.multiplyScalar(-1);
|
||||
up.normalize();
|
||||
|
||||
var coeff = 0.1;
|
||||
var coeff = this.size / 2;
|
||||
var left = Tools.cross(up, deriv); left.normalize(); left.multiplyScalar(coeff);
|
||||
var other = Tools.cross(deriv, left); other.normalize(); other.multiplyScalar(coeff);
|
||||
|
||||
|
@ -180,6 +184,9 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) {
|
|||
);
|
||||
}
|
||||
|
||||
this.arrow.geometry.vertices = vertices;
|
||||
|
||||
if (this.arrow.geometry.faces.length == 0) {
|
||||
var faces = new Array();
|
||||
|
||||
for (var i = 0; i < vertices.length - 4; i+= 4) {
|
||||
|
@ -192,9 +199,16 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) {
|
|||
var len = vertices.length;
|
||||
faces.push(new THREE.Face3(len-4,len-3,len-2), new THREE.Face3(len-4,len-2,len-1));
|
||||
|
||||
var max = 0;
|
||||
for (var i = 0; i < faces.length; i++) {
|
||||
max = Math.max(max, faces[i].a, faces[i].b, faces[i].c);
|
||||
}
|
||||
console.log(max + '/' + len);
|
||||
|
||||
|
||||
this.arrow.geometry.vertices = vertices;
|
||||
this.arrow.geometry.faces = faces;
|
||||
this.arrow.geometry.facesNeedUpdate = true;
|
||||
}
|
||||
|
||||
// this.arrow.geometry.mergeVertices();
|
||||
this.arrow.geometry.computeFaceNormals();
|
||||
|
@ -209,7 +223,6 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) {
|
|||
this.arrow.geometry.elementsNeedUpdate = true;
|
||||
this.arrow.geometry.groupsNeedUpdate = true;
|
||||
this.arrow.geometry.normalsNeedUpdate = true;
|
||||
// this.arrow.geometry.facesNeedUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,14 @@ Previewer.prototype.render = function(prev, container_width, container_height) {
|
|||
this.renderer.enableScissorTest (true);
|
||||
this.renderer.setViewport(left, bottom, width, height);
|
||||
this.renderer.render(scene, prev.camera);
|
||||
}
|
||||
|
||||
this.clearNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
Previewer.prototype.clear = function() {
|
||||
if (this.clearNeeded) {
|
||||
this.domElement.width = this.domElement.width;
|
||||
this.clearNeeded = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,6 +219,10 @@ function createBobombCameras(width, height) {
|
|||
}
|
||||
|
||||
cams.push(
|
||||
createCamera(
|
||||
new THREE.Vector3(37.24445046448742,17.56004329173052,-13.432945825465112),
|
||||
new THREE.Vector3(15.446296842638255,0.7142524861838169,15.568085721947512)
|
||||
),
|
||||
createCamera(
|
||||
new THREE.Vector3(-24.10987782946019,26.75997424452833,-24.7814217620827),
|
||||
new THREE.Vector3(-13.724964120740987,14.939165978074758,11.993869660150779)
|
||||
|
@ -243,10 +247,6 @@ function createBobombCameras(width, height) {
|
|||
new THREE.Vector3(5.068708131530766,11.201320390433953,9.77462743108436),
|
||||
new THREE.Vector3(9.20744154720096,3.8549750522404134,48.87580511010085)
|
||||
),
|
||||
createCamera(
|
||||
new THREE.Vector3(37.24445046448742,17.56004329173052,-13.432945825465112),
|
||||
new THREE.Vector3(15.446296842638255,0.7142524861838169,15.568085721947512)
|
||||
),
|
||||
createCamera(
|
||||
new THREE.Vector3(4.18086580540298,16.54831275414988,29.96253548469186),
|
||||
new THREE.Vector3(-17.059296481928556,3.408610856102113,-1.2817238286325505)
|
||||
|
@ -258,11 +258,11 @@ function createBobombCameras(width, height) {
|
|||
createCamera(
|
||||
new THREE.Vector3(11.29580093093769,15.03666008708929,31.377195488571406),
|
||||
new THREE.Vector3(-28.288314738873957,13.648654387264967,25.794075678265735)
|
||||
),
|
||||
createCamera(
|
||||
new THREE.Vector3(28.438969076366728,18.888756501203087,26.694456000440766),
|
||||
new THREE.Vector3(-5.369166248035665,2.54925886583683,12.909289954623416)
|
||||
)
|
||||
// createCamera(
|
||||
// new THREE.Vector3(28.438969076366728,18.888756501203087,26.694456000440766),
|
||||
// new THREE.Vector3(-5.369166248035665,2.54925886583683,12.909289954623416)
|
||||
// )
|
||||
);
|
||||
|
||||
return cams;
|
||||
|
|
Loading…
Reference in New Issue