This commit is contained in:
Nick Fisher
2023-04-18 15:12:23 +08:00
7 changed files with 19 additions and 32 deletions

View File

@@ -35,8 +35,6 @@ namespace polyvox {
private:
LoadResource _loadResource;
FreeResource _freeResource;
MaterialProvider* _materialProvider;
EntityManager* _entityManager;
AssetLoader* _assetLoader;
ResourceLoader* _resourceLoader;
NameComponentManager* _ncm;

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:738f663c400320f6c295f124543e698a241d8bac6065ac4b5c577f2248b97397
size 823816

View File

@@ -1 +0,0 @@
libpng16.a

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f9bff9a37abee1a3b792e882a327b114ebedc1458f7052675e8031ae16c786c
size 1310496

View File

@@ -16,8 +16,7 @@ SceneAssetLoader::SceneAssetLoader(LoadResource loadResource,
NameComponentManager *ncm,
Engine *engine,
Scene *scene)
: _loadResource(loadResource), _freeResource(freeResource), _materialProvider(materialProvider), _entityManager(entityManager),
_resourceLoader(resourceLoader), _ncm(ncm),
: _loadResource(loadResource), _freeResource(freeResource), _resourceLoader(resourceLoader), _ncm(ncm),
_engine(engine), _scene(scene) {
_assetLoader = AssetLoader::create({_engine, materialProvider, _ncm, entityManager});
}
@@ -111,21 +110,20 @@ SceneAsset *SceneAssetLoader::fromGlb(const char *uri) {
Log("Resources loaded.");
const Entity *entities = asset->getEntities();
// const Entity *entities = asset->getEntities();
RenderableManager &rm = _engine->getRenderableManager();
// RenderableManager &rm = _engine->getRenderableManager();
MaterialKey config;
auto mi_new = _materialProvider->createMaterialInstance(&config, nullptr);
// MaterialKey config;
// auto mi_new = _materialProvider->createMaterialInstance(&config, nullptr);
// why did I need to explicitly enable culling?
for (int i = 0; i < asset->getEntityCount(); i++) {
auto entityInstance = rm.getInstance(entities[i]);
auto mi = rm.getMaterialInstanceAt(entityInstance, 0);
// auto m = mi->getMaterial();
// auto shading = m->getShading();
// Log("Shading %d", shading);
}
// for (int i = 0; i < asset->getEntityCount(); i++) {
// auto entityInstance = rm.getInstance(entities[i]);
// auto mi = rm.getMaterialInstanceAt(entityInstance, 0);
// // auto m = mi->getMaterial();
// // auto shading = m->getShading();
// // Log("Shading %d", shading);
// }
auto lights = asset->getLightEntities();
_scene->addEntities(lights, asset->getLightEntityCount());

View File

@@ -103,7 +103,6 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
? null
: (d) async {
_scaling = true;
print("SCALE START");
if (d.pointerCount == 2) {
await widget.controller.zoomEnd();
await widget.controller.zoomBegin();
@@ -154,7 +153,6 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
onPointerDown: !widget.enableControls
? null
: (d) async {
print("piinterodoiwn");
if (d.buttons == kTertiaryButton || _rotating) {
await widget.controller.rotateStart(
d.localPosition.dx, d.localPosition.dy);
@@ -166,7 +164,6 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
onPointerMove: !widget.enableControls
? null
: (d) async {
print("pointermove");
if (d.buttons == kTertiaryButton || _rotating) {
await widget.controller.rotateUpdate(
d.localPosition.dx, d.localPosition.dy);
@@ -178,7 +175,6 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
onPointerUp: !widget.enableControls
? null
: (d) async {
print("pointerup");
if (d.buttons == kTertiaryButton || _rotating) {
await widget.controller.rotateEnd();
} else {

View File

@@ -125,9 +125,10 @@ static FlMethodResponse* _remove_ibl(PolyvoxFilamentPlugin* self, FlMethodCall*
static FlMethodResponse* _loadIbl(PolyvoxFilamentPlugin* self, FlMethodCall* method_call) {
FlValue* args = fl_method_call_get_args(method_call);
const gchar* path = fl_value_get_string(args);
auto path = fl_value_get_string(fl_value_get_list_value(args, 0));
auto intensity = fl_value_get_float(fl_value_get_list_value(args, 1));
load_ibl(self->_viewer, path);
load_ibl(self->_viewer, path, intensity);
g_autoptr(FlValue) result = fl_value_new_string("OK");
return FL_METHOD_RESPONSE(fl_method_success_response_new(result));
@@ -155,7 +156,7 @@ static FlMethodResponse* _set_background_image(PolyvoxFilamentPlugin* self, FlMe
static FlMethodResponse* _set_background_color(PolyvoxFilamentPlugin* self, FlMethodCall* method_call) {
const float* color = fl_value_get_float32_list(fl_method_call_get_args(method_call));
set_background_color(self->_viewer, color);
set_background_color(self->_viewer, color[0], color[1], color[2], color[2]);
g_autoptr(FlValue) result = fl_value_new_string("OK");
return FL_METHOD_RESPONSE(fl_method_success_response_new(result));
@@ -184,8 +185,9 @@ static FlMethodResponse* _add_light(PolyvoxFilamentPlugin* self, FlMethodCall* m
static FlMethodResponse* _load_glb(PolyvoxFilamentPlugin* self, FlMethodCall* method_call) {
FlValue* args = fl_method_call_get_args(method_call);
auto path = fl_value_get_string(args);
auto entityId = load_glb(self->_viewer, path);
auto path = fl_value_get_string(fl_value_get_list_value(args, 0));
auto unlit = fl_value_get_bool(fl_value_get_list_value(args, 1));
auto entityId = load_glb(self->_viewer, path, unlit);
g_autoptr(FlValue) result = fl_value_new_int((int64_t)entityId);
return FL_METHOD_RESPONSE(fl_method_success_response_new(result));
}