-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Lights testing three.js app</title> | ||
<style> | ||
body { margin: 0; } | ||
</style> | ||
</head> | ||
<body> | ||
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script> | ||
|
||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"three": "https://unpkg.com/[email protected]/build/three.module.js", | ||
"three/addons/": "https://unpkg.com/[email protected]/examples/jsm/" | ||
} | ||
} | ||
</script> | ||
|
||
|
||
<script type="module"> | ||
import * as THREE from 'three'; | ||
import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; | ||
|
||
const scene = new THREE.Scene(); | ||
//for foreground fog | ||
scene.fog = new THREE.Fog(0xFB6522, 10, 15); | ||
scene.fog = true; | ||
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); | ||
camera.position.set( -13, 0, 100); | ||
//renderer for the scene | ||
const renderer = new THREE.WebGLRenderer(); | ||
renderer.shadowMap.enabled = true; | ||
renderer.shadowMap.type = THREE.PCFSoftShadowMap; | ||
renderer.outputEncoding = THREE.sRGBEncoding; | ||
|
||
renderer.setSize( window.innerWidth, window.innerHeight); | ||
document.body.appendChild( renderer.domElement); | ||
|
||
//controls for camera | ||
const controls = new OrbitControls(camera, renderer.domElement); | ||
controls.minDistance = 20; | ||
controls.maxDistance = 300; | ||
controls.MaxPolarAngle = Math.PI/2; | ||
controls.target.set(0, 0, 0); | ||
controls.update(); | ||
|
||
//Ambient Light | ||
let ambientLight = new THREE.AmbientLight(0x404040); | ||
ambientLight.intensity = .05; | ||
ambientLight.isAmbientLight = true; | ||
|
||
scene.add(ambientLight); | ||
|
||
//Plane | ||
let PlaneGeo = new THREE.PlaneGeometry(2000,2000); | ||
|
||
|
||
window.addEventListener( 'resize', onWindowResize ); | ||
|
||
function onWindowResize() { | ||
|
||
camera.aspect = window.innerWidth / window.innerHeight; | ||
camera.updateProjectionMatrix(); | ||
|
||
renderer.setSize( window.innerWidth, window.innerHeight ); | ||
|
||
} | ||
|
||
function animate() { | ||
requestAnimationFrame(animate); | ||
const time = performance.now() / 3000; | ||
|
||
|
||
|
||
renderer.render(scene, camera); | ||
} | ||
animate(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters