aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/GLLine.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/GLLine.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/GLLine.js')
-rwxr-xr-xjs/helper-classes/backup-delete/GLLine.js507
1 files changed, 507 insertions, 0 deletions
diff --git a/js/helper-classes/backup-delete/GLLine.js b/js/helper-classes/backup-delete/GLLine.js
new file mode 100755
index 00000000..65e6ab1c
--- /dev/null
+++ b/js/helper-classes/backup-delete/GLLine.js
@@ -0,0 +1,507 @@
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///////////////////////////////////////////////////////////////////////
8// Class GLLine
9// GL representation of a line.
10// Derived from class GLGeomObj
11///////////////////////////////////////////////////////////////////////
12function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj)
13{
14 // initialize the inherited members
15 this.inheritedFrom = GLGeomObj;
16 this.inheritedFrom();
17
18 ///////////////////////////////////////////////////////////////////////
19 // Instance variables
20 ///////////////////////////////////////////////////////////////////////
21 this._width = 2.0;
22 this._height = 2.0;
23 this._xOffset = 0;
24 this._yOffset = 0;
25
26 // If line doesn't fit in canvas world, we had to grow the canvas by this much on either side
27 this._xAdj = 0;
28 this._yAdj = 0;
29
30 this._slope = 0;
31
32 this._strokeWidth = 0.25;
33
34 this._strokeStyle = "Solid";
35 this._scaleX = 1.0;
36 this._scaleY = 1.0;
37
38 if (arguments.length > 0)
39 {
40 this._width = width;
41 this._height = height;
42 this._xOffset = xOffset;
43 this._yOffset = yOffset;
44
45 this._xAdj = xAdj;
46 this._yAdj = yAdj;
47
48 this._slope = slope;
49 this._strokeWidth = strokeSize;
50 if (strokeColor) this._strokeColor = strokeColor.slice();
51
52 this._strokeStyle = strokeStyle;
53 this._scaleX = (world.getViewportWidth())/(world.getViewportHeight());
54 }
55
56 this._strokeVerticesLen = 0;
57
58 this.m_world = world;
59
60 this._materialAmbient = [0.2, 0.2, 0.2, 1.0];
61 this._materialDiffuse = [0.4, 0.4, 0.4, 1.0];
62 this._materialSpecular = [0.4, 0.4, 0.4, 1.0];
63
64 if(strokeMaterial)
65 {
66 this._strokeMaterial = strokeMaterial;
67 }
68
69 ///////////////////////////////////////////////////////////////////////
70 // Property Accessors
71 ///////////////////////////////////////////////////////////////////////
72 this.getStrokeWidth = function() { return this._strokeWidth; }
73 this.setStrokeWidth = function(w) { this._strokeWidth = w; }
74
75 this.getStrokeMaterial = function() { return this._strokeMaterial; }
76 this.setStrokeMaterial = function(m) { this._strokeMaterial = m; }
77
78 this.getStrokeColor = function() { return this._strokeColor; }
79 //this.setStrokeColor = function(c) { this._strokeColor = c; }
80
81 this.getStrokeStyle = function() { return this._strokeStyle; }
82 this.setStrokeStyle = function(s) { this._strokeStyle = s; }
83
84 this.getFillMaterial = function() { return null; }
85
86 this.setStrokeMaterial = function(m) { this._strokeMaterial = m; }
87 this.getStrokeMaterial = function() { return this._strokeMaterial; }
88
89 this.getWidth = function() { return this._width; }
90 this.setWidth = function(w) { this._width = w; }
91
92 this.getHeight = function() { return this._height; }
93 this.setHeight = function(h) { this._height = h; }
94
95 this.getXAdj = function() { return this._xAdj; }
96 this.setXAdj = function(x) { this._xAdj = x; }
97
98 this.getYAdj = function() { return this._yAdj; }
99 this.setYAdj = function(y) { this._yAdj = y; }
100
101 this.getSlope = function() { return this._slope; }
102 this.setSlope = function(m) { this._slope = m; }
103
104 this.geomType = function() { return this.GEOM_TYPE_LINE; }
105
106 ///////////////////////////////////////////////////////////////////////
107 // Methods
108 ///////////////////////////////////////////////////////////////////////
109 this.export = function()
110 {
111 var rtnStr = "type: " + this.geomType() + "\n";
112
113 rtnStr += "xoff: " + this._xOffset + "\n";
114 rtnStr += "yoff: " + this._yOffset + "\n";
115 rtnStr += "width: " + this._width + "\n";
116 rtnStr += "height: " + this._height + "\n";
117 rtnStr += "xAdj: " + this._xAdj + "\n";
118 rtnStr += "yAdj: " + this._yAdj + "\n";
119 rtnStr += "strokeWidth: " + this._strokeWidth + "\n";
120 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n";
121 rtnStr += "strokeStyle: " + this._strokeStyle + "\n";
122 rtnStr += "slope: " + String(this._slope) + "\n";
123
124 rtnStr += "strokeMat: ";
125 if (this._strokeMaterial)
126 rtnStr += this._strokeMaterial.getName();
127 else
128 rtnStr += "flatMaterial";
129 rtnStr += "\n";
130
131 return rtnStr;
132 }
133
134 this.import = function( importStr )
135 {
136 this._xOffset = Number( this.getPropertyFromString( "xoff: ", importStr ) );
137 this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) );
138 this._width = Number( this.getPropertyFromString( "width: ", importStr ) );
139 this._height = Number( this.getPropertyFromString( "height: ", importStr ) );
140 this._xAdj = Number( this.getPropertyFromString( "xAdj: ", importStr ) );
141 this._yAdj = Number( this.getPropertyFromString( "yAdj: ", importStr ) );
142 this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) );
143 var slope = this.getPropertyFromString( "slope: ", importStr );
144 if(isNaN(Number(slope)))
145 this._slope = slope;
146 else
147 this._slope = Number(slope);
148
149 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
150 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr );
151 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
152
153 var strokeMat = MaterialsLibrary.getMaterial( strokeMaterialName );
154 if (!strokeMat)
155 {
156 console.log( "object material not found in library: " + strokeMaterialName );
157 strokeMat = new FlatMaterial();
158 }
159 this._strokeMaterial = strokeMat;
160
161 }
162
163 ///////////////////////////////////////////////////////////////////////
164 // Methods
165 ///////////////////////////////////////////////////////////////////////
166 this.buildBuffers = function()
167 {
168 // get the world
169 var world = this.getWorld();
170 if (!world) throw( "null world in buildBuffers" );
171 if (!world._useWebGL) return;
172
173 // make sure RDGE has the correct context
174 g_Engine.setContext( world.getCanvas().rdgeid );
175
176 // create the gl buffer
177 var gl = world.getGLContext();
178
179 this._strokeVerticesLen = 0;
180
181 var strokeVertices = [];
182 var strokeTextures = [];
183 var strokeNormals = [];
184 var strokeColors = [];
185
186// var scaleMat = Matrix.I(3);
187// scaleMat.elements[0][0] = this._scaleX;
188// scaleMat.elements[1][1] = this._scaleY;
189
190
191// get the normalized device coordinates (NDC) for
192 // all position and dimensions.
193 var vpw = world.getViewportWidth(), vph = world.getViewportHeight();
194 var xNDC = 2*