This commit is contained in:
parent
bdea14fc20
commit
fb2f6079cc
16 changed files with 508 additions and 9 deletions
|
|
@ -19,10 +19,23 @@ export namespace Catcrafts {
|
|||
std::string content;
|
||||
};
|
||||
std::vector<BlogPost> posts {
|
||||
{
|
||||
"Hello World! 2?",
|
||||
"hello-world-2",
|
||||
"2026-07-18",
|
||||
R"(So this blog has been mega dead but today i bring something exciting that was already released months ago but never deployed xd.
|
||||
|
||||
Crafter.CppDOM is dead, long live Crafter.Graphics!
|
||||
|
||||
This website is now updated to use the new Crafter.Graphics library, which allow for C++ manpiulation of the DOM, and as a new feature WebGPU!
|
||||
|
||||
And what better way to flex WebGPU than ray tracing? Here's a little scene traced live in your browser, shadows and all, straight from the same C++ compiled to WASM that rendered this very post:
|
||||
)"
|
||||
},
|
||||
{
|
||||
"In WASM, Exit doesn't mean done.",
|
||||
"in-wasm-exit-doesnt-mean-done",
|
||||
"2026-11-14",
|
||||
"2025-11-14",
|
||||
R"(So if anyone looked at the source code for this website pefore this post you would have seen that everything was allocated with new, for example this very blog was defined as <code>std::vector<BlogPost> posts = new std::vector<BlogPost>{...};</code><br><br>
|
||||
|
||||
Reason for this was that everything became corrupted when callbacking from JS, not knowing sure as to why this was the fastest solution, but after debugging the problem became clear.<br><br>
|
||||
|
|
@ -40,7 +53,7 @@ export namespace Catcrafts {
|
|||
{
|
||||
"Hello World!",
|
||||
"hello-world",
|
||||
"2026-11-12",
|
||||
"2025-11-12",
|
||||
R"(Welcome to catcrafts.net!<br><br>
|
||||
Here we believe optimization is everything and C++ is a gift from god.<br>
|
||||
This blog will mostly be dedicated to random tidbits i come across while working on my Crafter series of libraries.<br><br>
|
||||
|
|
|
|||
36
interfaces/Catcrafts-Demo.cppm
Normal file
36
interfaces/Catcrafts-Demo.cppm
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
catcrafts.net
|
||||
Copyright (C) 2026 Catcrafts
|
||||
|
||||
The source code of this website is made available for viewing purposes only.
|
||||
No permission is granted to copy, modify, distribute, or create derivative works.
|
||||
*/
|
||||
|
||||
export module Catcrafts:Demo;
|
||||
import Crafter.Graphics;
|
||||
import std;
|
||||
using namespace Crafter;
|
||||
|
||||
export namespace Catcrafts {
|
||||
// DOM element id that the ray-traced WebGPU demo renders into. The
|
||||
// blog post embeds a <div> with this id; MountDemo() reparents the
|
||||
// Crafter.Graphics render canvas into it via WebGPU::SetCanvasMount.
|
||||
inline constexpr std::string_view kDemoMountId = "webgpu-demo";
|
||||
|
||||
// Build the ray-tracing pipeline + scene once and start the render
|
||||
// loop plumbing. Runs the window's StartInit()/FinishInit(), so call
|
||||
// it from main() right after the Window is constructed and before the
|
||||
// page chrome / routes are built. The canvas starts detached + hidden;
|
||||
// nothing is traced until MountDemo() is called.
|
||||
void SetupDemo(Window& window);
|
||||
|
||||
// Reparent the render canvas into #webgpu-demo and begin tracing. Call
|
||||
// only after the element exists in the DOM (i.e. right after the post's
|
||||
// innerHTML has been set). Idempotent.
|
||||
void MountDemo();
|
||||
|
||||
// Stop tracing and detach + hide the canvas, leaving a plain DOM page.
|
||||
// Call before any route re-render that would replace #webgpu-demo.
|
||||
// Safe to call when the demo is not mounted.
|
||||
void UnmountDemo();
|
||||
}
|
||||
|
|
@ -9,4 +9,5 @@ No permission is granted to copy, modify, distribute, or create derivative works
|
|||
export module Catcrafts;
|
||||
export import :Views;
|
||||
export import :Blog;
|
||||
export import :Root;
|
||||
export import :Root;
|
||||
export import :Demo;
|
||||
Loading…
Reference in a new issue