i love you

main
Brett 2024-01-25 11:08:23 -05:00
parent a57311fb7f
commit 8dce8be241
6 changed files with 35 additions and 49 deletions

View File

@ -1,3 +1,3 @@
Start testing: Jan 25 09:22 EST
Start testing: Jan 25 10:57 EST
----------------------------------------------------------
End testing: Jan 25 09:22 EST
End testing: Jan 25 10:57 EST

View File

@ -196,22 +196,22 @@ DEF_FUNC_LIST(FUNC_ALLOW_TERMINALS, function_t::SCALAR, function_t::X, function_
* Create mappings
*/
#define FUNC_DEFINE(NAME, MIN_ARGS, MAX_ARGS, FUNC, ...) MIN_ARGS,
std::array<blt::i32, OPERATOR_COUNT> function_arg_min_map = {
[[maybe_unused]] static inline std::array<blt::i32, OPERATOR_COUNT> function_arg_min_map = {
FUNC_FUNCTIONS
};
#undef FUNC_DEFINE
#define FUNC_DEFINE(NAME, MIN_ARGS, MAX_ARGS, FUNC, ...) MAX_ARGS,
std::array<blt::i32, OPERATOR_COUNT> function_arg_max_map = {
[[maybe_unused]] static inline std::array<blt::i32, OPERATOR_COUNT> function_arg_max_map = {
FUNC_FUNCTIONS
};
#undef FUNC_DEFINE
#define FUNC_DEFINE(NAME, MIN_ARGS, MAX_ARGS, FUNC, ...) func_list<function_t>{__VA_ARGS__},
std::array<func_list<function_t>, OPERATOR_COUNT> function_arg_allowed_map = {
[[maybe_unused]] static inline std::array<func_list<function_t>, OPERATOR_COUNT> function_arg_allowed_map = {
FUNC_FUNCTIONS
};
#undef FUNC_DEFINE
#define FUNC_DEFINE(NAME, MIN_ARGS, MAX_ARGS, FUNC, ...) convert(func_list<function_t>{__VA_ARGS__}),
std::array<func_set<function_t>, OPERATOR_COUNT> function_arg_allowed_set_map = {
[[maybe_unused]] static inline std::array<func_set<function_t>, OPERATOR_COUNT> function_arg_allowed_set_map = {
FUNC_FUNCTIONS
};
#undef FUNC_DEFINE

View File

@ -114,6 +114,7 @@ class image
blt::vec3 color = std::visit(blt::lambda_visitor{
[](const image_data_t*) -> blt::vec3 {
BLT_ASSERT("There has been an error in the matrix. You should not have gotten here!");
return {};
},
[](const blt::vec3& v) -> blt::vec3 {
return v;

@ -1 +1 @@
Subproject commit 709db718275718e09b3c68bde3faa6d7c9701af8
Subproject commit 129f6e3fb9d6524e9fd6ece47f9bf4ea6f0a1a83

View File

@ -51,14 +51,14 @@ void f_noise(image& img, float x, float y, blt::size_t argc, const image** argv,
float scaleX = width;
float scaleY = height;
if (argc >= 1)
scaleX *= argv[0].get().x();
scaleX *= argv[0]->get().x();
if (argc > 1)
scaleY *= argv[1].get().x();
scaleY *= argv[1]->get().x();
auto val = stb_perlin_noise3(protect_div(x, scaleX, z),
protect_div(y, scaleY, z),
z, 0, 0, 0);
img.set({val, val, val}, x, y);
img.set({val, val, val}, static_cast<int>(x), static_cast<int>(y));
}
void f_cnoise(image& img, float x, float y, blt::size_t argc, const image** argv, const data_t& extra_data)
@ -72,17 +72,17 @@ void f_cnoise(image& img, float x, float y, blt::size_t argc, const image** argv
float scaleGY = height;
float scaleBY = height;
if (argc >= 1)
scaleRX *= argv[0].get().x();
scaleRX *= argv[0]->get().x();
if (argc > 1)
scaleRY *= argv[1].get().x();
scaleRY *= argv[1]->get().x();
if (argc >= 3)
scaleRX *= argv[2].get().x();
scaleRX *= argv[2]->get().x();
if (argc > 3)
scaleRY *= argv[3].get().x();
scaleRY *= argv[3]->get().x();
if (argc >= 5)
scaleRX *= argv[4].get().x();
scaleRX *= argv[4]->get().x();
if (argc > 5)
scaleRY *= argv[5].get().x();
scaleRY *= argv[5]->get().x();
auto valR = stb_perlin_noise3(protect_div(x, scaleRX, z),
protect_div(y, scaleRY, z),
@ -93,7 +93,7 @@ void f_cnoise(image& img, float x, float y, blt::size_t argc, const image** argv
auto valB = stb_perlin_noise3(protect_div(x, scaleBX, z),
protect_div(y, scaleBY, z),
z, 0, 0, 0);
img.set({valR, valG, valB}, x, y);
img.set({valR, valG, valB}, static_cast<int>(x), static_cast<int>(y));
}
void f_scalar(image& img, float x, float y, blt::size_t argc, const image** argv, const data_t& extra_data)

View File

@ -139,17 +139,17 @@ struct node
BLT_ASSERT(sub_nodes[i] != nullptr && sub_nodes[i]->img.has_value() && "Node must have evaluated children!");
sub_node_images[i] = &sub_nodes[i]->img.value();
}
#define FUNC_DEFINE(NAME, MIN_ARGS, MAX_ARGS, FUNC, ...) case function_t::NAME: { \
if (FUNC_ALLOW_TERMINALS_SET.contains(function_t::NAME)){ \
FUNC(img.value(), 0, 0, argc, sub_node_images.data(), data); \
} else { \
for (blt::i32 y = 0; y < height; y++) { \
for (blt::i32 x = 0; x < width; x++) { \
FUNC(img.value(), static_cast<float>(x), static_cast<float>(y), argc, sub_node_images.data(), data); \
} \
} \
} \
} \
#define FUNC_DEFINE(NAME, MIN_ARGS, MAX_ARGS, FUNC, ...) case function_t::NAME: { \
if (FUNC_ALLOW_TERMINALS_SET.contains(function_t::NAME)){ \
FUNC(img.value(), 0, 0, argc, const_cast<const image**>(sub_node_images.data()), data); \
} else { \
for (blt::i32 y = 0; y < height; y++) { \
for (blt::i32 x = 0; x < width; x++) { \
FUNC(img.value(), static_cast<float>(x), static_cast<float>(y), argc, const_cast<const image**>(sub_node_images.data()), data); \
} \
} \
} \
} \
break;
switch (type)
@ -223,28 +223,13 @@ void update(std::int32_t w, std::int32_t h)
root = node::construct_random_tree();
root->evaluate_tree();
BLT_INFO("Preprocess");
auto& data = root->getImage()->getData();
for (auto& v : data)
{
//BLT_INFO_STREAM << "B4: " << v.x() << " " << v.y() << " " << v.z() << " " << v.w() << "\n";
if (fucky(v.x()))
v[0] = 0;
if (fucky(v.y()))
v[1] = 0;
if (fucky(v.z()))
v[2] = 0;
v = v.normalize();
if (fucky(v.x()))
v[0] = 0;
if (fucky(v.y()))
v[1] = 0;
if (fucky(v.z()))
v[2] = 0;
//BLT_INFO_STREAM << "A4: " << v.x() << " " << v.y() << " " << v.z() << " " << v.w() << "\n";
}
BLT_INFO("Uploading");
texture->upload((void*) root->getImage()->getData().data(), GL_RGB, 0, 0, 0, -1, -1, GL_FLOAT);
//delete texture;
texture->upload((void*) root->getImage().getData().data(), GL_RGB, 0, 0, 0, -1, -1, GL_FLOAT);
//texture->upload((void*) test.data(), GL_RGBA, 0, 0, 0, width, height, GL_UNSIGNED_BYTE);
//texture->upload(file);
//texture = new blt::gfx::texture_gl2D(file);
resources.set("img", texture);
}
@ -252,7 +237,7 @@ void update(std::int32_t w, std::int32_t h)
auto lh = 512.0f;
//renderer_2d.drawRectangle(blt::vec4{0.5, 0.0, 1.0, 1.0},
// {static_cast<float>(w) / 2.0f, static_cast<float>(h) / 2.0f, static_cast<float>(w), static_cast<float>(h)});
renderer_2d.drawRectangle("cum", {static_cast<float>(w) / 2.0f, static_cast<float>(h) / 2.0f, lw, lh});
renderer_2d.drawRectangle("img", {static_cast<float>(w) / 2.0f, static_cast<float>(h) / 2.0f, lw, lh});
global_matrices.update();
renderer_2d.render();