-
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
f501fda
commit b410b4a
Showing
2 changed files
with
48 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,47 @@ | ||
<!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 GUI from "lil-gui"; | ||
import { createOrbitScene } from "../utils/orbitScene.js"; | ||
import { Rock } from "../../src/index.js"; | ||
|
||
const { scene } = createOrbitScene(); | ||
|
||
let rock = new Rock(); | ||
scene.add(rock); | ||
|
||
const gui = new GUI(); | ||
const parameters = { | ||
radius: 1, | ||
widthSegments: 4, | ||
heightSegments: 4, | ||
}; | ||
|
||
gui.title("Rock"); | ||
gui.add(parameters, "radius", 0.5, 2).step(0.1).onChange(update); | ||
gui.add(parameters, "widthSegments", 2, 8).step(1).onChange(update); | ||
gui.add(parameters, "heightSegments", 2, 8).step(1).onChange(update); | ||
|
||
function update() { | ||
scene.remove(rock); | ||
rock = new Rock(parameters.radius, parameters.widthSegments, parameters.heightSegments); | ||
scene.add(rock); | ||
} | ||
</script> | ||
</body> | ||
</html> |