From 04343eda8c2f870b0da55cfdc8003c99fe1cc4de Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:53:10 -0700 Subject: Remove trailing spaces --- js/lib/NJUtils.js | 40 +++++++------- js/lib/drawing/world.js | 66 +++++++++++------------ js/lib/geom/anchor-point.js | 12 ++--- js/lib/geom/brush-stroke.js | 6 +-- js/lib/geom/circle.js | 2 +- js/lib/geom/geom-obj.js | 2 +- js/lib/geom/shape-primitive.js | 2 +- js/lib/geom/sub-path.js | 4 +- js/lib/math/matrix.js | 4 +- js/lib/rdge/materials/bump-metal-material.js | 16 +++--- js/lib/rdge/materials/cloud-material.js | 20 +++---- js/lib/rdge/materials/deform-material.js | 10 ++-- js/lib/rdge/materials/flag-material.js | 12 ++--- js/lib/rdge/materials/flat-material.js | 8 +-- js/lib/rdge/materials/fly-material.js | 10 ++-- js/lib/rdge/materials/julia-material.js | 10 ++-- js/lib/rdge/materials/keleidoscope-material.js | 10 ++-- js/lib/rdge/materials/linear-gradient-material.js | 32 +++++------ js/lib/rdge/materials/mandel-material.js | 10 ++-- js/lib/rdge/materials/material.js | 12 ++--- js/lib/rdge/materials/plasma-material.js | 10 ++-- js/lib/rdge/materials/pulse-material.js | 12 ++--- js/lib/rdge/materials/radial-gradient-material.js | 6 +-- js/lib/rdge/materials/taper-material.js | 2 +- js/lib/rdge/materials/tunnel-material.js | 10 ++-- js/lib/rdge/materials/twist-vert-material.js | 4 +- js/lib/rdge/materials/uber-material.js | 14 ++--- js/lib/rdge/materials/water-material.js | 2 +- js/lib/rdge/texture.js | 18 +++---- 29 files changed, 183 insertions(+), 183 deletions(-) (limited to 'js/lib') diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index e924e1b8..b7cb28e9 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -39,7 +39,7 @@ var Montage = require("montage/core/core").Montage, exports.NJUtils = Montage.create(Component, { /* =============== DOM Access ================ */ - + ///// Quick "getElementById" $ : { value: function(id, doc) { @@ -47,7 +47,7 @@ exports.NJUtils = Montage.create(Component, { return doc.getElementById(id); } }, - + ///// Quick "getElementsByClassName" which also returns as an Array ///// Can return as NodeList by passing true as second argument $$ : { @@ -57,7 +57,7 @@ exports.NJUtils = Montage.create(Component, { return (asNodeList) ? list : this.toArray(list); } }, - + ///// Get child nodes of element ///// Omit filter to only return element nodes ///// Pass in filter function to minimize collection, or @@ -70,9 +70,9 @@ exports.NJUtils = Montage.create(Component, { return this.toArray(el.childNodes).filter(f); } }, - + /* ============= DOM Manipulation ============= */ - + ///// Creates and returns text node from string textNode : { value: function(text) { @@ -95,7 +95,7 @@ exports.NJUtils = Montage.create(Component, { return el; } }, - + decor: { value: function(el, attr) { if (typeof attr === 'object') { @@ -183,7 +183,7 @@ exports.NJUtils = Montage.create(Component, { return node; } }, - + queryParentSelector : { value: function(el, strSelector) { // queryParentSelector: @@ -191,7 +191,7 @@ exports.NJUtils = Montage.create(Component, { // and find the first parent that matches selector strSelector (required). // Returns: The element that matches, or false if there is no match // or if insufficient parameters are supplied. - + if ((typeof(el) === "undefined") || (typeof(strSelector) === "undefined")) { // Parameters are required, m'kay? return false; @@ -199,26 +199,26 @@ exports.NJUtils = Montage.create(Component, { // You also have to use the right parameters. return false; } - + // First, get an empty clone of the parent. var myParent = el.parentNode; var clone = myParent.cloneNode(false); if (clone === null) { return false; } - + // If we're at the top of the DOM, our clone will be an htmlDocument. // htmlDocument has no tagName. if (typeof(clone.tagName) !== "undefined") { // create a bogus div to use as a base for querySelector var temp = document.createElement("div"); - + // Append the clone to the bogus div temp.appendChild(clone); - + // Now we can use querySelector! Sweet. var selectorTest = temp.querySelector(strSelector); - + // What has querySelector returned? if (selectorTest === null) { // No match, so recurse. @@ -232,7 +232,7 @@ exports.NJUtils = Montage.create(Component, { return false; } } - + }, // Returns the numerical value and unit string from a string. @@ -257,14 +257,14 @@ exports.NJUtils = Montage.create(Component, { }, /* ================= Style methods ================= */ - + ///// Get computed height of element height : { value: function(node, pseudo) { return node.ownerDocument.defaultView.getComputedStyle(node, pseudo).getPropertyValue('height'); } }, - + /* ================= Array methods ================= */ ///// Return an array from an array-like object @@ -273,9 +273,9 @@ exports.NJUtils = Montage.create(Component, { return Array.prototype.slice.call(arrayLikeObj); } }, - + /* ================= String methods ================= */ - + ///// Return the last part of a path (e.g. filename) getFileNameFromPath : { value: function(path) { @@ -310,9 +310,9 @@ exports.NJUtils = Montage.create(Component, { value: function(len) { var length; len ? length = len : length = 8; - + return Uuid.generate().substring(0,length); } } - + }); diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index b20b0a5d..08f9d319 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js @@ -68,7 +68,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { { this._2DContext = canvas.getContext( "2d" ); } - + this._viewportWidth = canvas.width; this._viewportHeight = canvas.height; @@ -152,7 +152,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { // Flag to play/pause animation at authortime this._previewAnimation = true; - + //////////////////////////////////////////////////////////////////////////////////// // RDGE // local variables @@ -175,7 +175,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { var camMat = Matrix.I(4); camMat[14] = this.getViewDistance(); this.setCameraMat( camMat ); - + // post-load processing of the scene this.init = function() { @@ -184,13 +184,13 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { if (ctx1 != ctx2) console.log( "***** different contexts *****" ); this.renderer = ctx1.renderer; this.renderer._world = this; - + // create a camera, set its perspective, and then point it at the origin var cam = new RDGE.camera(); this._camera = cam; cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar()); cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], RDGE.vec3.up()); - + // make this camera the active camera this.renderer.cameraManager().setActiveCamera(cam); @@ -198,61 +198,61 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { //this.renderer.setClearFlags(RDGE.globals.engine.getContext().DEPTH_BUFFER_BIT); this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]); //this.renderer.NinjaWorld = this; - + // create an empty scene graph this.myScene = new RDGE.SceneGraph(); - + // create some lights // light 1 // this.light = RDGE.createLightNode("myLight"); // this.light.setPosition([0,0,1.2]); // this.light.setDiffuseColor([0.75,0.9,1.0,1.0]); - + // light 2 // this.light2 = RDGE.createLightNode("myLight2"); // this.light2.setPosition([-0.5,0,1.2]); // this.light2.setDiffuseColor([1.0,0.9,0.75,1.0]); - + // create a light transform var lightTr = RDGE.createTransformNode("lightTr"); - + // create and attach a material - materials hold the light data lightTr.attachMaterial(RDGE.createMaterialNode("lights")); - + // enable light channels 1, 2 - channel 0 is used by the default shader // lightTr.materialNode.enableLightChannel(1, this.light); // lightTr.materialNode.enableLightChannel(2, this.light2); - + // all added objects are parented to the light node this._rootNode = lightTr; - + // add the light node to the scene this.myScene.addNode(lightTr); - + // Add the scene to the engine - necessary if you want the engine to draw for you //RDGE.globals.engine.AddScene("myScene" + this._canvas.id, this.myScene); - var name = this._canvas.getAttribute( "data-RDGE-id" ); + var name = this._canvas.getAttribute( "data-RDGE-id" ); RDGE.globals.engine.AddScene("myScene" + name, this.myScene); }; - - // main code for handling user interaction and updating the scene + + // main code for handling user interaction and updating the scene this.update = function(dt) { if (!dt) dt = 0.2; - + dt = 0.01; // use our own internal throttle this.elapsed += dt; - + if (this._useWebGL) { // changed the global position uniform of light 0, another way to change behavior of a light RDGE.rdgeGlobalParameters.u_light0Pos.set([5 * Math.cos(this.elapsed), 5 * Math.sin(this.elapsed), 20]); - + // orbit the light nodes around the boxes // this.light.setPosition([1.2*Math.cos(this.elapsed*2.0), 1.2*Math.sin(this.elapsed*2.0), 1.2*Math.cos(this.elapsed*2.0)]); // this.light2.setPosition([-1.2*Math.cos(this.elapsed*2.0), 1.2*Math.sin(this.elapsed*2.0), -1.2*Math.cos(this.elapsed)]); } - + this.updateMaterials( this.getGeomRoot(), this.elapsed ); // now update all the nodes in the scene @@ -260,7 +260,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { this.myScene.update(dt); }; - // defining the draw function to control how the scene is rendered + // defining the draw function to control how the scene is rendered this.draw = function() { if (this._useWebGL) @@ -306,12 +306,12 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { this.render(); } }; - + this.onRunState = function() { // console.log( "GLWorld.onRunState" ); this.restartRenderLoop(); }; - + this.onLoadState = function() { // console.log( "GLWorld.onLoadState" ); }; @@ -375,7 +375,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { world.textureMapLoaded( name ); } }; - + this.hasAnimatedMaterials = function() { var root = this.getGeomRoot(); var rtnVal = false; @@ -433,7 +433,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { { this._notifier.removeListener( obj ); } - + // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state // in the case of a procedurally built scene an init state is not needed for loading data this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" ); @@ -486,7 +486,7 @@ World.prototype.updateObject = function (obj) { ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[0]); ctrTrNode.attachMaterial(materialNodes[0]); } - + // delete all of the child nodes var i; var childTrNode; @@ -803,11 +803,11 @@ World.prototype.render = function() var ctx = this.get2DContext(); if (!ctx) return; ctx.clearRect(0, 0, this.getViewportWidth(), this.getViewportHeight()); - + // render the geometry var root = this.getGeomRoot(); this.hRender( root ); - } + } else { RDGE.globals.engine.setContext( this._canvas.rdgeid ); @@ -834,7 +834,7 @@ World.prototype.setViewportFromCanvas = function(canvas) { this._glContext.viewportHeight = canvas.height; this.getCamera().setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar()); - + this.renderer.setViewPort(0, 0, canvas.width, canvas.height); } }; @@ -863,7 +863,7 @@ World.prototype.getShapeFromPoint = function( offsetX, offsetY ) { World.prototype.exportJSON = function () { // world properties - var worldObj = + var worldObj = { 'version' : 1.1, 'id' : this.getCanvas().getAttribute( "data-RDGE-id" ), @@ -900,7 +900,7 @@ World.prototype.exportJSON = function () // and pre-JSON versions of fileIO. // the ending ';' in the version string is necessary jStr = "v1.0;" + jStr; - + return jStr; }; @@ -963,7 +963,7 @@ World.prototype.importJSON = function (jObj) { // start RDGE rdgeStarted = true; - var id = this._canvas.getAttribute( "data-RDGE-id" ); + var id = this._canvas.getAttribute( "data-RDGE-id" ); this._canvas.rdgeid = id; RDGE.globals.engine.registerCanvas(this._canvas, this); RDGE.RDGEStart(this._canvas); diff --git a/js/lib/geom/anchor-point.js b/js/lib/geom/anchor-point.js index a1fcfc0d..72eebd0d 100755 --- a/js/lib/geom/anchor-point.js +++ b/js/lib/geom/anchor-point.js @@ -30,14 +30,14 @@ POSSIBILITY OF SUCH DAMAGE. ///////////////////////////////////////////// // Class GLAnchorPoint -// GL representation of a point clicked +// GL representation of a point clicked // and dragged during pen tool -// -// +// +// ///////////////////////////////////////////// var GLAnchorPoint = function GLAnchorPoint() { ///////////////////////////////////////// - // Instance variables + // Instance variables ///////////////////////////////////////// this._x = 0.0; this._y = 0.0; @@ -99,7 +99,7 @@ GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) { if (totalTransSq < 0.0000001) { return; } - + // *** compute the rotation of the prev vector *** var oldP = [this._prevX + tx - this._x, this._prevY + ty - this._y, this._prevZ + tz - this._z]; var newP = [this._prevX - this._x, this._prevY - this._y, this._prevZ - this._z]; @@ -133,7 +133,7 @@ GLAnchorPoint.prototype.translatePrevFromNext = function (tx, ty, tz) { if (totalTransSq < 0.0000001) { return; } - + // *** compute the rotation of the next vector *** var oldN = [this._nextX + tx - this._x, this._nextY + ty - this._y, this._nextZ + tz - this._z]; var newN = [this._nextX - this._x, this._nextY - this._y, this._nextZ - this._z]; diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index e553a1c6..6365d14c 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js @@ -52,7 +52,7 @@ var BrushStroke = function GLBrushStroke() { this._BBoxMax = [0, 0, 0]; this._isDirty = true; this._isInit = false; - + //the HTML5 canvas that holds this brush stroke this._canvas = null; //flag indicating whether or not to freeze the size and position of canvas @@ -312,7 +312,7 @@ BrushStroke.prototype.setWidth = function (newW) { } var minWidth = 1+this._strokeWidth; if (newW height ? 0.25*width : 0.25*height; @@ -377,12 +377,12 @@ var CloudMaterial = function CloudMaterial() this._adjustedZMin = zMin; this._adjustedZMax = zMax; - + // build the polygons var verts = [], normals = [ [0,0,1], [0,0,1], [0,0,1], [0,0,1] ], uvs = [ [0,0], [1,0], [1,1], [0,1] ]; - + for ( i = 0; i < 20; i++ ) { // var x = hWidth*2*(Math.random() - 0.5), @@ -496,17 +496,17 @@ var cloudMaterialDef = ] } }; - + // the cloud map material def is used to map the cloud image onto // the destination geometry var cloudMapMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/BasicTex.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -520,13 +520,13 @@ var cloudMapMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_tex0' : { 'type' : 'tex2d' }, }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js index 6c5f93ad..8f88b22e 100644 --- a/js/lib/rdge/materials/deform-material.js +++ b/js/lib/rdge/materials/deform-material.js @@ -102,16 +102,16 @@ var DeformMaterial = function DeformMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var deformMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/Deform.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -125,7 +125,7 @@ var deformMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_tex0': { 'type' : 'tex2d' }, 'u_time' : { 'type' : 'float' }, @@ -134,7 +134,7 @@ var deformMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/flag-material.js b/js/lib/rdge/materials/flag-material.js index 5cd361df..f0d9b84c 100644 --- a/js/lib/rdge/materials/flag-material.js +++ b/js/lib/rdge/materials/flag-material.js @@ -70,7 +70,7 @@ var FlagMaterial = function FlagMaterial() { this._propValues[ this._propNames[3] ] = this._speed; - // a material can be animated or not. default is not. + // a material can be animated or not. default is not. // Any material needing continuous rendering should override this method this.isAnimated = function() { return true; }; this.getShaderDef = function() { return flagMaterialDef; } @@ -106,16 +106,16 @@ var FlagMaterial = function FlagMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var flagMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Flag.vert.glsl", 'defaultFShader':"assets/shaders/Flag.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -129,7 +129,7 @@ var flagMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_tex0': { 'type' : 'tex2d' }, 'u_time' : { 'type' : 'float' }, @@ -139,7 +139,7 @@ var flagMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index 5fa46231..b344db7c 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js @@ -70,7 +70,7 @@ var FlatMaterial = function FlatMaterial() // set up the material node this._materialNode = RDGE.createMaterialNode("flatMaterial_" + world.generateUniqueNodeID()); this._materialNode.setShader(this._shader); - + this.setShaderValues(); } else @@ -91,9 +91,9 @@ var FlatMaterial = function FlatMaterial() /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) -flatShaderDef = +flatShaderDef = { 'shaders': { // shader files 'defaultVShader':"assets/shaders/Basic.vert.glsl", @@ -104,7 +104,7 @@ flatShaderDef = { 'vshader' : 'defaultVShader', 'fshader' : 'defaultFShader', - + // attributes 'attributes' : { diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js index d53532d9..13291e25 100644 --- a/js/lib/rdge/materials/fly-material.js +++ b/js/lib/rdge/materials/fly-material.js @@ -97,17 +97,17 @@ var FlyMaterial = function FlyMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var flyMaterialDef = { - 'shaders': + 'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/Fly.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -121,7 +121,7 @@ var flyMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_tex0': { 'type' : 'tex2d' }, 'u_time' : { 'type' : 'float' }, @@ -130,7 +130,7 @@ var flyMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js index 718f5b44..cf9176df 100644 --- a/js/lib/rdge/materials/julia-material.js +++ b/js/lib/rdge/materials/julia-material.js @@ -90,16 +90,16 @@ var JuliaMaterial = function JuliaMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var JuliaMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/Julia.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -113,7 +113,7 @@ var JuliaMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_time' : { 'type' : 'float' }, 'u_speed' : { 'type' : 'float' }, @@ -121,7 +121,7 @@ var JuliaMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/keleidoscope-material.js b/js/lib/rdge/materials/keleidoscope-material.js index 90340e00..8f235948 100644 --- a/js/lib/rdge/materials/keleidoscope-material.js +++ b/js/lib/rdge/materials/keleidoscope-material.js @@ -100,16 +100,16 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var keleidoscopeMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/Keleidoscope.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -123,7 +123,7 @@ var keleidoscopeMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_tex0': { 'type' : 'tex2d' }, 'u_speed' : { 'type' : 'float' }, @@ -132,7 +132,7 @@ var keleidoscopeMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js index d216a2c0..da6d205c 100755 --- a/js/lib/rdge/materials/linear-gradient-material.js +++ b/js/lib/rdge/materials/linear-gradient-material.js @@ -107,15 +107,15 @@ var LinearGradientMaterial = function LinearGradientMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var linearGradientMaterialDef = -{'shaders': +{'shaders': { // shader file 'defaultVShader':"assets/shaders/linearGradient.vert.glsl", 'defaultFShader':"assets/shaders/linearGradient.frag.glsl", - + // this shader is inline 'dirLightVShader': "\ uniform mat4 u_mvMatrix;\ @@ -130,7 +130,7 @@ var linearGradientMaterialDef = vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\ gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\ - }", + }", 'dirLightFShader': "\ precision highp float;\ uniform vec4 u_light1Diff;\ @@ -150,7 +150,7 @@ var linearGradientMaterialDef = }" }, 'techniques': - { + { 'default': [ { @@ -164,16 +164,16 @@ var linearGradientMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { - 'u_color1' : { 'type' : 'vec4' }, - 'u_color2' : { 'type' : 'vec4' }, - 'u_color3' : { 'type' : 'vec4' }, + 'u_color1' : { 'type' : 'vec4' }, + 'u_color2' : { 'type' : 'vec4' }, + 'u_color3' : { 'type' : 'vec4' }, 'u_color4' : { 'type' : 'vec4' }, - 'u_colorStop1': { 'type' : 'float' }, - 'u_colorStop2': { 'type' : 'float' }, - 'u_colorStop3': { 'type' : 'float' }, - 'u_colorStop4': { 'type' : 'float' }, + 'u_colorStop1': { 'type' : 'float' }, + 'u_colorStop2': { 'type' : 'float' }, + 'u_colorStop3': { 'type' : 'float' }, + 'u_colorStop4': { 'type' : 'float' }, 'u_cos_sin_angle': { 'type' : 'vec2' }, 'u_texTransform': { 'type' : 'mat3' } //'u_colorCount': {'type' : 'int' } @@ -181,7 +181,7 @@ var linearGradientMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] @@ -197,12 +197,12 @@ var linearGradientMaterialDef = 'a_nrm' : { 'type' : 'vec3' } }, // parameters - 'params' : + 'params' : { }, // render states - 'states' : + 'states' : { 'depthEnable' : true, "blendEnable" : true, diff --git a/js/lib/rdge/materials/mandel-material.js b/js/lib/rdge/materials/mandel-material.js index 41b7793e..6cf3ce7e 100644 --- a/js/lib/rdge/materials/mandel-material.js +++ b/js/lib/rdge/materials/mandel-material.js @@ -93,16 +93,16 @@ var MandelMaterial = function MandelMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var MandelMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/Mandel.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -116,7 +116,7 @@ var MandelMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_time' : { 'type' : 'float' }, 'u_speed' : { 'type' : 'float' }, @@ -124,7 +124,7 @@ var MandelMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/material.js b/js/lib/rdge/materials/material.js index c273611b..7e1f2ec5 100755 --- a/js/lib/rdge/materials/material.js +++ b/js/lib/rdge/materials/material.js @@ -103,7 +103,7 @@ var Material = function GLMaterial( world ) { return this._materialNode; }; - // a material can be animated or not. default is not. + // a material can be animated or not. default is not. // Any material needing continuous rendering should override this method this.isAnimated = function() { return false; @@ -187,7 +187,7 @@ var Material = function GLMaterial( world ) { // get the current values; var propNames = [], propValues = [], propTypes = [], propLabels = []; this.getAllProperties(propNames, propValues, propTypes, propLabels); - + // allocate a new material var MaterialLibrary = require("js/models/materials-model").MaterialsModel; var newMat = MaterialLibrary.createMaterialByShaderName( this.getShaderName() ); @@ -221,7 +221,7 @@ var Material = function GLMaterial( world ) { case "vector2d": rtnVal = ((valType == "object") && (value.length >= 2)); break; - + case "vector3d": rtnVal = ((valType == "object") && (value.length >= 3)); break; @@ -243,7 +243,7 @@ var Material = function GLMaterial( world ) { catch(e) { console.log( "setting invalid material property: " + prop + ", value: " + value ); } - + // if (!rtnVal && (prop != 'color')) { // console.log( "invalid material property: " + prop + " : " + value ); // } @@ -360,7 +360,7 @@ var Material = function GLMaterial( world ) { return jObj; }; - + this.importJSON = function (jObj) { if (this.getShaderName() != jObj.material) throw new Error("ill-formed material"); this.setName(jObj.name); @@ -382,7 +382,7 @@ var Material = function GLMaterial( world ) { }; /////////////////////////////////////////////////////////////////////// - + /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// diff --git a/js/lib/rdge/materials/plasma-material.js b/js/lib/rdge/materials/plasma-material.js index 8e51a9b0..cb8c881f 100644 --- a/js/lib/rdge/materials/plasma-material.js +++ b/js/lib/rdge/materials/plasma-material.js @@ -108,16 +108,16 @@ var PlasmaMaterial = function PlasmaMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var plasmaShaderDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/plasma.vert.glsl", 'defaultFShader':"assets/shaders/plasma.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -131,7 +131,7 @@ var plasmaShaderDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_time' : { 'type' : 'float' }, 'u_speed': { 'type' : 'float' }, @@ -141,7 +141,7 @@ var plasmaShaderDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/pulse-material.js b/js/lib/rdge/materials/pulse-material.js index 4356c911..2ad174a3 100644 --- a/js/lib/rdge/materials/pulse-material.js +++ b/js/lib/rdge/materials/pulse-material.js @@ -42,7 +42,7 @@ var PulseMaterial = function PulseMaterial() // initialize the inherited members this.inheritedFrom = Material; this.inheritedFrom(); - + /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// @@ -160,16 +160,16 @@ var PulseMaterial = function PulseMaterial() /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var pulseMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/Pulse.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -183,7 +183,7 @@ var pulseMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_tex0' : { 'type' : 'tex2d' }, 'u_time' : { 'type' : 'float' }, @@ -194,7 +194,7 @@ var pulseMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/radial-gradient-material.js b/js/lib/rdge/materials/radial-gradient-material.js index f7e28083..ab7cf484 100755 --- a/js/lib/rdge/materials/radial-gradient-material.js +++ b/js/lib/rdge/materials/radial-gradient-material.js @@ -54,7 +54,7 @@ var RadialGradientMaterial = function RadialGradientMaterial() { /////////////////////////////////////////////////////////////////////// // Property Accessors /////////////////////////////////////////////////////////////////////// - + this.isAnimated = function () { return false; }; this.getShaderDef = function() { return radialGradientMaterialDef; }; @@ -126,9 +126,9 @@ var RadialGradientMaterial = function RadialGradientMaterial() { 0.0, yScale, 0.0, xCtr*(1-xScale), yCtr*(1 - yScale), 1.0 ]; - + if (this._shader && this._shader['default']) - this._shader['default'].u_texTransform.set( this._textureTransform ); + this._shader['default'].u_texTransform.set( this._textureTransform ); } }; diff --git a/js/lib/rdge/materials/taper-material.js b/js/lib/rdge/materials/taper-material.js index d88b1e9e..988381f1 100644 --- a/js/lib/rdge/materials/taper-material.js +++ b/js/lib/rdge/materials/taper-material.js @@ -76,7 +76,7 @@ var TaperMaterial = function TaperMaterial() // set up the material node this._materialNode = RDGE.createMaterialNode("taperMaterial" + "_" + world.generateUniqueNodeID()); this._materialNode.setShader(this._shader); - + this._time = 0; if (this._shader && this._shader['default']) { this._shader['default'].u_time.set([this._time]); diff --git a/js/lib/rdge/materials/tunnel-material.js b/js/lib/rdge/materials/tunnel-material.js index fd2e28d5..8a80cb85 100644 --- a/js/lib/rdge/materials/tunnel-material.js +++ b/js/lib/rdge/materials/tunnel-material.js @@ -94,16 +94,16 @@ var TunnelMaterial = function TunnelMaterial() { /////////////////////////////////////////////////////////////////////////////////////// // RDGE shader - + // shader spec (can also be loaded from a .JSON file, or constructed at runtime) var tunnelMaterialDef = -{'shaders': +{'shaders': { 'defaultVShader':"assets/shaders/Basic.vert.glsl", 'defaultFShader':"assets/shaders/Tunnel.frag.glsl" }, 'techniques': - { + { 'default': [ { @@ -117,7 +117,7 @@ var tunnelMaterialDef = 'texcoord' : { 'type' : 'vec2' } }, // parameters - 'params' : + 'params' : { 'u_tex0': { 'type' : 'tex2d' }, 'u_time' : { 'type' : 'float' }, @@ -126,7 +126,7 @@ var tunnelMaterialDef = }, // render states - 'states' : + 'states' : { 'depthEnable' : true, 'offset':[1.0, 0.1] diff --git a/js/lib/rdge/materials/twist-vert-material.js b/js/lib/rdge/materials/twist-vert-material.js index 6ab2662e..1c04a90c 100644 --- a/js/lib/rdge/materials/twist-vert-material.js +++ b/js/lib/rdge/materials/twist-vert-material.js @@ -61,7 +61,7 @@ var TwistVertMaterial = function TwistVertMaterial() this.isAnimated = function () { return true; }; this.getShaderDef = function() { return twistVertShaderDef; }; this.getTechniqueName = function() { return 'twistMe' }; - + this.hasVertexDeformation = function () { return this._hasVertexDeformation; }; this._hasVertexDeformation = true; this._vertexDeformationTolerance = 0.02; // should be a property @@ -110,7 +110,7 @@ var TwistVertMaterial = function TwistVertMaterial() if (this._shader && this._shader.twistMe) { var technique = this._shader.twistMe; - + var angle = this._angle; angle += this._deltaTime * this._propValues["speed"]; if (angle > this._propValues["u_twistAmount"]) diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js index 8bd44e60..34aa06bf 100755 --- a/js/lib/rdge/materials/uber-material.js +++ b/js/lib/rdge/materials/uber-material.js @@ -146,9 +146,9 @@ var UberMaterial = function UberMaterial() { 'spotOuterCutoff': 15.0, // fragments outside the outer cutoff 'cone' are unlit. 'position': [8.0, 2.0, 8.0], // light position; ignored for directional lights 'direction': [-1.0, -1.0, -1.0], // light direction; ignored for point lights - 'attenuation': [1.0, 0.025, 0.00125], // light attenuation; constant, linear, quadratic + 'attenuation': [1.0, 0.025, 0.00125], // light attenuation; constant, linear, quadratic 'diffuseColor': [1.0, 0.5, 0.5, 1.0], // diffuse light color - 'specularColor': [1.0, 1.0, 1.0, 1.0] // specular light color + 'specularColor': [1.0, 1.0, 1.0, 1.0] // specular light color }, { 'type': 'point', @@ -184,7 +184,7 @@ var UberMaterial = function UberMaterial() { this._ubershaderCaps = { - // ubershader material properties. + // ubershader material properties. 'material': { 'ambientColor': this._ambientColor, // material ambient color 'diffuseColor': this._diffuseColor, // material diffuse color @@ -192,7 +192,7 @@ var UberMaterial = function UberMaterial() { 'specularPower': this._specularPower // material specular power (shininess) }, - // ubershader supports up to four lights. + // ubershader supports up to four lights. 'lighting': { 'light0': this._lights[0], 'light1': this._lights[1], @@ -386,7 +386,7 @@ var UberMaterial = function UberMaterial() { // get the current values; var propNames = [], propValues = [], propTypes = [], propLabels = []; this.getAllProperties(propNames, propValues, propTypes, propLabels); - + // allocate a new material var newMat = new UberMaterial(); newMat._useDiffuseMap = this._useDiffuseMap; @@ -434,7 +434,7 @@ var UberMaterial = function UberMaterial() { } } } - + this.isAnimated = function() { var anim = (this._diffuseTexture && this._diffuseTexture.isAnimated()); @@ -687,7 +687,7 @@ var UberMaterial = function UberMaterial() { var vshader = preproc + uberVShader; var fshader = preproc + uberFShader; - // build output jshader + // build output jshader var uberJShader = new RDGE.jshader(); uberJShader.def = { 'shaders': { diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index a0056452..0b431046 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js @@ -181,7 +181,7 @@ var ParisMaterial = function ParisMaterial() this._materialNode.setShader(this._shader); this._time = 0; - if (this._shader && this._shader['default']) + if (this._shader && this._shader['default']) this._shader['default'].u_time.set([this._time]); // set the shader values in the shader diff --git a/js/lib/rdge/texture.js b/js/lib/rdge/texture.js index dc0da247..0d58de1b 100644 --- a/js/lib/rdge/texture.js +++ b/js/lib/rdge/texture.js @@ -44,7 +44,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) this._texture; // the canvas generating the texture map (if there is one) - this._srcCanvas; + this._srcCanvas; this._srcWorld; // texture attributes @@ -52,7 +52,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) this._texMapName = texMapName.slice(); else this._srcCanvas = texMapName; - + // set default values for wrap and mips if (wrap === undefined) @@ -64,7 +64,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) // cache whether or not the source is animated this._isAnimated = false; - + // the destination world that will use the texture map this._dstWorld = dstWorld; @@ -121,7 +121,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) } else { - this.loadFromFile(); + this.loadFromFile(); } } @@ -218,7 +218,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) this.loadFromCanvas = function() { var NJUtils = require("js/lib/NJUtils").NJUtils; - + var srcCanvas = this._srcCanvas; var wrap = this._wrap; var mips = this._mips; @@ -308,12 +308,12 @@ function Texture( dstWorld, texMapName, wrap, mips ) return tex; } - + this.isPowerOfTwo = function(x) { return (x & (x - 1)) == 0; } - + this.nextHighestPowerOfTwo = function(x) { --x; @@ -322,7 +322,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) } return x + 1; } - + this.nextLowerPowerOfTwo = function(x) { return this.nextHighestPowerOfTwo(x) >> 1; @@ -332,7 +332,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) { if (elt.id && elt.id === id) return elt; - + if (elt.children) { var nKids = elt.children.length; -- cgit v1.2.3