All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.earth.worldwind.layer.ShowTessellationLayer.kt Maven / Gradle / Ivy

Go to download

The WorldWind Kotlin SDK (WWK) includes the library, examples and tutorials for building multiplatform 3D virtual globe applications for Android, Web and Java.

The newest version!
package earth.worldwind.layer

import earth.worldwind.draw.DrawableTessellation
import earth.worldwind.render.Color
import earth.worldwind.render.RenderContext
import earth.worldwind.render.program.BasicShaderProgram

class ShowTessellationLayer: AbstractLayer("Terrain Tessellation") {
    override var isPickEnabled = false
    var color = Color()
        set(value) {
            field.copy(value)
        }

    override fun doRender(rc: RenderContext) {
        if (rc.terrain.sector.isEmpty) return  // no terrain to render

        // Use WorldWind's basic GLSL program.
        val program = rc.getShaderProgram { BasicShaderProgram() }
        val pool = rc.getDrawablePool()
        val drawable = DrawableTessellation.obtain(pool).set(program, color, opacity)
        rc.offerSurfaceDrawable(drawable, 1.0 /*z-order after surface textures*/)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy