Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
xelatihy committed Jan 26, 2024
1 parent 1894941 commit 7907378
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 449 deletions.
42 changes: 0 additions & 42 deletions libs/yocto/yocto_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <stdexcept>

#include "yocto_color.h"
#include "yocto_noise.h"

// -----------------------------------------------------------------------------
// USING DIRECTIVES
Expand Down Expand Up @@ -343,47 +342,6 @@ image_t<vec4f> make_colormapramp(vec2i size, float scale) {
});
}

image_t<vec4f> make_noisemap(
vec2i size, float scale, vec4f color0, vec4f color1) {
return make_proc_image(size, [=](vec2f uv) {
uv *= 8 * scale;
auto v = perlin_noise(vec3f{uv.x, uv.y, 0});
v = clamp(v, 0.0f, 1.0f);
return lerp(color0, color1, v);
});
}

image_t<vec4f> make_fbmmap(
vec2i size, float scale, vec4f noise, vec4f color0, vec4f color1) {
return make_proc_image(size, [=](vec2f uv) {
uv *= 8 * scale;
auto v = perlin_fbm({uv.x, uv.y, 0}, noise.x, noise.y, (int)noise.z);
v = clamp(v, 0.0f, 1.0f);
return lerp(color0, color1, v);
});
}

image_t<vec4f> make_turbulencemap(
vec2i size, float scale, vec4f noise, vec4f color0, vec4f color1) {
return make_proc_image(size, [=](vec2f uv) {
uv *= 8 * scale;
auto v = perlin_turbulence({uv.x, uv.y, 0}, noise.x, noise.y, (int)noise.z);
v = clamp(v, 0.0f, 1.0f);
return lerp(color0, color1, v);
});
}

image_t<vec4f> make_ridgemap(
vec2i size, float scale, vec4f noise, vec4f color0, vec4f color1) {
return make_proc_image(size, [=](vec2f uv) {
uv *= 8 * scale;
auto v = perlin_ridge(
{uv.x, uv.y, 0}, noise.x, noise.y, (int)noise.z, noise.w);
v = clamp(v, 0.0f, 1.0f);
return lerp(color0, color1, v);
});
}

// Add image border
image_t<vec4f> add_border(
const image_t<vec4f>& image, float width, vec4f color) {
Expand Down
12 changes: 0 additions & 12 deletions libs/yocto/yocto_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,6 @@ image_t<vec4f> make_uvramp(vec2i size, float scale = 1);
image_t<vec4f> make_uvgrid(vec2i size, float scale = 1, bool colored = true);
// Make color map ramp.
image_t<vec4f> make_colormapramp(vec2i size, float scale = 1);
// Make a noise image. Noise parameters: lacunarity, gain, octaves, offset.
image_t<vec4f> make_noisemap(vec2i size, float scale = 1,
vec4f color0 = {0, 0, 0, 1}, vec4f color1 = {1, 1, 1, 1});
image_t<vec4f> make_fbmmap(vec2i size, float scale = 1,
vec4f noise = {2, 0.5, 8, 1}, vec4f color0 = {0, 0, 0, 1},
vec4f color1 = {1, 1, 1, 1});
image_t<vec4f> make_turbulencemap(vec2i size, float scale = 1,
vec4f noise = {2, 0.5, 8, 1}, vec4f color0 = {0, 0, 0, 1},
vec4f color1 = {1, 1, 1, 1});
image_t<vec4f> make_ridgemap(vec2i size, float scale = 1,
vec4f noise = {2, 0.5, 8, 1}, vec4f color0 = {0, 0, 0, 1},
vec4f color1 = {1, 1, 1, 1});

// Make a sunsky HDR model with sun at sun_angle elevation in [0,pif/2],
// turbidity in [1.7,10] with or without sun. The sun can be enabled or
Expand Down
Loading

0 comments on commit 7907378

Please sign in to comment.