extend to support rendering to RenderTarget/OpenGL texture on Linux
This commit is contained in:
@@ -5,18 +5,35 @@ cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# Project-level configuration.
|
||||
set(PROJECT_NAME "polyvox_filament")
|
||||
project(${PROJECT_NAME} LANGUAGES CXX)
|
||||
project(${PROJECT_NAME})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fPIC -Wno-unused-variable -Wno-unused-function")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wno-unused-variable")
|
||||
|
||||
# This value is used when generating builds using this plugin, so it must
|
||||
# not be changed.
|
||||
set(PLUGIN_NAME "polyvox_filament_plugin")
|
||||
|
||||
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
|
||||
add_library(FILAMENT_SHADERS SHARED
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/include/material/image_material.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/include/material/unlitopaque.c"
|
||||
)
|
||||
|
||||
# Define the plugin library target. Its name must not be changed (see comment
|
||||
# on PLUGIN_NAME above).
|
||||
#
|
||||
# Any new source files that you add to the plugin should be added here.
|
||||
add_library(${PLUGIN_NAME} SHARED
|
||||
"polyvox_filament_plugin.cc"
|
||||
"filament_texture.cc"
|
||||
"filament_pb_texture.cc"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/SceneAssetLoader.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/SceneAsset.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FilamentViewer.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/PolyvoxFilamentApi.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/StreamBufferAdapter.cpp"
|
||||
)
|
||||
|
||||
# Apply a standard set of build settings that are configured in the
|
||||
@@ -31,13 +48,57 @@ set_target_properties(${PLUGIN_NAME} PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden)
|
||||
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
|
||||
|
||||
target_compile_features(${PLUGIN_NAME} PRIVATE cxx_std_17)
|
||||
|
||||
# Source include directories and library dependencies. Add any plugin-specific
|
||||
# dependencies here.
|
||||
target_include_directories(${PLUGIN_NAME} INTERFACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
include_directories(../ios/src)
|
||||
include_directories(../ios/include)
|
||||
include_directories(../example/linux)
|
||||
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter)
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
|
||||
|
||||
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE
|
||||
FILAMENT_SHADERS
|
||||
geometry
|
||||
filament
|
||||
backend
|
||||
geometry
|
||||
filameshio
|
||||
viewer
|
||||
filamat
|
||||
utils
|
||||
filabridge
|
||||
gltfio_core
|
||||
filament-iblprefilter
|
||||
image
|
||||
camutils
|
||||
filaflat
|
||||
dracodec
|
||||
ibl
|
||||
ktxreader
|
||||
image
|
||||
imageio
|
||||
tinyexr
|
||||
stb
|
||||
EGL
|
||||
bluevk
|
||||
vkshaders
|
||||
bluegl
|
||||
uberzlib
|
||||
smol-v
|
||||
uberarchive
|
||||
meshoptimizer
|
||||
mathio
|
||||
-l:libmath.a
|
||||
geometry
|
||||
)
|
||||
|
||||
# List of absolute paths to libraries that should be bundled with the plugin.
|
||||
# This list could contain prebuilt libraries, or libraries created by an
|
||||
# external build triggered from this build file.
|
||||
|
||||
67
linux/filament_pb_texture.cc
Normal file
67
linux/filament_pb_texture.cc
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_pixel_buffer_texture.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include "include/polyvox_filament/filament_pb_texture.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
G_DEFINE_TYPE(FilamentPBTexture,
|
||||
filament_pb_texture,
|
||||
fl_pixel_buffer_texture_get_type())
|
||||
|
||||
|
||||
static gboolean video_texture_copy_pixels (FlPixelBufferTexture* texture,
|
||||
const uint8_t** out_buffer,
|
||||
uint32_t* width,
|
||||
uint32_t* height,
|
||||
GError** error) {
|
||||
|
||||
auto buffer = new std::vector<uint8_t>(400*200*4);
|
||||
for (int i = 0; i < 400*200*4; i++)
|
||||
{
|
||||
if(i%4 == 1 || i % 4 == 3) {
|
||||
buffer->at(i) = (uint8_t)255;
|
||||
} else {
|
||||
buffer->at(i) = (uint8_t)0;
|
||||
}
|
||||
}
|
||||
*width = 400;
|
||||
*height = 200;
|
||||
*out_buffer = buffer->data();
|
||||
std::cout << "COPY" << std::endl;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void filament_pb_texture_dispose(GObject* object) {
|
||||
G_OBJECT_CLASS(filament_pb_texture_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
void filament_pb_texture_class_init(FilamentPBTextureClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = filament_pb_texture_dispose;
|
||||
FL_PIXEL_BUFFER_TEXTURE_CLASS(klass)->copy_pixels = video_texture_copy_pixels;
|
||||
}
|
||||
|
||||
void filament_pb_texture_init(FilamentPBTexture* self) { }
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_pb_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar) {
|
||||
|
||||
auto pbTexture = FILAMENT_PB_TEXTURE(g_object_new(filament_pb_texture_get_type(), nullptr));
|
||||
|
||||
g_autoptr(FlTexture) texture = FL_TEXTURE(pbTexture);
|
||||
|
||||
if(fl_texture_registrar_register_texture(registrar, texture) == TRUE) {
|
||||
if(fl_texture_registrar_mark_texture_frame_available(registrar,
|
||||
texture) != TRUE) {
|
||||
std::cout << "FAILED" << std::endl;
|
||||
}
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
74
linux/filament_texture.cc
Normal file
74
linux/filament_texture.cc
Normal file
@@ -0,0 +1,74 @@
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include "include/polyvox_filament/filament_texture.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
G_DEFINE_TYPE(FilamentTextureGL,
|
||||
filament_texture_gl,
|
||||
fl_texture_gl_get_type())
|
||||
|
||||
static gboolean
|
||||
filament_texture_populate (FlTextureGL *texture,
|
||||
uint32_t *target,
|
||||
uint32_t *name,
|
||||
uint32_t *width,
|
||||
uint32_t *height,
|
||||
GError **error) {
|
||||
FilamentTextureGL *self = FILAMENT_TEXTURE_GL (texture);
|
||||
*target = GL_TEXTURE_2D;
|
||||
*name = self->texture_id;
|
||||
*width = self->width;
|
||||
*height = self->height;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void filament_texture_gl_dispose(GObject* object) {
|
||||
G_OBJECT_CLASS(filament_texture_gl_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
void filament_texture_gl_class_init(FilamentTextureGLClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = filament_texture_gl_dispose;
|
||||
FL_TEXTURE_GL_CLASS(klass)->populate = filament_texture_populate;
|
||||
}
|
||||
|
||||
void filament_texture_gl_init(FilamentTextureGL* self) { }
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar) {
|
||||
auto textureGL = FILAMENT_TEXTURE_GL(g_object_new(filament_texture_gl_get_type(), nullptr));
|
||||
textureGL->width = width;
|
||||
textureGL->height = height;
|
||||
|
||||
g_autoptr(FlTexture) texture = FL_TEXTURE(textureGL);
|
||||
|
||||
|
||||
glGenTextures(1, &textureGL->texture_id);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, textureGL->texture_id);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, textureGL->width, textureGL->height, 0, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
if(fl_texture_registrar_register_texture(registrar, texture) == TRUE) {
|
||||
|
||||
if(fl_texture_registrar_mark_texture_frame_available(registrar,
|
||||
texture) != TRUE) {
|
||||
std::cout << "FAILED" << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
44
linux/include/polyvox_filament/filament_pb_texture.h
Normal file
44
linux/include/polyvox_filament/filament_pb_texture.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef FILAMENT_PB_TEXTURE_H
|
||||
#define FILAMENT_PB_TEXTURE_H
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_pixel_buffer_texture.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
|
||||
|
||||
#ifdef FLUTTER_PLUGIN_IMPL
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define FLUTTER_PLUGIN_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define FILAMENT_PB_TEXTURE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), filament_pb_texture_get_type(), \
|
||||
FilamentPBTexture))
|
||||
|
||||
struct _FilamentPBTexture {
|
||||
FlPixelBufferTexture parent_instance;
|
||||
};
|
||||
|
||||
typedef struct _FilamentPBTexture FilamentPBTexture;
|
||||
typedef struct {
|
||||
FlPixelBufferTextureClass parent_instance;
|
||||
gboolean (*copy_pixels)(FlPixelBufferTexture* texture,
|
||||
const uint8_t** buffer,
|
||||
uint32_t* width,
|
||||
uint32_t* height,
|
||||
GError** error);
|
||||
|
||||
} FilamentPBTextureClass;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_pb_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar);
|
||||
|
||||
#endif
|
||||
48
linux/include/polyvox_filament/filament_texture.h
Normal file
48
linux/include/polyvox_filament/filament_texture.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef FILAMENT_TEXTURE_H
|
||||
#define FILAMENT_TEXTURE_H
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
|
||||
|
||||
#ifdef FLUTTER_PLUGIN_IMPL
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define FLUTTER_PLUGIN_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define FILAMENT_TEXTURE_GL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), filament_texture_gl_get_type(), \
|
||||
FilamentTextureGL))
|
||||
|
||||
struct _FilamentTextureGL {
|
||||
FlTextureGL parent_instance;
|
||||
GLuint texture_id;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
typedef struct _FilamentTextureGL FilamentTextureGL;
|
||||
typedef struct {
|
||||
FlTextureGLClass parent_instance;
|
||||
gboolean (*populate)(FlTextureGL* texture,
|
||||
uint32_t* target,
|
||||
uint32_t* name,
|
||||
uint32_t* width,
|
||||
uint32_t* height,
|
||||
GError** error);
|
||||
|
||||
GLuint texture_id;
|
||||
} FilamentTextureGLClass;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar);
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
#define FLUTTER_PLUGIN_POLYVOX_FILAMENT_PLUGIN_H_
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
3
linux/lib/libOGLCompiler.a
Normal file
3
linux/lib/libOGLCompiler.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4aaf436489ba71b8c6f5d921cad39f1c4e3104c176c374efae3a728e45d11502
|
||||
size 3940
|
||||
3
linux/lib/libOSDependent.a
Normal file
3
linux/lib/libOSDependent.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0327c66ed61c78233914909dcffc410fbb056faa6900d3db17d67459d3f31fa6
|
||||
size 5294
|
||||
3
linux/lib/libSPIRV-Tools-diff.a
Normal file
3
linux/lib/libSPIRV-Tools-diff.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ac1387628b4d7ebd89a3121815540256f46e5aaf397c3023d0974bcc3a85506f
|
||||
size 499778
|
||||
3
linux/lib/libSPIRV-Tools-link.a
Normal file
3
linux/lib/libSPIRV-Tools-link.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a75e67e06921513fb04dc8d5aaeb6b975eab1bab0bcd02d3a0a39398c162c6ac
|
||||
size 162318
|
||||
3
linux/lib/libSPIRV-Tools-lint.a
Normal file
3
linux/lib/libSPIRV-Tools-lint.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6b6bab1c7a792a4769f479ad55d0c116f8755c418ebe7d64292ccf7a6fbcb033
|
||||
size 273884
|
||||
3
linux/lib/libSPIRV-Tools-opt.a
Normal file
3
linux/lib/libSPIRV-Tools-opt.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:464c750b313575d2c2c62cf1ace18eb67813a654c12e9ab809b5e9b5a02b9160
|
||||
size 12709646
|
||||
3
linux/lib/libSPIRV-Tools-reduce.a
Normal file
3
linux/lib/libSPIRV-Tools-reduce.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:88f1ab1b62fec378637a8608d26e39a4f9cccfad68898fe132f1e7d56c57caa7
|
||||
size 836218
|
||||
3
linux/lib/libSPIRV-Tools.a
Normal file
3
linux/lib/libSPIRV-Tools.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:70c565068260155b85b1b20e3fc65469475f522fa38581482f4f15e984a8a26f
|
||||
size 4047794
|
||||
3
linux/lib/libSPIRV.a
Normal file
3
linux/lib/libSPIRV.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2933df356c0346f58d55c0682a6a9828561a3d0a3c16119220efe20d1467e4cc
|
||||
size 1773318
|
||||
3
linux/lib/libassimp.a
Normal file
3
linux/lib/libassimp.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aa3d111b7912c2e1e23fe382dcecd19a33091800da9e27635980de264cd89efe
|
||||
size 3880496
|
||||
3
linux/lib/libbackend.a
Normal file
3
linux/lib/libbackend.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ac4abd851be9f0eed4b95000baef7fa2b0409c1df337295cf5e1ef1b7d6dbaea
|
||||
size 1690468
|
||||
3
linux/lib/libbasis_encoder.a
Normal file
3
linux/lib/libbasis_encoder.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:17bd4166018341677a88d292dd7304a3fcf8a2e7fff90efda230baac0fdf2f1d
|
||||
size 1410760
|
||||
3
linux/lib/libbasis_transcoder.a
Normal file
3
linux/lib/libbasis_transcoder.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f35efb26c0143301cdee46e7362656970520f5f65d4b3c654d18b69e38cb9bc4
|
||||
size 537812
|
||||
3
linux/lib/libbenchmark.a
Normal file
3
linux/lib/libbenchmark.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2741667ac0e1e0e0272a80e1fc73de59bbbc39740e19fd79bd06c98a6269757e
|
||||
size 591234
|
||||
3
linux/lib/libbenchmark_main.a
Normal file
3
linux/lib/libbenchmark_main.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:22b4861b8b446fe1b1f5aa785ab09bb81d8eeae50bf5e428ac3043c08201fcf2
|
||||
size 2192
|
||||
3
linux/lib/libbluegl.a
Normal file
3
linux/lib/libbluegl.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:571e356344c8cad8c87708e92dde7889516b6f6b6b8c92a75fe2d1a53104cb54
|
||||
size 1135330
|
||||
3
linux/lib/libbluevk.a
Normal file
3
linux/lib/libbluevk.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bf814327734358793f6df11c88637b98b9ff9e5bd440a2dce8d9e51071c188dd
|
||||
size 175380
|
||||
3
linux/lib/libcamutils.a
Normal file
3
linux/lib/libcamutils.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3d56a24728acf4b18a12230984c6657e0f87e7d06196bc5870dc9af7d1f945e1
|
||||
size 60246
|
||||
3
linux/lib/libcivetweb.a
Normal file
3
linux/lib/libcivetweb.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:eb778f2052cdf43e20d4c5c6b0c9caedafaaec1cd67c093a017111bb0370ae6b
|
||||
size 300552
|
||||
3
linux/lib/libdracodec.a
Normal file
3
linux/lib/libdracodec.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:51072abd5dfbceece10028e281c9e03782b9b2ce26bccee0ee2df3a1f26f4529
|
||||
size 2554848
|
||||
3
linux/lib/libfilabridge.a
Normal file
3
linux/lib/libfilabridge.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:00631ea36f087c1bccdfc9ad093c80b337ca08819358385967ea9138603cd79e
|
||||
size 64946
|
||||
3
linux/lib/libfilaflat.a
Normal file
3
linux/lib/libfilaflat.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:007d156c68edfeb1d410094820acef98a5144a75b5858e0aa538af50eec3e59e
|
||||
size 43616
|
||||
3
linux/lib/libfilagui.a
Normal file
3
linux/lib/libfilagui.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:34eb1d23ed8172a1f889262c9a19e4f79c95cc400d81af242ae88920f3c6fc74
|
||||
size 114036
|
||||
3
linux/lib/libfilamat.a
Normal file
3
linux/lib/libfilamat.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0efa5a8a9ec3d114a9882d17e5231f24600250510743d2e25086b7973f945860
|
||||
size 29448180
|
||||
3
linux/lib/libfilamat_combined.a
Normal file
3
linux/lib/libfilamat_combined.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fdde9c8708cadcde670a376407c455b4b16c53892cbefa0d6436307c249e6eaf
|
||||
size 29448180
|
||||
3
linux/lib/libfilamat_lite.a
Normal file
3
linux/lib/libfilamat_lite.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6eb32aae2e7f732b7f22e8c169e795b8e67f67cd2469a158529353d74f56e4d5
|
||||
size 584682
|
||||
3
linux/lib/libfilament-iblprefilter.a
Normal file
3
linux/lib/libfilament-iblprefilter.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fc5486db22a0d01f16ef6f093cc737f950a9ed90f7f880651aa88061be4bb1aa
|
||||
size 52686
|
||||
3
linux/lib/libfilament.a
Normal file
3
linux/lib/libfilament.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f77735120c66966b7dd760510b3ec541cea2116e6098099520028156bec8b6fb
|
||||
size 2634676
|
||||
3
linux/lib/libfilamentapp-resources.a
Normal file
3
linux/lib/libfilamentapp-resources.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:32daace64e95eab47eeedcf41316a206ea7524242da5b978e11e5c126ccb1950
|
||||
size 1017810
|
||||
3
linux/lib/libfilamentapp.a
Normal file
3
linux/lib/libfilamentapp.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:38f04e48455161b25bb8c713713bee391ce7908f4f1881d1464585e7ad59b2d2
|
||||
size 356048
|
||||
3
linux/lib/libfilameshio.a
Normal file
3
linux/lib/libfilameshio.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c16ca38264d0b6e4c08680ee6038b94d7061fb9c19b4078d65ad0c764e717e2e
|
||||
size 39506
|
||||
3
linux/lib/libgeometry.a
Normal file
3
linux/lib/libgeometry.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e865b838a0e09daf6f77dff65aa833fab34d1d74acec95c2f19179e624ed26ef
|
||||
size 39390
|
||||
3
linux/lib/libgetopt.a
Normal file
3
linux/lib/libgetopt.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d30c6cbedc32007ec3100a1f5b683e5dd6183ef321ac953de09b9862b1e6d40d
|
||||
size 8016
|
||||
3
linux/lib/libglslang.a
Normal file
3
linux/lib/libglslang.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:de4997c7619ed8f581dc93fde892cbdb7a8a193c96f3f464a9164ce539cc876e
|
||||
size 4621260
|
||||
3
linux/lib/libgltf-demo-resources.a
Normal file
3
linux/lib/libgltf-demo-resources.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:696c21bc5f7c0b33f0779b508a47cffde4bbb0fd3e3e2be356fe8b0eb6567120
|
||||
size 3955646
|
||||
3
linux/lib/libgltfio.a
Normal file
3
linux/lib/libgltfio.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:04b04d76363603d7500243c2f1c03c84ac564a7207bc07464499ba9dc87d6d17
|
||||
size 46224
|
||||
3
linux/lib/libgltfio_core.a
Normal file
3
linux/lib/libgltfio_core.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:84680f658766b77a42775f10a0ad4a28acfbb4f7c42d62532ad22efa1c6b2ccf
|
||||
size 1127462
|
||||
3
linux/lib/libgtest.a
Normal file
3
linux/lib/libgtest.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4708f5c09ce031cc389ff2b2da2015c118f2e615846c4989a89900ce8b6b8547
|
||||
size 891830
|
||||
3
linux/lib/libibl-lite.a
Normal file
3
linux/lib/libibl-lite.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bb24571755f31e2730a42ba68c9f4b5d32ef7cacb007716cd98a08836e4ca1d5
|
||||
size 399434
|
||||
3
linux/lib/libibl.a
Normal file
3
linux/lib/libibl.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:78f779af48d685f2a62286e6677a099ee5901c317cbcb26fe539ced28d71b70b
|
||||
size 491202
|
||||
3
linux/lib/libimage.a
Normal file
3
linux/lib/libimage.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:28709bdf232b2069ae6e27a88bb0b75efa22de8699978c14bd9b5a99245ad5d7
|
||||
size 111950
|
||||
3
linux/lib/libimageio.a
Normal file
3
linux/lib/libimageio.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4e78d760c308860e373d864912f74a0c48a967eb761cf56cb6f57db530c3e05a
|
||||
size 210192
|
||||
3
linux/lib/libimgui.a
Normal file
3
linux/lib/libimgui.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0a21917307e13645d9dbcb80e516ce7fc0ec74a08f05fd6260741109ae213c59
|
||||
size 1984050
|
||||
3
linux/lib/libktxreader.a
Normal file
3
linux/lib/libktxreader.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:395dda9bc2487e5985eb391473915debc60d9ea922debfca0377abe35f95fe94
|
||||
size 76350
|
||||
3
linux/lib/libmatdbg.a
Normal file
3
linux/lib/libmatdbg.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4ba2e8232e23c7adee35713a8857329077c16936500decde0750c27dccf6f24d
|
||||
size 7384824
|
||||
3
linux/lib/libmatdbg_combined.a
Normal file
3
linux/lib/libmatdbg_combined.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7dfc57add9555eb8ff3973ff294f10c6dd45e4119be046bccceb45e4f91faef7
|
||||
size 7384824
|
||||
3
linux/lib/libmatdbg_resources.a
Normal file
3
linux/lib/libmatdbg_resources.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3c7227ca0aea3a171e1dba93bc434d9ea8e175d4f31cc52165ebdecb00282f8f
|
||||
size 23744
|
||||
3
linux/lib/libmath.a
Normal file
3
linux/lib/libmath.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:081baec257e5bb1056b5ddb16a88b1f640320f061cc3ceec053b90ae065cb594
|
||||
size 812
|
||||
3
linux/lib/libmathio.a
Normal file
3
linux/lib/libmathio.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:125e41bf05c5569bbab1a9a4e730952171f1d1ecd3c9ac51201c5b703b431d2e
|
||||
size 62396
|
||||
3
linux/lib/libmatlang.a
Normal file
3
linux/lib/libmatlang.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c2372bd1a5d8c119a61042f66e0cc153fe02b901bb4194379886e6960eccc158
|
||||
size 735324
|
||||
3
linux/lib/libmeshoptimizer.a
Normal file
3
linux/lib/libmeshoptimizer.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e71274e730f076b0e0c20e597b1d064bdb454c70b96329d671c386b0b7d27a18
|
||||
size 169098
|
||||
3
linux/lib/libpng.a
Normal file
3
linux/lib/libpng.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8ecd3731472c14aa487a51052f3becbbf12077e10c8373c66ef72559134cd70b
|
||||
size 380418
|
||||
3
linux/lib/libsample-resources.a
Normal file
3
linux/lib/libsample-resources.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:617c1a04b3ec1e41374faf6d8f37796c7ce1fd9fba72199f4ce873fccb4c3013
|
||||
size 8140782
|
||||
3
linux/lib/libsdl2.a
Normal file
3
linux/lib/libsdl2.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9991225fc5156f48ae4bb31f5b5cbba90978dd45b92fec3115cfc7d90fa61cac
|
||||
size 2029366
|
||||
3
linux/lib/libshaders.a
Normal file
3
linux/lib/libshaders.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3da1577af7d0a9b5e4fa5bfc266fff94422cec7146e37b9990ceb292de234009
|
||||
size 124252
|
||||
3
linux/lib/libsmol-v.a
Normal file
3
linux/lib/libsmol-v.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:70eb4839911aaa9dbcbdf70776b01090189549f300e6b93cc6f831084df222c3
|
||||
size 57012
|
||||
3
linux/lib/libspirv-cross-core.a
Normal file
3
linux/lib/libspirv-cross-core.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e4bd7682f5884060b1a8a374a7f9a0e73c5f1e1d747cde27fc98fdaa4040e37f
|
||||
size 914436
|
||||
3
linux/lib/libspirv-cross-glsl.a
Normal file
3
linux/lib/libspirv-cross-glsl.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f86993e4f2dcf29040046ec3aac2966f06bd430947a2f6cfc41ea62a8bca5d55
|
||||
size 1746516
|
||||
3
linux/lib/libspirv-cross-msl.a
Normal file
3
linux/lib/libspirv-cross-msl.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bd6b1dd81857b4c156bf4c8e10bcc2b55a4e811b67c1586845ed38dd54fc49e1
|
||||
size 2596394
|
||||
3
linux/lib/libstb.a
Normal file
3
linux/lib/libstb.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b1b6a3f52c0aab90f57b6065d619886f452e1864c88607eb9cfe05f74e55ebef
|
||||
size 142614
|
||||
3
linux/lib/libsuzanne-resources.a
Normal file
3
linux/lib/libsuzanne-resources.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fcf631b71a70fb97ac175a1c130c1718bc82f3b3127585903a2ac52855456bd0
|
||||
size 4403048
|
||||
3
linux/lib/libtinyexr.a
Normal file
3
linux/lib/libtinyexr.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bc8e80b0e43fcf1918b6e85368b2d72b20e392bc3badfca0481556e90568f305
|
||||
size 203598
|
||||
3
linux/lib/libuberarchive.a
Normal file
3
linux/lib/libuberarchive.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:23048d940fc084880caa0d7f4af294211684be363c63d0e74af7ff92a470c4a8
|
||||
size 1146036
|
||||
3
linux/lib/libuberzlib.a
Normal file
3
linux/lib/libuberzlib.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9e9a9a9f5f9bf270bc2dbe09b2688e04293d739b6552cc5cdf7cd8489ff71792
|
||||
size 32808
|
||||
3
linux/lib/libutils.a
Normal file
3
linux/lib/libutils.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:84c732d5da0b9db1ed45a76b5d2759194c39ffab3c05b1accb309bb3da179470
|
||||
size 309080
|
||||
3
linux/lib/libviewer.a
Normal file
3
linux/lib/libviewer.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3d118ef6f39b678b054bdaab6a6e0df3334f986c8a7e1f587f80c77f299118d4
|
||||
size 532758
|
||||
3
linux/lib/libvkshaders.a
Normal file
3
linux/lib/libvkshaders.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a525737650b7f894af676df385eab74ff4774fb6d682cd20d8d814e3c3a5abf0
|
||||
size 2358
|
||||
3
linux/lib/libz.a
Normal file
3
linux/lib/libz.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3fca5266e22d18bb79cda9d05e8484e2c3c7dcfd4d2893999aef2e1a6b4b1d32
|
||||
size 135482
|
||||
3
linux/lib/libzstd.a
Normal file
3
linux/lib/libzstd.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:df6e739b1345d375242b4c88a35ca0c751a3f26b4a921d7fdd643c99b106bcc5
|
||||
size 997970
|
||||
@@ -1,37 +1,176 @@
|
||||
#include "include/polyvox_filament/polyvox_filament_plugin.h"
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "include/polyvox_filament/filament_texture.h"
|
||||
#include "include/polyvox_filament/filament_pb_texture.h"
|
||||
|
||||
#include "FilamentViewer.hpp"
|
||||
extern "C" {
|
||||
#include "PolyvoxFilamentApi.h"
|
||||
}
|
||||
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <epoxy/glx.h>
|
||||
|
||||
#define POLYVOX_FILAMENT_PLUGIN(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), polyvox_filament_plugin_get_type(), \
|
||||
PolyvoxFilamentPlugin))
|
||||
|
||||
|
||||
struct _PolyvoxFilamentPlugin {
|
||||
GObject parent_instance;
|
||||
FlTextureRegistrar* texture_registrar;
|
||||
FlView* fl_view;
|
||||
|
||||
FlTexture* texture;
|
||||
void* _viewer;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(PolyvoxFilamentPlugin, polyvox_filament_plugin, g_object_get_type())
|
||||
|
||||
static map<uint32_t, void*> _file_assets;
|
||||
static uint32_t _i = 0;
|
||||
|
||||
static ResourceBuffer loadResource(const char* name) {
|
||||
|
||||
char cwd[PATH_MAX];
|
||||
if (getcwd(cwd, sizeof(cwd)) != NULL) {
|
||||
std::cout << "Current working dir: " << cwd << std::endl;
|
||||
}
|
||||
|
||||
string name_str(name);
|
||||
auto id = _i++;
|
||||
|
||||
if (name_str.rfind("file://", 0) == 0) {
|
||||
name_str = name_str.substr(7);
|
||||
}
|
||||
|
||||
name_str = string(cwd) + string("/") + name_str;
|
||||
|
||||
std::cout << "Loading resource at " << name_str.c_str() << std::endl;
|
||||
|
||||
streampos length;
|
||||
ifstream is(name_str, ios::binary);
|
||||
if(!is) {
|
||||
std::cout << "Failed to find resource at file path " << name_str.c_str() << std::endl;
|
||||
return ResourceBuffer(nullptr, 0, -1);
|
||||
}
|
||||
is.seekg (0, ios::end);
|
||||
length = is.tellg();
|
||||
char * buffer;
|
||||
buffer = new char [length];
|
||||
is.seekg (0, ios::beg);
|
||||
is.read (buffer, length);
|
||||
is.close();
|
||||
_file_assets[id] = buffer;
|
||||
return ResourceBuffer(buffer, length, id);
|
||||
}
|
||||
|
||||
static void freeResource(uint32_t id) {
|
||||
std::cout << "Freeing resource " << id << std::endl;
|
||||
auto it = _file_assets.find(id);
|
||||
if (it != _file_assets.end()) {
|
||||
free(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
// Called when a method call is received from Flutter.
|
||||
static void polyvox_filament_plugin_handle_method_call(
|
||||
PolyvoxFilamentPlugin* self,
|
||||
FlMethodCall* method_call) {
|
||||
|
||||
g_autoptr(FlMethodResponse) response = nullptr;
|
||||
|
||||
const gchar* method = fl_method_call_get_name(method_call);
|
||||
|
||||
if (strcmp(method, "getPlatformVersion") == 0) {
|
||||
struct utsname uname_data = {};
|
||||
uname(&uname_data);
|
||||
g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version);
|
||||
g_autoptr(FlValue) result = fl_value_new_string(version);
|
||||
if(strcmp(method, "initialize") == 0) {
|
||||
|
||||
if(self->_viewer) {
|
||||
std::cout << "Deleting existing viewer";
|
||||
filament_viewer_delete(self->_viewer);
|
||||
}
|
||||
|
||||
auto context = glXGetCurrentContext();
|
||||
|
||||
FlValue* args = fl_method_call_get_args(method_call);
|
||||
|
||||
const double width = fl_value_get_float(fl_value_get_list_value(args, 0));
|
||||
const double height = fl_value_get_float(fl_value_get_list_value(args, 1));
|
||||
|
||||
auto texture = create_filament_texture(uint32_t(width), uint32_t(height), self->texture_registrar);
|
||||
//auto texture = create_filament_pb_texture(uint32_t(width), uint32_t(height), self->texture_registrar);
|
||||
self->texture = texture;
|
||||
|
||||
g_autoptr(FlValue) result =
|
||||
fl_value_new_int(reinterpret_cast<int64_t>(texture));
|
||||
|
||||
self->_viewer = filament_viewer_new(
|
||||
(void*)context,
|
||||
loadResource,
|
||||
freeResource
|
||||
);
|
||||
|
||||
// don't pass a surface to the SwapChain as we are effectively creating a headless SwapChain that will render into a RenderTarget associated with a texture
|
||||
create_swap_chain(self->_viewer, nullptr, width, height);
|
||||
create_render_target(self->_viewer, ((FilamentTextureGL*)texture)->texture_id,width,height);
|
||||
|
||||
update_viewport_and_camera_projection(self->_viewer, width, height, 1.0f);
|
||||
|
||||
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
|
||||
} else if {
|
||||
|
||||
} else if(strcmp(method, "loadSkybox") == 0) {
|
||||
|
||||
FlValue* args = fl_method_call_get_args(method_call);
|
||||
|
||||
const gchar* path = fl_value_get_string(args);
|
||||
|
||||
load_skybox(self->_viewer, path);
|
||||
|
||||
g_autoptr(FlValue) result = fl_value_new_string("OK");
|
||||
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
|
||||
} else if(strcmp(method, "removeSkybox") == 0) {
|
||||
std::cout << "Removing skybox" << std::endl;
|
||||
remove_skybox(self->_viewer);
|
||||
g_autoptr(FlValue) result = fl_value_new_string("OK");
|
||||
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
|
||||
} else if(strcmp(method, "resize") == 0) {
|
||||
// val args = call.arguments as ArrayList<Int>
|
||||
// val width = args[0]
|
||||
// val height = args[1]
|
||||
// val scale = if(args.size > 2) (args[2] as Double).toFloat() else 1.0f
|
||||
// surfaceTexture!!.setDefaultBufferSize(width, height)
|
||||
// _lib.update_viewport_and_camera_projection(_viewer!!, width, height, scale);
|
||||
// result.success(null)
|
||||
} else if(strcmp(method, "render") == 0) {
|
||||
|
||||
render(self->_viewer, 0);
|
||||
g_autoptr(FlValue) result = fl_value_new_string("OK");
|
||||
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
|
||||
} else if(strcmp(method, "setBackgroundImage") == 0) {
|
||||
|
||||
FlValue* args = fl_method_call_get_args(method_call);
|
||||
|
||||
const gchar* path = fl_value_get_string(args);
|
||||
|
||||
set_background_image(self->_viewer, path);
|
||||
|
||||
g_autoptr(FlValue) result = fl_value_new_string("OK");
|
||||
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
|
||||
} else {
|
||||
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
|
||||
}
|
||||
@@ -59,10 +198,16 @@ void polyvox_filament_plugin_register_with_registrar(FlPluginRegistrar* registra
|
||||
PolyvoxFilamentPlugin* plugin = POLYVOX_FILAMENT_PLUGIN(
|
||||
g_object_new(polyvox_filament_plugin_get_type(), nullptr));
|
||||
|
||||
FlView* fl_view = fl_plugin_registrar_get_view(registrar);
|
||||
plugin->fl_view = fl_view;
|
||||
|
||||
plugin->texture_registrar =
|
||||
fl_plugin_registrar_get_texture_registrar(registrar);
|
||||
|
||||
g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
|
||||
g_autoptr(FlMethodChannel) channel =
|
||||
fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar),
|
||||
"polyvox_filament",
|
||||
"app.polyvox.filament/event",
|
||||
FL_METHOD_CODEC(codec));
|
||||
fl_method_channel_set_method_call_handler(channel, method_call_cb,
|
||||
g_object_ref(plugin),
|
||||
|
||||
Reference in New Issue
Block a user