From 683c209c94852d23156232805ead1f4fb4212fb9 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Tue, 9 Apr 2024 22:51:27 -0500 Subject: [PATCH] added 3d floor. texture must be added seperately as git hates it --- main.js | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/main.js b/main.js index acda91d..9350051 100644 --- a/main.js +++ b/main.js @@ -48,39 +48,25 @@ scene.add(gridHelper, lightHelper); const controls = new OrbitControls(camera, renderer.domElement); -const geometry = new THREE.PlaneGeometry(100, 100, 100, 100); -const mirrorMaterial = new THREE.MeshBasicMaterial( { color: 0x111111, envMap: camera.renderTarget } ); -const material = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} ); -const plane = new THREE.Mesh( geometry, mirrorMaterial ); -plane.rotateX(200); -scene.add( plane ); +//beggining of creating floor +const floorTexture = new THREE.TextureLoader().load("marble.jpg"); +floorTexture.wrapT = THREE.RepeatWrapping; +floorTexture.wrapS = THREE.RepeatWrapping; +floorTexture.repeat.set(1, 10); +const floorGeometry = new THREE.PlaneGeometry(100, 1000, 1000, 1000); +const floorMaterial = new THREE.MeshStandardMaterial({ + map: floorTexture, +}) +const floor = new THREE.Mesh(floorGeometry, floorMaterial); +floor.rotateX(200); +scene.add(floor); -const circleGeometry = new THREE.SphereGeometry(10, 10, 10, 10); -const sphere = new THREE.Mesh(circleGeometry, material); - -sphere.position.y += 15 - -scene.add(sphere); - - - -function getRandomInt(max) { - return Math.floor(Math.random() * max); - } - - - - -scene.background = "black"; function animate(){ requestAnimationFrame(animate); - - - renderer.render(scene, camera) } -animate(); \ No newline at end of file +animate();