Skip to content

Commit

Permalink
"Little BaseObject to create some meshes."
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris2011 committed Feb 22, 2012
1 parent 1ccfb94 commit 3299c0b
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions Scripts/functions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
(function()
{
"use strict";

var threeObj = window.THREE;
console.log(threeObj);

var sceneObj = {
WIDTH: 1024,
HEIGHT: 768
Expand All @@ -13,12 +18,12 @@
};

var canvasArea = document.getElementById("area");
var renderer = new THREE.WebGLRenderer();
var camera = new THREE.PerspectiveCamera(cameraAttr.VIEW_ANGLE,
cameraAttr.ASPECT,
cameraAttr.NEAR,
cameraAttr.FAR);
var scene = new THREE.Scene();
var renderer = new threeObj.WebGLRenderer();
var camera = new threeObj.PerspectiveCamera(cameraAttr.VIEW_ANGLE,
cameraAttr.ASPECT,
cameraAttr.NEAR,
cameraAttr.FAR);
var scene = new threeObj.Scene();

var init = function()
{
Expand All @@ -29,14 +34,9 @@
renderer.render(scene, camera);
};

var mesh = (function()
{
return this;
}());

window.init = init;
window.mesh = mesh;
var mesh = function(){ return this; };

mesh.meshMaterial = new threeObj.MeshLambertMaterial({ color: 0xCC00FF });
mesh.sphere = {
sphereAttr: {
radius: 50,
Expand All @@ -45,24 +45,32 @@
},
create: function()
{
var sphereMaterial = new THREE.MeshLambertMaterial({ color: 0xCC0000 });
var create = new THREE.Mesh(new THREE.SphereGeometry(this.sphereAttr.radius, this.sphereAttr.segments, this.sphereAttr.rings), sphereMaterial);

scene.add(create);
var sphereMesh = new threeObj.Mesh(new threeObj.SphereGeometry(this.sphereAttr.radius,
this.sphereAttr.segments,
this.sphereAttr.rings), mesh.meshMaterial);
scene.add(sphereMesh);
}
};

mesh.cube = {
cubeAttr: {
color: "black"
color: 0xCCDDCC
}
};

window.threeObj = threeObj;
window.init = init;
window.mesh = mesh;
}());

// init();
/**/
init();

console.log(mesh);
console.log(mesh.meshMaterial);
console.log(mesh.meshMaterial.color);
console.log(mesh.sphere.sphereAttr);
mesh.sphere.create();

console.log(mesh.cube.cubeAttr.color);
//console.log(createMesh.sphereAttr.rings);
//console.log(createMesh.sphereAttr.segments);
// createMesh.createSphere();
/**/

0 comments on commit 3299c0b

Please sign in to comment.