Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRawAPIShaderData ¶
GetRawAPIShaderData fetches the JSON data for a given Shadertoy ID. It sends a POST request to the Shadertoy API endpoint with specific browser-like headers and returns the raw JSON string response.
Types ¶
type BufferRenderPass ¶
type BufferRenderPass struct {
Code string
Inputs []*ShadertoyChannel
BufferIdx string
Name string
}
BufferRenderPass represents a processed buffer pass.
type RenderPass ¶
type Shader ¶
type Shader struct {
Info ShaderInfo `json:"info"`
RenderPass []RenderPass `json:"renderpass"`
}
type ShaderArgs ¶
type ShaderArgs struct {
// ShaderCode string
CommonCode string
// Inputs []*ShadertoyChannel
Buffers map[string]*BufferRenderPass
Title string
Complete bool
}
ShaderArgs holds the final, processed arguments for a Shadertoy implementation.
func ShaderArgsFromJSON ¶
func ShaderArgsFromJSON(shaderData *ShadertoyResponse, useCache bool) (*ShaderArgs, error)
ShaderArgsFromJSON builds the final ShaderArgs from the raw API response.
type ShaderInfo ¶
type ShaderPasses ¶
type ShaderPasses map[string]*ShaderArgs
type ShadertoyChannel ¶
type ShadertoyChannel struct {
CType string
Channel int
Sampler Sampler
Data image.Image // For textures
Volume *VolumeData // For 3D volume textures
CubeData [6]image.Image // For cubemaps
BufferRef string // Buffer name that will be attached to this input channel
MusicFile string // For audio input channels
}
ShadertoyChannel represents a generic input channel.
type ShadertoyResponse ¶
type ShadertoyResponse struct {
Shader *Shader `json:"Shader"`
Error string `json:"Error,omitempty"`
IsAPI bool `json:"isAPI,omitempty"` // Indicates if this is an API response
}
func ShaderFromID ¶
func ShaderFromID(apikey string, idOrURL string, useCache bool) (*ShadertoyResponse, error)
ShaderFromID fetches a shader's JSON data from Shadertoy.com by its ID.
Click to show internal directories.
Click to hide internal directories.