- 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)
37 lines
1.3 KiB
C++
37 lines
1.3 KiB
C++
#pragma once
|
|
#include "hd2d/GL.h"
|
|
#include "hd2d/RenderTarget.h"
|
|
|
|
#include <string>
|
|
|
|
namespace hd2d {
|
|
|
|
// Writes color attachment 0 of `fbo` as PNG; `fbo` = 0 reads the window's
|
|
// backbuffer (call before swapBuffers).
|
|
bool saveScreenshot(const std::string& path, int width, int height, GLuint fbo = 0);
|
|
|
|
// Window-independent render output for headless captures. Color is plain
|
|
// RGBA8 (not sRGB) plus a depth/stencil buffer, matching the default
|
|
// framebuffer, so captures are pixel-identical to on-screen frames.
|
|
//
|
|
// hd2d::Window window; window.create(w, h, "capture", false, false, /*visible*/ false);
|
|
// hd2d::OffscreenTarget out; out.create(window.width(), window.height());
|
|
// renderer.setOutputFramebuffer(out.fbo());
|
|
// renderer.render(scene, cam, time); // + any ImGui / UI drawing
|
|
// out.save("shot.png");
|
|
class OffscreenTarget {
|
|
public:
|
|
bool create(int width, int height);
|
|
void resize(int width, int height); // reallocates only when the size changes
|
|
GLuint fbo() const { return target_.fbo(); }
|
|
GLuint color() const { return target_.color(); }
|
|
int width() const { return target_.width(); }
|
|
int height() const { return target_.height(); }
|
|
bool save(const std::string& path) const { return saveScreenshot(path, width(), height(), fbo()); }
|
|
|
|
private:
|
|
RenderTarget target_;
|
|
};
|
|
|
|
} // namespace hd2d
|