0.2.0-dev Download ZIP
88 lines ·2.3 KB Raw
| 1 | // Scene data stores all our 3D rendering globals for a frame such as our matrices |
| 2 | // where this information is independent of the different RD implementations. |
| 3 | // This enables us to use this UBO in our main scene render shaders but also in |
| 4 | // effects that need access to this data. |
| 5 | |
| 6 | #define SCENE_DATA_FLAGS_USE_AMBIENT_LIGHT (1 << 0) |
| 7 | #define SCENE_DATA_FLAGS_USE_AMBIENT_CUBEMAP (1 << 1) |
| 8 | #define SCENE_DATA_FLAGS_USE_REFLECTION_COLOR (1 << 2) |
| 9 | #define SCENE_DATA_FLAGS_USE_REFLECTION_CUBEMAP (1 << 3) |
| 10 | #define SCENE_DATA_FLAGS_USE_ROUGHNESS_LIMITER (1 << 4) |
| 11 | #define SCENE_DATA_FLAGS_USE_FOG (1 << 5) |
| 12 | #define SCENE_DATA_FLAGS_USE_UV2_MATERIAL (1 << 6) |
| 13 | #define SCENE_DATA_FLAGS_USE_PANCAKE_SHADOWS (1 << 7) |
| 14 | #define SCENE_DATA_FLAGS_IN_SHADOW_PASS (1 << 8) |
| 15 | |
| 16 | struct SceneData { |
| 17 | mat4 projection_matrix; |
| 18 | mat4 inv_projection_matrix; |
| 19 | mat3x4 inv_view_matrix; |
| 20 | mat3x4 view_matrix; |
| 21 | |
| 22 | #ifdef USE_DOUBLE_PRECISION |
| 23 | vec4 inv_view_precision; |
| 24 | #endif |
| 25 | |
| 26 | // only used for multiview |
| 27 | mat4 projection_matrix_view[MAX_VIEWS]; |
| 28 | mat4 inv_projection_matrix_view[MAX_VIEWS]; |
| 29 | vec4 eye_offset[MAX_VIEWS]; |
| 30 | |
| 31 | // Used for billboards to cast correct shadows. |
| 32 | mat4 main_cam_inv_view_matrix; |
| 33 | |
| 34 | vec2 viewport_size; |
| 35 | vec2 screen_pixel_size; |
| 36 | |
| 37 | // Use vec4s because std140 doesn't play nice with vec2s, z and w are wasted. |
| 38 | vec4 directional_penumbra_shadow_kernel[32]; |
| 39 | vec4 directional_soft_shadow_kernel[32]; |
| 40 | vec4 penumbra_shadow_kernel[32]; |
| 41 | vec4 soft_shadow_kernel[32]; |
| 42 | |
| 43 | vec2 shadow_atlas_pixel_size; |
| 44 | vec2 directional_shadow_pixel_size; |
| 45 | |
| 46 | float radiance_pixel_size; |
| 47 | float radiance_border_size; |
| 48 | vec2 reflection_atlas_border_size; |
| 49 | |
| 50 | uint directional_light_count; |
| 51 | float dual_paraboloid_side; |
| 52 | float z_far; |
| 53 | float z_near; |
| 54 | |
| 55 | float roughness_limiter_amount; |
| 56 | float roughness_limiter_limit; |
| 57 | float opaque_prepass_threshold; |
| 58 | uint flags; |
| 59 | |
| 60 | mat3 radiance_inverse_xform; |
| 61 | |
| 62 | vec4 ambient_light_color_energy; |
| 63 | |
| 64 | vec3 reflection_color; |
| 65 | uint pad; |
| 66 | |
| 67 | float ambient_color_sky_mix; |
| 68 | float fog_density; |
| 69 | float fog_height; |
| 70 | float fog_height_density; |
| 71 | |
| 72 | float fog_depth_curve; |
| 73 | float fog_depth_begin; |
| 74 | float fog_depth_end; |
| 75 | float fog_sun_scatter; |
| 76 | |
| 77 | vec3 fog_light_color; |
| 78 | float fog_aerial_perspective; |
| 79 | |
| 80 | float time; |
| 81 | float taa_frame_count; |
| 82 | vec2 taa_jitter; |
| 83 | |
| 84 | float emissive_exposure_normalization; |
| 85 | float IBL_exposure_normalization; |
| 86 | uint camera_visible_layers; |
| 87 | float pass_alpha_multiplier; |
| 88 | }; |