surface

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heightfield

type Heightfield struct {
	Res int
	Z   []float64
}

Heightfield is the res×res grid of z values — the pure output of the math, row-major, x fastest.

type Markdown

type Markdown string

func (Markdown) Render

func (m Markdown) Render() Rendered

type Rendered

type Rendered struct{ MIME, Data string }

type Scene

type Scene struct {
	Field Heightfield
}

Scene wraps a heightfield and renders it to a WebGL canvas.

func (Scene) Render

func (s Scene) Render() Rendered

Render emits the text/html the client injects: a <canvas> and an <img onerror> that bootstraps WebGL. The heightfield rides in a data- attribute as a JSON array; the handler reads it, builds a triangle mesh, and animates a rotating, height-shaded draw. The Go side never touches a pixel; the JS never touches the math. That the JS lives in a string here — not in a .js file, not importable, not typechecked — is the honest cost of the escape hatch, and why it's quarantined to this one cell.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL