var objects = [];
var scene = new THREE.Scene();
var width = window.innerWidth;
var height = window.innerHeight;
var camera = new THREE.PerspectiveCamera( 35, width/height, 0.1, 1000 );
var renderer = new THREE.WebGLRenderer();
renderer.setSize( width, height );
renderer.setClearColor( 0xcccccc, 1 );
document.body.appendChild( renderer.domElement );
scene.add(camera);
controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.screenSpacePanning = true;
setToFullOrbit(controls)
camera.position.copy(new THREE.Vector3(fti(5), fti(5), fti(5)) );
// fix first frame render issue going invisible
camera.lookAt(new THREE.Vector3(0,0,0));
var axisHelper = new THREE.AxisHelper();
scene.add(axisHelper);
var grid = new THREE.GridHelper(fti(12), 12);
scene.add(grid);
// ----- playground starts here ----------------- //
// ---- your code here ------/
var sphere = createSphere(1, new THREE.Vector3(3,3,3));
createLight();
var wallGeo = new THREE.BoxGeometry(10,5,1);
var wall = new THREE.Mesh(wallGeo, new THREE.MeshLambertMaterial({color:0x005500}));
wall.translateY(5);
scene.add(wall);
createUI(sphere);
createShape();
let Obj = function(val){
this.x = val;
}
let o1 = new Obj(1);
let o2 = new Obj(1);
let v1 = new THREE.Vector3(1, 2, 3);
let v2 = new THREE.Vector3(1, 2, 3);
if(o1 === o2) {
console.log('equal');
} else {
console.log('not euqual');
}
// ---- end of playground ---------------------- //
function createLight(){
var dirLight = new THREE.DirectionalLight();
dirLight.position.set(3, 2, 1);
dirLight.position.multiplyScalar(10);
scene.add(dirLight);
}
function createLine(points, color){
color = color || 0xff0000;
var geo = new THREE.Geometry();
geo.vertices.push(...points);
var line = new THREE.Line(geo, new THREE.LineBasicMaterial({color: color}));
scene.add(line);
console.warn('line addded');
}
function createSphere(size, position){
if(!size){
size = 3;
}
var mesh = new THREE.Mesh(new...
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.