Closed collinsmith closed 4 years ago
I'm going to group this in with this issue for now: MapRenderer
drawing results in jitter (desktop) and gaps (mobile). I think this is caused by the rounding that's performed when drawing the textures onto a projected buffer and temp fix I've been using is to just stretch the height of floor tiles by 1, but some walls show a gap also in the vertical dimension even on desktop. This is very distracting if you're looking for it and I think it should be reasonably simple to fix.
The fix I'd like to look into is drawing to a buffer without any stretching (identity matrix) to get a perfect 1:1 pixel scale and then stretching that buffer in one go to eliminate the tile gap (upscale filter will sample guaranteed non-transparent pixels this way). I think this approach may also remove most of the jitter (some may still be present from upscaling, don't think that's fixable unless I go with a different upscaler). I.e., layers will render using an identity matrix and then the layers will have the OrthographicCamera
projection matrix applied upon final rendering.
This change will be easiest to make when MapRenderer
is decoupled from its built-in camera fields and support for IsometricCamera
is added.
IsometricCamera
has been roughly tested with CameraTool
, I need to go through it and document the methods because they're confusing as to what they actually do. I'm really happy with the result though, but concerned about the behavior this will have on iso position versus offset (camera position is centered on the tile, but the center of the tile is really the iso position + (0,-Tile.SUBTILE_HEIGHT50)
d6105d9f9a580c3b542c8adbeaee0d3656bc4ebe closes this
I've created and begun working on an improved camera system
com.riiablo.camera
. This camera should support a 1:1 ratio with the game world and simplify the many screen↔map coordinate conversions that take place -- specifically regarding position and rounding coordinates to convert to and from tiles. This change/distinction is needed because I wantOrthographicCamera
to hide the zoom/camera position properties fromIsometricCamera
so when entities are working with their position/angle data they don't need to take into account client-specific camera properties -- this should provide more consistency and simplify the implementation of a proper physics engine.Essentially this should consist of two main classes:
OrthographicCamera
is just a decorator ofcom.badlogic.gdx.graphics.OrthographicCamera
with additionalVector2
support to hide theVector3
math (obviously it's still there, but all of my classes useVector2
, so it's more useful to have method signatures that reflect that).IsometricCamera
is a subclass ofOrthographicCamera
that should encapsulate the isometric map responsibilities -- i.e., converting between screen and map coordinates.As of now, I am not planning on adding support for the perspective mode -- this may require a different implementation of
MapRenderer
and is outside the scope of the initial design. It could be as simple as applying an additional camera extension forPerspectiveCamera
with a lower angle of attack (i.e., to transform the output ofMapRenderer
) and some FOV, but I can't say without further investigation.