This commit is contained in:
luboslenco
2023-12-05 23:50:55 +01:00
parent 512e558b70
commit f63e7c32e6
47 changed files with 40 additions and 39 deletions
-42
View File
@@ -1,42 +0,0 @@
#include <v8.h>
#include <kinc/log.h>
using namespace v8;
static Isolate *isolate;
extern "C" {
void texsynth_inpaint(int w, int h, void *output_ptr, void *image_ptr, void *mask_ptr, bool tiling);
}
namespace {
void krom_texsynth_inpaint(const FunctionCallbackInfo<Value> &args) {
HandleScope scope(args.GetIsolate());
int32_t w = args[0]->ToInt32(isolate->GetCurrentContext()).ToLocalChecked()->Value();
int32_t h = args[1]->ToInt32(isolate->GetCurrentContext()).ToLocalChecked()->Value();
Local<ArrayBuffer> bufferOut = Local<ArrayBuffer>::Cast(args[2]);
std::shared_ptr<BackingStore> contentOut = bufferOut->GetBackingStore();
Local<ArrayBuffer> bufferImage = Local<ArrayBuffer>::Cast(args[3]);
std::shared_ptr<BackingStore> contentImage = bufferImage->GetBackingStore();
Local<ArrayBuffer> bufferMask = Local<ArrayBuffer>::Cast(args[4]);
std::shared_ptr<BackingStore> contentMask = bufferMask->GetBackingStore();
bool tiling = args[5]->ToBoolean(isolate)->Value();
texsynth_inpaint(w, h, contentOut->Data(), contentImage->Data(), contentMask->Data(), tiling);
}
}
#define SET_FUNCTION(object, name, fn)\
object->Set(String::NewFromUtf8(isolate, name).ToLocalChecked(),\
FunctionTemplate::New(isolate, fn, Local<v8::Value>(), Local<v8::Signature>(), 0,\
v8::ConstructorBehavior::kThrow, v8::SideEffectType::kHasNoSideEffect, nullptr))
void plugin_embed(Isolate *_isolate, Local<ObjectTemplate> global) {
isolate = _isolate;
Isolate::Scope isolate_scope(isolate);
HandleScope handle_scope(isolate);
Local<ObjectTemplate> krom_texsynth = ObjectTemplate::New(isolate);
SET_FUNCTION(krom_texsynth, "inpaint", krom_texsynth_inpaint);
global->Set(String::NewFromUtf8(isolate, "Krom_texsynth").ToLocalChecked(), krom_texsynth);
}
@@ -1,27 +0,0 @@
Copyright (c) 2019 Embark Studios
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
https://github.com/EmbarkStudios/texture-synthesis
-21
View File
@@ -1,21 +0,0 @@
let project = new Project('plugins');
project.addExclude('.git/**');
project.addExclude('build/**');
project.addFile('Sources/**');
project.addDefine('WITH_PLUGIN_EMBED');
if (platform === Platform.Windows) {
project.addLib('Sources/proc_texsynth/win32/texsynth');
}
else if (platform === Platform.Linux) {
process.env.LIBRARY_PATH = project.basedir + "/Sources/proc_texsynth/linux";
project.addLib('texsynth');
}
else if (platform === Platform.OSX) {
project.addLib('Sources/proc_texsynth/macos/libtexsynth.a');
}
resolve(project);