three#Scene TypeScript Examples

The following examples show how to use three#Scene. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: scene-helper.ts    From head-tracked-3d with MIT License 6 votes vote down vote up
export function loadModel(scene: Scene, file: string) {
  const loader = new GLTFLoader();
  loader.load(file, function (gltf) {
    gltf.scene.scale.multiplyScalar(0.05);
    gltf.scene.position.z = 4;

    gltf.scene.rotation.y = -Math.PI / 2;
    scene.add(gltf.scene);
  });
}
Example #2
Source File: scene-helper.ts    From head-tracked-3d with MIT License 6 votes vote down vote up
export function loadEnvMap(renderer: WebGLRenderer, scene: Scene) {
  const pmremGenerator = new PMREMGenerator(renderer);
  pmremGenerator.compileEquirectangularShader();

  new RGBELoader()
    .setDataType(UnsignedByteType)
    .load("quarry_01_1k.hdr", function (texture) {
      const envMap = pmremGenerator.fromEquirectangular(texture).texture;

      scene.background = envMap;
      scene.environment = envMap;

      texture.dispose();
      pmremGenerator.dispose();
    });
}
Example #3
Source File: MapView.ts    From geo-three with MIT License 6 votes vote down vote up
/**
	 * Ajust node configuration depending on the camera distance.
	 *
	 * Called everytime before render.
	 */
	public onBeforeRender: (renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group)=> void = (renderer, scene, camera, geometry, material, group) => 
	{
		this.lod.updateLOD(this, camera, renderer, scene);
	};
Example #4
Source File: app.component.ts    From Angular-Cookbook with MIT License 5 votes vote down vote up
// DO NOT USE THE CODE BELOW IN PRODUCTION
  // IT WILL CAUSE PERFORMANCE ISSUES
  constructor(private auth: AuthService, private router: Router) {
    console.log(format(new Date(), 'LLL do yyyy'));
    const scene = new Scene();
  }
Example #5
Source File: app.component.ts    From Angular-Cookbook with MIT License 5 votes vote down vote up
// DO NOT USE THE CODE BELOW IN PRODUCTION
  // IT WILL CAUSE PERFORMANCE ISSUES
  constructor(private auth: AuthService, private router: Router) {
    const scene = new Scene();
    console.log(format(new Date(), 'LLL do yyyy'));
  }
Example #6
Source File: Stage.ts    From FairyGUI-threejs with MIT License 5 votes vote down vote up
_scene: Scene
Example #7
Source File: App.ts    From codecity with Mozilla Public License 2.0 5 votes vote down vote up
static scene: Scene;
Example #8
Source File: scene-helper.ts    From head-tracked-3d with MIT License 5 votes vote down vote up
export function updateFog(scene: Scene) {
  const color = "black";

  if (!scene.fog) {
    scene.fog = new FogExp2(color, 0.05);
    scene.background = new Color(color);
  }
}
Example #9
Source File: MapView.d.ts    From geo-three with MIT License 5 votes vote down vote up
onBeforeRender: (renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Group) => void;
Example #10
Source File: Scene.ts    From trois with MIT License 5 votes vote down vote up
SceneInjectionKey: InjectionKey<Scene> = Symbol('Scene')