diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/client/ClientWorld.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/client/ClientWorld.kt index ce60e2ea..6d23b83d 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/client/ClientWorld.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/client/ClientWorld.kt @@ -117,29 +117,29 @@ class ClientWorld( val determineRenderers = ArrayList() - client.lightRenderer.begin() + //client.lightRenderer.begin() for (chunk in collectPositionAware(size.encasingChunkPosAABB())) { val renderer = chunk.second.OneShotRenderer(chunk.first) determineRenderers.add(renderer) chunk.second.bake() - client.lightRenderer.addShadowGeometry(renderer) + //client.lightRenderer.addShadowGeometry(renderer) } renderLayeredList(client.gl.matrixStack, determineRenderers) - for ((lightPosition, color) in listOf( + /*for ((lightPosition, color) in listOf( (client.screenToWorld(client.mouseCoordinatesF)) to Color.RED, (client.screenToWorld(client.mouseCoordinatesF) + Vector2f(0.1f)) to Color.GREEN, (client.screenToWorld(client.mouseCoordinatesF) + Vector2f(-0.1f)) to Color.BLUE, )) { if (isScreenspaceRender) { - val (x, y) = client.worldToScreen(lightPosition.x - 20f, lightPosition.y - 20f) - val (x2, y2) = client.worldToScreen(lightPosition.x + 20f, lightPosition.y + 20f) + val (x, y) = client.worldToScreen(lightPosition.x - 64f, lightPosition.y - 64f) + val (x2, y2) = client.worldToScreen(lightPosition.x + 64f, lightPosition.y + 64f) client.pushScissorRect(x, client.viewportHeight - y, x2 - x, y - y2) } - //client.lightRenderer.renderSoftLight(lightPosition, color, radius = 20f, innerRadius = 1f) + client.lightRenderer.renderSoftLight(lightPosition, color, radius = 64f, innerRadius = 2f) if (isScreenspaceRender) { client.popScissorRect() @@ -149,12 +149,12 @@ class ClientWorld( val old = client.gl.blendFunc client.gl.blendFunc = BlendFunc.MULTIPLY_BY_SRC - // client.gl.activeTexture = 0 - // client.gl.texture2D = client.lightRenderer.outputTexture - // client.gl.programs.textureQuad.run() + client.gl.activeTexture = 0 + client.gl.texture2D = client.lightRenderer.outputTexture + client.gl.programs.viewTextureQuad.run() client.gl.blendFunc = old - +*/ val pos = client.screenToWorld(client.mouseCoordinatesF).toDoubleVector() /*val lightsize = 16 @@ -197,6 +197,9 @@ class ClientWorld( } */ + //rayLightCircleNaive(pos, 48.0, falloffByTravel = 1.0, falloffByTile = 3.0) + + /* val result = rayLightCircleNaive(pos, 48.0, falloffByTravel = 1.0, falloffByTile = 3.0) val result2 = rayLightCircleNaive(pos + Vector2d(-8.0), 24.0, falloffByTravel = 1.0, falloffByTile = 3.0) val frame = GLFrameBuffer(client.gl) @@ -207,7 +210,7 @@ class ClientWorld( client.gl.clearColor = Color.BLACK glClear(GL_COLOR_BUFFER_BIT) - client.gl.blendFunc = BlendFunc.ADDITIVE + client.gl.blendFunc = BlendFunc.ADDITIVE*/ /*client.gl.quadColor { for (row in 0 until result.rows) { @@ -243,7 +246,7 @@ class ClientWorld( } }*/ - val lightTextureWidth = (client.viewportWidth / PIXELS_IN_STARBOUND_UNIT).roundToInt() + /*val lightTextureWidth = (client.viewportWidth / PIXELS_IN_STARBOUND_UNIT).roundToInt() val lightTextureHeight = (client.viewportHeight / PIXELS_IN_STARBOUND_UNIT).roundToInt() val textureBuffer = ByteBuffer.allocateDirect(lightTextureWidth * lightTextureHeight * 3) @@ -261,28 +264,28 @@ class ClientWorld( textureBuffer.put((color * 255).toInt().coerceAtMost(255).toByte()) } } - } + }*/ - frame.unbind() + //frame.unbind() - val texture = GLTexture2D(client.gl) + // val texture = GLTexture2D(client.gl) - textureBuffer.position(0) - texture.upload(GL_RGB, lightTextureWidth, lightTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, textureBuffer) + // textureBuffer.position(0) + // texture.upload(GL_RGB, lightTextureWidth, lightTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, textureBuffer) - texture.textureMinFilter = GL_LINEAR - texture.textureMagFilter = GL_LINEAR + // texture.textureMinFilter = GL_LINEAR + // texture.textureMagFilter = GL_LINEAR - client.gl.blendFunc = BlendFunc.MULTIPLY_BY_SRC + // client.gl.blendFunc = BlendFunc.MULTIPLY_BY_SRC - client.gl.activeTexture = 0 - client.gl.texture2D = texture - client.gl.programs.viewTextureQuad.run() + // client.gl.activeTexture = 0 + // client.gl.texture2D = texture + // client.gl.programs.viewTextureQuad.run() - client.gl.blendFunc = old + // client.gl.blendFunc = old - frame.close() - texture.close() + //frame.close() + //texture.close() physics.debugDraw() diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt index c6a2b047..8331a708 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/World.kt @@ -473,12 +473,12 @@ abstract class World, ChunkType : Chunk