@@ -11,6 +11,7 @@ import openfl.geom.Rectangle;
1111import flixel .graphics .FlxGraphic ;
1212import flixel .graphics .frames .FlxFrame ;
1313import flixel .graphics .tile .FlxDrawBaseItem ;
14+ import flixel .graphics .tile .FlxDrawQuadsItem ;
1415import flixel .graphics .tile .FlxDrawTrianglesItem ;
1516import flixel .math .FlxMath ;
1617import flixel .math .FlxMatrix ;
@@ -27,8 +28,6 @@ import openfl.filters.BitmapFilter;
2728
2829using flixel .util .FlxColorTransformUtil ;
2930
30- private typedef FlxDrawItem = flixel.graphics.tile. FlxDrawQuadsItem ;
31-
3231/**
3332 * The camera class is used to display the game's visuals.
3433 * By default one camera is created automatically, that is the same size as window.
@@ -537,7 +536,7 @@ class FlxCamera extends FlxBasic
537536 /**
538537 * Last draw tiles item
539538 */
540- var _headTiles : FlxDrawItem ;
539+ var _headTiles : FlxDrawQuadsItem ;
541540
542541 /**
543542 * Last draw triangles item
@@ -547,7 +546,7 @@ class FlxCamera extends FlxBasic
547546 /**
548547 * Draw tiles stack items that can be reused
549548 */
550- static var _storageTilesHead : FlxDrawItem ;
549+ static var _storageTilesHead : FlxDrawQuadsItem ;
551550
552551 /**
553552 * Draw triangles stack items that can be reused
@@ -601,7 +600,7 @@ class FlxCamera extends FlxBasic
601600 }
602601 else
603602 {
604- itemToReturn = new FlxDrawItem ();
603+ itemToReturn = new FlxDrawQuadsItem ();
605604 }
606605
607606 // TODO: catch this error when the dev actually messes up, not in the draw phase
@@ -643,10 +642,8 @@ class FlxCamera extends FlxBasic
643642 && _headTriangles .antialiasing == smoothing
644643 && _headTriangles .colored == isColored
645644 && _headTriangles .blend == blend
646- #if !flash
647645 && _headTriangles .hasColorOffsets == hasColorOffsets
648646 && _headTriangles .shader == shader
649- #end
650647 )
651648 {
652649 return _headTriangles ;
@@ -676,10 +673,8 @@ class FlxCamera extends FlxBasic
676673 itemToReturn .antialiasing = smoothing ;
677674 itemToReturn .colored = isColored ;
678675 itemToReturn .blend = blend ;
679- #if !flash
680676 itemToReturn .hasColorOffsets = hasColorOffsets ;
681677 itemToReturn .shader = shader ;
682- #end
683678
684679 itemToReturn .nextTyped = _headTriangles ;
685680 _headTriangles = itemToReturn ;
@@ -769,9 +764,9 @@ class FlxCamera extends FlxBasic
769764 var hasColorOffsets : Bool = (transform != null && transform .hasRGBAOffsets ());
770765
771766 #if FLX_RENDER_TRIANGLE
772- var drawItem : FlxDrawTrianglesItem = startTrianglesBatch (frame .parent , smoothing , isColored , blend );
767+ final drawItem : FlxDrawTrianglesItem = startTrianglesBatch (frame .parent , smoothing , isColored , blend , hasColorOffsets , shader );
773768 #else
774- var drawItem = startQuadBatch (frame .parent , isColored , hasColorOffsets , blend , smoothing , shader );
769+ final drawItem : FlxDrawQuadsItem = startQuadBatch (frame .parent , isColored , hasColorOffsets , blend , smoothing , shader );
775770 #end
776771 drawItem .addQuad (frame , matrix , transform );
777772 }
@@ -812,10 +807,10 @@ class FlxCamera extends FlxBasic
812807 var isColored = (transform != null && transform .hasRGBMultipliers ());
813808 var hasColorOffsets : Bool = (transform != null && transform .hasRGBAOffsets ());
814809
815- #if ! FLX_RENDER_TRIANGLE
816- var drawItem = startQuadBatch (frame .parent , isColored , hasColorOffsets , blend , smoothing , shader );
810+ #if FLX_RENDER_TRIANGLE
811+ final drawItem : FlxDrawTrianglesItem = startTrianglesBatch (frame .parent , smoothing , isColored , blend , hasColorOffsets , shader );
817812 #else
818- var drawItem : FlxDrawTrianglesItem = startTrianglesBatch (frame .parent , smoothing , isColored , blend );
813+ final drawItem : FlxDrawQuadsItem = startQuadBatch (frame .parent , isColored , hasColorOffsets , blend , smoothing , shader );
819814 #end
820815 drawItem .addQuad (frame , _helperMatrix , transform );
821816 }
@@ -881,7 +876,8 @@ class FlxCamera extends FlxBasic
881876 _helperMatrix .translate (- viewMarginLeft , - viewMarginTop );
882877 }
883878
884- buffer .draw (trianglesSprite , _helperMatrix );
879+ buffer .draw (trianglesSprite , _helperMatrix , transform );
880+
885881 #if FLX_DEBUG
886882 if (FlxG .debugger .drawDebug )
887883 {
@@ -899,17 +895,11 @@ class FlxCamera extends FlxBasic
899895 }
900896 else
901897 {
902- var isColored : Bool = (colors != null && colors .length != 0 );
898+ final isColored = (colors != null && colors .length != 0 ) || (transform != null && transform .hasRGBMultipliers ());
899+ final hasColorOffsets = (transform != null && transform .hasRGBAOffsets ());
903900
904- #if !flash
905- var hasColorOffsets : Bool = (transform != null && transform .hasRGBAOffsets ());
906- isColored = isColored || (transform != null && transform .hasRGBMultipliers ());
907- var drawItem : FlxDrawTrianglesItem = startTrianglesBatch (graphic , smoothing , isColored , blend , hasColorOffsets , shader );
901+ final drawItem = startTrianglesBatch (graphic , smoothing , isColored , blend , hasColorOffsets , shader );
908902 drawItem .addTriangles (vertices , indices , uvtData , colors , position , cameraBounds , transform );
909- #else
910- var drawItem : FlxDrawTrianglesItem = startTrianglesBatch (graphic , smoothing , isColored , blend );
911- drawItem .addTriangles (vertices , indices , uvtData , colors , position , cameraBounds );
912- #end
913903 }
914904 }
915905
@@ -1667,9 +1657,6 @@ class FlxCamera extends FlxBasic
16671657 }
16681658 else
16691659 {
1670- if (FxAlpha == 0 )
1671- return ;
1672-
16731660 final targetGraphics = (graphics == null ) ? canvas .graphics : graphics ;
16741661
16751662 targetGraphics .overrideBlendMode (null );
0 commit comments