Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Oct 26, 2023
1 parent bce4303 commit 0fa06c7
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 287 deletions.
257 changes: 131 additions & 126 deletions dist/xeokit-sdk.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -45987,7 +45987,10 @@ class Bitmap extends Component {
this._rtcPos = math.vec3();
this._imageSize = math.vec2();

this._texture = new Texture(this);
this._texture = new Texture(this, {
flipY: true
});

this._image = new Image();

if (this._type !== "jpg" && this._type !== "png") {
Expand Down Expand Up @@ -46360,6 +46363,116 @@ class Bitmap extends Component {
}
}

const tempVec3a$v = math.vec3();
const tempVec3b$q = math.vec3();
const tempMat4a$h = math.mat4();

/**
* @private
*/
class FrustumPlane {

constructor() {
this.normal = math.vec3();
this.offset = 0;
this.testVertex = math.vec3();
}

set(nx, ny, nz, offset) {
const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
this.normal[0] = nx * s;
this.normal[1] = ny * s;
this.normal[2] = nz * s;
this.offset = offset * s;
this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;
this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;
this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;
}
}

/**
* @private
*/
class Frustum {
constructor() {
this.planes = [
new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),
new FrustumPlane(), new FrustumPlane(), new FrustumPlane()
];
}
}

Frustum.INSIDE = 0;
Frustum.INTERSECT = 1;
Frustum.OUTSIDE = 2;

/** @private */
function setFrustum(frustum, viewMat, projMat) {

const m = math.mulMat4(projMat, viewMat, tempMat4a$h);

const m0 = m[0];
const m1 = m[1];
const m2 = m[2];
const m3 = m[3];
const m4 = m[4];
const m5 = m[5];
const m6 = m[6];
const m7 = m[7];
const m8 = m[8];
const m9 = m[9];
const m10 = m[10];
const m11 = m[11];
const m12 = m[12];
const m13 = m[13];
const m14 = m[14];
const m15 = m[15];

frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);
frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);
frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);
frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);
frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);
frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);
}

/** @private */
function frustumIntersectsAABB3(frustum, aabb) {

let ret = Frustum.INSIDE;

const min = tempVec3a$v;
const max = tempVec3b$q;

min[0] = aabb[0];
min[1] = aabb[1];
min[2] = aabb[2];
max[0] = aabb[3];
max[1] = aabb[4];
max[2] = aabb[5];

const bminmax = [min, max];

for (let i = 0; i < 6; ++i) {
const plane = frustum.planes[i];
if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +
(plane.normal[1] * bminmax[plane.testVertex[1]][1]) +
(plane.normal[2] * bminmax[plane.testVertex[2]][2]) +
(plane.offset)) < 0.0) {
return Frustum.OUTSIDE;
}

if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +
(plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +
(plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +
(plane.offset)) < 0.0) {
ret = Frustum.INTERSECT;
}
}

return ret;
}

/**
* A set of 3D line segments.
*
Expand Down Expand Up @@ -46434,8 +46547,10 @@ class LineSet extends Component {
super(owner, cfg);

this._positions = cfg.positions || [];

this._origin = math.vec3(cfg.origin || [0, 0, 0]);
const rtcPositions = new Float32Array(this._positions.length);
const rtcCenter = math.vec3();
const cellSize = 100;
const rtcNeeded = worldToRTCPositions(this._positions, new Float32Array(this._positions.length), rtcCenter, cellSize);

if (cfg.indices) {
this._indices = cfg.indices;
Expand All @@ -46453,9 +46568,9 @@ class LineSet extends Component {
collidable: cfg.collidable,
geometry: new VBOGeometry(this, {
primitive: "lines",
positions: this._positions,
positions: rtcNeeded ? rtcPositions : this._positions,
indices: this._indices,
origin: cfg.origin
origin: rtcNeeded ? rtcCenter : null
}),
material: new PhongMaterial(this, {
diffuse: cfg.color || [0, 0, 0],
Expand Down Expand Up @@ -46518,8 +46633,8 @@ class LineSet extends Component {
}

const tempVec3$5 = math.vec3();
const tempVec3a$v = math.vec3();
const tempVec3b$q = math.vec3();
const tempVec3a$u = math.vec3();
const tempVec3b$p = math.vec3();
const tempVec3c$m = math.vec3();

/**
Expand Down Expand Up @@ -47199,8 +47314,8 @@ class BCFViewpointsPlugin extends Plugin {
bcfViewpoint.bitmaps.forEach(function (e) {
const bitmap_type = e.bitmap_type || "jpg"; // "jpg" | "png"
const bitmap_data = e.bitmap_data; // base64
let location = xyzObjectToArray(e.location, tempVec3a$v);
let normal = xyzObjectToArray(e.normal, tempVec3b$q);
let location = xyzObjectToArray(e.location, tempVec3a$u);
let normal = xyzObjectToArray(e.normal, tempVec3b$p);
let up = xyzObjectToArray(e.up, tempVec3c$m);
let height = e.height || 1;
if (!bitmap_type) {
Expand Down Expand Up @@ -50596,7 +50711,7 @@ class SplineCurve extends Curve {
}
}

const tempVec3a$u = math.vec3();
const tempVec3a$t = math.vec3();

/**
* @desc Defines a sequence of frames along which a {@link CameraPathAnimation} can animate a {@link Camera}.
Expand Down Expand Up @@ -50728,9 +50843,9 @@ class CameraPath extends Component {
t = t / (this._frames[this._frames.length - 1].t - this._frames[0].t);
t = t < 0.0 ? 0.0 : (t > 1.0 ? 1.0 : t);

camera.eye = this._eyeCurve.getPoint(t, tempVec3a$u);
camera.look = this._lookCurve.getPoint(t, tempVec3a$u);
camera.up = this._upCurve.getPoint(t, tempVec3a$u);
camera.eye = this._eyeCurve.getPoint(t, tempVec3a$t);
camera.look = this._lookCurve.getPoint(t, tempVec3a$t);
camera.up = this._upCurve.getPoint(t, tempVec3a$t);
}

/**
Expand Down Expand Up @@ -51769,7 +51884,7 @@ CameraPathAnimation.PLAYING = 2;
CameraPathAnimation.PLAYING_TO = 3;

const tempVec3$3 = math.vec3();
const tempVec3b$p = math.vec3();
const tempVec3b$o = math.vec3();
math.vec3();
const zeroVec$2 = math.vec3([0, -1, 0]);
const tempQuat = math.vec4([0, 0, 0, 1]);
Expand Down Expand Up @@ -52197,7 +52312,7 @@ class ImagePlane extends Component {
const dist = -math.dotVec3(negDir, tempVec3$3);

math.normalizeVec3(negDir);
math.mulVec3Scalar(negDir, dist, tempVec3b$p);
math.mulVec3Scalar(negDir, dist, tempVec3b$o);
math.vec3PairToQuaternion(zeroVec$2, dir, tempQuat);

this._node.quaternion = tempQuat;
Expand Down Expand Up @@ -53363,116 +53478,6 @@ class SpriteMarker extends Marker {
}
}

const tempVec3a$t = math.vec3();
const tempVec3b$o = math.vec3();
const tempMat4a$h = math.mat4();

/**
* @private
*/
class FrustumPlane {

constructor() {
this.normal = math.vec3();
this.offset = 0;
this.testVertex = math.vec3();
}

set(nx, ny, nz, offset) {
const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
this.normal[0] = nx * s;
this.normal[1] = ny * s;
this.normal[2] = nz * s;
this.offset = offset * s;
this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;
this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;
this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;
}
}

/**
* @private
*/
class Frustum {
constructor() {
this.planes = [
new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),
new FrustumPlane(), new FrustumPlane(), new FrustumPlane()
];
}
}

Frustum.INSIDE = 0;
Frustum.INTERSECT = 1;
Frustum.OUTSIDE = 2;

/** @private */
function setFrustum(frustum, viewMat, projMat) {

const m = math.mulMat4(projMat, viewMat, tempMat4a$h);

const m0 = m[0];
const m1 = m[1];
const m2 = m[2];
const m3 = m[3];
const m4 = m[4];
const m5 = m[5];
const m6 = m[6];
const m7 = m[7];
const m8 = m[8];
const m9 = m[9];
const m10 = m[10];
const m11 = m[11];
const m12 = m[12];
const m13 = m[13];
const m14 = m[14];
const m15 = m[15];

frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);
frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);
frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);
frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);
frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);
frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);
}

/** @private */
function frustumIntersectsAABB3(frustum, aabb) {

let ret = Frustum.INSIDE;

const min = tempVec3a$t;
const max = tempVec3b$o;

min[0] = aabb[0];
min[1] = aabb[1];
min[2] = aabb[2];
max[0] = aabb[3];
max[1] = aabb[4];
max[2] = aabb[5];

const bminmax = [min, max];

for (let i = 0; i < 6; ++i) {
const plane = frustum.planes[i];
if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +
(plane.normal[1] * bminmax[plane.testVertex[1]][1]) +
(plane.normal[2] * bminmax[plane.testVertex[2]][2]) +
(plane.offset)) < 0.0) {
return Frustum.OUTSIDE;
}

if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +
(plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +
(plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +
(plane.offset)) < 0.0) {
ret = Frustum.INTERSECT;
}
}

return ret;
}

/**
* @desc Saves and restores the state of a {@link Scene}'s {@link Camera}.
*
Expand Down Expand Up @@ -82918,7 +82923,7 @@ class SceneModel extends Component {
cfg.primitive = "triangles";
}
if (cfg.primitive !== "points" && cfg.primitive !== "lines" && cfg.primitive !== "triangles" && cfg.primitive !== "solid" && cfg.primitive !== "surface") {
this.error(`[createGeometry] Unsupported value for 'primitive': '${primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);
this.error(`[createGeometry] Unsupported value for 'primitive': '${cfg.primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);
return;
}
if (!cfg.positions && !cfg.positionsCompressed && !cfg.buckets) {
Expand Down
Loading

0 comments on commit 0fa06c7

Please sign in to comment.