|
@@ -3513,11 +3513,13 @@
|
|
private _tangents = new Array<Vector3>();
|
|
private _tangents = new Array<Vector3>();
|
|
private _normals = new Array<Vector3>();
|
|
private _normals = new Array<Vector3>();
|
|
private _binormals = new Array<Vector3>();
|
|
private _binormals = new Array<Vector3>();
|
|
|
|
+ private _raw: boolean;
|
|
|
|
|
|
- constructor(public path: Vector3[], firstNormal?: Vector3) {
|
|
|
|
|
|
+ constructor(public path: Vector3[], firstNormal?: Vector3, raw?: boolean) {
|
|
for (var p = 0; p < path.length; p++) {
|
|
for (var p = 0; p < path.length; p++) {
|
|
this._curve[p] = path[p].clone(); // hard copy
|
|
this._curve[p] = path[p].clone(); // hard copy
|
|
}
|
|
}
|
|
|
|
+ this._raw = raw || false;
|
|
this._compute(firstNormal);
|
|
this._compute(firstNormal);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3557,17 +3559,25 @@
|
|
|
|
|
|
// first and last tangents
|
|
// first and last tangents
|
|
this._tangents[0] = this._getFirstNonNullVector(0);
|
|
this._tangents[0] = this._getFirstNonNullVector(0);
|
|
- this._tangents[0].normalize();
|
|
|
|
|
|
+ if (!this._raw) {
|
|
|
|
+ this._tangents[0].normalize();
|
|
|
|
+ }
|
|
this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);
|
|
this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);
|
|
- this._tangents[l - 1].normalize();
|
|
|
|
|
|
+ if (!this._raw) {
|
|
|
|
+ this._tangents[l - 1].normalize();
|
|
|
|
+ }
|
|
|
|
|
|
// normals and binormals at first point : arbitrary vector with _normalVector()
|
|
// normals and binormals at first point : arbitrary vector with _normalVector()
|
|
var tg0 = this._tangents[0];
|
|
var tg0 = this._tangents[0];
|
|
var pp0 = this._normalVector(this._curve[0], tg0, firstNormal);
|
|
var pp0 = this._normalVector(this._curve[0], tg0, firstNormal);
|
|
this._normals[0] = pp0;
|
|
this._normals[0] = pp0;
|
|
- this._normals[0].normalize();
|
|
|
|
|
|
+ if (!this._raw) {
|
|
|
|
+ this._normals[0].normalize();
|
|
|
|
+ }
|
|
this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);
|
|
this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);
|
|
- this._binormals[0].normalize();
|
|
|
|
|
|
+ if (!this._raw) {
|
|
|
|
+ this._binormals[0].normalize();
|
|
|
|
+ }
|
|
this._distances[0] = 0;
|
|
this._distances[0] = 0;
|
|
|
|
|
|
// normals and binormals : next points
|
|
// normals and binormals : next points
|
|
@@ -3592,9 +3602,13 @@
|
|
curTang = this._tangents[i];
|
|
curTang = this._tangents[i];
|
|
prevBinor = this._binormals[i - 1];
|
|
prevBinor = this._binormals[i - 1];
|
|
this._normals[i] = Vector3.Cross(prevBinor, curTang);
|
|
this._normals[i] = Vector3.Cross(prevBinor, curTang);
|
|
- this._normals[i].normalize();
|
|
|
|
|
|
+ if (!this._raw) {
|
|
|
|
+ this._normals[i].normalize();
|
|
|
|
+ }
|
|
this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);
|
|
this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);
|
|
- this._binormals[i].normalize();
|
|
|
|
|
|
+ if (!this._raw) {
|
|
|
|
+ this._binormals[i].normalize();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|