use decompose/composeMatrix for transforms and add mouse controls for rotation

This commit is contained in:
Nick Fisher
2024-02-03 14:11:02 +08:00
parent 63a52025dd
commit 48a1c6dc0b
10 changed files with 204 additions and 64 deletions

View File

@@ -39,7 +39,7 @@ namespace polyvox
inline void updateTransform(EntityId e);
void setScale(EntityId e, float scale);
void setPosition(EntityId e, float x, float y, float z, bool relative);
void setRotation(EntityId e, float rads, float x, float y, float z);
void setRotation(EntityId e, float rads, float x, float y, float z, float w, bool relative);
const utils::Entity *getCameraEntities(EntityId e);
size_t getCameraEntityCount(EntityId e);
const utils::Entity *getLightEntities(EntityId e) const noexcept;
@@ -119,7 +119,5 @@ namespace polyvox
SceneAsset asset,
const char *entityName);
inline void updateTransform(SceneAsset &asset);
};
}

View File

@@ -147,7 +147,7 @@ extern "C"
FLUTTER_PLUGIN_EXPORT bool set_material_color(void *assetManager, EntityId asset, const char *meshName, int materialIndex, const float r, const float g, const float b, const float a);
FLUTTER_PLUGIN_EXPORT void transform_to_unit_cube(void *assetManager, EntityId asset);
FLUTTER_PLUGIN_EXPORT void set_position(void *assetManager, EntityId asset, float x, float y, float z, bool relative);
FLUTTER_PLUGIN_EXPORT void set_rotation(void *assetManager, EntityId asset, float rads, float x, float y, float z);
FLUTTER_PLUGIN_EXPORT void set_rotation(void *assetManager, EntityId asset, float rads, float x, float y, float z, float w, bool relative);
FLUTTER_PLUGIN_EXPORT void set_scale(void *assetManager, EntityId asset, float scale);
// Camera methods

View File

@@ -86,14 +86,6 @@ namespace polyvox {
// a slot to preload textures
filament::Texture* texture = nullptr;
// initialized to identity
math::mat4f position;
// initialized to identity
math::mat4f rotation;
float mScale = 1;
SceneAsset(
FilamentAsset* asset
) : asset(asset) {}