-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
52ac5af
commit 0844fc7
Showing
2 changed files
with
55 additions
and
0 deletions.
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
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,54 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Three Low Poly</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
canvas { | ||
display: block; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<script type="module"> | ||
import * as THREE from "three"; | ||
import { OrbitControls } from "three/addons/controls/OrbitControls.js"; | ||
import { DaySkybox } from "../../src/index.js"; | ||
|
||
const scene = new THREE.Scene(); | ||
|
||
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); | ||
camera.position.z = 5; | ||
|
||
const renderer = new THREE.WebGLRenderer(); | ||
renderer.setClearColor(0x000000); | ||
renderer.setSize(window.innerWidth, window.innerHeight); | ||
renderer.shadowMap.enabled = true; | ||
document.body.appendChild(renderer.domElement); | ||
|
||
let daySkybox = new DaySkybox(); | ||
scene.add(daySkybox); | ||
|
||
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.5); | ||
directionalLight.position.set(-5, 10, 5); | ||
directionalLight.castShadow = true; | ||
scene.add(directionalLight); | ||
|
||
const hemisphereLight = new THREE.HemisphereLight(0xaaaaaa, 0x000000, 0.5); | ||
hemisphereLight.position.set(0, 10, 0); | ||
scene.add(hemisphereLight); | ||
|
||
const controls = new OrbitControls(camera, renderer.domElement); | ||
controls.update(); | ||
|
||
renderer.setAnimationLoop(() => { | ||
renderer.render(scene, camera); | ||
controls.update(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |