Unify folder names
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
let project = new Project('plugins');
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
return project;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
#include <kinc/log.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user