add method for setting material color
This commit is contained in:
@@ -615,7 +615,18 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
||||
case "setCameraFocusDistance":
|
||||
set_camera_focus_distance(viewer, call.arguments as! Float)
|
||||
result(true)
|
||||
|
||||
case "setMaterialColor":
|
||||
guard let args = call.arguments as? [Any], args.count == 5,
|
||||
let assetManager = args[0] as? Int64,
|
||||
let asset = args[1] as? EntityId,
|
||||
let meshName = args[2] as? String,
|
||||
let materialIndex = args[3] as? Int32,
|
||||
let color = args[4] as? [Double] else {
|
||||
result(FlutterError(code: "INVALID_ARGUMENTS", message: "Expected correct arguments for setMaterialColor", details: nil))
|
||||
return
|
||||
}
|
||||
set_material_color(unsafeBitCast(assetManager, to:UnsafeMutableRawPointer.self), asset, meshName, materialIndex, Float(color[0]), Float(color[1]), Float(color[2]), Float(color[3]))
|
||||
result(true)
|
||||
|
||||
case "hideMesh":
|
||||
guard let args = call.arguments as? [Any], args.count == 3,
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace polyvox {
|
||||
const utils::Entity* getLightEntities(EntityId e) const noexcept;
|
||||
size_t getLightEntityCount(EntityId e) const noexcept;
|
||||
void updateAnimations();
|
||||
bool setMaterialColor(EntityId e, const char* meshName, int materialInstance, const float r, const float g, const float b, const float a);
|
||||
|
||||
bool setMorphAnimationBuffer(
|
||||
EntityId entityId,
|
||||
|
||||
@@ -82,6 +82,7 @@ void remove_asset(const void* const viewer, EntityId asset);
|
||||
void clear_assets(const void* const viewer);
|
||||
void load_texture(void* assetManager, EntityId asset, const char *assetPath, int renderableIndex);
|
||||
void set_texture(void* assetManager, EntityId asset);
|
||||
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);
|
||||
void transform_to_unit_cube(void* assetManager, EntityId asset);
|
||||
void set_position(void* assetManager, EntityId asset, float x, float y, float z);
|
||||
void set_rotation(void* assetManager, EntityId asset, float rads, float x, float y, float z);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -337,6 +337,10 @@ extern "C" {
|
||||
// ((AssetManager*)assetManager)->setTexture();
|
||||
}
|
||||
|
||||
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) {
|
||||
return ((AssetManager*)assetManager)->setMaterialColor(asset, meshName, materialIndex, r, g, b, a);
|
||||
}
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT void transform_to_unit_cube(void* assetManager, EntityId asset) {
|
||||
((AssetManager*)assetManager)->transformToUnitCube(asset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user