remove extraneous updatebuffer call
parent
031f438333
commit
8c3ef6f326
|
@ -1 +1,2 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
|
dist/
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
|
@ -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>
|
|
|
@ -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"
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
# https://www.robotstxt.org/robotstxt.html
|
|
||||||
User-agent: *
|
|
||||||
Disallow:
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -250,11 +250,10 @@ export class Sketcher extends THREE.Group {
|
||||||
|
|
||||||
onDrag(e) {
|
onDrag(e) {
|
||||||
const mouseLoc = this.getLocation(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()
|
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' })
|
this.dispatchEvent({ type: 'change' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +262,6 @@ export class Sketcher extends THREE.Group {
|
||||||
this.domElement.removeEventListener('pointermove', this.onDrag)
|
this.domElement.removeEventListener('pointermove', this.onDrag)
|
||||||
this.domElement.removeEventListener('pointerup', this.onRelease)
|
this.domElement.removeEventListener('pointerup', this.onRelease)
|
||||||
this.geomGroup.children[this.grabPtIdx].geometry.computeBoundingSphere()
|
this.geomGroup.children[this.grabPtIdx].geometry.computeBoundingSphere()
|
||||||
// this.grabbedObject = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -530,13 +528,6 @@ export class Sketcher extends THREE.Group {
|
||||||
|
|
||||||
solve() {
|
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)
|
const pts_buffer = Module._malloc(this.ptsBuf.length * this.ptsBuf.BYTES_PER_ELEMENT)
|
||||||
Module.HEAPF32.set(this.ptsBuf, pts_buffer >> 2)
|
Module.HEAPF32.set(this.ptsBuf, pts_buffer >> 2)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue