diff options
author | Nivesh Rajbhandari | 2012-03-22 14:24:46 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-22 14:24:46 -0700 |
commit | 636014cf5d824909993d7dc3510fbe6ce2fc72f1 (patch) | |
tree | 2d148b138b9d283fdd6228d31801c5924cf70d01 | |
parent | 6965b72f1f42f7280bc5e5e52d08b3d64d106831 (diff) | |
download | ninja-636014cf5d824909993d7dc3510fbe6ce2fc72f1.tar.gz |
WebGL needs to have 3d styles to render.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 1 | ||||
-rw-r--r-- | js/tools/BrushTool.js | 2 | ||||
-rwxr-xr-x | js/tools/LineTool.js | 2 | ||||
-rwxr-xr-x | js/tools/PenTool.js | 2 | ||||
-rwxr-xr-x | js/tools/ShapeTool.js | 4 | ||||
-rwxr-xr-x | js/tools/TagTool.js | 4 |
6 files changed, 8 insertions, 7 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 9b0159d4..689bc421 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -495,6 +495,7 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
495 | world = new World(el, true); | 495 | world = new World(el, true); |
496 | el.elementModel.shapeModel.GLWorld = world; | 496 | el.elementModel.shapeModel.GLWorld = world; |
497 | el.elementModel.shapeModel.useWebGl = true; | 497 | el.elementModel.shapeModel.useWebGl = true; |
498 | el.elementModel.controller.setProperty(el, "-webkit-transform-style", "preserve-3d"); | ||
498 | world.import(worldData, true); | 499 | world.import(worldData, true); |
499 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); | 500 | el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); |
500 | 501 | ||
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index 4ce9976a..ac29f2f2 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js | |||
@@ -252,7 +252,7 @@ exports.BrushTool = Montage.create(ShapeTool, { | |||
252 | 252 | ||
253 | if (!canvas) { | 253 | if (!canvas) { |
254 | var newCanvas = NJUtils.makeNJElement("canvas", "Brushstroke", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); | 254 | var newCanvas = NJUtils.makeNJElement("canvas", "Brushstroke", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); |
255 | var elementModel = TagTool.makeElement(w, h, planeMat, midPt, newCanvas); | 255 | var elementModel = TagTool.makeElement(w, h, planeMat, midPt, newCanvas, this._useWebGL); |
256 | ElementMediator.addElement(newCanvas, elementModel.data, true); | 256 | ElementMediator.addElement(newCanvas, elementModel.data, true); |
257 | 257 | ||
258 | // create all the GL stuff | 258 | // create all the GL stuff |
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index a61f8f79..a1cf7eb0 100755 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js | |||
@@ -89,7 +89,7 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
89 | } | 89 | } |
90 | 90 | ||
91 | canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); | 91 | canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); |
92 | var elementModel = TagTool.makeElement(w, h, drawData.planeMat, drawData.midPt, canvas); | 92 | var elementModel = TagTool.makeElement(w, h, drawData.planeMat, drawData.midPt, canvas, this.options.use3D); |
93 | 93 | ||
94 | ElementMediator.addElement(canvas, elementModel.data, true); | 94 | ElementMediator.addElement(canvas, elementModel.data, true); |
95 | canvas.elementModel.isShape = true; | 95 | canvas.elementModel.isShape = true; |
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 60ef4f92..17756772 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js | |||
@@ -584,7 +584,7 @@ exports.PenTool = Montage.create(ShapeTool, { | |||
584 | if (!canvas) { | 584 | if (!canvas) { |
585 | var newCanvas = null; | 585 | var newCanvas = null; |
586 | newCanvas = NJUtils.makeNJElement("canvas", "Subpath", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); | 586 | newCanvas = NJUtils.makeNJElement("canvas", "Subpath", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); |
587 | var elementModel = TagTool.makeElement(parseInt(w), parseInt(h), planeMat, midPt, newCanvas); | 587 | var elementModel = TagTool.makeElement(parseInt(w), parseInt(h), planeMat, midPt, newCanvas, this._useWebGL); |
588 | ElementMediator.addElement(newCanvas, elementModel.data, true); | 588 | ElementMediator.addElement(newCanvas, elementModel.data, true); |
589 | 589 | ||
590 | // create all the GL stuff | 590 | // create all the GL stuff |
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index d3a36163..2124376d 100755 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js | |||
@@ -6,8 +6,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | DrawingTool = require("js/tools/drawing-tool").DrawingTool, | 8 | DrawingTool = require("js/tools/drawing-tool").DrawingTool, |
9 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, | ||
10 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, | ||
11 | NJUtils = require("js/lib/NJUtils").NJUtils, | 9 | NJUtils = require("js/lib/NJUtils").NJUtils, |
12 | ElementMediator = require("js/mediators/element-mediator").ElementMediator, | 10 | ElementMediator = require("js/mediators/element-mediator").ElementMediator, |
13 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, | 11 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, |
@@ -70,7 +68,7 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
70 | { | 68 | { |
71 | canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); | 69 | canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); |
72 | var elementModel = TagTool.makeElement(~~drawData.width, ~~drawData.height, | 70 | var elementModel = TagTool.makeElement(~~drawData.width, ~~drawData.height, |
73 | drawData.planeMat, drawData.midPt, canvas); | 71 | drawData.planeMat, drawData.midPt, canvas, this.options.use3D); |
74 | 72 | ||
75 | ElementMediator.addElement(canvas, elementModel.data, true); | 73 | ElementMediator.addElement(canvas, elementModel.data, true); |
76 | canvas.elementModel.isShape = true; | 74 | canvas.elementModel.isShape = true; |
diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js index 6df49a7b..2b6742e6 100755 --- a/js/tools/TagTool.js +++ b/js/tools/TagTool.js | |||
@@ -221,7 +221,7 @@ exports.TagTool = Montage.create(DrawingTool, { | |||
221 | }, | 221 | }, |
222 | 222 | ||
223 | makeElement: { | 223 | makeElement: { |
224 | value: function(w, h, planeMat, midPt,tag) { | 224 | value: function(w, h, planeMat, midPt,tag, isWebGl) { |
225 | var left = Math.round(midPt[0] - 0.5 * w); | 225 | var left = Math.round(midPt[0] - 0.5 * w); |
226 | var top = Math.round(midPt[1] - 0.5 * h); | 226 | var top = Math.round(midPt[1] - 0.5 * h); |
227 | 227 | ||
@@ -234,6 +234,8 @@ exports.TagTool = Montage.create(DrawingTool, { | |||
234 | if(!MathUtils.isIdentityMatrix(planeMat)) { | 234 | if(!MathUtils.isIdentityMatrix(planeMat)) { |
235 | styles['-webkit-transform-style'] = 'preserve-3d'; | 235 | styles['-webkit-transform-style'] = 'preserve-3d'; |
236 | styles['-webkit-transform'] = DrawingToolBase.getElementMatrix(planeMat, midPt); | 236 | styles['-webkit-transform'] = DrawingToolBase.getElementMatrix(planeMat, midPt); |
237 | } else if(isWebGl) { | ||
238 | styles['-webkit-transform-style'] = 'preserve-3d'; | ||
237 | } | 239 | } |
238 | 240 | ||
239 | // TODO - for canvas, set both as style and attribute. | 241 | // TODO - for canvas, set both as style and attribute. |