5.0.0-beta2 • Published 9 days ago

ore-three v5.0.0-beta2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 days ago

Ore Three

three.js utils.

npm.io

Documentation Examples

install

You can get the library from npm.

$ npm install ore-three
Import
import * as ORE from 'ore-three';

Create Controller

import * as ORE from 'ore-three';

import { MainScene } from './MainScene';

export class APP {

	private controller: ORE.Controller;
	private scene: MainScene;

	constructor() {

		this.controller = new ORE.Controller();

		this.scene = new MainScene( {
			name: 'Main',
			canvas: document.querySelector( '#canvas' ) as HTMLCanvasElement,
		} );

		this.controller.addLayer( this.scene );

	}

}

window.addEventListener( 'load', () => {

	let app = new APP();

} );

Create Scene

import * as THREE from 'three';
import * as ORE from '@ore-three';

export class MainScene extends ORE.BaseLayer {

	private box: THREE.Mesh;

	constructor( param: ORE.LayerParam ) {

		super( param );

		/*-------------------------------
			Scene
		-------------------------------*/

		this.camera.position.set( 0, 1.5, 4 );
		this.camera.lookAt( 0, 0, 0 );

		this.box = new THREE.Mesh( 
			new THREE.BoxGeometry(),
			new THREE.MeshNormalMaterial()
		);

		this.scene.add( this.box );

	}

	public animate( deltaTime: number ) {

		if ( this.box ) {

			this.box.rotateY( 1.0 * deltaTime );

		}

		if ( this.renderer ) {

			this.renderer.render( this.scene, this.camera );

		}

	}

	public onResize() {

		super.onResize();

	}

	public onTouchStart( args: ORE.TouchEventArgs ) {
	}

	public onTouchMove( args: ORE.TouchEventArgs ) {
	}

	public onTouchEnd( args: ORE.TouchEventArgs ) {
	}

	public onHover( args: ORE.TouchEventArgs ) {
	}

	public onWheel( event: WheelEvent, trackpadDelta: number ) {
	}

}
5.0.0-beta2

9 days ago

5.0.0-beta1

2 months ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.0-beta1

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

3.0.0-beta2

2 years ago

3.0.0-beta

2 years ago