Skip to content

Fixed broken promise chain #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 107 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
51de20f
use tmp object in old version svx code
Mar 16, 2023
aef4998
make all label ids unique and simplify code
Jun 2, 2023
56f5642
update deps
Jun 2, 2023
969f06c
remove side scroll selection page from ui
Jun 3, 2023
39cdfe1
move/rename more slide selection page remains
Jun 3, 2023
e25854c
remove css for slide mechanism
Jun 3, 2023
06596e3
update deps
Jun 3, 2023
dd83713
remove unused event trigger
Jun 4, 2023
e2e4000
cleanup code
Jun 4, 2023
04653e4
fix loading survey tree ui after cut
Jun 4, 2023
1ab4d1d
prototype node materials
Jun 9, 2023
2de39eb
add FIXME
Jun 9, 2023
a4b52cf
hypsometric material > node
Jun 9, 2023
946f56e
add extendedPoints node material
Jun 9, 2023
fb800a7
add node version of contour shader
Jun 10, 2023
325552e
wip node materials
Jun 10, 2023
cf18a52
wip node materials
Jun 10, 2023
dd13d89
wip depth material
Jun 11, 2023
5613698
fix sizing
Jun 11, 2023
96e712a
wip move to common base material for terrain
Jun 11, 2023
d794f9c
add entrancePoints node material
Jun 11, 2023
d2175ff
use node based terrain overlay material
Jun 11, 2023
03532f8
assume webgl2
Jun 11, 2023
79918cb
assume webgl2
Jun 11, 2023
0a197bd
repair damage
Jun 11, 2023
b7893e1
add node support to viewer
Jun 11, 2023
373c846
convert cluster material to node materials
Jun 11, 2023
6277f6c
update hud components to node materials
Jun 11, 2023
bbf1e77
create help class for common uniforms
Jun 11, 2023
b894461
wip depth cursor material
Jun 11, 2023
3996243
wip node matrerial conversion
Jun 11, 2023
ed20ca4
add location aware shader code and wire up datum
Jun 11, 2023
d6ec796
revert removal for testing
Jun 11, 2023
5698c7f
wip location based shading
Jun 12, 2023
6a35675
WIP WEBGPU
Jun 13, 2023
6e84b02
add instanced sprite node material
Jun 14, 2023
3ff5817
add instanced sprite node material
Jun 14, 2023
d83904f
update deps
Jun 14, 2023
3f00f7e
wip points replacement
Jun 14, 2023
13d4a41
add common UVs
Jun 14, 2023
1e3ebb2
adapt to module use
Jun 14, 2023
6b448e6
adapt entrance markers
Jun 14, 2023
a102814
wip glyphstring node conversion
Jun 14, 2023
70e8c60
WIP Thick line support
Jun 16, 2023
b69a477
WIP NodeMaterial rework and cache rework
Jun 19, 2023
8cb3b56
wip nodes
Jun 19, 2023
5063053
wip node material
Jun 19, 2023
5d57330
wip move node materials to materials
Jun 19, 2023
e35d0c8
cleanup
Jun 19, 2023
a29ca50
clean up
Jun 19, 2023
efea2b0
fix cache
Jun 21, 2023
1d84a69
restore interleaved instanced now renderer is fixed
Jun 21, 2023
4bdceb9
allow setting leg colors
Jun 21, 2023
94ab2d2
fix leg shading by colour
Jun 21, 2023
d66404c
remove debug message
Jun 21, 2023
6604bd4
remove debug message
Jun 21, 2023
73e3a55
fix Line2Material
Jun 21, 2023
26631e3
cleanup and fix simple leg shading
Jun 21, 2023
50fdc8c
fix sorite material and wip on line shaders
Jun 21, 2023
481429d
fix survey shading mode switching to trigger events
Jun 21, 2023
ebbfca6
WIP node material conversion
Jun 22, 2023
3666bd8
WIP fix contour material and tidy
Jun 22, 2023
a432129
avoid built in sahder color processing for now
Jun 23, 2023
4b26705
avoid built in sahder color processing for now
Jun 23, 2023
0fe5d05
remove debug line
Jun 23, 2023
6bbf3b6
WIP DepthMap
Jun 23, 2023
21e0430
use global cache and avoid passing ctx
Jun 24, 2023
8360498
allow GC
Jun 25, 2023
4232af9
remove unneed function
Jun 25, 2023
eec9e03
use common meterial ref for HUD
Jun 25, 2023
02f9d8e
remove dead import
Jun 25, 2023
e391480
adapt height map to wip async api
Jun 25, 2023
638d42f
tidy up
Jun 25, 2023
468886b
remove old glyph geometry cache
Jun 25, 2023
d7c32c4
wip cluster material
Jun 25, 2023
2c87330
remove old Point object
Jun 25, 2023
a1c1829
WIP conversion of anaglyph effect
Jun 25, 2023
5bc44e6
enable rendering of terrain underside
Jun 25, 2023
8b27539
update lockfile
Jun 25, 2023
198c649
tidy
Jun 25, 2023
4186c23
analglyph node shader
Jul 5, 2023
d72db07
materials update
Jul 5, 2023
0b6c2a6
revert to interleaved instance geometry
Jul 5, 2023
59169eb
add opacity themes
Jul 5, 2023
9d25ade
snapshot WIP
Jul 5, 2023
996e34d
snapshot WIP
Jul 5, 2023
f47ac46
invert image amd use imageBitmap directly to avoid delay in display
Jul 5, 2023
3ab1853
preload svg textures to avoid delay in deisplay
Jul 7, 2023
a869ee4
handle render not initialised case
Jul 7, 2023
4b933c9
remove old code
Jul 7, 2023
b091310
wip material dynamic uniform setting
Jul 7, 2023
07dbddf
clean up materials
Jul 12, 2023
f46ea0b
rework cleearing to avoid unrequired render passes
Jul 12, 2023
4ae4d3b
rework materials
Aug 8, 2023
8a30b0e
rewire line width setting
Aug 8, 2023
bc6577d
update to use line2nodematerial
Aug 8, 2023
3bd1447
more material fixes
Aug 9, 2023
57b1516
update build env
Aug 9, 2023
a79791a
remove unused feature
Aug 9, 2023
9c8776c
calculate correct bounding boxes
Aug 9, 2023
91db5a9
fix
Aug 9, 2023
2f6429a
backup wip plugin
Sep 4, 2023
e240eb4
wip plugin for treeshaking
Sep 4, 2023
37f5696
remove redundant imports
Sep 4, 2023
49d566f
tidy plugin
Sep 4, 2023
f9221f6
rename plugin
Sep 4, 2023
5ff3480
Fixed broken promise chain
matteopic Sep 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,119 changes: 1,105 additions & 1,014 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,27 @@
},
"homepage": "https://github.com/aardgoose/CaveView.js#readme",
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.19.0",
"@babel/preset-env": "^7.20.0",
"@babel/plugin-transform-runtime": "^7.22.0",
"@babel/preset-env": "^7.22.0",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-beep": "^1.0.2",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/pluginutils": "^5.0.0",
"concurrently": "^7.5.0",
"eslint": "^8.19.0",
"concurrently": "^8.1.0",
"eslint": "^8.41.0",
"postcss": "^8.4.00",
"proj4": "^2.8.0",
"rollup": "^3.2.0",
"proj4": "^2.9.0",
"rollup": "^3.23.0",
"rollup-plugin-graph": "^2.0.0",
"serve": "^14.0.0",
"terser": "^5.14.0",
"three": "^0.150.0",
"terser": "^5.17.0",
"three": "^0.156.0",
"x18n": "^2.0.3"
},
"dependencies": {
"acorn-walk": "^8.2.0"
}
}
7 changes: 6 additions & 1 deletion rollup-gl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function glconstants() {
INT: 5124,
FLOAT: 5126,
HALF_FLOAT: 5131,
COLOR: 6144,
DEPTH_COMPONENT: 6402,
RED: 6403,
ALPHA: 6406,
Expand Down Expand Up @@ -163,7 +164,11 @@ function glconstants() {
DRAW_FRAMEBUFFER: 36009,
SAMPLE_ALPHA_TO_COVERAGE: 32926,
SRGB8_ALPHA8: 35907,
MAX_UNIFORM_BUFFER_BINDINGS: 35375 };
MAX_UNIFORM_BUFFER_BINDINGS: 35375,
TEXTURE_COMPARE_MODE: 34892,
TEXTURE_COMPARE_FUNC: 34893,
COMPARE_REF_TO_TEXTURE: 34894
};

return {

Expand Down
84 changes: 84 additions & 0 deletions rollup-plugin-three-nodes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { simple } from 'acorn-walk';

const nodeElements = {};

export default function threeNodes () {

return {
name: 'three-nodes', // this name will show up in logs and errors

transform: {

order: 'post',

handler ( code, id ) {

const fileName = id.split( '\\' ).pop();

// prevent creation of circular dependencies with spurious imports
if ( fileName === 'ShaderNode.js' ) return null;

const ast = this.parse( code );
const newImports = [];
const currentImports = {};

simple( ast, {

ImportSpecifier( node ) {

// track file's current imports
currentImports[ node.imported.name ] = true;

},

CallExpression ( node ) {

if ( node.callee.type == 'Identifier' && node.callee.name == 'addNodeElement' ) {

nodeElements[ node.arguments[ 0 ].value ] = id;
return;

}

if ( node.callee.type === 'MemberExpression' ) {

const propertyName = node.callee.property.name;

// don't duplicate imports
if ( currentImports[ propertyName ] === true ) return;

// exclude builtin Math.x methods
if ( node.callee.object.name === 'Math' ) return;

const moduleId = nodeElements[ propertyName ];

if ( moduleId === undefined || typeof moduleId !== 'string' ) return;

newImports.push( `import { ${propertyName} } from '${moduleId.replaceAll( '\\', '\/' ) }';` );
newImports.push( `console.log( 'custard:', ${propertyName});` );

delete nodeElements[ propertyName ];

}

}

} );

if ( newImports.length === 0 ) {

return { code: code, ast: ast, map: null };

} else {

return newImports.join( "\n" ) + "\n" + code;

}

},

}

};

}
16 changes: 10 additions & 6 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,39 @@ import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import { glconstants, glsl, glslThree } from './rollup-gl.mjs';
import beep from '@rollup/plugin-beep';
import threeNodes from './rollup-plugin-three-nodes.mjs';
//import graph from 'rollup-plugin-graph';

export default [
{
// treeshake: false,
input: 'src/js/CV2.js',
output: [
{
name: 'CV2',
file: 'build/CaveView/js/CaveView2.js',
format: 'umd'
format: 'es'
},
{
name: 'CV2',
file: 'build/CaveView/js/CaveView2.min.js',
format: 'umd',
format: 'es',
plugins: [ terser() ]
}
],
plugins: [
glsl(),
glslThree(),
glconstants(),
threeNodes(),
beep(),
json( {
exclude: [ 'node_modules/**', 'build/**', 'tools/**' ],
preferConst: true, // Default: false
} ),
nodeResolve( {} ),
commonjs( {
sourceMap: false, // Default: true
} )
} ),
// graph()
]
}, {
input: 'src/js/CV2Plugins.js',
Expand Down
6 changes: 2 additions & 4 deletions rollup.graph.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json from '@rollup/plugin-json';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import beep from '@rollup/plugin-beep';

import { glconstants, glsl, glslThree } from './rollup-gl.mjs';

import graph from 'rollup-plugin-graph';

Expand All @@ -22,9 +22,7 @@ export default [
}
],
plugins: [
glsl(),
glslThree(),
glconstants(),
beep(),
json( {
exclude: [ 'node_modules/**', 'build/**', 'tools/**' ],
preferConst: true, // Default: false
Expand Down
21 changes: 0 additions & 21 deletions src/css/caveview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ $animation-speed: 0.25s;
display: none;
}

.cv-frame div.page div.slide ul.cv-tree {
width: 280px;
}

.cv-frame div.page div.slide ul.cv-tree li {
margin-left: 20px;
}

.cv-frame div.page ul {
list-style-type: none;
Expand Down Expand Up @@ -134,16 +127,6 @@ $animation-speed: 0.25s;
background-color: black;
}

.cv-frame div.page div.slide {
position: absolute;
top: 42px;
bottom: 4px;
left: 0px;
max-height: 100%;
background-color: $background;
transition: transform $animation-speed ease-in;
}

.cv-frame div.slide-out {
border-right: $page-rule;
transform: translateX(-100%);
Expand Down Expand Up @@ -364,10 +347,6 @@ div.cv-frame::-webkit-scrollbar-button:end {
top: $tab-size * 2;
}

.cv-frame div.page div.slide, .cv-frame div.slide ul {
width: 100%;
}

.cv-tab-box {
left: 0px;
right: 0px;
Expand Down
1 change: 1 addition & 0 deletions src/js/Nodes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../../node_modules/three/examples/jsm/nodes/Nodes';
25 changes: 18 additions & 7 deletions src/js/Three.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
export * from 'three';
export { cloneUniforms, mergeUniforms } from 'three/src/renderers/shaders/UniformsUtils.js';

/*
export { WebGLRenderTarget } from 'three/src/renderers/WebGLRenderTarget.js';
export { WebGLRenderer } from 'three/src/renderers/WebGLRenderer.js';
export { ShaderChunk } from 'three/src/renderers/shaders/ShaderChunk.js';
export { cloneUniforms, mergeUniforms } from 'three/src/renderers/shaders/UniformsUtils.js';
export { FogExp2 } from 'three/src/scenes/FogExp2.js';
export { Scene } from 'three/src/scenes/Scene.js';
export { Mesh } from 'three/src/objects/Mesh.js';
export { Sprite } from 'three/src/objects/Sprite.js';
export { LineSegments } from 'three/src/objects/LineSegments.js';
export { Line } from 'three/src/objects/Line.js';
export { Points } from 'three/src/objects/Points.js';
Expand All @@ -22,11 +27,11 @@ export { PlaneGeometry } from 'three/src/geometries/PlaneGeometry.js';
export { CylinderGeometry } from 'three/src/geometries/CylinderGeometry.js';

export { ShaderMaterial } from 'three/src/materials/ShaderMaterial.js';
export { PointsMaterial } from 'three/src/materials/PointsMaterial.js';
export { MeshBasicMaterial } from 'three/src/materials/MeshBasicMaterial.js';
export { MeshLambertMaterial } from 'three/src/materials/MeshLambertMaterial.js';
export { MeshPhongMaterial } from 'three/src/materials/MeshPhongMaterial.js';
export { LineBasicMaterial } from 'three/src/materials/LineBasicMaterial.js';
//export { PointsMaterial } from 'three/src/materials/PointsMaterial.js';
//export { MeshBasicMaterial } from 'three/src/materials/MeshBasicMaterial.js';
//export { MeshLambertMaterial } from 'three/src/materials/MeshLambertMaterial.js';
//export { MeshPhongMaterial } from 'three/src/materials/MeshPhongMaterial.js';
export { SpriteMaterial } from 'three/src/materials/SpriteMaterial.js';
export { UniformsLib } from 'three/src/renderers/shaders/UniformsLib.js';
export { TextureLoader } from 'three/src/loaders/TextureLoader.js';
export { ImageLoader } from 'three/src/loaders/ImageLoader.js';
Expand Down Expand Up @@ -70,14 +75,20 @@ export { Vector2 } from 'three/src/math/Vector2.js';
export { Quaternion } from 'three/src/math/Quaternion.js';
export { Color } from 'three/src/math/Color.js';
export { Line3 } from 'three/src/math/Line3.js';
export { ColorManagement } from 'three/src/math/ColorManagement.js';

export * from 'three/src/constants.js';
*/
import { ColorManagement } from 'three';
import { Object3D } from 'three';
//import { Object3D } from 'three/src/core/Object3D.js';

import { Object3D } from 'three/src/core/Object3D.js';
ColorManagement.enabled = true;

Object3D.onUploadDropBuffer = function () {

// call back from BufferAttribute to drop JS buffers after data has been transfered to GPU
this.array = null;
// this.array = null;

};

Expand Down
23 changes: 15 additions & 8 deletions src/js/core/Cfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ class Cfg extends EventDispatcher {

}

return value || defaultValue;
return value ?? defaultValue;

}

themeAngle ( name ) {
themeAngle ( name, defaultAngle = 0 ) {

return MathUtils.degToRad( this.themeValue ( name ) );
return MathUtils.degToRad( this.themeValue ( name, defaultAngle ) );

}

Expand All @@ -159,21 +159,26 @@ class Cfg extends EventDispatcher {

}

themeColorCSS ( name ) {
themeColorCSS ( name, defaultColor = 'black' ) {

return this.themeColor( name ).getStyle();
const color = this.themeColor( name, defaultColor ).getStyle();

return color === undefined ? defaultColor : color;

}

themeColor ( name ) {
themeColor ( name, defaultColor = undefined ) {

let color = this.themeColors.get( name );

if ( color === undefined ) {

const savedColorName = window.localStorage.getItem( 'cv-color:' + name );

color = new Color( savedColorName ? savedColorName : this.themeValue( name ) );
let dcColor = this.themeValue( name );
if ( dcColor === undefined ) dcColor = defaultColor;

color = new Color( savedColorName ? savedColorName : dcColor );
this.themeColors.set( name, color );

}
Expand Down Expand Up @@ -215,7 +220,9 @@ class Cfg extends EventDispatcher {

if ( document.currentScript !== undefined ) {

Cfg.home = document.currentScript.src.match( /^(.*\/)js\// )[ 1 ];
console.log( import.meta );
Cfg.home = import.meta.url.match( /^(.*\/)js\// )[ 1 ];
// Cfg.home = document.currentScript.src.match( /^(.*\/)js\// )[ 1 ];

}

Expand Down
10 changes: 9 additions & 1 deletion src/js/core/CommonAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ const positionAttribute = new Float32BufferAttribute( [
1, 0, 0
], 3 );

const uvAttribute = new Float32BufferAttribute( [
0, 0,
0, 1,
1, 1,
1, 0
], 2 );

const CommonAttributes = {
index: indexAttribute,
position: positionAttribute
position: positionAttribute,
uv: uvAttribute
};

export { CommonAttributes };
Loading