Sprite sheets, atlases, game UI, time of day, weather presets, headless captures
- BillboardInstance: per-instance uv sub-rect, feet anchor, turn, dithered alpha, flash; BillboardBatch::sharedTexture; Texture createEmpty/update/cellUV/cellAnchor/nearest - SpriteAtlas: fixed-cell runtime atlas with gutters - hd2d::ui: Octopath-style panels, fonts (Cinzel, EB Garamond), dialogue box with typewriter + portraits + choices, menus, nameplates, toasts, ImGui theme - DayCycle (dawn/day/dusk/night keyframes, sun + moon arcs), Weather overcast/mist/ lightning, night-aware presets, stars and moon in the sky - Hidden-window offscreen captures (Window visible=false, Renderer output FBO, OffscreenTarget); --screenshot never opens a window - Camera::worldToScreen; CMake usable via add_subdirectory (HD2D_BUILD_DEMO, HD2D_ENGINE_ASSET_DIR)
This commit is contained in:
@@ -8,6 +8,7 @@ in VS {
|
||||
vec3 pivot;
|
||||
vec2 local;
|
||||
float tint;
|
||||
flat vec2 fx; // alpha, flash
|
||||
} v;
|
||||
|
||||
layout(binding = 0) uniform sampler2D uTex;
|
||||
@@ -15,10 +16,19 @@ uniform int uPass;
|
||||
uniform float uEmissive;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
const float kFlashWhite = 4.0; // linear HDR white the flash blends toward (blooms)
|
||||
|
||||
// 4x4 ordered (Bayer) threshold in (0, 1): alpha 1 keeps every pixel, 0 none.
|
||||
float bayer4(vec2 p) {
|
||||
ivec2 i = ivec2(p) & 3;
|
||||
const float m[16] = float[](0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5);
|
||||
return (m[i.y * 4 + i.x] + 0.5) / 16.0;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 c = sharpSample(uTex, v.uv);
|
||||
if (c.a < 0.5) discard;
|
||||
if (v.fx.x < 1.0 && v.fx.x < bayer4(gl_FragCoord.xy)) discard; // dithered fade, shadows included
|
||||
if (uPass == 1) return;
|
||||
|
||||
vec3 up = vec3(0.0, 1.0, 0.0);
|
||||
@@ -48,5 +58,6 @@ void main() {
|
||||
float d = length(v.pivot.xz - uBlob.xz) / uBlob.w;
|
||||
col *= 1.0 - 0.35 * (1.0 - smoothstep(0.3, 1.0, d)) * (1.0 - clamp(v.local.y / 0.6, 0.0, 1.0));
|
||||
}
|
||||
col = mix(col, vec3(kFlashWhite), clamp(v.fx.y, 0.0, 1.0)); // hit / capture flash
|
||||
fragColor = vec4(col, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user