#define SCENE_DATA_FLAGS_USE_AMBIENT_LIGHT (1 << 0) #define SCENE_DATA_FLAGS_USE_AMBIENT_CUBEMAP (1 << 1) #define SCENE_DATA_FLAGS_USE_REFLECTION_CUBEMAP (1 << 2) #define SCENE_DATA_FLAGS_USE_ROUGHNESS_LIMITER (1 << 3) #define SCENE_DATA_FLAGS_USE_FOG (1 << 4) #define SCENE_DATA_FLAGS_USE_UV2_MATERIAL (1 << 5) #define SCENE_DATA_FLAGS_USE_PANCAKE_SHADOWS (1 << 6) #define SCENE_DATA_FLAGS_IN_SHADOW_PASS (1 << 7) #define MAX_VIEWS 2 #define GODOT_VERSION_MAJOR 4 #define GODOT_VERSION_MINOR 5 struct SceneData { #if (GODOT_VERSION_MAJOR == 4) && (GODOT_VERSION_MINOR == 4) // godot version 4.4 highp mat4 projection_matrix; highp mat4 inv_projection_matrix; highp mat4 inv_view_matrix; highp mat4 view_matrix; // only used for multiview highp mat4 projection_matrix_view[MAX_VIEWS]; highp mat4 inv_projection_matrix_view[MAX_VIEWS]; highp vec4 eye_offset[MAX_VIEWS]; // Used for billboards to cast correct shadows. highp mat4 main_cam_inv_view_matrix; highp vec2 viewport_size; highp vec2 screen_pixel_size; // Use vec4s because std140 doesn't play nice with vec2s, z and w are wasted. highp vec4 directional_penumbra_shadow_kernel[32]; highp vec4 directional_soft_shadow_kernel[32]; highp vec4 penumbra_shadow_kernel[32]; highp vec4 soft_shadow_kernel[32]; mediump mat3 radiance_inverse_xform; mediump vec4 ambient_light_color_energy; mediump float ambient_color_sky_mix; bool use_ambient_light; bool use_ambient_cubemap; bool use_reflection_cubemap; highp vec2 shadow_atlas_pixel_size; highp vec2 directional_shadow_pixel_size; uint directional_light_count; mediump float dual_paraboloid_side; highp float z_far; highp float z_near; bool roughness_limiter_enabled; mediump float roughness_limiter_amount; mediump float roughness_limiter_limit; mediump float opaque_prepass_threshold; bool fog_enabled; uint fog_mode; highp float fog_density; highp float fog_height; highp float fog_height_density; highp float fog_depth_curve; highp float fog_depth_begin; highp float taa_frame_count; mediump vec3 fog_light_color; highp float fog_depth_end; mediump float fog_sun_scatter; mediump float fog_aerial_perspective; highp float time; mediump float reflection_multiplier; // one normally, zero when rendering reflections vec2 taa_jitter; bool material_uv2_mode; float emissive_exposure_normalization; float IBL_exposure_normalization; bool pancake_shadows; uint camera_visible_layers; float pass_alpha_multiplier; #elif (GODOT_VERSION_MAJOR == 4) && (GODOT_VERSION_MINOR == 5) /* 4.5 definition */ mat4 projection_matrix; mat4 inv_projection_matrix; mat4 inv_view_matrix; mat4 view_matrix; // only used for multiview mat4 projection_matrix_view[MAX_VIEWS]; mat4 inv_projection_matrix_view[MAX_VIEWS]; vec4 eye_offset[MAX_VIEWS]; // Used for billboards to cast correct shadows. mat4 main_cam_inv_view_matrix; vec2 viewport_size; vec2 screen_pixel_size; // Use vec4s because std140 doesn't play nice with vec2s, z and w are wasted. vec4 directional_penumbra_shadow_kernel[32]; vec4 directional_soft_shadow_kernel[32]; vec4 penumbra_shadow_kernel[32]; vec4 soft_shadow_kernel[32]; vec2 shadow_atlas_pixel_size; vec2 directional_shadow_pixel_size; uint directional_light_count; float dual_paraboloid_side; float z_far; float z_near; float roughness_limiter_amount; float roughness_limiter_limit; float opaque_prepass_threshold; uint flags; mat3 radiance_inverse_xform; vec4 ambient_light_color_energy; float ambient_color_sky_mix; float fog_density; float fog_height; float fog_height_density; float fog_depth_curve; float fog_depth_begin; float fog_depth_end; float fog_sun_scatter; vec3 fog_light_color; float fog_aerial_perspective; float time; float taa_frame_count; vec2 taa_jitter; float emissive_exposure_normalization; float IBL_exposure_normalization; uint camera_visible_layers; float pass_alpha_multiplier; #endif }; struct GenericData{ vec3 extralargenoiseposition; float extralargenoisescale; vec3 largenoiseposition; float cloud_lighting_sharpness; vec3 mediumnoiseposition; float lighting_step_distance; vec3 smallnoiseposition; float atmospheric_density; vec4 ambientLightColor; vec4 ambientGroundLightColor; vec4 ambientfogdistancecolor; float small_noise_scale; float min_step_distance; float max_step_distance; float lod_bias; float cloud_sharpness; float directionalLightsCount; float powderStrength; float anisotropy; float cloud_floor; float cloud_ceiling; float max_step_count; float max_lighting_step_count; float filterIndex; float blurPower; float blurQuality; float curlPower; vec2 WindDirection; float fogEffectGround; float samplePointsCount; float pointLightsCount; float pointEffectorCount; float windSweptRange; float windSweptPower; vec2 raster_size; float large_noise_scale; float medium_noise_scale; float time; float cloud_coverage; float cloud_density; float small_noise_strength; float cloud_lighting_power; float accumilation_decay; float isAccumulationA; float resolutionscale; }; struct DirectionalLight { vec4 direction; //w = shadow sample count vec4 color; //a = intensity }; struct PointLight { vec4 position; //w = radius vec4 color; //a = intensity }; struct PointEffector { vec3 position; //w = radius float radius; float power; float attenuation; vec2 reserved; };