Browse Source

enable anti aliasing in 3d viewer

Thomas Buck 7 months ago
parent
commit
ca831dc446
3 changed files with 23 additions and 4 deletions
  1. 3
    1
      docs/src/3dprint.md
  2. 1
    1
      docs/src/introduction.md
  3. 19
    2
      docs/src/js/3d.js

+ 3
- 1
docs/src/3dprint.md View File

@@ -1,6 +1,8 @@
1 1
 # Mounting Hardware
2 2
 
3
-**TODO** work in progress
3
+This page shows all the 3d printed parts.
4
+The dimensions for the parametric OpenSCAD settings for these generated STL files should match what we used for the prototype.
5
+For your own build you may need to get the OpenSCAD sources [from the repo](https://github.com/xythobuz/lars/tree/master/3dprint) and tweak the values.
4 6
 
5 7
 ## Beam
6 8
 

+ 1
- 1
docs/src/introduction.md View File

@@ -10,4 +10,4 @@ It is controlled by a Raspberry Pi Pico on a custom PCB.
10 10
 
11 11
 See [this blog post for some more context](https://www.xythobuz.de/lars.html).
12 12
 
13
-**TODO** work in progress
13
+[![assembled prototype](https://www.xythobuz.de/img/lars_3_small.jpg)](https://www.xythobuz.de/img/lars_3.jpg)

+ 19
- 2
docs/src/js/3d.js View File

@@ -2,6 +2,24 @@
2 2
  * 3d.js
3 3
  *
4 4
  * Copyright (c) 2024 Thomas Buck (thomas@xythobuz.de)
5
+ *
6
+ * For the fitCameraToObject() function also:
7
+ * Copyright (c) 2024 Michal Jirků
8
+ * https://wejn.org/2020/12/cracking-the-threejs-object-fitting-nut/
9
+ *
10
+ * For everything else:
11
+ *
12
+ * This program is free software: you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation, either version 3 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * See <http://www.gnu.org/licenses/>.
5 23
  */
6 24
 
7 25
 import * as THREE from 'three';
@@ -9,7 +27,6 @@ import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
9 27
 import { STLLoader } from 'three/addons/loaders/STLLoader.js'
10 28
 import { VRMLLoader } from 'three/addons/loaders/VRMLLoader.js';
11 29
 
12
-// https://wejn.org/2020/12/cracking-the-threejs-object-fitting-nut/
13 30
 function fitCameraToObject(camera, object, offset, orbitControls, yOffset) {
14 31
     const boundingBox = new THREE.Box3();
15 32
     boundingBox.setFromObject( object );
@@ -92,7 +109,7 @@ export function init_3d(path, container, status, div_width, div_height) {
92 109
 
93 110
     const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
94 111
 
95
-    const renderer = new THREE.WebGLRenderer();
112
+    const renderer = new THREE.WebGLRenderer({ antialias: true });
96 113
     renderer.setSize(width, height);
97 114
 
98 115
     const controls = new OrbitControls(camera, renderer.domElement);

Loading…
Cancel
Save