aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/MaterialsLibrary.js
diff options
context:
space:
mode:
authorJonathan Duran2012-03-06 11:38:39 -0800
committerJonathan Duran2012-03-06 11:38:39 -0800
commit342fb451bd251358068a0dcb10e9dc218b79a176 (patch)
treeaa0195d581c3934fb6dc09981506b3c070002806 /js/helper-classes/backup-delete/MaterialsLibrary.js
parent2815adfd7c19b3dff89dc3e1bda9af8d30dca8d6 (diff)
downloadninja-342fb451bd251358068a0dcb10e9dc218b79a176.tar.gz
Squashed commit of the following:
commit 1cd89d4d06e3a8f2c221628b19cf26a2c69f5d3f Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 11:24:25 2012 -0800 Fixing WebGL not available bug commit 84332ab81c1b445195f1d9be8bbeae0725c8e758 Author: Valerio Virgillito <valerio@motorola.com> 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 <valerio@motorola.com> commit 13f52cf0c74f53a919fa864f86669e8155f82961 Merge: dced508 abc04f3 Author: Valerio Virgillito <valerio@motorola.com> 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 <valerio@motorola.com> 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 <valerio@motorola.com> 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 <mqg734@motorola.com> Date: Fri Mar 2 11:34:58 2012 -0800 Fixing flying off into space bug for translate tool too. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit abc04f3d50311ed1c21067344bc7e448686f8c5c Author: Jonathan Duran <jduran@motorola.com> Date: Fri Mar 2 11:26:25 2012 -0800 Timeline Fix timing function Signed-off-by: Jonathan Duran <jduran@motorola.com> commit aabb48a1c8d34bc968f4c6b0ffee4e31c1d5d286 Author: Eric Guzman <ericg@motorola.com> 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 <mqg734@motorola.com> 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 <mqg734@motorola.com> commit 5425be91e7125c22955b4459a62412ff574e49a8 Author: Jonathan Duran <jduran@motorola.com> 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 <jduran@motorola.com> commit 1760bac1da9218315ad1bacdcf3a157495a049e8 Author: Nivesh Rajbhandari <mqg734@motorola.com> 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 <mqg734@motorola.com> commit 2c04935f0ccb1cb7c98371fc10b43155f2d956c4 Author: Nivesh Rajbhandari <mqg734@motorola.com> 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 <mqg734@motorola.com> commit 50058746779f714ed9b0287f49e56c9f0d35593e Merge: 500426d ff0a956 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 21:49:44 2012 -0800 Merge branch 'refs/heads/ninja-internal' into WebGLFixes commit 500426dea0ca95a6b45be8ea8d132cfdb4d2c940 Author: Nivesh Rajbhandari <mqg734@motorola.com> 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 <mqg734@motorola.com> commit 7980d9bde2b43aa5a494ddf6f1db5c4959a57b91 Author: Nivesh Rajbhandari <mqg734@motorola.com> 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 <mqg734@motorola.com> commit f04cc0146d8f7573628678613a99c270116768e4 Author: Nivesh Rajbhandari <mqg734@motorola.com> 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 <mqg734@motorola.com> Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/helper-classes/backup-delete/MaterialsLibrary.js')
-rwxr-xr-xjs/helper-classes/backup-delete/MaterialsLibrary.js230
1 files changed, 230 insertions, 0 deletions
diff --git a/js/helper-classes/backup-delete/MaterialsLibrary.js b/js/helper-classes/backup-delete/MaterialsLibrary.js
new file mode 100755
index 00000000..8f55f2bc
--- /dev/null
+++ b/js/helper-classes/backup-delete/MaterialsLibrary.js
@@ -0,0 +1,230 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6///////////////////////////////////////////////////////////////////////
7// Class MaterialsLibrary
8// Contains an array of GLMaterials.
9///////////////////////////////////////////////////////////////////////
10var MaterialsLibrary = Object.create(Object.prototype, {
11
12 _materials : { value: [], writable: true, enumerable: true, configurable: true },
13
14 materials : {
15 get: function() {
16 return this._materials;
17 }
18 },
19
20 addMaterial: {
21 value: function (material)
22 {
23 this._materials.push(material);
24 }
25 },
26
27 addMaterialAt: {
28 value: function (material, index)
29 {
30 this._materials.splice(index, 0, material);
31 }
32 },
33
34 removeMaterialAt: {
35 value: function (index)
36 {
37 return this._materials.splice(index, 1);
38 }
39 },
40
41 removeMaterial: {
42 value: function (materialName)
43 {
44 var index = this.getIndexOfMaterial(materialName);
45 if(index !== -1)
46 {
47 return this.removeMaterialAt(index);
48 }
49 }
50 },
51
52 getMaterialAt: {
53 value: function (index)
54 {
55 return this._materials[index];
56 }
57 },
58
59 getMaterial: {
60 value: function (materialName)
61 {
62 var index = this.getIndexOfMaterial(materialName);
63 if(index !== -1)
64 {
65 return this._materials[index];
66 }
67 }
68 },
69
70 getIndexOfMaterial: {
71 value: function (materialName)
72 {
73 var len = this._materials.length;
74 for(var i=0; i<len; i++)
75 {
76 var material = this._materials[i];
77 if(material.getName() === materialName)
78 {
79 return i;
80 }
81 }
82
83 return -1;
84 }
85 },
86
87 clearAllMaterials:
88 {
89 value: function()
90 {
91 this._materials = [];
92 }
93 },
94
95 export:
96 {
97 value: function()
98 {
99 var exportStr = "MaterialLibrary: \n"
100
101 var nMats = this._materials.length;
102 for (var i=0; i<nMats; i++)
103 {
104 var material = this._materials[i];
105 exportStr += material.export();
106 }
107
108 exportStr += "endMatLib\n";
109 return exportStr;
110 }
111 },
112
113 import:
114 {
115 value: function( importStr )
116 {
117 // we replace allmaterials, so remove anything
118 // that is currently there.
119 this.clearAllMaterials();
120
121 var pu = new ParseUtils( importStr );
122
123 var type = pu.nextValue( "material: ", "\n", false );
124 while (type)
125 {
126 var mat = null;
127 switch (type)
128 {
129 case "flat": mat = new FlatMaterial(); break;
130 case "linearGradient": mat = new LinearGradientMaterial(); break;
131 case "radialGradient": mat = new RadialGradientMaterial(); break;
132 case "bumpMetal": mat = new BumpMetalMaterial(); break;
133 case "uber": mat = new UberMaterial(); break;
134
135 case "taper": mat = new TaperMaterial(); break;
136 case "twistVert": mat = new TwistVertMaterial(); break;
137 case "radialBlur": mat = new RadialBlurMaterial(); break;
138 case "plasma": mat = new PlasmaMaterial(); break;
139 case "pulse": mat = new PulseMaterial(); break;
140 case "tunnel": mat = new TunnelMaterial(); break;
141 case "reliefTunnel": mat = new ReliefTunnelMaterial(); break;
142 case "squareTunnel": mat = new SquareTunnelMaterial(); break;
143 case "fly": mat = new FlyMaterial(); break;
144 case "water": mat = new WaterMaterial(); break;
145 case "zinvert": mat = new ZInvertMaterial(); break;
146 case "deform": mat = new DeformMaterial(); break;
147 case "star": mat = new StarMaterial(); break;
148 case "twist": mat = new TwistMaterial(); break;
149 case "julia": mat = new JuliaMaterial(); break;
150 case "keleidoscope": mat = new KeleidoscopeMaterial(); break;
151 case "mandel": mat = new MandelMaterial(); break;
152
153
154 default:
155 throw new Error( "Unrecognized material type: " + type );
156 pu.advancePastToken( "endMaterial\n" );
157 break;
158 }
159
160 if (mat)
161 {
162 importStr = mat.import( importStr );
163 pu.setBuffer( importStr );
164 this.addMaterial( mat );
165 }
166
167 type = pu.nextValue( "material: ", "\n", false );
168 }
169
170 return pu.getBuffer();
171 }
172 }
173
174});
175
176
177// create the library of stroke and fill materials
178
179var flatMaterial = new FlatMaterial();
180var linearGradientMaterial = new LinearGradientMaterial();
181var radialGradientMaterial = new RadialGradientMaterial();
182var bumpMetalMaterial = new BumpMetalMaterial();
183var uberMaterial = new UberMaterial();
184
185//var taperMaterial = new TaperMaterial();
186//var twistVertMaterial = new TwistVertMaterial();
187var radialBlurMaterial = new RadialBlurMaterial();
188var plasmaMaterial = new PlasmaMaterial();
189var pulseMaterial = new PulseMaterial();
190