diff options
Diffstat (limited to 'js/helper-classes/RDGE/GLLine.js')
-rw-r--r-- | js/helper-classes/RDGE/GLLine.js | 67 |
1 files changed, 61 insertions, 6 deletions
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js index 1cd70575..5ec51230 100644 --- a/js/helper-classes/RDGE/GLLine.js +++ b/js/helper-classes/RDGE/GLLine.js | |||
@@ -28,6 +28,8 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
28 | this._strokeWidth = 0.25; | 28 | this._strokeWidth = 0.25; |
29 | 29 | ||
30 | this._strokeStyle = "Solid"; | 30 | this._strokeStyle = "Solid"; |
31 | this._scaleX = 1.0; | ||
32 | this._scaleY = 1.0; | ||
31 | 33 | ||
32 | if (arguments.length > 0) | 34 | if (arguments.length > 0) |
33 | { | 35 | { |
@@ -44,13 +46,9 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
44 | this._strokeColor = strokeColor; | 46 | this._strokeColor = strokeColor; |
45 | 47 | ||
46 | this._strokeStyle = strokeStyle; | 48 | this._strokeStyle = strokeStyle; |
49 | this._scaleX = (world.getViewportWidth())/(world.getViewportHeight()); | ||
47 | } | 50 | } |
48 | 51 | ||
49 | this._scaleX = 1.0; | ||
50 | this._scaleY = 1.0; | ||
51 | |||
52 | this._scaleX = (world._viewportWidth)/(world._viewportHeight); | ||
53 | |||
54 | this._strokeVerticesLen = 0; | 52 | this._strokeVerticesLen = 0; |
55 | 53 | ||
56 | this.m_world = world; | 54 | this.m_world = world; |
@@ -104,7 +102,64 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
104 | this.setSlope = function(m) { this._slope = m; } | 102 | this.setSlope = function(m) { this._slope = m; } |
105 | 103 | ||
106 | this.geomType = function() { return this.GEOM_TYPE_LINE; } | 104 | this.geomType = function() { return this.GEOM_TYPE_LINE; } |
107 | 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 | |||
108 | /////////////////////////////////////////////////////////////////////// | 163 | /////////////////////////////////////////////////////////////////////// |
109 | // Methods | 164 | // Methods |
110 | /////////////////////////////////////////////////////////////////////// | 165 | /////////////////////////////////////////////////////////////////////// |