diff --git a/include/merian-shaders/bit_twiddling.glsl b/include/merian-shaders/bit_twiddling.glsl index 4a51b8f..9b3ca68 100644 --- a/include/merian-shaders/bit_twiddling.glsl +++ b/include/merian-shaders/bit_twiddling.glsl @@ -1,5 +1,5 @@ -#ifndef _BIT_TWIDDLING_H_ -#define _BIT_TWIDDLING_H_ +#ifndef _MERIAN_SHADERS_BIT_TWIDDLING_H_ +#define _MERIAN_SHADERS_BIT_TWIDDLING_H_ uint next_power_of_two(uint v) { v--; @@ -13,4 +13,4 @@ uint next_power_of_two(uint v) { return v; } -#endif // _BIT_TWIDDLING_H_ +#endif // _MERIAN_SHADERS_BIT_TWIDDLING_H_ diff --git a/include/merian-shaders/bsdf_diffuse.glsl b/include/merian-shaders/bsdf_diffuse.glsl index f91669a..e6892a3 100644 --- a/include/merian-shaders/bsdf_diffuse.glsl +++ b/include/merian-shaders/bsdf_diffuse.glsl @@ -1,8 +1,8 @@ #include "merian-shaders/sampling.glsl" #include "merian-shaders/frames.glsl" -#ifndef _BSDF_DIFFUSE_H_ -#define _BSDF_DIFFUSE_H_ +#ifndef _MERIAN_SHADERS_BSDF_DIFFUSE_H_ +#define _MERIAN_SHADERS_BSDF_DIFFUSE_H_ // n must be normalized #define bsdf_diffuse_sample(n, random) (make_frame(n) * sample_cos(random)) diff --git a/include/merian-shaders/bsdf_microfacet.glsl b/include/merian-shaders/bsdf_microfacet.glsl index 872c636..39b8fc4 100644 --- a/include/merian-shaders/bsdf_microfacet.glsl +++ b/include/merian-shaders/bsdf_microfacet.glsl @@ -5,8 +5,8 @@ * microfacet model by jonathan: */ -#ifndef _BSDF_MICROFACET_H_ -#define _BSDF_MICROFACET_H_ +#ifndef _MERIAN_SHADERS_BSDF_MICROFACET_H_ +#define _MERIAN_SHADERS_BSDF_MICROFACET_H_ //----------------------------------------------------------------- diff --git a/include/merian-shaders/camera.glsl b/include/merian-shaders/camera.glsl index 36c2c29..b8e6811 100644 --- a/include/merian-shaders/camera.glsl +++ b/include/merian-shaders/camera.glsl @@ -1,7 +1,7 @@ #include "merian-shaders/common.glsl" -#ifndef _CAMERA_H_ -#define _CAMERA_H_ +#ifndef _MERIAN_SHADERS_CAMERA_H_ +#define _MERIAN_SHADERS_CAMERA_H_ // importance sample the blackman harris pixel filter with 1.5px radius support vec2 pixel_offset_blackman_harris(const vec2 rand) { diff --git a/include/merian-shaders/color/colors_dng.glsl b/include/merian-shaders/color/colors_dng.glsl index fbdae10..9f250cd 100644 --- a/include/merian-shaders/color/colors_dng.glsl +++ b/include/merian-shaders/color/colors_dng.glsl @@ -1,5 +1,5 @@ -#ifndef _COLORS_DNG_H_ -#define _COLORS_DNG_H_ +#ifndef _MERIAN_SHADERS_COLORS_DNG_H_ +#define _MERIAN_SHADERS_COLORS_DNG_H_ /* Adapted from VKDT, licensed under: diff --git a/include/merian-shaders/color/colors_dtucs.glsl b/include/merian-shaders/color/colors_dtucs.glsl index e7b6eb1..8a2c56c 100644 --- a/include/merian-shaders/color/colors_dtucs.glsl +++ b/include/merian-shaders/color/colors_dtucs.glsl @@ -1,5 +1,5 @@ -#ifndef _COLORS_DTUCS_H_ -#define _COLORS_DTUCS_H_ +#ifndef _MERIAN_SHADERS_COLORS_DTUCS_H_ +#define _MERIAN_SHADERS_COLORS_DTUCS_H_ /* The following is darktable Uniform Color Space 2022 * © Aurélien Pierre diff --git a/include/merian-shaders/color/colors_munsell.glsl b/include/merian-shaders/color/colors_munsell.glsl index c520dbf..ace7301 100644 --- a/include/merian-shaders/color/colors_munsell.glsl +++ b/include/merian-shaders/color/colors_munsell.glsl @@ -1,7 +1,7 @@ #include "merian-shaders/common.glsl" -#ifndef _COLORS_MUNSELL_H_ -#define _COLORS_MUNSELL_H_ +#ifndef _MERIAN_SHADERS_COLORS_MUNSELL_H_ +#define _MERIAN_SHADERS_COLORS_MUNSELL_H_ /* Adapted from VKDT, licensed under: diff --git a/include/merian-shaders/color/colors_rec2020.glsl b/include/merian-shaders/color/colors_rec2020.glsl index 1785190..da9abcc 100644 --- a/include/merian-shaders/color/colors_rec2020.glsl +++ b/include/merian-shaders/color/colors_rec2020.glsl @@ -1,5 +1,5 @@ -#ifndef _COLORS_REC2020_H_ -#define _COLORS_REC2020_H_ +#ifndef _MERIAN_SHADERS_COLORS_REC2020_H_ +#define _MERIAN_SHADERS_COLORS_REC2020_H_ vec3 rec2020_to_xyY(vec3 rec2020) { diff --git a/include/merian-shaders/color/colors_srgb.glsl b/include/merian-shaders/color/colors_srgb.glsl index 9189a19..894ed17 100644 --- a/include/merian-shaders/color/colors_srgb.glsl +++ b/include/merian-shaders/color/colors_srgb.glsl @@ -1,5 +1,5 @@ -#ifndef _COLORS_SRGB_H_ -#define _COLORS_SRGB_H_ +#ifndef _MERIAN_SHADERS_COLORS_SRGB_H_ +#define _MERIAN_SHADERS_COLORS_SRGB_H_ // Converts the curve from sRGB to linear. Primary chromaticities are not transformed (output is close to rec709). vec3 srgb_to_rgb(vec3 srgb) { diff --git a/include/merian-shaders/color/colors_xyz.glsl b/include/merian-shaders/color/colors_xyz.glsl index 6fca326..58a3f1c 100644 --- a/include/merian-shaders/color/colors_xyz.glsl +++ b/include/merian-shaders/color/colors_xyz.glsl @@ -1,5 +1,5 @@ -#ifndef _COLORS_XYZ_H_ -#define _COLORS_XYZ_H_ +#ifndef _MERIAN_SHADERS_COLORS_XYZ_H_ +#define _MERIAN_SHADERS_COLORS_XYZ_H_ float XYZ_luminance(const vec3 rgb) { return dot(rgb, vec3(0.2126729, 0.7151522, 0.0721750)); diff --git a/include/merian-shaders/color/colors_yuv.glsl b/include/merian-shaders/color/colors_yuv.glsl index 337ce9c..33f1d4d 100644 --- a/include/merian-shaders/color/colors_yuv.glsl +++ b/include/merian-shaders/color/colors_yuv.glsl @@ -1,5 +1,5 @@ -#ifndef _COLORS_YUV_H_ -#define _COLORS_YUV_H_ +#ifndef _MERIAN_SHADERS_COLORS_YUV_H_ +#define _MERIAN_SHADERS_COLORS_YUV_H_ #define yuv_luminance(rgb) dot(rgb, vec3(0.299, 0.587, 0.114)) diff --git a/include/merian-shaders/common.glsl b/include/merian-shaders/common.glsl index 52d2274..5340197 100644 --- a/include/merian-shaders/common.glsl +++ b/include/merian-shaders/common.glsl @@ -1,5 +1,5 @@ -#ifndef _COMMON_H_ -#define _COMMON_H_ +#ifndef _MERIAN_SHADERS_COMMON_H_ +#define _MERIAN_SHADERS_COMMON_H_ #define M_PI 3.14159265358979323846 #define TWO_PI 6.283185307179586 @@ -9,4 +9,4 @@ // returns 1/x if x > 0 else 1. #define SAFE_RECIPROCAL(x) (x > 0. ? 1. / x : 1.0) -#endif // _COMMON_H_ +#endif // _MERIAN_SHADERS_COMMON_H_ diff --git a/include/merian-shaders/cubemap.glsl b/include/merian-shaders/cubemap.glsl index a69b764..d0ea5ce 100644 --- a/include/merian-shaders/cubemap.glsl +++ b/include/merian-shaders/cubemap.glsl @@ -1,5 +1,5 @@ -#ifndef _CUBEMAP_H_ -#define _CUBEMAP_H_ +#ifndef _MERIAN_SHADERS_CUBEMAP_H_ +#define _MERIAN_SHADERS_CUBEMAP_H_ // 0: pos x, 1: neg x, 2: pos y, 3: neg: y, 4: pos z, 5: neg z uint cubemap_side(const vec3 w) { diff --git a/include/merian-shaders/frames.glsl b/include/merian-shaders/frames.glsl index 31d7caa..62f65f7 100644 --- a/include/merian-shaders/frames.glsl +++ b/include/merian-shaders/frames.glsl @@ -1,5 +1,5 @@ -#ifndef _FRAMES_H_ -#define _FRAMES_H_ +#ifndef _MERIAN_SHADERS_FRAMES_H_ +#define _MERIAN_SHADERS_FRAMES_H_ // Returns a matrix of axis (x, y, z) which all being perpendicular to each other mat3x3 make_frame(vec3 z) { diff --git a/include/merian-shaders/gbuffer.glsl.h b/include/merian-shaders/gbuffer.glsl.h index 30e1200..3f60015 100644 --- a/include/merian-shaders/gbuffer.glsl.h +++ b/include/merian-shaders/gbuffer.glsl.h @@ -1,7 +1,7 @@ #include "merian-shaders/types.glsl.h" -#ifndef _GBUFFER_H_ -#define _GBUFFER_H_ +#ifndef _MERIAN_SHADERS_GBUFFER_H_ +#define _MERIAN_SHADERS_GBUFFER_H_ #ifdef __cplusplus namespace merian_nodes { diff --git a/include/merian-shaders/grid.glsl b/include/merian-shaders/grid.glsl index 90a76b3..2e0d946 100644 --- a/include/merian-shaders/grid.glsl +++ b/include/merian-shaders/grid.glsl @@ -1,7 +1,7 @@ #include "merian-shaders/cubemap.glsl" -#ifndef _GRID_H_ -#define _GRID_H_ +#ifndef _MERIAN_SHADERS_GRID_H_ +#define _MERIAN_SHADERS_GRID_H_ // Determines the grid cell of pos and returns the lower vertex indices. // The vertex pos then is index * cell_width. diff --git a/include/merian-shaders/hash.glsl b/include/merian-shaders/hash.glsl index 5a08816..41cffa9 100644 --- a/include/merian-shaders/hash.glsl +++ b/include/merian-shaders/hash.glsl @@ -1,5 +1,5 @@ -#ifndef _HASH_H_ -#define _HASH_H_ +#ifndef _MERIAN_SHADERS_HASH_H_ +#define _MERIAN_SHADERS_HASH_H_ // Jarzynski et al. From Hash Functions for GPU Rendering // Fastest to highest quality diff --git a/include/merian-shaders/interpolate.glsl b/include/merian-shaders/interpolate.glsl index 2ad28b1..f8492fc 100644 --- a/include/merian-shaders/interpolate.glsl +++ b/include/merian-shaders/interpolate.glsl @@ -1,5 +1,5 @@ -#ifndef _INTERPOLATE_H_ -#define _INTERPOLATE_H_ +#ifndef _MERIAN_SHADERS_INTERPOLATE_H_ +#define _MERIAN_SHADERS_INTERPOLATE_H_ // like smoothstep but without Hermite smoothing float linearstep(const float edge0, const float edge1, const float x) { diff --git a/include/merian-shaders/intersect.glsl b/include/merian-shaders/intersect.glsl index 2a16f55..faad73b 100644 --- a/include/merian-shaders/intersect.glsl +++ b/include/merian-shaders/intersect.glsl @@ -1,5 +1,5 @@ -#ifndef _INTERSECT_H_ -#define _INTERSECT_H_ +#ifndef _MERIAN_SHADERS_INTERSECT_H_ +#define _MERIAN_SHADERS_INTERSECT_H_ // Returns t such that ray_origin + t * ray_dir = intersection #define intersect_ray_plane(plane_origin, plane_normal, ray_origin, ray_dir) (dot(plane_normal, plane_origin - ray_origin) / dot(plane_normal, ray_dir)) diff --git a/include/merian-shaders/linalg.glsl b/include/merian-shaders/linalg.glsl index 3c3dca8..d06c56c 100644 --- a/include/merian-shaders/linalg.glsl +++ b/include/merian-shaders/linalg.glsl @@ -1,5 +1,5 @@ -#ifndef _LINALG_H_ -#define _LINALG_H_ +#ifndef _MERIAN_SHADERS_LINALG_H_ +#define _MERIAN_SHADERS_LINALG_H_ // Returns the Moore-Penrose inverse also known as the pseudoinverse A+ = (A^TA)^-1 * A^T. @@ -31,4 +31,4 @@ void pseudoinverse(const vec3 du, const vec3 dv, out vec3 du_dx, out vec3 dv_dx) pseudoinverse(du, dv, cross(du, dv), du_dx, dv_dx); } -#endif // _LINALG_H_ +#endif // _MERIAN_SHADERS_LINALG_H_ diff --git a/include/merian-shaders/morton.glsl b/include/merian-shaders/morton.glsl index 3c9bee8..14a5aa6 100644 --- a/include/merian-shaders/morton.glsl +++ b/include/merian-shaders/morton.glsl @@ -1,5 +1,5 @@ -#ifndef _MORTON_H_ -#define _MORTON_H_ +#ifndef _MERIAN_SHADERS_MORTON_H_ +#define _MERIAN_SHADERS_MORTON_H_ #include "merian-shaders/bit_twiddling.glsl" @@ -31,4 +31,4 @@ uint morton_encode2d(const uvec2 p, in uint width, in uint height) { } -#endif // _MORTON_H_ +#endif // _MERIAN_SHADERS_MORTON_H_ diff --git a/include/merian-shaders/normal_encode.glsl b/include/merian-shaders/normal_encode.glsl index a3422e7..05262d6 100644 --- a/include/merian-shaders/normal_encode.glsl +++ b/include/merian-shaders/normal_encode.glsl @@ -1,5 +1,5 @@ -#ifndef _NORMAL_ENCODE_H_ -#define _NORMAL_ENCODE_H_ +#ifndef _MERIAN_SHADERS_NORMAL_ENCODE_H_ +#define _MERIAN_SHADERS_NORMAL_ENCODE_H_ vec2 sign_no0(const vec2 v) { diff --git a/include/merian-shaders/phase_draine.glsl b/include/merian-shaders/phase_draine.glsl index c92d8cf..4263785 100644 --- a/include/merian-shaders/phase_draine.glsl +++ b/include/merian-shaders/phase_draine.glsl @@ -1,5 +1,5 @@ -#ifndef _PHASE_DRAINE_H_ -#define _PHASE_DRAINE_H_ +#ifndef _MERIAN_SHADERS_PHASE_DRAINE_H_ +#define _MERIAN_SHADERS_PHASE_DRAINE_H_ /* * SPDX-FileCopyrightText: Copyright (c) <2023> NVIDIA CORPORATION & AFFILIATES. All rights reserved. diff --git a/include/merian-shaders/phase_isotropic.glsl b/include/merian-shaders/phase_isotropic.glsl index b2d8910..b5c284c 100644 --- a/include/merian-shaders/phase_isotropic.glsl +++ b/include/merian-shaders/phase_isotropic.glsl @@ -1,8 +1,8 @@ #include "merian-shaders/sampling.glsl" #include "merian-shaders/frames.glsl" -#ifndef _PHASE_ISOTROPIC_H_ -#define _PHASE_ISOTROPIC_H_ +#ifndef _MERIAN_SHADERS_PHASE_ISOTROPIC_H_ +#define _MERIAN_SHADERS_PHASE_ISOTROPIC_H_ #define phase_isotropic_sample(random) sample_sphere(random) diff --git a/include/merian-shaders/phase_rayleigh.glsl b/include/merian-shaders/phase_rayleigh.glsl index 0f2d7db..1c8cd29 100644 --- a/include/merian-shaders/phase_rayleigh.glsl +++ b/include/merian-shaders/phase_rayleigh.glsl @@ -1,5 +1,5 @@ -#ifndef _PHASE_RAYLEIGH_H_ -#define _PHASE_RAYLEIGH_H_ +#ifndef _MERIAN_SHADERS_PHASE_RAYLEIGH_H_ +#define _MERIAN_SHADERS_PHASE_RAYLEIGH_H_ float phase_rayleigh(const float cos_theta) { return 3 * (1 + cos_theta * cos_theta) / 4; diff --git a/include/merian-shaders/random.glsl b/include/merian-shaders/random.glsl index 84a2645..4ca7549 100644 --- a/include/merian-shaders/random.glsl +++ b/include/merian-shaders/random.glsl @@ -1,5 +1,5 @@ -#ifndef _RANDOM_H_ -#define _RANDOM_H_ +#ifndef _MERIAN_SHADERS_RANDOM_H_ +#define _MERIAN_SHADERS_RANDOM_H_ // Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" // Returns random float in [0, 1) and updates state. diff --git a/include/merian-shaders/ray_differential.glsl b/include/merian-shaders/ray_differential.glsl index 09f9aee..aa363a5 100644 --- a/include/merian-shaders/ray_differential.glsl +++ b/include/merian-shaders/ray_differential.glsl @@ -1,5 +1,5 @@ -#ifndef _RAYDIFFERENTIAL_H_ -#define _RAYDIFFERENTIAL_H_ +#ifndef _MERIAN_SHADERS_RAYDIFFERENTIAL_H_ +#define _MERIAN_SHADERS_RAYDIFFERENTIAL_H_ struct RayDifferential { // current differential of origin @@ -29,4 +29,4 @@ void ray_diff_propagate(inout RayDifferential rd, } -#endif // _RAYDIFFERENT_H_ +#endif // _MERIAN_SHADERS_RAYDIFFERENTIAL_H_ diff --git a/include/merian-shaders/raytrace.glsl b/include/merian-shaders/raytrace.glsl index a2e8d80..ab5de03 100644 --- a/include/merian-shaders/raytrace.glsl +++ b/include/merian-shaders/raytrace.glsl @@ -1,5 +1,5 @@ -#ifndef _RAYTRACE_H_ -#define _RAYTRACE_H_ +#ifndef _MERIAN_SHADERS_RAYTRACE_H_ +#define _MERIAN_SHADERS_RAYTRACE_H_ #define _rq_get_t(ray_query, commited) rayQueryGetIntersectionTEXT(ray_query, commited) #define _rq_instance_id(ray_query, commited) rayQueryGetIntersectionInstanceIdEXT(ray_query, commited) diff --git a/include/merian-shaders/reprojection.glsl b/include/merian-shaders/reprojection.glsl index 60b1dd2..06cd449 100644 --- a/include/merian-shaders/reprojection.glsl +++ b/include/merian-shaders/reprojection.glsl @@ -1,3 +1,5 @@ +#ifndef _MERIAN_SHADERS_REPROJECTION +#define _MERIAN_SHADERS_REPROJECTION // Computes a weight for the quality of the reprojection. // Reprojections with normals further away than normal_reject_cos = cos(alpha) @@ -40,3 +42,5 @@ bool reprojection_intersect_border(inout vec2 prev_pos, const vec2 mv, const vec } return false; } + +#endif diff --git a/include/merian-shaders/sampler.glsl b/include/merian-shaders/sampler.glsl index c5f2cb5..cfe2308 100644 --- a/include/merian-shaders/sampler.glsl +++ b/include/merian-shaders/sampler.glsl @@ -1,5 +1,5 @@ -#ifndef _SAMPLER_H_ -#define _SAMPLER_H_ +#ifndef _MERIAN_SHADERS_SAMPLER_H_ +#define _MERIAN_SHADERS_SAMPLER_H_ // Adapted for Vulkan from https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1 // (MIT License) diff --git a/include/merian-shaders/sampling.glsl b/include/merian-shaders/sampling.glsl index 4462990..97885cf 100644 --- a/include/merian-shaders/sampling.glsl +++ b/include/merian-shaders/sampling.glsl @@ -1,8 +1,8 @@ #include "merian-shaders/common.glsl" #include "merian-shaders/random.glsl" -#ifndef _SAMPLING_H_ -#define _SAMPLING_H_ +#ifndef _MERIAN_SHADERS_SAMPLING_H_ +#define _MERIAN_SHADERS_SAMPLING_H_ // sample sphere, p = 1 / 4pi vec3 sample_sphere(const vec2 random) { diff --git a/include/merian-shaders/textures.glsl b/include/merian-shaders/textures.glsl index f7ba6df..48e00e7 100644 --- a/include/merian-shaders/textures.glsl +++ b/include/merian-shaders/textures.glsl @@ -1,5 +1,5 @@ -#ifndef _TEXTURES_H_ -#define _TEXTURES_H_ +#ifndef _MERIAN_SHADERS_TEXTURES_H_ +#define _MERIAN_SHADERS_TEXTURES_H_ // adapted from gl_warp.c #define MERIAN_TEXTUREEFFECT_QUAKE_WARPCALC(st, time) (2 * ((st) + 0.125 * sin(vec2(3 * (st).yx + 0.5 * (time))))) @@ -7,4 +7,4 @@ #define MERIAN_TEXTUREEFFECT_WAVES(st, time) (-vec2(.1, 0) * cos((st).x * 5 + (time) * 2) * pow(max(sin((st).x * 5 + (time) * 2), 0), 5) \ -vec2(.07, 0) * cos(-(st).x * 5 + -(st).y * 3 + (time) * 3) * pow(max(sin(-(st).x * 5 + -(st).y * 3 + (time) * 3), 0), 5)) -#endif // _TEXTURES_H_ +#endif // _MERIAN_SHADERS_TEXTURES_H_ diff --git a/include/merian-shaders/tonemap.glsl b/include/merian-shaders/tonemap.glsl index 3a16944..652c3cc 100644 --- a/include/merian-shaders/tonemap.glsl +++ b/include/merian-shaders/tonemap.glsl @@ -2,8 +2,8 @@ #include "merian-shaders/color/colors_srgb.glsl" #include "merian-shaders/common.glsl" -#ifndef _TONEMAP_H_ -#define _TONEMAP_H_ +#ifndef _MERIAN_SHADERS_TONEMAP_H_ +#define _MERIAN_SHADERS_TONEMAP_H_ vec3 tonemap_clamp(const vec3 rgb) { return clamp(rgb, vec3(0), vec3(1)); diff --git a/include/merian-shaders/transmittance.glsl b/include/merian-shaders/transmittance.glsl index 45a7047..eca350e 100644 --- a/include/merian-shaders/transmittance.glsl +++ b/include/merian-shaders/transmittance.glsl @@ -1,5 +1,5 @@ -#ifndef _TRANSMITTANCE_H_ -#define _TRANSMITTANCE_H_ +#ifndef _MERIAN_SHADERS_TRANSMITTANCE_H_ +#define _MERIAN_SHADERS_TRANSMITTANCE_H_ // Beer-Lambert law / Beer's law diff --git a/include/merian-shaders/types.glsl.h b/include/merian-shaders/types.glsl.h index ce5c0da..ed53b24 100644 --- a/include/merian-shaders/types.glsl.h +++ b/include/merian-shaders/types.glsl.h @@ -1,5 +1,5 @@ -#ifndef _TYPES_H_ -#define _TYPES_H_ +#ifndef _MERIAN_SHADERS_TYPES_H_ +#define _MERIAN_SHADERS_TYPES_H_ #ifdef __cplusplus diff --git a/include/merian-shaders/von_mises_fisher.glsl b/include/merian-shaders/von_mises_fisher.glsl index f4bad81..33299b0 100644 --- a/include/merian-shaders/von_mises_fisher.glsl +++ b/include/merian-shaders/von_mises_fisher.glsl @@ -1,8 +1,8 @@ #include "merian-shaders/common.glsl" #include "merian-shaders/frames.glsl" -#ifndef _VON_MISES_FISHER_H_ -#define _VON_MISES_FISHER_H_ +#ifndef _MERIAN_SHADERS_VON_MISES_FISHER_H_ +#define _MERIAN_SHADERS_VON_MISES_FISHER_H_ // Based on Wenzel Jakob, Numerically stable sampling of the von Mises Fisher distribution on S2 (and other tricks)