Jackalope / JenExamples (public) (License: GPLv3 or later version) (since 2020-04-27) (hash sha1)
Examples for JEN framework:
- images modification and onscreen displaying;
- presudo-random noise data generation benchmark with SIMDCPP implementation comparison.

Define CMake variable JEN_PROJECT_DIR to path of JEN root project directory.
List of commits:
Subject Hash Author Date (UTC)
Added support for custom hash function for white noise in GLSL code. 6a2d79f322efc837e8110b39c5771e918c3eae52 TheArtOfGriefing 2020-05-15 12:24:43
Added license 986f3561f7a32c88e12dbd07c017a801d474a752 TheArtOfGriefing 2020-05-12 22:23:36
JEN is not submodule now 513a2aaaaf4834c0944b271f503d895717ecc06e TheArtOfGriefing 2020-05-12 18:39:53
updated framework, added tga image reading to image example a15f21e611f2116bd999a4a4d79ea1f6616e9c46 Jackalope 2020-05-11 07:53:53
Examples are updated for the new framework version 492108b8c695abccd90c83d65a0a80aa08dbaa55 TheArtOfGriefing 2020-05-08 23:40:07
image example 5d6e9a53c423fca0a45dfbac79fb3ff0a85b970f Jackalope 2020-05-04 18:02:13
benchmarking example for cpu and gpu running 1,2,3,4D simplex and white noise 16153303e47565e606b8bbb7807f49f8fa150c5d TheArtOfGriefing 2020-04-26 08:08:41
glsl shaders noise library implementation: 5 hash functions, 1,2,3,4D simplex noise; 1,2,3,4D white noise d2069f88bfb3e37945f1ed64b313c977fa6dd7f7 TheArtOfGriefing 2020-04-24 01:06:25
shaders and framework test ca8a9eabcb049baeac9ba82e82c6268f05d9ec3c TheArtOfGriefing 2020-03-10 07:43:17
shaders binary d74c5bc7da8fa263b0bf8b09ff070b9f2b9f94e1 TheArtOfGriefing 2020-03-09 05:02:44
added .gitignore 6b638f2d3aee483a87554322a235d3b23aeea92e TheArtOfGriefing 2020-03-09 05:01:59
added jen framework 0a17b9c9eb165ff74e9111e7a4720f50fe6fdc67 TheArtOfGriefing 2020-03-09 05:00:19
simplex and white noise compute shaders bdaba8a192ac8e148233c3428e4ca94ac9f56b9e TheArtOfGriefing 2020-03-09 02:09:01
Commit 6a2d79f322efc837e8110b39c5771e918c3eae52 - Added support for custom hash function for white noise in GLSL code.
Author: TheArtOfGriefing
Author date (UTC): 2020-05-15 12:24
Committer name: TheArtOfGriefing
Committer date (UTC): 2020-05-15 12:35
Parent(s): 986f3561f7a32c88e12dbd07c017a801d474a752
Signing key:
Tree: 2d78b433730a2d6fe02c8e4da6085391f39ff3f9
File Lines added Lines deleted
shaders/hash.glsl 5 6
shaders/noise.spv 0 0
shaders/simplex_noise.glsl 1 1
shaders/white_noise.glsl 11 5
src/noise_main.cpp 4 4
File shaders/hash.glsl changed (mode: 100644) (index 9652d50..5ba8ba5)
... ... int hash_fast(int a) {
40 40 a = a ^ (a >> 11); a = a ^ (a >> 11);
41 41 return a; return a;
42 42 } }
43 int hash_alternative(int hash) {
44 hash = (hash * hash * 60493) * hash;
45 return (hash >> 13) ^ hash;
43 int hash_alternative(int a) {
44 a = (a * a * 60493) * a;
45 return (a >> 13) ^ a;
46 46 } }
47 float hash_float(int hash) {
48 hash = hash * hash * 60493 * hash;
49 return float(hash) * (1.f / 2147483648.f);
47 float float_normalized_from_hash(int a) {
48 return a / 2147483648.f;
50 49 } }
51 50
52 51 #endif #endif
File shaders/noise.spv changed (mode: 100644) (index 6ebb93f..56da3ec)
File shaders/simplex_noise.glsl changed (mode: 100644) (index 0839bd3..f7bf37d)
19 19 #include "hash.glsl" #include "hash.glsl"
20 20
21 21 #ifndef HASH_FOO #ifndef HASH_FOO
22 #error hash function not defined
22 #error hash function is not defined
23 23 #endif #endif
24 24
25 25 #ifndef SIMPLEX_KERNEL_RADIUS_EXTENDED #ifndef SIMPLEX_KERNEL_RADIUS_EXTENDED
File shaders/white_noise.glsl changed (mode: 100644) (index cdb1f32..9032974)
17 17 * along with this library. If not, see <https://www.gnu.org/licenses/> * along with this library. If not, see <https://www.gnu.org/licenses/>
18 18 */ */
19 19 #include "hash.glsl" #include "hash.glsl"
20
20 #ifndef HASH_FOO
21 #error hash function is not defined
22 #endif
21 23 const int PRIMES[] = {1619, 6971, 31337, 193939}; const int PRIMES[] = {1619, 6971, 31337, 193939};
22 24
23 25 float white_noise(int seed, float x) { float white_noise(int seed, float x) {
24 26 int hash = PRIMES[0] * (floatBitsToInt(x) ^ (floatBitsToInt(x) >> 16)); int hash = PRIMES[0] * (floatBitsToInt(x) ^ (floatBitsToInt(x) >> 16));
25 return hash_float(seed ^ hash);
27 int a = seed ^ hash;
28 return float_normalized_from_hash(HASH_FOO(a));
26 29 } }
27 30 float white_noise(int seed, vec2 c) { float white_noise(int seed, vec2 c) {
28 31 ivec2 hash; ivec2 hash;
29 32 hash.x = PRIMES[0] * (floatBitsToInt(c.x) ^ (floatBitsToInt(c.x) >> 16)); hash.x = PRIMES[0] * (floatBitsToInt(c.x) ^ (floatBitsToInt(c.x) >> 16));
30 33 hash.y = PRIMES[1] * (floatBitsToInt(c.y) ^ (floatBitsToInt(c.y) >> 16)); hash.y = PRIMES[1] * (floatBitsToInt(c.y) ^ (floatBitsToInt(c.y) >> 16));
31 return hash_float(seed ^ hash.x ^ hash.y);
34 int a = seed ^ hash.x ^ hash.y;
35 return float_normalized_from_hash(HASH_FOO(a));
32 36 } }
33 37 float white_noise(int seed, vec3 c) { float white_noise(int seed, vec3 c) {
34 38 ivec3 hash; ivec3 hash;
35 39 hash.x = PRIMES[0] * (floatBitsToInt(c.x) ^ (floatBitsToInt(c.x) >> 16)); hash.x = PRIMES[0] * (floatBitsToInt(c.x) ^ (floatBitsToInt(c.x) >> 16));
36 40 hash.y = PRIMES[1] * (floatBitsToInt(c.y) ^ (floatBitsToInt(c.y) >> 16)); hash.y = PRIMES[1] * (floatBitsToInt(c.y) ^ (floatBitsToInt(c.y) >> 16));
37 41 hash.z = PRIMES[2] * (floatBitsToInt(c.z) ^ (floatBitsToInt(c.z) >> 16)); hash.z = PRIMES[2] * (floatBitsToInt(c.z) ^ (floatBitsToInt(c.z) >> 16));
38 return hash_float(seed ^ hash.x ^ hash.y ^ hash.z);
42 int a = seed ^ hash.x ^ hash.y ^ hash.z;
43 return float_normalized_from_hash(HASH_FOO(a));
39 44 } }
40 45 float white_noise(int seed, vec4 c) { float white_noise(int seed, vec4 c) {
41 46 ivec4 hash; ivec4 hash;
 
... ... ivec4 hash;
43 48 hash.y = PRIMES[1] * (floatBitsToInt(c.y) ^ (floatBitsToInt(c.y) >> 16)); hash.y = PRIMES[1] * (floatBitsToInt(c.y) ^ (floatBitsToInt(c.y) >> 16));
44 49 hash.z = PRIMES[2] * (floatBitsToInt(c.z) ^ (floatBitsToInt(c.z) >> 16)); hash.z = PRIMES[2] * (floatBitsToInt(c.z) ^ (floatBitsToInt(c.z) >> 16));
45 50 hash.w = PRIMES[3] * (floatBitsToInt(c.w) ^ (floatBitsToInt(c.w) >> 16)); hash.w = PRIMES[3] * (floatBitsToInt(c.w) ^ (floatBitsToInt(c.w) >> 16));
46 return hash_float(seed ^ hash.x ^ hash.y ^ hash.z ^ hash.w);
51 int a = seed ^ hash.x ^ hash.y ^ hash.z ^ hash.w;
52 return float_normalized_from_hash(HASH_FOO(a));
47 53 } }
File src/noise_main.cpp changed (mode: 100644) (index 5b692a3..dcbce2f)
... ... simd_simplex(u32 size, float step, i32 seed, f32 *p_dst)
86 86 template<simd::Level L> template<simd::Level L>
87 87 simd::pfloat<L> simd::pfloat<L>
88 88 white_simd(simd::pint<L> seed, jm::vector<1, simd::pfloat<L>> pos) { white_simd(simd::pint<L> seed, jm::vector<1, simd::pfloat<L>> pos) {
89 return noise::white<L>(seed, pos.x);
89 return noise::white<L, noise::hash_fast<L>>(seed, pos.x);
90 90 } }
91 91 template<simd::Level L> template<simd::Level L>
92 92 simd::pfloat<L> simd::pfloat<L>
93 93 white_simd(simd::pint<L> seed, jm::vector<2, simd::pfloat<L>> pos) { white_simd(simd::pint<L> seed, jm::vector<2, simd::pfloat<L>> pos) {
94 return noise::white<L>(seed, pos.x, pos.y);
94 return noise::white<L, noise::hash_fast<L>>(seed, pos.x, pos.y);
95 95 } }
96 96 template<simd::Level L> template<simd::Level L>
97 97 simd::pfloat<L> simd::pfloat<L>
98 98 white_simd(simd::pint<L> seed, jm::vector<3, simd::pfloat<L>> pos) { white_simd(simd::pint<L> seed, jm::vector<3, simd::pfloat<L>> pos) {
99 return noise::white<L>(seed, pos.x, pos.y, pos.z);
99 return noise::white<L, noise::hash_fast<L>>(seed, pos.x, pos.y, pos.z);
100 100 } }
101 101 template<simd::Level L> template<simd::Level L>
102 102 simd::pfloat<L> simd::pfloat<L>
103 103 white_simd(simd::pint<L> seed, jm::vector<4, simd::pfloat<L>> pos) { white_simd(simd::pint<L> seed, jm::vector<4, simd::pfloat<L>> pos) {
104 return noise::white<L>(seed, pos.x, pos.y, pos.z, pos.w);
104 return noise::white<L, noise::hash_fast<L>>(seed, pos.x, pos.y, pos.z, pos.w);
105 105 } }
106 106 template<simd::Level L, int D> template<simd::Level L, int D>
107 107 void white_simd(u32 size, float step, i32 seed, f32 *p_dst) { void white_simd(u32 size, float step, i32 seed, f32 *p_dst) {
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/Jackalope/JenExamples

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/Jackalope/JenExamples

Clone this repository using git:
git clone git://git.rocketgit.com/user/Jackalope/JenExamples

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main