-
Notifications
You must be signed in to change notification settings - Fork 212
Getting started
Nicolas Rannou edited this page Jan 2, 2017
·
8 revisions
Few words about threejs, ami and XTK
Manages all the rendering, at the GPU level. Many properties can be tweaked. It allows us to render a scene.
Typical usage:
// Get container in the DOM
var container = document.getElementById('container');
// Create renderer
var renderer = new THREE.WebGLRenderer({
antialias: true
});
renderer.setSize(container.clientWidth, container.clientHeight);
renderer.setClearColor(0x2196F3, 1);
// Attach renderer to the DOM
container.appendChild(renderer0.domElement);
...
// Render to screen
renderer.render(scene, camera);
...
Contains all elements to be rendered.
Typical usage:
// create scene
var scene = new THREE.Scene();
...
// add mesh to the scene
scene.add( mesh );
// add light to the scene
scene.add( light );
...
Defines the way we look at the scene.
Typical usage:
// create the camera
var camera = new THREE.PerspectiveCamera(45, container.offsetWidth / container.offsetHeight, 0.01, 10000000);
camera.position.x = 150;
camera.position.y = 150;
camera.position.z = 100;
...
scene.add( mesh );
scene.add( light );
...
Modifies the camera's position/orientation in order to update the scene to be rendered.
Typical usage:
// create the camera
var controls = new THREE.Trackball(camera, container);
camera.position.x = 150;
camera.position.y = 150;
camera.position.z = 100;
...
scene.add( mesh );
scene.add( light );
...
Get an array buffers from urls.
Parse loader's output and convert it to a user friendly JS object.
Base elements that contains all element specific required methods.
Elements that connect loaders, parsers and models for common actions.
Look at the lessons to see how the pieces work together.