From 342fb451bd251358068a0dcb10e9dc218b79a176 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Tue, 6 Mar 2012 11:38:39 -0800 Subject: Squashed commit of the following: commit 1cd89d4d06e3a8f2c221628b19cf26a2c69f5d3f Author: Jose Antonio Marquez Date: Tue Mar 6 11:24:25 2012 -0800 Fixing WebGL not available bug commit 84332ab81c1b445195f1d9be8bbeae0725c8e758 Author: Valerio Virgillito Date: Tue Mar 6 10:58:25 2012 -0800 Squashed commit of preload-fix into Master - Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito commit 13f52cf0c74f53a919fa864f86669e8155f82961 Merge: dced508 abc04f3 Author: Valerio Virgillito Date: Fri Mar 2 15:46:11 2012 -0800 Merge pull request #93 from imix23ways/Timeline Timeline: Critical bug fixes commit dced508bb19a7bcd467ff1b86b5df5bbec4be794 Merge: 0aeb400 cc772ef Author: Valerio Virgillito Date: Fri Mar 2 15:45:35 2012 -0800 Merge pull request #92 from mqg734/WebGLFixes Selection Tool Fixes for elements flying off into space when they overlap commit 0aeb400070762cf01d83cf9f9ee25a5595098b7f Merge: ff0a956 aabb48a Author: Valerio Virgillito Date: Fri Mar 2 14:05:21 2012 -0800 Merge pull request #94 from ericguzman/PresetsPanel Presets Panel - Fix single-click activation, and transition cut-off bug. commit cc772ef3333ed419d269a2bda7aea5b0150a7bd9 Author: Nivesh Rajbhandari Date: Fri Mar 2 11:34:58 2012 -0800 Fixing flying off into space bug for translate tool too. Signed-off-by: Nivesh Rajbhandari commit abc04f3d50311ed1c21067344bc7e448686f8c5c Author: Jonathan Duran Date: Fri Mar 2 11:26:25 2012 -0800 Timeline Fix timing function Signed-off-by: Jonathan Duran commit aabb48a1c8d34bc968f4c6b0ffee4e31c1d5d286 Author: Eric Guzman Date: Fri Mar 2 11:22:44 2012 -0800 Presets Panel - Fix single-click activation, and transition cut-off bug. Use double-click as the activation event for transition presets. Also fixed the bug when applying a style preset before the transition preset, which disabled transitions after the first one. commit f3207f39ea9d8c1c34246217a23d3a689671903d Author: Nivesh Rajbhandari Date: Fri Mar 2 11:21:29 2012 -0800 Don't draw transform handles if the stage is the target element. Signed-off-by: Nivesh Rajbhandari commit 5425be91e7125c22955b4459a62412ff574e49a8 Author: Jonathan Duran Date: Fri Mar 2 11:11:48 2012 -0800 Timeline: Fix for animation iteration count Add default webkit css properties to allow animations with integer iteration counts. Signed-off-by: Jonathan Duran commit 1760bac1da9218315ad1bacdcf3a157495a049e8 Author: Nivesh Rajbhandari Date: Fri Mar 2 10:48:41 2012 -0800 Fix for jumping issue when moving items that have any 3d on them. We can't translate 3d moves into 2d space due to perspective, so we must update the matrix3d values instead of the top-left values if items have 3d. Signed-off-by: Nivesh Rajbhandari commit 2c04935f0ccb1cb7c98371fc10b43155f2d956c4 Author: Nivesh Rajbhandari Date: Thu Mar 1 22:20:06 2012 -0800 Fix for elements flying off into space when moving elements that overlap. This was happening because our hit record's element and the browser's element from point did not match. Signed-off-by: Nivesh Rajbhandari commit 50058746779f714ed9b0287f49e56c9f0d35593e Merge: 500426d ff0a956 Author: Nivesh Rajbhandari Date: Thu Mar 1 21:49:44 2012 -0800 Merge branch 'refs/heads/ninja-internal' into WebGLFixes commit 500426dea0ca95a6b45be8ea8d132cfdb4d2c940 Author: Nivesh Rajbhandari Date: Thu Mar 1 10:11:39 2012 -0800 Fixed logic error when resizing with the top-left transform handles. Signed-off-by: Nivesh Rajbhandari commit 7980d9bde2b43aa5a494ddf6f1db5c4959a57b91 Author: Nivesh Rajbhandari Date: Thu Mar 1 10:04:15 2012 -0800 Re-fixing IKNinja-940 - Can't select objects when in side/top view. Signed-off-by: Nivesh Rajbhandari commit f04cc0146d8f7573628678613a99c270116768e4 Author: Nivesh Rajbhandari Date: Wed Feb 29 16:45:40 2012 -0800 Last-used material (instead of FlatMaterial) is applied to shape when turning on use WebGL checkbox in the PI. Signed-off-by: Nivesh Rajbhandari Signed-off-by: Jonathan Duran --- js/helper-classes/RDGE/GLMaterial.js | 308 ----------------------------------- 1 file changed, 308 deletions(-) delete mode 100755 js/helper-classes/RDGE/GLMaterial.js (limited to 'js/helper-classes/RDGE/GLMaterial.js') diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js deleted file mode 100755 index 642fab05..00000000 --- a/js/helper-classes/RDGE/GLMaterial.js +++ /dev/null @@ -1,308 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -/////////////////////////////////////////////////////////////////////// -// Class GLMaterial -// GL representation of a material. -/////////////////////////////////////////////////////////////////////// -function GLMaterial( world ) -{ - /////////////////////////////////////////////////////////////////////// - // Instance variables - /////////////////////////////////////////////////////////////////////// - this._name = "GLMaterial"; - this._shaderName = "undefined"; - - // keep a reference to the owning GLWorld - this._world = null; - if(world) - { - this._world = world; - } - - this._shininess = 60; - - this._ambient = [0.0, 0.0, 0.0, 1.0]; - this._diffuse = [0.0, 0.0, 0.0, 1.0]; - this._specular = [0.0, 0.0, 0.0, 1.0]; - - this._texture; - - // vertex deformation variables - this._hasVertexDeformation = false; - this._vertexDeformationRange = [0, 0, 1, 1]; // (xMin, yMin, xMax, yMax) - this._vertexDeformationTolerance = 0.1; - - // RDGE variables - this._shader; - this._materialNode; - - /////////////////////////////////////////////////////////////////////// - // Property Accessors - /////////////////////////////////////////////////////////////////////// - this.getShininess = function() { return this._shininess; } - this.setShininess = function(s) { this._shininess = s; } - - this.setName = function(n) { this._name = n; } - this.getName = function() { return this._name; } - - this.setShaderName = function(n) { this._shaderName = n; } - this.getShaderName = function() { return this._shaderName; } - - this.setWorld = function(world) { this._world = world; } - this.getWorld = function() { return this._world; } - - this.setAmbient = function(r, g, b, a) { this._ambient = [r, g, b, a]; } - this.getAmbient = function() { return [this._ambient[0], this._ambient[1], this._ambient[2], this._ambient[3]]; } - - this.setDiffuse = function(r, g, b, a) { this._diffuse = [r, g, b, a]; } - this.getDiffuse = function() { return [this._diffuse[0], this._diffuse[1], this._diffuse[2], this._diffuse[3]]; } - - this.setSpecular = function(r, g, b, a) { this._specular = [r, g, b, a]; } - this.getSpecular = function() { return [this._specular[0], this._specular[1], this._specular[2], this._specular[3]]; } - - this.getShader = function() { return this._shader; } - this.getMaterialNode = function() { return this._materialNode; } - - // a material can be animated or not. default is not. - // Any material needing continuous rendering should override this method - this.isAnimated = function() { return false; } - - // the vertex shader can apply deformations requiring refinement in - // certain areas. - this.hasVertexDeformation = function() { return this._hasVertexDeformation; } - this.getVertexDeformationRange = function() { return this._vertexDeformationRange.slice(); } - this.getVertexDeformationTolerance = function() { return this._vertexDeformationTolerance; } - - - /////////////////////////////////////////////////////////////////////// - // Common Material Methods - /////////////////////////////////////////////////////////////////////// - this.getProperty = function( propName ) - { - return this._propValues[propName]; - } - - this.getPropertyCount = function() - { - return this._propNames.length; - } - - this.getPropertyAtIndex = function( index ) - { - var rtnArr = []; - if ((index < 0) || (index >= this.getPropertyCount())) - throw new Error( "property index " + index + " is out of range for material" ); - - var rtnArr = [ this._propNames[index], this._propLabels[index], this._propTypes[index], this._propValues[index] ]; - return rtnArr; - } - - this.getAllProperties = function( propNames, propValues, propTypes, propLabels) - { - // clear all the input arrays if there is junk in them - propNames.length = 0; - propValues.length = 0; - propTypes.length = 0; - propLabels.length = 0; - - var nProps = this._propNames.length; - for (var i=0; i= 4)); - break; - - case "vector2d": - rtnVal = ((valType == "object") && (value.length >= 2)); - break; - - case "vector3d": - rtnVal = ((valType == "object") && (value.length >= 3)); - break; - - case "float": - rtnVal = (valType == "number"); - break; - - case "file": - rtnVal = ((valType == "string") || !value); - break; - } - break; - } - } - } - catch(e) { - console.log( "setting invalid material property: " + prop + ", value: " + value ); - } - - if (!rtnVal) - console.log( "invalid material property: " + prop + " : " + value ); - - return rtnVal; - } - /////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////// - // Methods - /////////////////////////////////////////////////////////////////////// - // duplcate method required by sub class - this.dup = function() - { - throw new Error( "Material.dup() must be overridden by subclass" ); - } - - this.init = function( world ) - { - throw new Error( "Material.init() must be overridden by subclass" ); - } - - this.update = function( time ) - { - // animated materials should implement the update method - } - - this.registerTexture = function( texture ) - { - // the world needs to know about the texture map - var world = this.getWorld(); - if (!world) - console.log( "**** world not defined for registering texture map: " + texture.lookUpName ); - else - world.textureToLoad( texture ); - } - - this.loadTexture = function( texMapName, wrap, mips ) - { - var tex; - var world = this.getWorld(); - if (!world) - console.log( "world not defined for material with texture map" ); - else - { - var renderer = world.getRenderer(); - tex = renderer.getTextureByName(texMapName, wrap, mips ); - this.registerTexture( tex ); - } - return tex; - } - - this.export = function() - { - // this function should be overridden by subclasses - var exportStr = "material: " + this.getShaderName() + "\n" + "endMaterial\n"; - return exportStr; - } - - this.import = function( importStr ) - { - var endKey = "endMaterial\n"; - var index = importStr.indexOf( endKey ); - index += endKey.length; - var rtnStr = importStr.substr( index ); - - return rtnStr; - } - - /* - this.setRenderProperties = function( glContext, shaderProgram ) - { - glContext.uniform1f( shaderProgram.materialShininessUniform, this._shininess ); - - if (this._texture) - this.prepareTextureForRender( 0 ); - else - glContext.uniform1i( shaderProgram.useTextureUniform, false ); - - var amb = this._ambient, diff = this._diffuse, spec = this._specular; - glContext.uniform4f( shaderProgram.materialAmbientUniform, amb[0], amb[1], amb[2], amb[3]); - glContext.uniform4f( shaderProgram.materialDiffuseUniform, diff[0], diff[1], diff[2], diff[3]); - glContext.uniform4f( shaderProgram.materialSpecularUniform, spec[0], spec[1], spec[2], spec[3]); - } - - - - this.prepareTextureForRender = function ( index ) - { - // we will need to be able to handle multiple textures. - // currently only dealing with 1. - index = 0; - var texture = this._texture; - - var gl = this.getWorld().getGLContext(); - var shaderProgram = this.getWorld().getShaderProgram(); - - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.uniform1i(shaderProgram.samplerUniform, 0); - gl.uniform1i( shaderProgram.useTextureUniform, true ); - } - - this.textureLoadHandler = function (event) - { - var texture = this._texture; - - var gl = this._world.getGLContext(); - var shaderProgram = this._world.getShaderProgram(); - - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.image); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - -// gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); -// gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - - gl.bindTexture(gl.TEXTURE_2D, null); - - this._material._texture = this._texture; - this._world.render(); - } - - - this.loadTexture = function( path ) - { - var gl = this.getWorld().getGLContext(); - var tex = gl.createTexture(); - tex.image = new Image(); - tex.image._world = this._world; - tex.image._material = this; - tex.image._texture = tex; - tex.image.onload = this.textureLoadHandler; - tex.image.src = path; - } - */ -} - - -- cgit v1.2.3