mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-06 08:38:30 +09:00
wip2
This commit is contained in:
@@ -140,14 +140,14 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
UV mapping coord.y
|
UV mapping coord.y
|
||||||
|
|
||||||
-+ <- 1.0 =
|
-+ <- 1.0 =
|
||||||
D| = // parallax of +1
|
D| = // parallax of -1
|
||||||
i| = =
|
i| = =
|
||||||
s| = // parallax of 0
|
s| = // parallax of 0
|
||||||
p| = =
|
p| = =
|
||||||
.| = // parallax of -1
|
.| = // parallax of +1
|
||||||
-+ <- 0.0 =
|
-+ <- 0.0 =
|
||||||
*/
|
*/
|
||||||
val parallax = ((parallaxZeroPos - WorldCamera.gdxCamY.div(CreateTileAtlas.TILE_SIZE.toFloat())) / parallaxDomainSize).coerceIn(-1f, 1f)
|
val parallax = -((parallaxZeroPos - WorldCamera.gdxCamY.div(CreateTileAtlas.TILE_SIZE.toFloat())) / parallaxDomainSize).coerceIn(-1f, 1f)
|
||||||
val parallaxSize = 1f / 3f
|
val parallaxSize = 1f / 3f
|
||||||
|
|
||||||
// draw skybox to provided graphics instance
|
// draw skybox to provided graphics instance
|
||||||
@@ -155,6 +155,8 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
val colBottommost = getGradientColour(world, skyboxColourMap, 1, timeNow).toGdxColor()
|
val colBottommost = getGradientColour(world, skyboxColourMap, 1, timeNow).toGdxColor()
|
||||||
val colMid = colorMix(colTopmost, colBottommost, 0.5f)
|
val colMid = colorMix(colTopmost, colBottommost, 0.5f)
|
||||||
|
|
||||||
|
//println(parallax) // parallax value works as intended.
|
||||||
|
|
||||||
val colTop = colorMix(colTopmost, colBottommost, (parallax + parallaxSize / 2f) * 2f - 1f)
|
val colTop = colorMix(colTopmost, colBottommost, (parallax + parallaxSize / 2f) * 2f - 1f)
|
||||||
val colBottom = colorMix(colTopmost, colBottommost, (parallax - parallaxSize / 2f) * 2f - 1f)
|
val colBottom = colorMix(colTopmost, colBottommost, (parallax - parallaxSize / 2f) * 2f - 1f)
|
||||||
|
|
||||||
@@ -169,11 +171,11 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
skyboxPixmap.setColor(colBottom)
|
skyboxPixmap.setColor(colBottom)
|
||||||
skyboxPixmap.drawPixel(0, 1); skyboxPixmap.drawPixel(1, 1)
|
skyboxPixmap.drawPixel(0, 1); skyboxPixmap.drawPixel(1, 1)
|
||||||
skyboxTexture.dispose()
|
skyboxTexture.dispose()
|
||||||
skyboxTexture = Texture(skyboxPixmap)
|
skyboxTexture = Texture(skyboxPixmap); skyboxTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||||
|
|
||||||
batch.shader = IngameRenderer.shaderBayer
|
batch.shader = IngameRenderer.shaderBayer
|
||||||
batch.inUse {
|
batch.inUse {
|
||||||
it.draw(skyboxTexture, 0f, 0f, AppLoader.screenWf, AppLoader.screenHf)
|
it.draw(skyboxTexture, 0f, -AppLoader.halfScreenHf, AppLoader.screenWf, AppLoader.screenHf * 2f) // because of how the linear filter works, we extend the image by two
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't use shader to just fill the whole screen... frag shader will be called a million times and it's best to not burden it
|
// don't use shader to just fill the whole screen... frag shader will be called a million times and it's best to not burden it
|
||||||
|
|||||||
Reference in New Issue
Block a user