remove extraneous updatebuffer call

master
howard 2021-03-24 15:35:13 -07:00
parent 031f438333
commit 8c3ef6f326
13 changed files with 5 additions and 95380 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules/
dist/

0
dist/.nojekyll vendored
View File

92805
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

1
dist/bundle.js.map vendored

File diff suppressed because one or more lines are too long

BIN
dist/favicon.ico vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
dist/icon-192.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

BIN
dist/icon-512.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

71
dist/index.html vendored
View File

@ -1,71 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta property="og:title" content="CAD Tool" />
<meta property="og:description" content="Three.js CAD tool" />
<meta property="og:url" content="" />
<meta property="og:image" content="" />
<link rel="apple-touch-icon" href="icon-192.png" />
<link rel="manifest" href="manifest.json" />
<title>CAD Tool</title>
<style>
html,
body {
margin: 0;
height: 100%;
}
#c {
width: 100%;
height: 100%;
display: block;
}
.split {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
#view1 {
width: 100%;
height: 100%;
}
#view2 {
position: absolute;
right: 0;
top: 0;
width: 30%;
height: 30%;
}
</style>
</head>
<body>
<canvas id="c"></canvas>
<div class="split">
<div id="view1"></div>
<!-- <div id="view2"></div> -->
</div>
<script src="solver.js">
</script>
<script src="bundle.js" type="module"></script>
</script>
</body>
</html>

27
dist/manifest.json vendored
View File

@ -1,27 +0,0 @@
{
"short_name": "CAD Tool",
"name": "CAD Tool using Three.js",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "icon-192.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable any"
},
{
"src": "icon-512.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable any"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

3
dist/robots.txt vendored
View File

@ -1,3 +0,0 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

2460
dist/solver.js vendored

File diff suppressed because it is too large Load Diff

BIN
dist/solver.wasm vendored

Binary file not shown.

View File

@ -250,11 +250,10 @@ export class Sketcher extends THREE.Group {
onDrag(e) {
const mouseLoc = this.getLocation(e);
this.geomGroup.children[this.grabPtIdx].geometry.attributes.position.set(mouseLoc);
this.updatePointsBuffer()
this.ptsBuf.set(mouseLoc.slice(0,2),this.objIdx.get(this.geomGroup.children[this.grabPtIdx].id)*2)
this.solve()
// console.log(this.geomGroup.children[this.grabPtIdx].geometry.attributes.position.array)
// this.geomGroup.children[this.grabPtIdx].geometry.attributes.position.needsUpdate = true;
this.dispatchEvent({ type: 'change' })
}
@ -263,7 +262,6 @@ export class Sketcher extends THREE.Group {
this.domElement.removeEventListener('pointermove', this.onDrag)
this.domElement.removeEventListener('pointerup', this.onRelease)
this.geomGroup.children[this.grabPtIdx].geometry.computeBoundingSphere()
// this.grabbedObject = null
}
@ -530,13 +528,6 @@ export class Sketcher extends THREE.Group {
solve() {
for (let i = 0, p = 0; i < this.geomGroup.children.length; i++) {
if (this.geomGroup.children[i].type == "Points") {
this.ptsBuf[2 * i] = this.geomGroup.children[i].geometry.attributes.position.array[0]
this.ptsBuf[2 * i + 1] = this.geomGroup.children[i].geometry.attributes.position.array[1]
}
}
const pts_buffer = Module._malloc(this.ptsBuf.length * this.ptsBuf.BYTES_PER_ELEMENT)
Module.HEAPF32.set(this.ptsBuf, pts_buffer >> 2)