BasicTextureProgram

Lit / unlit textured-mesh program. A single GLSL source carries both the no-shadow (default) and shadow-aware paths, gated by a #define SHADOWS_ENABLED preprocessor symbol that shadowsEnabled toggles. Default BasicTextureProgram() is the smaller-binary no-shadow variant; BasicTextureProgramShadow - selected by get when an earth.worldwind.layer.shadow.ShadowLayer is in the layer list - flips the #define on.

Inheritors

Constructors

Link copied to clipboard
constructor(shadowsEnabled: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Indicates the approximate size of the OpenGL resources referenced by this GPU program.

Link copied to clipboard
open override var shadowUploadStamp: Long

Frame stamp of the last ShadowState whose uniforms were uploaded into this program. GL uniforms are program-state and persist across draw calls, so once a program has been loaded with the current frame's cascades it doesn't need to be loaded again until the cascades change. Implementations declare this as a plain var field, default -1L.

Functions

Link copied to clipboard
fun loadApplyLighting(applyLighting: Boolean)
Link copied to clipboard
fun loadColor(color: Color)
Link copied to clipboard
fun loadIsRenderLine(isRenderLine: Boolean)
Link copied to clipboard
fun loadLightDirection(direction: Vec3)

Loads an eye-space unit vector pointing toward the light source. Callers transform the world-space sun direction by the modelview rotation (see DrawContext.modelviewNormalTransform) before passing it in, so the fragment shader can dot it directly against eye-space normals.

Link copied to clipboard

Loads the model -> world transform for shadow receivers. Dirty-checked: COLLADA / glTF scenes with many sub-meshes sharing the same root world transform see the same matrix on every draw. Drawables only call this when earth.worldwind.draw.DrawContext.shadowState is non-null, so it doesn't run on no-shadow frames at all.

Link copied to clipboard

Loads the specified matrix as the value of this program's 'mvInverseMatrix' uniform variable. Skips the upload when the value matches the cached one - COLLADA / glTF scenes with many sub-meshes sharing the same camera state see the same matrix on every draw, so dirty-checking pays off.

Link copied to clipboard

Loads the specified matrix as the value of this program's 'mvpMatrix' uniform variable. Dirty-checked - same rationale as loadModelviewInverse.

Link copied to clipboard
Link copied to clipboard
fun loadOpacity(opacity: Float)
Link copied to clipboard
open override fun loadShadowDisabled()

Disables shadow sampling. Receivers' fragments fall through to a fixed 1.0 visibility.

Link copied to clipboard
open override fun loadShadowEnabled(state: ShadowState)

Enables shadow sampling and uploads the cascade matrices, split depths, texel sizes, light direction and fade distance from state. Cascade sampler bindings (GL_TEXTURE1..4) are baked in at program init time; the caller is responsible for binding the matching cascade depth textures to those units before invoking this method — applyShadowReceiverUniforms does both in lockstep.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun loadTextureUnit(unit: Int)
Link copied to clipboard
fun loadUpDirection(direction: Vec3)

Loads the eye-space globe-radial up at the camera (hemispheric ambient); callers transform world up by the same modelview rotation as loadLightDirection.

Link copied to clipboard
open override fun release(dc: DrawContext)

Frees any resources associated with this instance. After this method returns the rendering resource is invalid, and any associated GL object is deleted.

Link copied to clipboard