-
Notifications
You must be signed in to change notification settings - Fork 491
Rework & separate renderers #3539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
doesn't seem to be a reason for them to be in FlxCameraView? if I've overlooked something then we can easily move them back at some later point in time
|
I decided to deprecate all the internals and make them point to where they were moved, to avoid breaking anything. Addons and UI will need to be updated to avoid warnings, I'll get to that in a bit. Addons specifically seems to have an issue because I think this is in a good enough of a state now for a review, so I'll undraft |
| * @param color The color to fill with in `0xAARRGGBB` hex format. | ||
| * @param blendAlpha Whether to blend the alpha value or just wipe the previous contents. Default is `true`. | ||
| */ | ||
| overload public inline extern function fill(color:FlxColor, blendAlpha:Bool = true):Void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than overloading maybe we should define a new fillView() or use view.fill directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that could work. I'm leaning more towards fillView(), I think having a convenience method in FlxCamera would be nice. What about all the other overloaded methods? Ideally I wanted to keep everything working as is, but I completely forgot to account that people might be overriding these methods
| inline function set_flashSprite(value:Sprite):Sprite | ||
| { | ||
| var sprite = FlxG.renderTile ? viewQuad.flashSprite : viewBlit.flashSprite; | ||
| return sprite = value; | ||
| } | ||
| inline function get_flashSprite():Sprite | ||
| { | ||
| return FlxG.renderTile ? viewQuad.flashSprite : viewBlit.flashSprite; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self, this can probably be simplified to just view.display
|
Some more notes and thoughts. I'm currently playing around trying to implement an OpenGL renderer to really test the flexibility of this system. Overloading methods in FlxCameraView won't work:For stuff like FlxMaterial and FlxTrianglesData, the function signatures of the core rendering functions need to be changed. To avoid breaking changes, I was just going to do this with overloads, but that didn't work out because overloads need to be inlined and you can't override inline functions. I got around this by deprecating drawPixels() and copyPixels() for draw() and copy() in FlxCameraView, but I couldn't do the same in FlxCamera because it inherits FlxBasic.draw(). I ended up overloading the camera's drawPixels() and copyPixels() to call the new methods in camera view. Pretty gross solution IMO but I can't think of a better way without a breaking change. Unifying renderBlit with other renderersI did some work related to this in 3cd97d9, but there's still a couple places where we have to do things differently depending on the renderer, notably Lines 743 to 744 in c32ab91
When the blitting renderer is used, Isolating direct access to rendererFlixel shouldn't access any renderer implementations directly from common code, it should be done through the renderer abstraction. First thing that comes to mind is that we need to abstract way EDIT: This could be done via the RenderFrontEnd via some method like |
Here we go, first step towards a renderer overhaul. Looks like a pretty big and scary change but 99% of this is just moving stuff around.
Shout out goes to Beeblerox & Austin East, a lot of this is based on the original renderer overhaul branch, I'm just porting bits and pieces to modern Flixel.
This PR:
FlxCameraViewclass, accessible viacamera.view, which serves as the base for all rendering functionality. Renderer implementations extend it and implement the required methods.FlxBlitViewandFlxQuadView, respectively. You can use thecamera.viewBlitandcamera.viewQuadshortcuts to access the camera's view typed as the respective class.FlxCameraintoFlxCameraViewimplementations.I'm opening this as a DRAFT, because:
TODO: