Backdrop improvements...

Un-mirrored texture mapping
Added dynamic texture size based on the height of the backdrop texture
Backdrop color matches the daytime now
This commit is contained in:
JappaWakka 2023-03-26 19:40:25 +02:00
parent b2f6c98f8e
commit 779fda3885

View File

@ -93,8 +93,8 @@
_shader = Content.Load(Of Effect)("Effects\BackdropShader") _shader = Content.Load(Of Effect)("Effects\BackdropShader")
_vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(0, 0, 0), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(0, 0))) _vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(0, 0, 0), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(0, 0)))
_vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(Width, 0, 0), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(0, 1))) _vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(Width, 0, 0), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(1, 0)))
_vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(0, 0, Height), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(1, 0))) _vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(0, 0, Height), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(0, 1)))
_vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(Width, 0, Height), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(1, 1))) _vertices.Add(New VertexPositionNormalTangentTexture(New Vector3(Width, 0, Height), New Vector3(-1, 0, 0), New Vector3(0, 1, 0), New Vector2(1, 1)))
Me._position = Position Me._position = Position
@ -107,7 +107,8 @@
Select Case BackdropType.ToLower() Select Case BackdropType.ToLower()
Case "water" Case "water"
Me._backdropType = BackdropTypes.Water Me._backdropType = BackdropTypes.Water
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Backdrops\Water"), 1, 3, 64, 64, Water.WaterSpeed, 0, 0) Dim WaterSize As Integer = CInt(TextureManager.GetTexture("Textures\Backdrops\Water").Height)
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Backdrops\Water"), 1, 3, WaterSize, WaterSize, Water.WaterSpeed, 0, 0)
_backdropTexture = TextureManager.GetTexture("Textures\Backdrops\Water", WaterAnimation.TextureRectangle, "") _backdropTexture = TextureManager.GetTexture("Textures\Backdrops\Water", WaterAnimation.TextureRectangle, "")
Case "grass" Case "grass"
Me._backdropType = BackdropTypes.Grass Me._backdropType = BackdropTypes.Grass
@ -131,20 +132,21 @@
End If End If
Case BackdropTypes.Grass Case BackdropTypes.Grass
If Me._setTexture = False Then If Me._setTexture = False Then
Dim GrassSize As Integer = CInt(TextureManager.GetTexture("Backdrops\Grass").Height)
Dim x As Integer = 0 Dim x As Integer = 0
Select Case World.CurrentSeason Select Case World.CurrentSeason
Case World.Seasons.Winter Case World.Seasons.Winter
x = 0 x = 0
Case World.Seasons.Spring Case World.Seasons.Spring
x = 16 x = GrassSize
Case World.Seasons.Summer Case World.Seasons.Summer
x = 32 x = GrassSize * 2
Case World.Seasons.Fall Case World.Seasons.Fall
x = 48 x = GrassSize * 3
End Select End Select
_backdropTexture = TextureManager.GetTexture("Backdrops\Grass", New Rectangle(x, 0, 16, 16)) _backdropTexture = TextureManager.GetTexture("Backdrops\Grass", New Rectangle(x, 0, GrassSize, GrassSize))
Me._setTexture = True Me._setTexture = True
End If End If
End Select End Select
@ -186,11 +188,11 @@
Case P3D.World.EnvironmentTypes.Outside Case P3D.World.EnvironmentTypes.Outside
dayColor = SkyDome.GetDaytimeColor(True).ToVector3() dayColor = SkyDome.GetDaytimeColor(True).ToVector3()
Case P3D.World.EnvironmentTypes.Dark Case P3D.World.EnvironmentTypes.Dark
dayColor = New Vector3(0.5F, 0.5F, 0.6F) dayColor = New Vector3(0.5F, 0.5F, 0.5F)
End Select End Select
End If End If
Return (dayColor * diffuseColor).ToColor().ToVector4() Return (dayColor * diffuseColor * Lighting.GetEnvironmentColor(1)).ToColor().ToVector4()
End Function End Function
End Class End Class