Initial work in making it compatible with Epsilon
This commit is contained in:
50
src/EpsilonHook.cpp
Normal file
50
src/EpsilonHook.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "morph.h"
|
||||
|
||||
#define export extern "C" [[maybe_unused]]
|
||||
|
||||
export am::morph* create_morph(uint16_t width, uint16_t height, uint8_t img_a[], uint8_t img_b[]) {
|
||||
auto* morph = new am::morph();
|
||||
|
||||
morph->set_blob_delimiter (am::HSP);
|
||||
morph->set_blob_max_size (128);
|
||||
morph->set_blob_min_size (3);
|
||||
morph->set_blob_box_grip (16);
|
||||
morph->set_blob_box_samples(-1);
|
||||
morph->set_blob_threshold (128);
|
||||
morph->set_blob_number (1);
|
||||
morph->set_seed (0);
|
||||
morph->set_blob_rgba_weight(1);
|
||||
morph->set_blob_size_weight(0);
|
||||
morph->set_blob_xy_weight (0);
|
||||
morph->set_degeneration (10000);
|
||||
morph->set_density (2); // Higher than 1 sets fluid to 0.
|
||||
morph->set_motion (am::SPLINE);
|
||||
morph->set_fading (am::PERLIN);
|
||||
morph->set_threads (8);
|
||||
morph->set_cycle_length (100000);
|
||||
morph->set_feather (0);
|
||||
morph->set_keep_background (0);
|
||||
morph->set_finite (1);
|
||||
morph->set_show_blobs (am::TEXTURE);
|
||||
morph->set_fluid (0); // Higher than 0 sets density to 1.
|
||||
|
||||
|
||||
morph->set_resolution(width, height);
|
||||
for (int i = 0; i < width * height; i++) {
|
||||
auto real_index = i * 4;
|
||||
morph->add_pixel(0, am::create_pixel(i % width, i / width, img_a[real_index], img_a[real_index + 1],
|
||||
img_a[real_index + 2], img_a[real_index + 3]));
|
||||
}
|
||||
for (int i = 0; i < width * height; i++) {
|
||||
auto real_index = i * 4;
|
||||
morph->add_pixel(1, am::create_pixel(i % width, i / width, img_b[real_index], img_b[real_index + 1],
|
||||
img_b[real_index + 2], img_b[real_index + 3]));
|
||||
}
|
||||
|
||||
morph->compute();
|
||||
return morph;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export void delete_morph(am::morph* morph) { delete morph; }
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef ATOMORPH_OPENCV
|
||||
#include <opencv/cv.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#endif
|
||||
|
||||
#include "spline.h"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* See Copyright Notice in atomorph.h
|
||||
*/
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "atomorph.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user