class CrShader::ShaderBuilder

Overview

============================================================================= ShaderBuilder - Programmatic Crystal Shader Constructor & Procedural Mutator

Defined in:

crshader/builder/shader_builder.cr
crshader_resource.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(shader_type : Symbol | String = :spatial) #

Instance Method Detail

def access(*buffers : Symbol | String) : self #

def add_color_tint(name : Symbol | String = :tint_color, hex : String = "#ffffff") : self #

Procedural Mutators


def add_dissolve(prefix : Symbol | String | Nil = nil) : self #

def add_rim_glow(prefix : Symbol | String | Nil = nil) : self #

def add_uv_warp(freq : Float32 = 8.0_f32, amp : Float32 = 0.02_f32) : self #

def append_fragment(code : String) : self #

def append_light(code : String) : self #

def append_pixel(code : String) : self #

def append_vertex(code : String) : self #

def compile(target : ShaderTarget | Nil = nil, cache : VariantCache = VariantCache.global) : String #

def compositor_access : Array(String) #

def compositor_access=(compositor_access : Array(String)) #

def compositor_stage : String #

def compositor_stage=(compositor_stage : String) #

def curve(name : Symbol | String, points, interp : Symbol | String = :smooth) : self #

def declaration_lines : Array(String) #

def declaration_lines=(declaration_lines : Array(String)) #

def feature(name : Symbol | String, default : FeatureValue = true, options : Array(Symbol | String) | Nil = nil) : self #

def feature_overrides : Hash(String, FeatureValue) #

def feature_overrides=(feature_overrides : Hash(String, FeatureValue)) #

def fork : ShaderBuilder #

Deep-clones this builder for zero-mutation branching / specialization


def fork(&block : ShaderBuilder -> ) : ShaderBuilder #

def fragment(code : String) : self #

def fragment_chunks : Array(String) #

def fragment_chunks=(fragment_chunks : Array(String)) #

def function(name : Symbol | String, params : String, return_type : Symbol | String, body : String) : self #

def gradient(name : Symbol | String, stops, space : Symbol | String = :oklab, interp : Symbol | String = :linear) : self #

def helper_defs : Array(String) #

def helper_defs=(helper_defs : Array(String)) #

def inspect_var(label : Symbol | String, expr : String | Nil = nil) : self #

def light(code : String) : self #

def light_chunks : Array(String) #

def light_chunks=(light_chunks : Array(String)) #

def pixel_chunks : Array(String) #

def pixel_chunks=(pixel_chunks : Array(String)) #

def process_pixel(code : String) : self #

def property(name : Symbol | String, type_name : Symbol | String, default : String | Nil = nil, hint : Symbol | String | Nil = nil, range : ::Range(Float64, Float64) | ::Range(Float32, Float32) | Nil = nil, group : String | Nil = nil) : self #

def release(enabled : Bool = true) : self #

def render_mode(*modes : Symbol | String) : self #

def render_modes : Array(String) #

def render_modes=(render_modes : Array(String)) #

def require_lib(*libs : String) : self #

def requires : Array(String) #

def requires=(requires : Array(String)) #

def sampler(name : Symbol | String, filter : Symbol | String | Nil = nil, repeat : Symbol | String | Nil = nil, hint : Symbol | String | Nil = nil) : self #

def set_feature(name : Symbol | String, value : FeatureValue) : self #

def shader_type_kind : String #

def strip_debug_inspects : Bool #

def strip_debug_inspects=(strip_debug_inspects : Bool) #

def to_crshader : String #

def to_godot_shader(cache : VariantCache = VariantCache.global) : Godot::Shader | Nil #

def traits : Array(TraitUse) #

def traits=(traits : Array(TraitUse)) #

def uniform(name : Symbol | String, type_name : Symbol | String, default : String | Nil = nil, hint : Symbol | String | Nil = nil, range : ::Range(Float64, Float64) | ::Range(Float32, Float32) | Nil = nil, group : String | Nil = nil) : self #

def use_trait(path_or_name : Symbol | String, prefix : Symbol | String | Nil = nil) : self #

def varying(name : Symbol | String, type_name : Symbol | String, qualifier : Symbol | String | Nil = nil) : self #

def vertex(code : String) : self #

def vertex_chunks : Array(String) #

def vertex_chunks=(vertex_chunks : Array(String)) #