@@ -44,9 +44,10 @@ module SpriteBatch =
4444 type [<ReferenceEquality>] SpriteBatchEnv =
4545 private
4646 { mutable SpriteIndex : int
47- mutable ViewProjectionAbsolute : Matrix4x4
48- mutable ViewProjectionRelative : Matrix4x4
49- mutable ViewProjectionClip : Matrix4x4
47+ mutable ViewProjection2dAbsolute : Matrix4x4
48+ mutable ViewProjection2dRelative : Matrix4x4
49+ mutable ViewProjectionClipAbsolute : Matrix4x4
50+ mutable ViewProjectionClipRelative : Matrix4x4
5051 PerimetersUniform : int
5152 TexCoordsesUniform : int
5253 PivotsUniform : int
@@ -99,7 +100,7 @@ module SpriteBatch =
99100 Gl.Enable EnableCap.CullFace
100101 match env.State.ClipOpt with
101102 | ValueSome clip ->
102- let viewProjection = if env.State.Absolute then env.ViewProjectionAbsolute else env.ViewProjectionClip
103+ let viewProjection = if env.State.Absolute then env.ViewProjectionClipAbsolute else env.ViewProjectionClipRelative
103104 let minClip = Vector4.Transform ( Vector4 ( clip.Min, 0.0 f, 1.0 f), viewProjection)
104105 let minNdc = minClip / minClip.W * single viewport.DisplayScalar
105106 let minScissor = ( minNdc.V2 + v2One) * 0.5 f * viewport.Bounds.Size.V2
@@ -125,7 +126,7 @@ module SpriteBatch =
125126 Gl.Uniform2 ( env.PivotsUniform, env.Pivots)
126127 Gl.Uniform1 ( env.RotationsUniform, env.Rotations)
127128 Gl.Uniform4 ( env.ColorsUniform, env.Colors)
128- Gl.UniformMatrix4 ( env.ViewProjectionUniform, false , if env.State.Absolute then env.ViewProjectionAbsolute .ToArray () else env.ViewProjectionRelative .ToArray ())
129+ Gl.UniformMatrix4 ( env.ViewProjectionUniform, false , if env.State.Absolute then env.ViewProjection2dAbsolute .ToArray () else env.ViewProjection2dRelative .ToArray ())
129130 Gl.Uniform1 ( env.TexUniform, 0 )
130131 Gl.ActiveTexture TextureUnit.Texture0
131132 Gl.BindTexture ( TextureTarget.Texture2d, texture.TextureId)
@@ -163,13 +164,15 @@ module SpriteBatch =
163164
164165 /// Beging a new sprite batch frame3.
165166 let BeginSpriteBatchFrame
166- ( viewProjectionAbsolute : Matrix4x4 inref ,
167- viewProjectionRelative : Matrix4x4 inref ,
168- viewProjectionClip : Matrix4x4 inref ,
167+ ( viewProjection2dAbsolute : Matrix4x4 inref ,
168+ viewProjection2dRelative : Matrix4x4 inref ,
169+ viewProjectionClipAbsolute : Matrix4x4 inref ,
170+ viewProjectionClipRelative : Matrix4x4 inref ,
169171 env ) =
170- env.ViewProjectionAbsolute <- viewProjectionAbsolute
171- env.ViewProjectionRelative <- viewProjectionRelative
172- env.ViewProjectionClip <- viewProjectionClip
172+ env.ViewProjection2dAbsolute <- viewProjection2dAbsolute
173+ env.ViewProjection2dRelative <- viewProjection2dRelative
174+ env.ViewProjectionClipAbsolute <- viewProjectionClipAbsolute
175+ env.ViewProjectionClipRelative <- viewProjectionClipRelative
173176 BeginSpriteBatch SpriteBatchState.defaultState env
174177
175178 /// End the current sprite batch frame, if any.
@@ -239,7 +242,9 @@ module SpriteBatch =
239242 Hl.Assert ()
240243
241244 // create env
242- { SpriteIndex = 0 ; ViewProjectionAbsolute = m4Identity; ViewProjectionRelative = m4Identity; ViewProjectionClip = m4Identity
245+ { SpriteIndex = 0
246+ ViewProjection2dAbsolute = m4Identity; ViewProjection2dRelative = m4Identity
247+ ViewProjectionClipAbsolute = m4Identity; ViewProjectionClipRelative = m4Identity
243248 PerimetersUniform = perimetersUniform; PivotsUniform = pivotsUniform; RotationsUniform = rotationsUniform
244249 TexCoordsesUniform = texCoordsesUniform; ColorsUniform = colorsUniform; ViewProjectionUniform = viewProjectionUniform
245250 TexUniform = texUniform; Shader = shader
0 commit comments