diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /modules/lightmapper_rd | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) |
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
-o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
-o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```
This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.
This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.
Part of #33027.
Diffstat (limited to 'modules/lightmapper_rd')
-rw-r--r-- | modules/lightmapper_rd/lightmapper_rd.cpp | 7 | ||||
-rw-r--r-- | modules/lightmapper_rd/lm_common_inc.glsl | 7 | ||||
-rw-r--r-- | modules/lightmapper_rd/lm_compute.glsl | 2 | ||||
-rw-r--r-- | modules/lightmapper_rd/lm_raster.glsl | 1 |
4 files changed, 17 insertions, 0 deletions
diff --git a/modules/lightmapper_rd/lightmapper_rd.cpp b/modules/lightmapper_rd/lightmapper_rd.cpp index cf54754a16..b55c73e9bc 100644 --- a/modules/lightmapper_rd/lightmapper_rd.cpp +++ b/modules/lightmapper_rd/lightmapper_rd.cpp @@ -64,6 +64,7 @@ void LightmapperRD::add_directional_light(bool p_static, const Vector3 &p_direct l.size = p_angular_distance; lights.push_back(l); } + void LightmapperRD::add_omni_light(bool p_static, const Vector3 &p_position, const Color &p_color, float p_energy, float p_range, float p_attenuation, float p_size) { Light l; l.type = LIGHT_TYPE_OMNI; @@ -80,6 +81,7 @@ void LightmapperRD::add_omni_light(bool p_static, const Vector3 &p_position, con l.size = p_size; lights.push_back(l); } + void LightmapperRD::add_spot_light(bool p_static, const Vector3 &p_position, const Vector3 p_direction, const Color &p_color, float p_energy, float p_range, float p_attenuation, float p_spot_angle, float p_spot_attenuation, float p_size) { Light l; l.type = LIGHT_TYPE_SPOT; @@ -1700,17 +1702,21 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d int LightmapperRD::get_bake_texture_count() const { return bake_textures.size(); } + Ref<Image> LightmapperRD::get_bake_texture(int p_index) const { ERR_FAIL_INDEX_V(p_index, bake_textures.size(), Ref<Image>()); return bake_textures[p_index]; } + int LightmapperRD::get_bake_mesh_count() const { return mesh_instances.size(); } + Variant LightmapperRD::get_bake_mesh_userdata(int p_index) const { ERR_FAIL_INDEX_V(p_index, mesh_instances.size(), Variant()); return mesh_instances[p_index].data.userdata; } + Rect2 LightmapperRD::get_bake_mesh_uv_scale(int p_index) const { ERR_FAIL_COND_V(bake_textures.size() == 0, Rect2()); Rect2 uv_ofs; @@ -1719,6 +1725,7 @@ Rect2 LightmapperRD::get_bake_mesh_uv_scale(int p_index) const { uv_ofs.size = Vector2(mesh_instances[p_index].data.albedo_on_uv2->get_width(), mesh_instances[p_index].data.albedo_on_uv2->get_height()) / atlas_size; return uv_ofs; } + int LightmapperRD::get_bake_mesh_texture_slice(int p_index) const { ERR_FAIL_INDEX_V(p_index, mesh_instances.size(), Variant()); return mesh_instances[p_index].slice; diff --git a/modules/lightmapper_rd/lm_common_inc.glsl b/modules/lightmapper_rd/lm_common_inc.glsl index 0ff455936e..15946d5327 100644 --- a/modules/lightmapper_rd/lm_common_inc.glsl +++ b/modules/lightmapper_rd/lm_common_inc.glsl @@ -11,6 +11,7 @@ struct Vertex { layout(set = 0, binding = 1, std430) restrict readonly buffer Vertices { Vertex data[]; } + vertices; struct Triangle { @@ -21,6 +22,7 @@ struct Triangle { layout(set = 0, binding = 2, std430) restrict readonly buffer Triangles { Triangle data[]; } + triangles; struct Box { @@ -33,11 +35,13 @@ struct Box { layout(set = 0, binding = 3, std430) restrict readonly buffer Boxes { Box data[]; } + boxes; layout(set = 0, binding = 4, std430) restrict readonly buffer GridIndices { uint data[]; } + grid_indices; #define LIGHT_TYPE_DIRECTIONAL 0 @@ -66,6 +70,7 @@ struct Light { layout(set = 0, binding = 5, std430) restrict readonly buffer Lights { Light data[]; } + lights; struct Seam { @@ -76,11 +81,13 @@ struct Seam { layout(set = 0, binding = 6, std430) restrict readonly buffer Seams { Seam data[]; } + seams; layout(set = 0, binding = 7, std430) restrict readonly buffer Probes { vec4 data[]; } + probe_positions; layout(set = 0, binding = 8) uniform utexture3D grid; diff --git a/modules/lightmapper_rd/lm_compute.glsl b/modules/lightmapper_rd/lm_compute.glsl index 5a1f1ceda3..a442016969 100644 --- a/modules/lightmapper_rd/lm_compute.glsl +++ b/modules/lightmapper_rd/lm_compute.glsl @@ -36,6 +36,7 @@ layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; layout(set = 1, binding = 0, std430) restrict buffer LightProbeData { vec4 data[]; } + light_probes; layout(set = 1, binding = 1) uniform texture2DArray source_light; @@ -93,6 +94,7 @@ layout(push_constant, binding = 0, std430) uniform Params { mat3x4 env_transform; } + params; //check it, but also return distance and barycentric coords (for uv lookup) diff --git a/modules/lightmapper_rd/lm_raster.glsl b/modules/lightmapper_rd/lm_raster.glsl index 41b3e89a3f..36b706bcd5 100644 --- a/modules/lightmapper_rd/lm_raster.glsl +++ b/modules/lightmapper_rd/lm_raster.glsl @@ -26,6 +26,7 @@ layout(push_constant, binding = 0, std430) uniform Params { ivec3 grid_size; uint pad2; } + params; /* clang-format on */ |