Skip to content

Commit

Permalink
Switch to babylonjs version 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
derpylz committed Jan 29, 2023
1 parent 88b3762 commit bf179d6
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 2,430 deletions.
2 changes: 1 addition & 1 deletion dist/babyplots.js

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions dist/babyplots.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,6 @@
*
*/

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

/**
* chroma.js - JavaScript library for color conversions
*
Expand Down
2 changes: 1 addition & 1 deletion dist/babyplots.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/examples/semantleExample.js

Large diffs are not rendered by default.

2,386 changes: 13 additions & 2,373 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babyplots",
"version": "1.6.1",
"version": "1.7.0",
"description": "Easy interactive 3d plots.",
"main": "build/babyplots.js",
"scripts": {
Expand All @@ -11,13 +11,13 @@
"author": "Nils Trost",
"license": "Apache-2.0",
"dependencies": {
"@babylonjs/core": "^5.44.0",
"@babylonjs/gui": "^5.44.0",
"@babylonjs/loaders": "^5.44.0",
"@types/ccapture.js": "^1.1.0",
"@types/chroma-js": "^2.1.1",
"@types/downloadjs": "^1.4.2",
"@types/uuid": "^8.3.0",
"@babylonjs/core": "^4.2.0",
"@babylonjs/gui": "^4.2.0",
"@babylonjs/loaders": "^4.2.0",
"axios": "^0.21.2",
"ccapture.js": "^1.1.0",
"chroma-js": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/babyplots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ import { Engine } from "@babylonjs/core/Engines/engine";
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera";
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight";
import { Vector3, Color4, Color3 } from "@babylonjs/core/Maths/math";
import { BoxBuilder } from "@babylonjs/core/Meshes/Builders/boxBuilder";
import { CreateBox } from "@babylonjs/core/Meshes/Builders/boxBuilder";
import { AdvancedDynamicTexture } from "@babylonjs/gui/2D/advancedDynamicTexture";
import { Rectangle, TextBlock, Grid, Control, Image } from "@babylonjs/gui/2D/controls";
import { ScreenshotTools } from "@babylonjs/core/Misc/screenshotTools";
Expand Down
8 changes: 4 additions & 4 deletions src/plotTypes/HeatMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import { Scene } from "@babylonjs/core/scene";
import { Mesh } from "@babylonjs/core/Meshes/mesh";
import { Color3, Vector3 } from "@babylonjs/core/Maths/math";
import { BoxBuilder } from "@babylonjs/core/Meshes/Builders/boxBuilder";
import { PlaneBuilder } from "@babylonjs/core/Meshes/Builders/planeBuilder";
import { CreateBox } from "@babylonjs/core/Meshes/Builders/boxBuilder";
import { CreatePlane } from "@babylonjs/core/Meshes/Builders/planeBuilder";
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
import { LegendData } from "../utils/LegendData";
import { CoordinatePlot } from "../utils/Plot";
Expand Down Expand Up @@ -50,7 +50,7 @@ export class HeatMap extends CoordinatePlot {
const coord = rowCoords[column];
if (coord > 0) {
let height = coord * this.yScale;
let box = BoxBuilder.CreateBox("box_" + row + "-" + column, {
let box = CreateBox("box_" + row + "-" + column, {
height: height,
width: this.xScale * this._size,
depth: this.zScale * this._size
Expand All @@ -69,7 +69,7 @@ export class HeatMap extends CoordinatePlot {
boxes.push(box);
}
else {
let box = PlaneBuilder.CreatePlane(
let box = CreatePlane(
"box_" + row + "-" + column,
{
width: this.xScale * this._size,
Expand Down
10 changes: 5 additions & 5 deletions src/plotTypes/Line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Vector3, Color4 } from "@babylonjs/core/Maths/math";
import { LegendData } from "../utils/LegendData";
import { CoordinatePlot } from "../utils/Plot";
import { AnnotationManager } from "../utils/Label";
import { LinesBuilder } from "@babylonjs/core/Meshes/Builders/linesBuilder";
import { CreateLines } from "@babylonjs/core/Meshes/Builders/linesBuilder";

export class Line extends CoordinatePlot {
labels: string[];
Expand Down Expand Up @@ -130,7 +130,7 @@ export class Line extends CoordinatePlot {
lineColors.push(Color4.FromHexString(pointColor));
}
}
let lines = LinesBuilder.CreateLines(
let lines = CreateLines(
"lines",
{ points: lineCoords, colors: lineColors }
)
Expand Down Expand Up @@ -167,7 +167,7 @@ export class Line extends CoordinatePlot {
Color4.FromHexString(this._coordColors[1])
);

let lines = LinesBuilder.CreateLines(
let lines = CreateLines(
"lines",
{ points: lineCoords, colors: lineColors }
)
Expand Down Expand Up @@ -220,7 +220,7 @@ export class Line extends CoordinatePlot {
lineColors.push(Color4.FromHexString(this._coordColors[currSegment + 1]));

this.mesh.dispose();
let lines = LinesBuilder.CreateLines(
let lines = CreateLines(
"lines",
{ points: lineCoords, colors: lineColors }
)
Expand All @@ -245,7 +245,7 @@ export class Line extends CoordinatePlot {
const pointColor = this._coordColors[i];
lineColors.push(Color4.FromHexString(pointColor));
}
let lines = LinesBuilder.CreateLines(
let lines = CreateLines(
"lines",
{ points: lineCoords, colors: lineColors }
)
Expand Down
20 changes: 10 additions & 10 deletions src/plotTypes/ShapeCloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import { Scene } from "@babylonjs/core/scene";
import { Mesh } from "@babylonjs/core/Meshes/mesh";
import "@babylonjs/core/Meshes/thinInstanceMesh";
import { SphereBuilder } from "@babylonjs/core/Meshes/Builders/sphereBuilder";
import { BoxBuilder } from "@babylonjs/core/Meshes/Builders/boxBuilder";
import { TorusBuilder } from "@babylonjs/core/Meshes/Builders/torusBuilder";
import { CylinderBuilder } from "@babylonjs/core/Meshes/Builders/cylinderBuilder";
import { CreateSphere } from "@babylonjs/core/Meshes/Builders/sphereBuilder";
import { CreateBox } from "@babylonjs/core/Meshes/Builders/boxBuilder";
import { CreateTorus } from "@babylonjs/core/Meshes/Builders/torusBuilder";
import { CreateCylinder } from "@babylonjs/core/Meshes/Builders/cylinderBuilder";
import { Color3, Color4, Matrix, Vector3 } from "@babylonjs/core/Maths/math";
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
import { LegendData } from "../utils/LegendData";
Expand Down Expand Up @@ -91,22 +91,22 @@ export class ShapeCloud extends CoordinatePlot {

switch (this._shape) {
case "box":
origMesh = BoxBuilder.CreateBox(mid, { size: this._size });
origMesh = CreateBox(mid, { size: this._size });
break;
case "sphere":
origMesh = SphereBuilder.CreateSphere(mid, { diameter: this._size });
origMesh = CreateSphere(mid, { diameter: this._size });
break;
case "cone":
origMesh = CylinderBuilder.CreateCylinder(mid, { height: this._size, diameterBottom: this._size, diameterTop: 0 }, this._scene);
origMesh = CreateCylinder(mid, { height: this._size, diameterBottom: this._size, diameterTop: 0 }, this._scene);
break;
case "torus":
origMesh = TorusBuilder.CreateTorus(mid, { diameter: this._size, thickness: this._size * 0.5 }, this._scene);
origMesh = CreateTorus(mid, { diameter: this._size, thickness: this._size * 0.5 }, this._scene);
break;
case "cylinder":
origMesh = CylinderBuilder.CreateCylinder(mid, { height: this._size, diameter: this._size }, this._scene);
origMesh = CreateCylinder(mid, { height: this._size, diameter: this._size }, this._scene);
break;
default:
origMesh = BoxBuilder.CreateBox(mid, { size: this._size });
origMesh = CreateBox(mid, { size: this._size });
break;
}

Expand Down
26 changes: 13 additions & 13 deletions src/utils/Axes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { Scene } from "@babylonjs/core/scene";
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera";
import { Mesh } from "@babylonjs/core/Meshes/mesh";
import { LinesBuilder } from "@babylonjs/core/Meshes/Builders/linesBuilder";
import { CreateLines } from "@babylonjs/core/Meshes/Builders/linesBuilder";
import { LinesMesh } from "@babylonjs/core/Meshes/linesMesh";
import { Vector3, Axis, Color3} from "@babylonjs/core/Maths/math";
import { DynamicTexture } from "@babylonjs/core/Materials/Textures/dynamicTexture";
Expand Down Expand Up @@ -101,7 +101,7 @@ export class Axes {
// Create X axis
if (this.axisData.showAxes[0]) {
// Create axis line
let axisX = LinesBuilder.CreateLines("axisX", {
let axisX = CreateLines("axisX", {
points: [
new Vector3(xmin, ymin, zmin),
new Vector3(xmax, ymin, zmin)
Expand Down Expand Up @@ -139,7 +139,7 @@ export class Axes {
if (heatmap) {
tickPos = tickPos - 0.5 * this.axisData.scale[0];
}
let tick = LinesBuilder.CreateLines("xTicks", {
let tick = CreateLines("xTicks", {
points: [
new Vector3(tickPos, ymin, zmin + 0.05 * xmax),
new Vector3(tickPos, ymin, zmin),
Expand All @@ -161,7 +161,7 @@ export class Axes {
tickChar.isPickable = false;
this._tickLabels.push(tickChar);
if (this.axisData.showTickLines[0][0]) {
let tickLine = LinesBuilder.CreateLines("xTickLines", {
let tickLine = CreateLines("xTickLines", {
points: [
new Vector3(tickPos, ymax, zmin),
new Vector3(tickPos, ymin, zmin)
Expand All @@ -172,7 +172,7 @@ export class Axes {
this._tickLines.push(tickLine);
}
if (this.axisData.showTickLines[0][1]) {
let tickLine = LinesBuilder.CreateLines("xTickLines", {
let tickLine = CreateLines("xTickLines", {
points: [
new Vector3(tickPos, ymin, zmax),
new Vector3(tickPos, ymin, zmin)
Expand All @@ -187,7 +187,7 @@ export class Axes {
// create Y axis
if (this.axisData.showAxes[1]) {
// axis
let axisY = LinesBuilder.CreateLines("axisY", {
let axisY = CreateLines("axisY", {
points: [
new Vector3(xmin, ymin, zmin),
new Vector3(xmin, ymax, zmin)
Expand All @@ -211,7 +211,7 @@ export class Axes {
}
for (let i = 0; i < yTicks.length; i++) {
let tickPos = yTicks[i];
let tick = LinesBuilder.CreateLines("yTicks", {
let tick = CreateLines("yTicks", {
points: [
new Vector3(xmin, tickPos, zmin + 0.05 * zmax),
new Vector3(xmin, tickPos, zmin),
Expand All @@ -228,7 +228,7 @@ export class Axes {
this._tickLabels.push(tickChar);
// tick lines
if (this.axisData.showTickLines[1][0]) {
let tickLine = LinesBuilder.CreateLines("yTicksLines", {
let tickLine = CreateLines("yTicksLines", {
points: [
new Vector3(xmax, tickPos, zmin),
new Vector3(xmin, tickPos, zmin)
Expand All @@ -239,7 +239,7 @@ export class Axes {
this._tickLines.push(tickLine);
}
if (this.axisData.showTickLines[1][1]) {
let tickLine = LinesBuilder.CreateLines("yTickLines", {
let tickLine = CreateLines("yTickLines", {
points: [
new Vector3(xmin, tickPos, zmax),
new Vector3(xmin, tickPos, zmin)
Expand All @@ -254,7 +254,7 @@ export class Axes {
// create Z axis
if (this.axisData.showAxes[2]) {
// axis
let axisZ = LinesBuilder.CreateLines("axisZ", {
let axisZ = CreateLines("axisZ", {
points: [
new Vector3(xmin, ymin, zmin),
new Vector3(xmin, ymin, zmax)
Expand Down Expand Up @@ -285,7 +285,7 @@ export class Axes {
if (heatmap) {
tickPos = tickPos - 0.5 * this.axisData.scale[2];
}
let tick = LinesBuilder.CreateLines("zTicks", {
let tick = CreateLines("zTicks", {
points: [
new Vector3(xmin + 0.05 * xmax, ymin, tickPos),
new Vector3(xmin, ymin, tickPos),
Expand All @@ -308,7 +308,7 @@ export class Axes {
this._tickLabels.push(tickChar);
// tick lines
if (this.axisData.showTickLines[2][0]) {
let tickLine = LinesBuilder.CreateLines("zTickLines", {
let tickLine = CreateLines("zTickLines", {
points: [
new Vector3(xmax, ymin, tickPos),
new Vector3(xmin, ymin, tickPos)
Expand All @@ -319,7 +319,7 @@ export class Axes {
this._tickLines.push(tickLine);
}
if (this.axisData.showTickLines[2][1]) {
let tickLine = LinesBuilder.CreateLines("zTickLines", {
let tickLine = CreateLines("zTickLines", {
points: [
new Vector3(xmin, ymax, tickPos),
new Vector3(xmin, ymin, tickPos)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/Label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Scene } from "@babylonjs/core/scene";
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera";
import { Mesh } from "@babylonjs/core/Meshes/mesh";
import { Vector3, Axis, Color3 } from "@babylonjs/core/Maths/math";
import { PlaneBuilder } from "@babylonjs/core/Meshes/Builders/planeBuilder";
import { CreatePlane } from "@babylonjs/core/Meshes/Builders/planeBuilder";
import { PointerDragBehavior } from "@babylonjs/core/Behaviors/Meshes/pointerDragBehavior";
import { AdvancedDynamicTexture } from "@babylonjs/gui/2D/advancedDynamicTexture";
import { Button, Rectangle, TextBlock } from "@babylonjs/gui/2D/controls";
Expand Down Expand Up @@ -151,7 +151,7 @@ class Label {
if (size != null) {
this.size = size;
}
let plane = PlaneBuilder.CreatePlane('label', {
let plane = CreatePlane('label', {
width: this.size * 0.05,
height: this.size * 0.05
}, scene);
Expand Down

0 comments on commit bf179d6

Please sign in to comment.