huntrezz commited on
Commit
e320b6c
1 Parent(s): 4c44b59

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +34 -0
index.html CHANGED
@@ -15,6 +15,40 @@
15
  <script>
16
  // Your WebGL and Three.js code will go here
17
  // Initialize scene, camera, renderer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  const scene = new THREE.Scene();
19
  const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
20
  const renderer = new THREE.WebGLRenderer({canvas: document.getElementById('depthCanvas')});
 
15
  <script>
16
  // Your WebGL and Three.js code will go here
17
  // Initialize scene, camera, renderer
18
+ // Set up Three.js scene, camera, and renderer
19
+ const scene = new THREE.Scene();
20
+ const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
21
+ const renderer = new THREE.WebGLRenderer();
22
+
23
+ // Create point cloud geometry
24
+ const geometry = new THREE.BufferGeometry();
25
+ const positions = new Float32Array(256 * 256 * 3);
26
+ const colors = new Float32Array(256 * 256 * 3);
27
+ geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
28
+ geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
29
+
30
+ // Create point cloud material
31
+ const material = new THREE.PointsMaterial({ size: 0.01, vertexColors: true });
32
+
33
+ // Create point cloud object
34
+ const pointCloud = new THREE.Points(geometry, material);
35
+ scene.add(pointCloud);
36
+
37
+ // Function to update point cloud with new data
38
+ function updatePointCloud(depthMap, rgbFrame) {
39
+ // Convert depth map and RGB frame to 3D coordinates and colors
40
+ // Update geometry attributes
41
+ pointCloud.geometry.attributes.position.needsUpdate = true;
42
+ pointCloud.geometry.attributes.color.needsUpdate = true;
43
+ }
44
+
45
+ // Main render loop
46
+ function animate() {
47
+ requestAnimationFrame(animate);
48
+ renderer.render(scene, camera);
49
+ }
50
+ animate();
51
+
52
  const scene = new THREE.Scene();
53
  const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
54
  const renderer = new THREE.WebGLRenderer({canvas: document.getElementById('depthCanvas')});