Skip to content

Commit 90c92a1

Browse files
committed
No vertex caching for custom static esp
1 parent 6000a84 commit 90c92a1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

common/src/main/kotlin/com/lambda/graphics/renderer/esp/global/StaticESP.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com.lambda.event.listener.SafeListener.Companion.listener
77
import com.lambda.graphics.buffer.vao.vertex.BufferUsage
88
import com.lambda.graphics.renderer.esp.impl.StaticESPRenderer
99

10-
object StaticESP : StaticESPRenderer(BufferUsage.DYNAMIC) {
10+
object StaticESP : StaticESPRenderer(BufferUsage.DYNAMIC, false) {
1111
init {
1212
listener<TickEvent.Post> {
1313
clear()

common/src/main/kotlin/com/lambda/graphics/renderer/esp/impl/StaticESPRenderer.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import java.awt.Color
66
import java.util.concurrent.ConcurrentHashMap
77

88
open class StaticESPRenderer(
9-
usage: BufferUsage = BufferUsage.STATIC
9+
usage: BufferUsage = BufferUsage.STATIC,
10+
private val useVertexCaching: Boolean = true,
1011
) : ESPRenderer(usage, false) {
1112
val faceVertices = ConcurrentHashMap<Vertex, Int>()
1213
val outlineVertices = ConcurrentHashMap<Vertex, Int>()
@@ -37,9 +38,10 @@ open class StaticESPRenderer(
3738
x: Double, y: Double, z: Double,
3839
color: Color
3940
) = lazy {
40-
storage.getOrPut(Vertex(x, y, z, color)) {
41-
vec3(x, y, z).color(color).end()
42-
}
41+
val vtx = { vec3(x, y, z).color(color).end() }
42+
if (!useVertexCaching) return@lazy vtx()
43+
44+
storage.getOrPut(Vertex(x, y, z, color), vtx)
4345
}
4446

4547
data class Vertex(val x: Double, val y: Double, val z: Double, val color: Color)

0 commit comments

Comments
 (0)