rusting_engine 2.7.0

Vulkan 3D game engine with GPU-accelerated physics for massive physics-heavy scenes
// Rusting shader language, version 1: the built-ins a `#rusting surface 1`
// shader sees. Fields are only ever added at the end, and a change that
// would break a version 1 shader bumps RUSTING_SHADER_VERSION.
#define RUSTING_SHADER_VERSION 1
// Surface.subsurface exists.
#define RUSTING_SURFACE_SUBSURFACE 1
// What the engine knows about the pixel before the shader runs.
struct SurfaceInput {
    // Texture coordinates after the material's uv_scale and uv_offset.
    vec2 uv;
    vec3 world_position;
    // Unit vector from the surface toward the camera.
    vec3 view_direction;
    // Vertex color times the material and per-object color.
    vec4 vertex_color;
    // Seconds since the game started.
    float time;
    // Bits 0-15 of the mesh vertex `data`: a block id.
    uint block_id;
    // The RUSTING_FLAG_* bits of the mesh vertex `data`, not shifted.
    uint flags;
    // The vertex tangent in world space (w: the bitangent's handedness),
    // interpolated. A mesh drawn without a normal map may carry its own
    // per-vertex data here, such as baked light.
    vec4 tangent;
};
// SurfaceInput.tangent exists.
#define RUSTING_SURFACE_TANGENT 1
// The surface the engine lights. It starts as the material's own values,
// textures applied; the shader may change any of them.
struct Surface {
    // Linear RGB and alpha; alpha drives Mask and Blend.
    vec4 base_color;
    // World-space normal; the engine normalizes it after the shader.
    vec3 normal;
    float metallic;
    float roughness;
    // Light given off, linear RGB.
    vec3 emissive;
    // Thin-surface transmission: rgb is the linear tint of directional
    // light let through from behind (0, the default, is off), a the
    // thickness in metres the shadow is looked up past the surface.
    vec4 subsurface;
};
#ifndef RUSTING_CUSTOM_SURFACE
void surface(SurfaceInput i, inout Surface s) {}
#endif