add model/view matrix getters & manipulator options

This commit is contained in:
Nick Fisher
2023-11-03 15:20:15 +08:00
parent 83469e93b9
commit 58a9542121
18 changed files with 833 additions and 553 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <mutex>
#include <filament/Scene.h>
#include <gltfio/AssetLoader.h>
@@ -82,6 +84,7 @@ namespace polyvox {
gltfio::ResourceLoader* _gltfResourceLoader = nullptr;
gltfio::TextureProvider* _stbDecoder = nullptr;
gltfio::TextureProvider* _ktxDecoder = nullptr;
std::mutex _animationMutex;
vector<SceneAsset> _assets;
tsl::robin_map<EntityId, int> _entityIdLookup;

View File

@@ -92,6 +92,8 @@ namespace polyvox {
void setCameraExposure(float aperture, float shutterSpeed, float sensitivity);
void setCameraPosition(float x, float y, float z);
void setCameraRotation(float rads, float x, float y, float z);
const math::mat4 getCameraModelMatrix();
const math::mat4 getCameraViewMatrix();
void setCameraModelMatrix(const float* const matrix);
void setCameraFocalLength(float fl);
void setCameraFocusDistance(float focusDistance);
@@ -103,7 +105,7 @@ namespace polyvox {
void scrollUpdate(float x, float y, float delta);
void scrollEnd();
int32_t addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
EntityId addLight(LightManager::Type t, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
void removeLight(EntityId entityId);
void clearLights();
void setPostProcessing(bool enabled);

View File

@@ -144,8 +144,12 @@ FLUTTER_PLUGIN_EXPORT void move_camera_to_asset(const void* const viewer, Entity
FLUTTER_PLUGIN_EXPORT void set_view_frustum_culling(const void* const viewer, bool enabled);
FLUTTER_PLUGIN_EXPORT void set_camera_exposure(const void* const viewer, float aperture, float shutterSpeed, float sensitivity);
FLUTTER_PLUGIN_EXPORT void set_camera_position(const void* const viewer, float x, float y, float z);
FLUTTER_PLUGIN_EXPORT void get_camera_position(const void* const viewer);
FLUTTER_PLUGIN_EXPORT void set_camera_rotation(const void* const viewer, float rads, float x, float y, float z);
FLUTTER_PLUGIN_EXPORT void set_camera_model_matrix(const void* const viewer, const float *const matrix);
FLUTTER_PLUGIN_EXPORT const double* const get_camera_model_matrix(const void* const viewer);
FLUTTER_PLUGIN_EXPORT const double* const get_camera_view_matrix(const void* const viewer);
FLUTTER_PLUGIN_EXPORT const double* const get_camera_projection_matrix(const void* const viewer);
FLUTTER_PLUGIN_EXPORT void set_camera_focal_length(const void* const viewer, float focalLength);
FLUTTER_PLUGIN_EXPORT void set_camera_focus_distance(const void* const viewer, float focusDistance);
FLUTTER_PLUGIN_EXPORT int hide_mesh(void* assetManager, EntityId asset, const char* meshName);