aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 14:35:44 -0700
committerValerio Virgillito2012-07-09 14:35:44 -0700
commit84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch)
tree3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/lib/geom
parentc0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff)
parent40c6eb2c06b34f65a74d59ef9687251952858bab (diff)
downloadninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts: js/components/gradientpicker.reel/gradientpicker.js js/components/tools-properties/text-properties.reel/text-properties.js js/document/views/base.js js/document/views/design.js js/helper-classes/3D/StageLine.js js/helper-classes/3D/draw-utils.js js/lib/drawing/world.js js/lib/geom/circle.js js/lib/geom/line.js js/lib/geom/rectangle.js js/lib/geom/shape-primitive.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/flag-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/water-material.js js/panels/Materials/materials-library-panel.reel/materials-library-panel.html js/panels/Materials/materials-library-panel.reel/materials-library-panel.js js/panels/Materials/materials-popup.reel/materials-popup.html js/panels/Materials/materials-popup.reel/materials-popup.js js/tools/LineTool.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/lib/geom')
-rwxr-xr-xjs/lib/geom/anchor-point.js12
-rwxr-xr-xjs/lib/geom/brush-stroke.js6
-rwxr-xr-xjs/lib/geom/circle.js1576
-rwxr-xr-xjs/lib/geom/geom-obj.js40
-rwxr-xr-xjs/lib/geom/line.js70
-rwxr-xr-xjs/lib/geom/rectangle.js1248
-rw-r--r--js/lib/geom/shape-primitive.js334
-rwxr-xr-xjs/lib/geom/sub-path.js4
8 files changed, 1645 insertions, 1645 deletions
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.
30 30
31///////////////////////////////////////////// 31/////////////////////////////////////////////
32// Class GLAnchorPoint 32// Class GLAnchorPoint
33// GL representation of a point clicked 33// GL representation of a point clicked
34// and dragged during pen tool 34// and dragged during pen tool
35// 35//
36// 36//
37///////////////////////////////////////////// 37/////////////////////////////////////////////
38var GLAnchorPoint = function GLAnchorPoint() { 38var GLAnchorPoint = function GLAnchorPoint() {
39 ///////////////////////////////////////// 39 /////////////////////////////////////////
40 // Instance variables 40 // Instance variables
41 ///////////////////////////////////////// 41 /////////////////////////////////////////
42 this._x = 0.0; 42 this._x = 0.0;
43 this._y = 0.0; 43 this._y = 0.0;
@@ -99,7 +99,7 @@ GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) {
99 if (totalTransSq < 0.0000001) { 99 if (totalTransSq < 0.0000001) {
100 return; 100 return;
101 } 101 }
102 102
103 // *** compute the rotation of the prev vector *** 103 // *** compute the rotation of the prev vector ***
104 var oldP = [this._prevX + tx - this._x, this._prevY + ty - this._y, this._prevZ + tz - this._z]; 104 var oldP = [this._prevX + tx - this._x, this._prevY + ty - this._y, this._prevZ + tz - this._z];
105 var newP = [this._prevX - this._x, this._prevY - this._y, this._prevZ - this._z]; 105 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) {
133 if (totalTransSq < 0.0000001) { 133 if (totalTransSq < 0.0000001) {
134 return; 134 return;
135 } 135 }
136 136
137 // *** compute the rotation of the next vector *** 137 // *** compute the rotation of the next vector ***
138 var oldN = [this._nextX + tx - this._x, this._nextY + ty - this._y, this._nextZ + tz - this._z]; 138 var oldN = [this._nextX + tx - this._x, this._nextY + ty - this._y, this._nextZ + tz - this._z];
139 var newN = [this._nextX - this._x, this._nextY - this._y, this._nextZ - this._z]; 139 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() {
52 this._BBoxMax = [0, 0, 0]; 52 this._BBoxMax = [0, 0, 0];
53 this._isDirty = true; 53 this._isDirty = true;
54 this._isInit = false; 54 this._isInit = false;
55 55
56 //the HTML5 canvas that holds this brush stroke 56 //the HTML5 canvas that holds this brush stroke
57 this._canvas = null; 57 this._canvas = null;
58 //flag indicating whether or not to freeze the size and position of canvas 58 //flag indicating whether or not to freeze the size and position of canvas
@@ -312,7 +312,7 @@ BrushStroke.prototype.setWidth = function (newW) {
312 } 312 }
313 var minWidth = 1+this._strokeWidth; 313 var minWidth = 1+this._strokeWidth;
314 if (newW<minWidth) { 314 if (newW<minWidth) {
315 newW=minWidth; 315 newW=minWidth;
316 } 316 }
317 317
318 if (oldCanvasWidth<minWidth) { 318 if (oldCanvasWidth<minWidth) {
@@ -731,7 +731,7 @@ BrushStroke.prototype.drawToContext = function(ctx, drawStageWorldPts, stageWorl
731 w = world.getViewportWidth(); 731 w = world.getViewportWidth();
732 h = world.getViewportHeight(); 732 h = world.getViewportHeight();
733 } 733 }
734 734
735 if (this._strokeUseCalligraphic) { 735 if (this._strokeUseCalligraphic) {
736 //build the stamp for the brush stroke 736 //build the stamp for the brush stroke
737 var t=0; 737 var t=0;
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 2cd5a21f..53847631 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -31,60 +31,60 @@ POSSIBILITY OF SUCH DAMAGE.
31var GeomObj = require("js/lib/geom/geom-obj").GeomObj; 31var GeomObj = require("js/lib/geom/geom-obj").GeomObj;
32var ShapePrimitive = require("js/lib/geom/shape-primitive").ShapePrimitive; 32var ShapePrimitive = require("js/lib/geom/shape-primitive").ShapePrimitive;
33var MaterialsModel = require("js/models/materials-model").MaterialsModel; 33var MaterialsModel = require("js/models/materials-model").MaterialsModel;
34var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; 34var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils;
35var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; 35var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
36 36
37/////////////////////////////////////////////////////////////////////// 37///////////////////////////////////////////////////////////////////////
38// Class GLCircle 38// Class GLCircle
39// GL representation of a circle. 39// GL representation of a circle.
40// Derived from class GLGeomObj 40// Derived from class GLGeomObj
41// The position and dimensions of the stroke, fill, and inner Radius should be in pixels 41// The position and dimensions of the stroke, fill, and inner Radius should be in pixels
42/////////////////////////////////////////////////////////////////////// 42///////////////////////////////////////////////////////////////////////
43exports.Circle = Object.create(GeomObj, { 43exports.Circle = Object.create(GeomObj, {
44 44
45 /////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////
46 // Instance variables 46 // Instance variables
47 /////////////////////////////////////////////////////////////////////// 47 ///////////////////////////////////////////////////////////////////////
48 _width: { value : 2.0, writable: true }, 48 _width: { value : 2.0, writable: true },
49 _height: { value : 2.0, writable: true }, 49 _height: { value : 2.0, writable: true },
50 _xOffset: { value : 0, writable: true }, 50 _xOffset: { value : 0, writable: true },
51 _yOffset: { value : 0, writable: true }, 51 _yOffset: { value : 0, writable: true },
52 52
53 _radius: { value : 2.0, writable: true }, 53 _radius: { value : 2.0, writable: true },
54 _strokeWidth: { value : 0.25, writable: true }, 54 _strokeWidth: { value : 0.25, writable: true },
55 _innerRadius: { value : 0, writable: true }, 55 _innerRadius: { value : 0, writable: true },
56 _ovalHeight: { value : 4.0, writable: true }, 56 _ovalHeight: { value : 4.0, writable: true },
57 _strokeStyle: { value : "Solid", writable: true }, 57 _strokeStyle: { value : "Solid", writable: true },
58 _aspectRatio: { value : 1.0, writable: true }, 58 _aspectRatio: { value : 1.0, writable: true },
59 59
60 init: { 60 init: {
61 value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) { 61 value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) {
62 if(arguments.length > 0) { 62 if(arguments.length > 0) {
63 this._width = width; 63 this._width = width;
64 this._height = height; 64 this._height = height;
65 this._xOffset = xOffset; 65 this._xOffset = xOffset;
66 this._yOffset = yOffset; 66 this._yOffset = yOffset;
67 this._ovalHeight = 2.0 * this._radius; 67 this._ovalHeight = 2.0 * this._radius;
68 68
69 this._strokeWidth = strokeSize; 69 this._strokeWidth = strokeSize;
70 this._innerRadius = innerRadius; 70 this._innerRadius = innerRadius;
71 this._strokeColor = strokeColor; 71 this._strokeColor = strokeColor;
72 this._fillColor = fillColor; 72 this._fillColor = fillColor;
73 73
74 this._strokeStyle = strokeStyle; 74 this._strokeStyle = strokeStyle;
75 75
76 this._matrix = Matrix.I(4); 76 this._matrix = Matrix.I(4);
77 //this._matrix[12] = xOffset; 77 //this._matrix[12] = xOffset;
78 //this._matrix[13] = yOffset; 78 //this._matrix[13] = yOffset;
79 } 79 }
80 80
81 this.m_world = world; 81 this.m_world = world;
82 82
83 if(strokeMaterial) { 83 if(strokeMaterial) {
84 this._strokeMaterial = strokeMaterial.dup(); 84 this._strokeMaterial = strokeMaterial.dup();
85 } else { 85 } else {
86 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); 86 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
87 } 87 }
88 88
89 if(strokeColor) { 89 if(strokeColor) {
90 if(this._strokeMaterial.hasProperty("color")) { 90 if(this._strokeMaterial.hasProperty("color")) {
@@ -94,135 +94,135 @@ exports.Circle = Object.create(GeomObj, {
94 } 94 }
95 } 95 }
96 96
97 if(fillMaterial) { 97 if(fillMaterial) {
98 this._fillMaterial = fillMaterial.dup(); 98 this._fillMaterial = fillMaterial.dup();
99 } else { 99 } else {
100 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); 100 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup();
101 } 101 }
102 102
103 if(fillColor) { 103 if(fillColor) {
104 if(this._fillMaterial.hasProperty("color")) { 104 if(this._fillMaterial.hasProperty("color")) {
105 this._fillMaterial.setProperty( "color", this._fillColor ); 105 this._fillMaterial.setProperty( "color", this._fillColor );
106 } else if (this._fillMaterial && (this._fillMaterial.gradientType === this._fillColor.gradientMode)) { 106 } else if (this._fillMaterial && (this._fillMaterial.gradientType === this._fillColor.gradientMode)) {
107 this._fillMaterial.setGradientData(this._fillColor.color); 107 this._fillMaterial.setGradientData(this._fillColor.color);
108 } 108 }
109 } 109 }
110 } 110 }
111 }, 111 },
112 112
113 /////////////////////////////////////////////////////////////////////// 113 ///////////////////////////////////////////////////////////////////////
114 // Property Accessors 114 // Property Accessors
115 /////////////////////////////////////////////////////////////////////// 115 ///////////////////////////////////////////////////////////////////////
116 // TODO - Use getters/setters in the future 116