Skip to content

Commit

Permalink
Merge pull request #53 from jpmorganchase/prefabClass
Browse files Browse the repository at this point in the history
prefabs now extend transformNode updated examples
  • Loading branch information
dsaffo authored Oct 1, 2024
2 parents b309918 + 54d3db3 commit 8118c4a
Show file tree
Hide file tree
Showing 18 changed files with 274 additions and 255 deletions.
4 changes: 2 additions & 2 deletions anu-examples/examples/Geographic/Mesh_Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function meshMap(babylonEngine){



let map = anu.createMeshMap('test', {geoJson: geoJ, depth: 0.05, projection: d3.geoAlbers().reflectY(true), size: [2,2], simplification: 0.00001});
let map = anu.createMeshMap('meshMap', {geoJson: geoJ, depth: 0.05, projection: d3.geoAlbers().reflectY(true), size: [2,2], simplification: 0.00001});


let projection = map.projection;
Expand All @@ -30,7 +30,7 @@ export function meshMap(babylonEngine){
.prop("isPickable", false); //complex geometry has performance impact when pickable
//if you need to select it wrap it in a empty mesh with bounding box set

let mapCot = anu.selectName('meshMapCOT', scene);
let mapCot = anu.selectName('meshMap', scene);

let rootSphere = anu.create('sphere', 'sphere', {diameter: 0.003})
rootSphere.isVisible = false;
Expand Down
14 changes: 7 additions & 7 deletions anu-examples/examples/Geographic/Texture_Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function textureMap(babylonEngine){
rootSphere.instancedBuffers.color = new Color4(1,1,1,1)

//Using the texture map prefab we create a plane with a canvas OL map set as the texture
let textureMap = anu.createTextureMap('test');
let textureMap = anu.createTextureMap('map');
//Keyboard controls WASD and -+ can be enabled on the prefab
textureMap.keyboardControls(scene);

Expand Down Expand Up @@ -60,14 +60,14 @@ export function textureMap(babylonEngine){
}
}

//Create a cot for our spheres
let cot = anu.bind('cot')
//Select a cot for our spheres
let cot = anu.selectName('map', scene);


cot.run((d,n,i) => {
textureMap.mesh.parent = n;
n.normalizeToUnitCube();
}).positionY(0.5)
// cot.run((d,n,i) => {
// textureMap.parent = n;
// n.normalizeToUnitCube();
// }).positionY(0.5)


//Use binInstace to create an instance of root sphere for each data point
Expand Down
3 changes: 2 additions & 1 deletion anu-examples/examples/ScatterPlots/Scatterplot3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const scatterplot3D = function(engine){
.positionZ((d) => scaleZ(d.sepalWidth)) //So we create a function that takes param d and since we know the keys of the data can pass d.<key> into our function that returns an int
.material((d) => scaleC(d.species))

let axis = anu.createAxes('test', scene, {scale: {x: scaleX, y: scaleY, z: scaleZ}});
let axis = anu.createAxes('test', scene, {parent: chart, scale: {x: scaleX, y: scaleY, z: scaleZ}});
//axis.position.x = 1;
return scene;

};
Expand Down
6 changes: 3 additions & 3 deletions anu-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"vite": "^3.2.7"
},
"dependencies": {
"@babylonjs/core": "^7.17.0",
"@babylonjs/gui": "^7.0.0",
"@babylonjs/inspector": "^7.17.0",
"@babylonjs/core": "^7.26.2",
"@babylonjs/gui": "^7.26.2",
"@babylonjs/inspector": "^7.26.2",
"d3": "^7.6.1",
"d3-force-3d": "^3.0.5",
"simplify-3d": "^1.0.0",
Expand Down
5 changes: 2 additions & 3 deletions docs/anu-examples/Mesh_Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import data from './data/airports.csv'
import geoJ from "./data/gz_2010_us_040_00_5m.json"
import * as d3 from 'd3';


export function meshMap(babylonEngine){
const scene = new Scene(babylonEngine);
//Add some lighting
Expand All @@ -16,7 +15,7 @@ export function meshMap(babylonEngine){



let map = anu.createMeshMap('test', {geoJson: geoJ, depth: 0.05, projection: d3.geoAlbers().reflectY(true), size: [2,2], simplification: 0.00001});
let map = anu.createMeshMap('meshMap', {geoJson: geoJ, depth: 0.05, projection: d3.geoAlbers().reflectY(true), size: [2,2], simplification: 0.00001});


let projection = map.projection;
Expand All @@ -30,7 +29,7 @@ export function meshMap(babylonEngine){
.prop("isPickable", false); //complex geometry has performance impact when pickable
//if you need to select it wrap it in a empty mesh with bounding box set

let mapCot = anu.selectName('meshMapCOT', scene);
let mapCot = anu.selectName('meshMap', scene);

let rootSphere = anu.create('sphere', 'sphere', {diameter: 0.003})
rootSphere.isVisible = false;
Expand Down
14 changes: 7 additions & 7 deletions docs/anu-examples/Texture_Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function textureMap(babylonEngine){
rootSphere.instancedBuffers.color = new Color4(1,1,1,1)

//Using the texture map prefab we create a plane with a canvas OL map set as the texture
let textureMap = anu.createTextureMap('test');
let textureMap = anu.createTextureMap('map');
//Keyboard controls WASD and -+ can be enabled on the prefab
textureMap.keyboardControls(scene);

Expand Down Expand Up @@ -59,14 +59,14 @@ export function textureMap(babylonEngine){
}
}

//Create a cot for our spheres
let cot = anu.bind('cot')
//Select a cot for our spheres
let cot = anu.selectName('map', scene);


cot.run((d,n,i) => {
textureMap.mesh.parent = n;
n.normalizeToUnitCube();
}).positionY(0.5)
// cot.run((d,n,i) => {
// textureMap.parent = n;
// n.normalizeToUnitCube();
// }).positionY(0.5)


//Use binInstace to create an instance of root sphere for each data point
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@babylonjs/gui": "^7.1.0",
"@babylonjs/inspector": "^7.1.0",
"@babylonjs/loaders": "^7.1.0",
"@jpmorganchase/anu": "^0.0.55",
"@jpmorganchase/anu": "latest",
"d3": "^7.9.0",
"d3-force-3d": "^3.0.5",
"vite-plugin-dynamic-import": "^1.5.0",
Expand Down
Loading

0 comments on commit 8118c4a

Please sign in to comment.