-
Notifications
You must be signed in to change notification settings - Fork 419
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
Internalise TextureGL
and rewrite Texture
to take its role
#5330
Conversation
osu.Framework/Graphics/Textures/TextureAtlas_InternalAtlasTexture.cs
Outdated
Show resolved
Hide resolved
/// <param name="area">A display-space area of this texture to compute the UV coordinates of.<br/> | ||
/// The full area is used if not provided: (0, 0, <see cref="DisplayWidth"/>, <see cref="DisplayHeight"/>).</param> | ||
/// <returns>The UV coordinates of <paramref name="area"/> in this texture.</returns> | ||
public virtual RectangleF GetTextureRect(RectangleF? area = null) |
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.
One thing I forgot to mention is that I had a lot of trouble getting this GetTextureRect()
method to work due to working in two "coordinate spaces".
In this PR, I've tried to use the terminology "texture-space" and "display-space" to describe which coordinate space the user or reviewer of code should be thinking of.
- "texture-space" is in coordinates
(0, 0, Width, Height)
- "display-space" is in coordinates
(0, 0, DisplayWidth, DisplayHeight)
This method here is one example, as well as:
- The XMLDoc on
TextureRegion
: https://github.com/ppy/osu-framework/pull/5330/files#diff-296537cb3a9b525374da9be847ea69b5532c71516de14c76ab09a73e1b373df0R17-R25 - The implementation of
TextureRegion
: https://github.com/ppy/osu-framework/pull/5330/files#diff- - 296537cb3a9b525374da9be847ea69b5532c71516de14c76ab09a73e1b373df0R60-R78
As well as... GetTextureRect()
returns as "UV coordinates" which is typically known to be normalised coordinates in texture space (i.e. what's passed to the GPU).
I'd be glad to change it if anyone has better suggestions.
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.
Looks good on a post-merge read.
This PR is very big and nigh impossible to split out due to the amount of dependencies between
TextureGL
andTexture
. Hopefully the diff should be pretty easy to go through, and I've done my best to separate the process via commits.TextureGL*
classes merged into one.Texture
.Texture
no longer exposes the underlying native texture.Texture
s must be created through theIRenderer
.The rest should be explainable via the breaking changes below:
vNext
WrapMode
andOpacity
enums have been re-namespacedTheir new location is
osu.Framework.Graphics.Textures
.Texture.WhitePixel
has been moved toIRenderer
It is no longer provided as a static member. Instead, resolve an
IRenderer
and accessIRenderer.WhitePixel
.TextureStore
,FontStore
andLargeTextureStore
construction parameters have changedIRenderer
parameter (via dependency injection).All
toTextureFilteringMode
.One common use case is to provide a new texture store from inside a derived
Game
, for which the following change is required:Texture
cannot be used to create texturesTexture
must now be created viaIRenderer
.DummyRenderer
may be used for cases where textures need to be created and neither anIRenderer
norGameHost
is accessible:Texture drawing methods moved from
DrawNode
toIRenderer
extension methodsAppearing alongside
IRenderer
is the newRendererExtensions
class providing extension helper methods for common drawing procedures.An example of the type of change required
DrawNode
:The following methods have been moved to this class:
TextureGL
is no longer accessibleProperties such as
TextureGL.BypassTextureUploadQueueing
have been moved toTexture
itself, andTexture
can be used for all drawing procedures.During rendering, textures may now be bound via an integer sampling unit.