Documentation
¶
Overview ¶
Package tools exposes shader editing, parameter tuning and image previews.
Index ¶
- Constants
- func Register(s *State, vision bool, servers ...*wgslls.Service) (*ds4.ToolRegistry, error)
- func Registry(servers ...*wgslls.Service) map[string]Handler
- func Schemas() []ds4.ToolSchema
- type Handler
- type Performance
- type Renderer
- type Snapshot
- type State
- func (s *State) Checkpoint() error
- func (s *State) Clock(t, dt float32, frame uint32, fps float64)
- func (s *State) Load(path string) error
- func (s *State) Nudge(index, steps int) error
- func (s *State) Randomize()
- func (s *State) RecordPerformance(p Performance)
- func (s *State) Render(snap Snapshot, w, h int) (*image.NRGBA, error)
- func (s *State) Replace(src shader.Source, values map[string]float32, revision uint64) error
- func (s *State) Save(path string) error
- func (s *State) Set(name string, value float32) (float32, error)
- func (s *State) SetArchive(save func(params.Preset) error)
- func (s *State) Snapshot() Snapshot
- func (s *State) Viewport(w, h int)
Constants ¶
View Source
const SystemPrompt = `` /* 3438-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func Schemas ¶
func Schemas() []ds4.ToolSchema
Types ¶
type Handler ¶
type Handler func(context.Context, *State, json.RawMessage) (ds4.ToolResult, error)
type Performance ¶
type Performance struct {
RenderMS float64 `json:"render_ms"`
EncodeMS float64 `json:"encode_ms"`
UploadBytes int `json:"upload_bytes"`
SampledAt int64 `json:"sampled_at"`
Kitty bool `json:"kitty"`
// Transport is what the last Kitty frame actually used: png, rgba, or shm.
// With shm, UploadBytes is only the reference written to the terminal.
Transport string `json:"transport,omitempty"`
}
Performance records wall times, not GPU timestamps or terminal display latency.
type Snapshot ¶
type Snapshot struct {
Source shader.Source `json:"source"`
Values [16]float32 `json:"-"`
Named map[string]float32 `json:"values"`
Time float32 `json:"time"`
Dt float32 `json:"dt"`
Frame uint32 `json:"frame"`
FPS float64 `json:"fps"`
Width int `json:"width"`
Height int `json:"height"`
Revision uint64 `json:"-"`
Performance Performance `json:"performance"`
}
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) Checkpoint ¶
Checkpoint records current controls as well as source, for gallery browsing and clean shutdown. Shader replacements themselves save synchronously.
func (*State) RecordPerformance ¶
func (s *State) RecordPerformance(p Performance)
func (*State) Replace ¶
Replace compiles before committing. A failed compile never changes live state. Concurrent edits supersede the pending replacement instead of being lost. Identical source and effective values skip compilation, history and revision changes.
func (*State) SetArchive ¶
SetArchive enables durable history for subsequent successful replacements. The callback must not call back into State.
Click to show internal directories.
Click to hide internal directories.