You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/sample/old/lightSample.ts

184 lines
6.0 KiB

// import { gScene, gRender } from "./index";
// import * as THREE from 'three'
// import { createPath, } from "./AddExtrude";
// declare function require(string): string;
// export function test2()
// {
// var bulbLight = new THREE.PointLight(0xffee88, 1, 100000, 2);
// bulbLight.position.set(0, 0, 5);
// gScene.add(bulbLight);
// gRender.physicallyCorrectLights = true;
// gRender.gammaInput = true;
// gRender.shadowMap.enabled = true;
// gRender.toneMapping = THREE.ReinhardToneMapping;
// gRender.setPixelRatio(window.devicePixelRatio);
// var bulbGeometry = new THREE.SphereGeometry(0.02, 16, 8);
// var bulbLight = new THREE.PointLight(0xffee88, 1, 100, 2);
// var bulbMat = new THREE.MeshStandardMaterial({
// emissiveIntensity: 1,
// color: 0x000000
// });
// bulbLight.add(new THREE.Mesh(bulbGeometry, bulbMat));
// bulbLight.position.set(0, 2, 0);
// bulbLight.castShadow = true;
// gScene.add(bulbLight);
// var hemiLight = new THREE.HemisphereLight(0xddeeff, 0x0f0e0d, 0.02);
// gScene.add(hemiLight);
// var floorMat = new THREE.MeshStandardMaterial({
// roughness: 0.8,
// color: 0xffffff,
// metalness: 0.2,
// bumpScale: 0.0005
// });
// var textureLoader = new THREE.TextureLoader();
// textureLoader.load("textures/hardwood2_diffuse.jpg", function (map)
// {
// map.wrapS = THREE.RepeatWrapping;
// map.wrapT = THREE.RepeatWrapping;
// map.anisotropy = 4;
// map.repeat.set(10, 24);
// floorMat.map = map;
// floorMat.needsUpdate = true;
// });
// textureLoader.load("textures/hardwood2_bump.jpg", function (map)
// {
// map.wrapS = THREE.RepeatWrapping;
// map.wrapT = THREE.RepeatWrapping;
// map.anisotropy = 4;
// map.repeat.set(10, 24);
// floorMat.bumpMap = map;
// floorMat.needsUpdate = true;
// });
// textureLoader.load("textures/hardwood2_roughness.jpg", function (map)
// {
// map.wrapS = THREE.RepeatWrapping;
// map.wrapT = THREE.RepeatWrapping;
// map.anisotropy = 4;
// map.repeat.set(10, 24);
// floorMat.roughnessMap = map;
// floorMat.needsUpdate = true;
// });
// var cubeMat = new THREE.MeshStandardMaterial({
// roughness: 0.7,
// color: 0xffffff,
// bumpScale: 0.002,
// metalness: 0.2
// });
// textureLoader.load("textures/brick_diffuse.jpg", function (map)
// {
// map.wrapS = THREE.RepeatWrapping;
// map.wrapT = THREE.RepeatWrapping;
// map.anisotropy = 4;
// map.repeat.set(1, 1);
// cubeMat.map = map;
// cubeMat.needsUpdate = true;
// });
// textureLoader.load("textures/brick_bump.jpg", function (map)
// {
// map.wrapS = THREE.RepeatWrapping;
// map.wrapT = THREE.RepeatWrapping;
// map.anisotropy = 4;
// map.repeat.set(1, 1);
// cubeMat.bumpMap = map;
// cubeMat.needsUpdate = true;
// });
// var ballMat = new THREE.MeshStandardMaterial({
// color: 0xffffff,
// roughness: 0.5,
// metalness: 1.0
// });
// textureLoader.load("textures/planets/earth_atmos_2048.jpg", function (map)
// {
// map.anisotropy = 4;
// ballMat.map = map;
// ballMat.needsUpdate = true;
// });
// textureLoader.load("textures/planets/earth_specular_2048.jpg", function (map)
// {
// map.anisotropy = 4;
// ballMat.metalnessMap = map;
// ballMat.needsUpdate = true;
// });
// var floorGeometry = new THREE.PlaneBufferGeometry(20, 20);
// var floorMesh = new THREE.Mesh(floorGeometry, floorMat);
// floorMesh.receiveShadow = true;
// floorMesh.rotation.x = -Math.PI / 2.0;
// gScene.add(floorMesh);
// var ballGeometry = new THREE.SphereGeometry(0.5, 32, 32);
// var ballMesh = new THREE.Mesh(ballGeometry, ballMat);
// ballMesh.position.set(1, 0.5, 1);
// ballMesh.rotation.y = Math.PI;
// ballMesh.castShadow = true;
// gScene.add(ballMesh);
// var boxGeometry = new THREE.BoxGeometry(0.5, 0.5, 0.5);
// var boxMesh = new THREE.Mesh(boxGeometry, cubeMat);
// boxMesh.position.set(-0.5, 0.25, -1);
// boxMesh.castShadow = true;
// gScene.add(boxMesh);
// var boxMesh2 = new THREE.Mesh(boxGeometry, cubeMat);
// boxMesh2.position.set(0, 0.25, -5);
// boxMesh2.castShadow = true;
// gScene.add(boxMesh2);
// var boxMesh3 = new THREE.Mesh(boxGeometry, cubeMat);
// boxMesh3.position.set(7, 0.25, 0);
// boxMesh3.castShadow = true;
// gScene.add(boxMesh3);
// var wid = 0.2;
// var len = 0.2;
// let pts = [
// new THREE.Vector2(0, 0),
// new THREE.Vector2(wid, 0),
// new THREE.Vector2(wid, len - 2),
// new THREE.Vector2(wid - 2, len),
// new THREE.Vector2(2, len),
// new THREE.Vector2(0, len - 2),
// new THREE.Vector2(0, 0)
// ];
// let buls = [0, 0, -0.414214, 0, 0.414214, 0];
// //sbmesh.
// var sp = createPath(pts, buls);
// var extrudeSettings = {
// steps: 1,
// bevelEnabled: false,
// amount: 0.5
// };
// var ext = new THREE.ExtrudeGeometry(sp, extrudeSettings);
// var geo = new THREE.ShapeGeometry(sp);
// var loader: THREE.TextureLoader = new THREE.TextureLoader();
// var url = require("file-loader?!../textures/017.jpg");
// var texture: THREE.Texture = loader.load(require("file-loader?!../textures/017.jpg"));
// texture.wrapS = texture.wrapT = THREE.RepeatWrapping; // CHANGED
// texture.offset.set(0, 0.5); // CHANGED
// texture.repeat.set(1, 1); // CHANGED
// var mesh = new THREE.Mesh(ext, new THREE.MeshPhongMaterial({
// // color: 0xFF00FF,
// map: texture
// }));
// mesh.position.set(3, 0, -3
// );
// mesh.rotation.set(1, 1, 0);
// gScene.add(mesh);
// }
// window["move"] = function ()
// {
// }