use mln_gfx::gfx_types::AttributeDataType::{Float, Short4};
use mln_gfx::shaders::program::{Attribute, Program, ProgramBuffer, ProgramTexture, Projection, Stages, Variants};
use mln_gfx::shaders::source::Sources;
use super::ubo::{HillshadeEvaluatedPropsUBO, HillshadeTilePropsUBO, TerrainDrawableUBO, TerrainSurfaceUBO};
use super::{glsl, glsl_es, msl, wgsl};
pub const GROUND_HEIGHT: Attribute = Attribute::new("ground_height", Float).only_in(Variants::Standing);
pub const GROUND_DEPTH: ProgramTexture =
ProgramTexture::texels("ground_depth", Stages::Vertex).only_in(Variants::Standing);
pub const GROUND_DEM: ProgramTexture = ProgramTexture::texels("ground_dem", Stages::Vertex);
const TERRAIN_DRAWABLE: ProgramBuffer = ProgramBuffer::storage::<TerrainDrawableUBO>("drawableVector", Stages::Vertex);
pub const TERRAIN_SURFACE: ProgramBuffer = ProgramBuffer::uniform::<TerrainSurfaceUBO>("terrain", 0, Stages::Vertex);
pub static TERRAIN: Program = Program {
name: "TerrainShader",
buffers: &[
TERRAIN_DRAWABLE,
ProgramBuffer::storage::<HillshadeTilePropsUBO>("lightVector", Stages::Fragment),
ProgramBuffer { stages: Stages::Both, ..TERRAIN_SURFACE },
ProgramBuffer::uniform::<HillshadeEvaluatedPropsUBO>("props", 1, Stages::Fragment),
],
paint_params: None,
projection: Projection::PerDraw,
attributes: &[Attribute::new("pos", Short4)],
instance_attributes: &[],
textures: &[ProgramTexture::UNUSED, ProgramTexture::new("drape", Stages::Fragment), GROUND_DEM],
properties: &[],
sources: Sources::NONE.wgsl(&wgsl::TERRAIN).msl(&msl::TERRAIN).glsl(&glsl::TERRAIN).glsl_es(&glsl_es::TERRAIN),
};
pub static TERRAIN_DEPTH: Program = Program {
name: "TerrainDepthShader",
buffers: &[TERRAIN_DRAWABLE, TERRAIN_SURFACE],
paint_params: None,
projection: Projection::PerDraw,
attributes: &[Attribute::new("pos", Short4)],
instance_attributes: &[],
textures: &[ProgramTexture::UNUSED, ProgramTexture::UNUSED, GROUND_DEM],
properties: &[],
sources: Sources::NONE
.wgsl(&wgsl::TERRAIN_DEPTH)
.msl(&msl::TERRAIN_DEPTH)
.glsl(&glsl::TERRAIN_DEPTH)
.glsl_es(&glsl_es::TERRAIN_DEPTH),
};