class CrShader::CRShaderCompositorEffect

Overview

============================================================================= CRShaderCompositorEffect - Godot 4.8+ Render Pipeline Compositor Effect Base

Plugs directly into Godot 4's WorldEnvironment / Camera3D Compositor stack. Compiles .crshader or .glsl compute shaders to SPIR-V via RenderingDevice, binds per-view color (rgba16f image2D), depth (sampler2D), Forward+ normal_roughness (sampler2D), and CrShaderSceneData matrices, and packs uniform parameters automatically into std430 push constants or std140 UBOs.

Defined in:

crshader/compositor/compositor_effect_base.cr

Constant Summary

COMPOSITOR_MOUNT_GDSCRIPT = "extends RefCounted\n\nfunc mount_effect(world_env: WorldEnvironment, effect: CompositorEffect) -> void:\n\tif world_env == null or effect == null:\n\t\treturn\n\tif world_env.compositor == null:\n\t\tworld_env.compositor = Compositor.new()\n\tvar list: Array[CompositorEffect] = [effect]\n\tworld_env.compositor.compositor_effects = list\n\nfunc clear_effects(world_env: WorldEnvironment) -> void:\n\tif world_env == null or world_env.compositor == null:\n\t\treturn\n\tvar empty: Array[CompositorEffect] = []\n\tworld_env.compositor.compositor_effects = empty"

Constructors

Class Method Summary

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(&block : self -> ) : self #

def self.new(pointer : Pointer(Void) = Pointer(Void).null) #

Class Method Detail

def self._godot_has_virtual_method(method_name : String) : Bool #

def self._godot_register_node_class : Void #

def self.build_scene_ubo_bytes(scene_data : Godot::RenderSceneData, view : Int64, size : Vector2i, elapsed_sec : Float32) : Bytes #

Packs 272-byte CrShaderSceneData std140 UBO: mat4 INV_PROJECTION_MATRIX, mat4 PROJECTION_MATRIX, mat4 INV_VIEW_MATRIX, mat4 VIEW_MATRIX, vec2 VIEWPORT_SIZE, float TIME, float pad


def self.clear_world_environment(world_env : Godot::Object) : Void #

Clears active CompositorEffect entries on a WorldEnvironment


def self.godot_class_name : String #

def self.godot_parent_class_name : String #

def self.invert_mat4(m : Pointer(Float32), out_inv : Pointer(Float32)) : Void #

Analytical 4x4 column-major matrix inversion (Cramer's rule / cofactors in Float64 precision)


def self.mount_to_world_environment(world_env : Godot::Object, effect : Godot::CompositorEffect) : Void #

Mounts a CompositorEffect onto a WorldEnvironment (auto-creating Compositor if needed)


def self.write_transform_mat4(dst : Pointer(Float32), t : Transform3D) : Void #

Macro Detail

macro autoload(*args, **kwargs) #

DSL directives for in-body autoload configuration


macro autoload_node(*args, **kwargs) #

macro build(**kwargs, &block) #

macro create(**kwargs, &block) #

Instance Method Detail

def _godot_call_tool_button(button_name : String) : Void #
Description copied from class Godot::Object

Dispatches inspector tool button clicks on this object.


def _godot_call_virtual(method_name : String, delta : Float64) : Void #
Description copied from class Godot::Object

Virtual method and property dispatch hooks overridden by class registration macros. Delta timestep is received with 64-bit precision (Float64).


def _godot_call_virtual_with_data(method_name : String, args : Pointer(Pointer(Void)), ret : Pointer(Void)) : Void #
Description copied from class Godot::Object

Dispatches generic virtual methods with raw arguments and return buffer.


def _godot_dispatch_crystal_0(method : String) : Bool #

def _godot_dispatch_crystal_1(method : String, a0 : Godot::Variant) : Bool #

def _godot_dispatch_crystal_2(method : String, a0 : Godot::Variant, a1 : Godot::Variant) : Bool #

def _godot_get_property(prop_name : String, ret_ptr : Pointer(Void)) : Void #
Description copied from class Godot::Object

Invoked by the GDExtension bridge when retrieving an exposed @export property.


def _godot_has_crystal_method?(method : String) : Bool #
Description copied from class Godot::Object

Internal hooks overridden by Lapis node/gdclass/resource classes to expose Crystal-defined methods.


def _godot_set_property(prop_name : String, val_ptr : Pointer(Void)) : Void #
Description copied from class Godot::Object

Invoked by the GDExtension bridge when setting an exposed @export property.


def _render_callback(effect_callback_type : Int64, render_data : Godot::RenderData) : Void #

Executed on the Godot render thread for each frame


def active_features : Hash(String, FeatureValue) #

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

def apply_dictionary_properties!(dict : Godot::Dictionary) : Void #
Description copied from class Godot::Object

Populates @[Export] properties on this object from a Godot::Dictionary.


def compiled_glsl : String #

def compiled_program : ShaderProgram | Nil #

def configure_compositor_flags : Void #

def crshader_path : String #

def crshader_path=(crshader_path : String) #

def crshader_source : String #

def crshader_source=(crshader_source : String) #

def export_config_hash : UInt64 #
Description copied from class Godot::Object

Computes a deterministic 64-bit hash of all @[Export] properties on this object.


def intensity : Float32 #

def intensity=(intensity : Float32) #

def load_shader_file(path : String) : Bool #

Sets .crshader or .glsl file path at runtime and flags GPU pipeline for recompilation


def needs_depth_buffer : Bool #

def needs_depth_buffer=(needs_depth_buffer : Bool) #

def needs_normal_roughness_buffer : Bool #

def needs_normal_roughness_buffer=(needs_normal_roughness_buffer : Bool) #

def packed_layout : GLSLLayoutPacker::PackedLayout | Nil #

def parameter_overrides : Hash(String, ParamValue) #

def parameter_overrides=(parameter_overrides : Hash(String, ParamValue)) #

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

Toggles or updates a compile-time specialization feature and schedules SPIR-V swap


def set_shader_code(source : String, is_glsl : Bool = false) : Void #

Sets .crshader source code at runtime and flags GPU pipeline for recompilation


def set_shader_parameter(name : String, value : ParamValue) : Void #

Updates a uniform parameter dynamically (mirrors ShaderMaterial#set_shader_parameter)


def specialize(**features) : String #

Compiles a specialized GLSL compute permutation using VariantCache


def stage_callback : Int32 #

def stage_callback=(stage_callback : Int32) #

def strip_debug_inspects : Bool #

def strip_debug_inspects=(strip_debug_inspects : Bool) #