@@ -32,10 +32,12 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
3232 public var vertices : DrawData <Float > = new DrawData <Float >();
3333 public var indices : DrawData <Int > = new DrawData <Int >();
3434 public var uvtData : DrawData <Float > = new DrawData <Float >();
35+ @:deprecated (" colors is deprecated, use colorMultipliers and colorOffsets" )
3536 public var colors : DrawData <Int > = new DrawData <Int >();
3637
3738 public var verticesPosition : Int = 0 ;
3839 public var indicesPosition : Int = 0 ;
40+ @:deprecated (" colorsPosition is deprecated" )
3941 public var colorsPosition : Int = 0 ;
4042
4143 var bounds : FlxRect = FlxRect .get ();
@@ -101,11 +103,9 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
101103 vertices .length = 0 ;
102104 indices .length = 0 ;
103105 uvtData .length = 0 ;
104- colors .length = 0 ;
105106
106107 verticesPosition = 0 ;
107108 indicesPosition = 0 ;
108- colorsPosition = 0 ;
109109 alphas .splice (0 , alphas .length );
110110 if (colorMultipliers != null )
111111 colorMultipliers .splice (0 , colorMultipliers .length );
@@ -120,7 +120,6 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
120120 vertices = null ;
121121 indices = null ;
122122 uvtData = null ;
123- colors = null ;
124123 bounds = null ;
125124 alphas = null ;
126125 colorMultipliers = null ;
@@ -141,7 +140,6 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
141140 var numberOfVertices : Int = Std .int (verticesLength / 2 );
142141 var prevIndicesLength : Int = this .indices .length ;
143142 var prevUVTDataLength : Int = this .uvtData .length ;
144- var prevColorsLength : Int = this .colors .length ;
145143 var prevNumberOfVertices : Int = this .numVertices ;
146144
147145 var tempX : Float , tempY : Float ;
@@ -185,16 +183,6 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
185183 {
186184 this .indices [prevIndicesLength + i ] = indices [i ] + prevNumberOfVertices ;
187185 }
188-
189- if (colored )
190- {
191- for (i in 0 ... numberOfVertices )
192- {
193- this .colors [prevColorsLength + i ] = colors [i ];
194- }
195-
196- colorsPosition + = numberOfVertices ;
197- }
198186
199187 final alphaMultiplier = transform != null ? transform .alphaMultiplier : 1.0 ;
200188 for (_ in 0 ... indicesLength )
@@ -282,51 +270,35 @@ class FlxDrawTrianglesItem extends FlxDrawBaseItem<FlxDrawTrianglesItem>
282270 override public function addQuad (frame : FlxFrame , matrix : FlxMatrix , ? transform : ColorTransform ): Void
283271 {
284272 final prevVerticesPos = verticesPosition ;
285- final prevIndicesPos = indicesPosition ;
286273 final prevNumberOfVertices = numVertices ;
287-
288- point .set (0 , 0 );
289- point .transform (matrix );
290-
291- vertices [prevVerticesPos ] = point .x ;
292- vertices [prevVerticesPos + 1 ] = point .y ;
293-
294- uvtData [prevVerticesPos ] = frame .uv .left ;
274+
275+ final w = frame .frame .width ;
276+ final h = frame .frame .height ;
277+ vertices [prevVerticesPos + 0 ] = matrix .transformX (0 , 0 ); // left
278+ vertices [prevVerticesPos + 1 ] = matrix .transformY (0 , 0 ); // top
279+ vertices [prevVerticesPos + 2 ] = matrix .transformX (w , 0 ); // right
280+ vertices [prevVerticesPos + 3 ] = matrix .transformY (w , 0 ); // top
281+ vertices [prevVerticesPos + 4 ] = matrix .transformX (0 , h ); // left
282+ vertices [prevVerticesPos + 5 ] = matrix .transformY (0 , h ); // bottom
283+ vertices [prevVerticesPos + 6 ] = matrix .transformX (w , h ); // right
284+ vertices [prevVerticesPos + 7 ] = matrix .transformY (w , h ); // bottom
285+
286+ uvtData [prevVerticesPos + 0 ] = frame .uv .left ;
295287 uvtData [prevVerticesPos + 1 ] = frame .uv .top ;
296-
297- point .set (frame .frame .width , 0 );
298- point .transform (matrix );
299-
300- vertices [prevVerticesPos + 2 ] = point .x ;
301- vertices [prevVerticesPos + 3 ] = point .y ;
302-
303288 uvtData [prevVerticesPos + 2 ] = frame .uv .right ;
304289 uvtData [prevVerticesPos + 3 ] = frame .uv .top ;
305-
306- point .set (0 , frame .frame .height );
307- point .transform (matrix );
308-
309- vertices [prevVerticesPos + 4 ] = point .x ;
310- vertices [prevVerticesPos + 5 ] = point .y ;
311-
312290 uvtData [prevVerticesPos + 4 ] = frame .uv .left ;
313291 uvtData [prevVerticesPos + 5 ] = frame .uv .bottom ;
314-
315- point .set (frame .frame .width , frame .frame .height );
316- point .transform (matrix );
317-
318- vertices [prevVerticesPos + 6 ] = point .x ;
319- vertices [prevVerticesPos + 7 ] = point .y ;
320-
321292 uvtData [prevVerticesPos + 6 ] = frame .uv .right ;
322293 uvtData [prevVerticesPos + 7 ] = frame .uv .bottom ;
323-
324- indices [prevIndicesPos ] = prevNumberOfVertices ;
325- indices [prevIndicesPos + 1 ] = prevNumberOfVertices + 1 ;
326- indices [prevIndicesPos + 2 ] = prevNumberOfVertices + 2 ;
327- indices [prevIndicesPos + 3 ] = prevNumberOfVertices + 1 ;
328- indices [prevIndicesPos + 4 ] = prevNumberOfVertices + 2 ;
329- indices [prevIndicesPos + 5 ] = prevNumberOfVertices + 3 ;
294+
295+ final prevIndicesPos = indicesPosition ;
296+ indices [prevIndicesPos + 0 ] = prevNumberOfVertices + 0 ; // TL
297+ indices [prevIndicesPos + 1 ] = prevNumberOfVertices + 1 ; // TR
298+ indices [prevIndicesPos + 2 ] = prevNumberOfVertices + 2 ; // BL
299+ indices [prevIndicesPos + 3 ] = prevNumberOfVertices + 1 ; // TR
300+ indices [prevIndicesPos + 4 ] = prevNumberOfVertices + 2 ; // BL
301+ indices [prevIndicesPos + 5 ] = prevNumberOfVertices + 3 ; // BR
330302
331303 final alphaMultiplier = transform != null ? transform .alphaMultiplier : 1.0 ;
332304 for (i in 0 ... INDICES_PER_QUAD )
0 commit comments