fix
This commit is contained in:
parent
b758a96da2
commit
52d464d706
BIN
dist/img/2.hdr
vendored
Normal file
BIN
dist/img/2.hdr
vendored
Normal file
Binary file not shown.
27
src/index.ts
27
src/index.ts
@ -16,10 +16,8 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
if (canvas == null) return;
|
if (canvas == null) return;
|
||||||
|
|
||||||
const scene = new THREE.Scene();
|
const scene = new THREE.Scene();
|
||||||
|
const camera = new THREE.PerspectiveCamera( 70, canvas.clientWidth/canvas.clientHeight, 0.1, 2000);
|
||||||
const camera = new THREE.PerspectiveCamera(
|
camera.position.set(0, 1, -1.5)
|
||||||
30, canvas.clientWidth/canvas.clientHeight, 0.1, 20);
|
|
||||||
camera.position.set(0.0, 0.9, -4.0)
|
|
||||||
camera.rotation.set(0.0, Math.PI, 0.0)
|
camera.rotation.set(0.0, Math.PI, 0.0)
|
||||||
camera.lookAt(new THREE.Vector3(0, 0, 0));
|
camera.lookAt(new THREE.Vector3(0, 0, 0));
|
||||||
|
|
||||||
@ -115,7 +113,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
const ambientLight = new THREE.AmbientLight(0x333333);
|
const ambientLight = new THREE.AmbientLight(0x333333);
|
||||||
scene.add(ambientLight);
|
scene.add(ambientLight);
|
||||||
|
|
||||||
const floor = new Mesh(
|
let floor = new Mesh(
|
||||||
new BoxGeometry(50, 100),
|
new BoxGeometry(50, 100),
|
||||||
new MeshLambertMaterial({
|
new MeshLambertMaterial({
|
||||||
color: 0xffffff,
|
color: 0xffffff,
|
||||||
@ -140,18 +138,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
const ambientLight = new THREE.AmbientLight(0x333333);
|
const ambientLight = new THREE.AmbientLight(0x333333);
|
||||||
scene.add(ambientLight);
|
scene.add(ambientLight);
|
||||||
|
|
||||||
//const floor = new Mesh(
|
let grid = new GridHelper(500, 1000, 0xffffff, 0xffffff);
|
||||||
// new BoxGeometry(50, 100),
|
|
||||||
// new MeshLambertMaterial({
|
|
||||||
// color: 0xffffff,
|
|
||||||
// depthWrite: true,
|
|
||||||
// })
|
|
||||||
//);
|
|
||||||
//floor.position.y = -1.0;
|
|
||||||
//floor.rotation.x = -Math.PI / 2;
|
|
||||||
//scene.add(floor);
|
|
||||||
|
|
||||||
const grid = new GridHelper(50, 100, 0xffffff, 0xffffff);
|
|
||||||
scene.add(grid);
|
scene.add(grid);
|
||||||
grid.position.set(Math.round(0), 0, Math.round(0));
|
grid.position.set(Math.round(0), 0, Math.round(0));
|
||||||
scene.fog = new Fog(0xffffff, 3, 20);
|
scene.fog = new Fog(0xffffff, 3, 20);
|
||||||
@ -249,11 +236,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
let hdr_r = 0;
|
let hdr_r = 0;
|
||||||
function hdr_s() {
|
function hdr_s() {
|
||||||
if (hdr_r == 0) {
|
if (hdr_r >= 2) { hdr_r = 0; } else { hdr_r++; };
|
||||||
hdr_r = 1;
|
|
||||||
} else {
|
|
||||||
hdr_r = 0;
|
|
||||||
}
|
|
||||||
let hdr = "/img/" + hdr_r + ".hdr";
|
let hdr = "/img/" + hdr_r + ".hdr";
|
||||||
new RGBELoader().load(hdr, function (texture) {
|
new RGBELoader().load(hdr, function (texture) {
|
||||||
texture.mapping = THREE.EquirectangularReflectionMapping;
|
texture.mapping = THREE.EquirectangularReflectionMapping;
|
||||||
|
Loading…
Reference in New Issue
Block a user