added 3d floor. texture must be added seperately as git hates it

This commit is contained in:
Daniel Jones 2024-04-09 22:51:27 -05:00
parent 58d6cd78bf
commit 683c209c94

40
main.js
View File

@ -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();
animate();