/* globals Stats, dat, AMI*/
// VJS classes we will be using in this lesson
var LoadersVolume = AMI.default.Loaders.Volume;
var CamerasOrthographic = AMI.default.Cameras.Orthographic;
var ControlsOrthographic = AMI.default.Controls.TrackballOrtho;
var HelpersStack = AMI.default.Helpers.Stack;
// Setup renderer
var container = document.getElementById('container');
var renderer = new THREE.WebGLRenderer({
antialias: true
});
renderer.setSize(container.offsetWidth, container.offsetHeight);
renderer.setClearColor(0x353535, 1);
renderer.setPixelRatio(window.devicePixelRatio);
container.appendChild(renderer.domElement);
// Setup scene
var scene = new THREE.Scene();
// Setup camera
var camera = new CamerasOrthographic(container.clientWidth / -2, container.clientWidth / 2, container.clientHeight / 2, container.clientHeight / -2, 0.1, 10000);
// Setup controls
var controls = new ControlsOrthographic(camera, container);
controls.staticMoving = true;
controls.noRotate = true;
controls.modified = false;
controls.addEventListener("start", function(){controls.modified = true;});
controls.addEventListener("change", function(){controls.modified = true;});
controls.addEventListener("OnScroll", function(){controls.modified = true;});
controls.addEventListener("end", function(){requestAnimationFrame(function() {
controls.modified = false;
});});
// handle resize
function onWindowResize() {
camera.canvas = {
width: container.offsetWidth,
height: container.offsetHeight
};
camera.fitBox(2);
renderer.setSize(container.offsetWidth, container.offsetHeight);
}
window.addEventListener('resize', onWindowResize, false);
// build GUI
function gui(stackHelper){
var gui = new dat.GUI({
autoPlace: false
});
var customContainer = document.getElementById('my-gui-container');
customContainer.appendChild(gui.domElement);
// only reason to use this object is to satusfy data.GUI
var camUtils = {
invertRows:...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.