Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/noise.cc
| Show First 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | float hash_float_to_float(float3 k) | ||||
| return hash_to_float(hash_float(k)); | return hash_to_float(hash_float(k)); | ||||
| } | } | ||||
| float hash_float_to_float(float4 k) | float hash_float_to_float(float4 k) | ||||
| { | { | ||||
| return hash_to_float(hash_float(k)); | return hash_to_float(hash_float(k)); | ||||
| } | } | ||||
| float hash_float2_to_float(float2 k) | |||||
JacquesLucke: ```
[3/50] Building CXX object source/blender/blenlib/CMakeFiles/bf_blenlib.dir/intern/noise.cc. | |||||
| { | |||||
| return hash_to_float(hash_float(k.x), hash_float(k.y)); | |||||
| } | |||||
| float hash_float4_to_float(float4 k) | |||||
JacquesLuckeUnsubmitted Done Inline ActionsThis function isn't used. JacquesLucke: This function isn't used. | |||||
charlieAuthorUnsubmitted Done Inline ActionsI've included hash functions ready for other shaders. Maybe a separate commit? charlie: I've included hash functions ready for other shaders. Maybe a separate commit? | |||||
| { | |||||
| return hash_to_float(hash_float(k.x), hash_float(k.y), hash_float(k.z), hash_float(k.w)); | |||||
| } | |||||
| /* Hashing a number of floats into a float3 in the range [0, 1]. */ | |||||
| float3 hash_float_to_float3(float k) | |||||
| { | |||||
| return float3(hash_float_to_float(k), | |||||
| hash_float2_to_float(float2(k, 1.0)), | |||||
JacquesLuckeUnsubmitted Done Inline ActionsThat's probably for consistency, but it does look a bit unnecessary to hash the constant 1.0 as well. Fortunately, that will probably be optimized away by the compiler. JacquesLucke: That's probably for consistency, but it does look a bit unnecessary to hash the constant `1.0`… | |||||
charlieAuthorUnsubmitted Done Inline ActionsThis is a copy of the cycles code. Perhaps it can be optimised later if the compiler doesn't do that. charlie: This is a copy of the cycles code. Perhaps it can be optimised later if the compiler doesn't do… | |||||
| hash_float2_to_float(float2(k, 2.0))); | |||||
| } | |||||
| float3 hash_float_to_float3(float2 k) | |||||
| { | |||||
| return float3(hash_float2_to_float(k), | |||||
| hash_float_to_float(float3(k.x, k.y, 1.0)), | |||||
| hash_float_to_float(float3(k.x, k.y, 2.0))); | |||||
| } | |||||
| float3 hash_float_to_float3(float3 k) | |||||
| { | |||||
| return float3(hash_float_to_float(k), | |||||
| hash_float_to_float(float4(k.x, k.y, k.z, 1.0)), | |||||
| hash_float_to_float(float4(k.x, k.y, k.z, 2.0))); | |||||
| } | |||||
| float3 hash_float_to_float3(float4 k) | |||||
| { | |||||
| return float3(hash_float_to_float(k), | |||||
| hash_float_to_float(float4(k.z, k.x, k.w, k.y)), | |||||
| hash_float_to_float(float4(k.w, k.z, k.y, k.x))); | |||||
| } | |||||
| /* ------------ | /* ------------ | ||||
| * Perlin Noise | * Perlin Noise | ||||
| * ------------ | * ------------ | ||||
| * | * | ||||
| * Perlin, Ken. "Improving noise." Proceedings of the 29th annual conference on Computer graphics | * Perlin, Ken. "Improving noise." Proceedings of the 29th annual conference on Computer graphics | ||||
| * and interactive techniques. 2002. | * and interactive techniques. 2002. | ||||
| * | * | ||||
| * This implementation is functionally identical to the implementations in EEVEE, OSL, and SVM. So | * This implementation is functionally identical to the implementations in EEVEE, OSL, and SVM. So | ||||
| ▲ Show 20 Lines • Show All 467 Lines • Show Last 20 Lines | |||||
[3/50] Building CXX object source/blender/blenlib/CMakeFiles/bf_blenlib.dir/intern/noise.cc.o /home/jacques/blender-git/blender/source/blender/blenlib/intern/noise.cc:243:7: warning: no previous declaration for ‘float blender::noise::hash_float2_to_float(blender::float2)’ [-Wmissing-declarations] 243 | float hash_float2_to_float(float2 k) | ^~~~~~~~~~~~~~~~~~~~ /home/jacques/blender-git/blender/source/blender/blenlib/intern/noise.cc:248:7: warning: no previous declaration for ‘float blender::noise::hash_float4_to_float(blender::float4)’ [-Wmissing-declarations] 248 | float hash_float4_to_float(float4 k) | ^~~~~~~~~~~~~~~~~~~~I wonder, does this have to be a different function than hash_float_to_float(float2 k)? Maybe only one of the two is necessary. If only your new method is the one we should use, fine with me, but I'm not sure. Needs to be investigated.