expose setParameterBool/hasParameter on material + instance
This commit is contained in:
@@ -22,6 +22,12 @@ class FFIMaterial extends Material {
|
||||
Engine_destroyMaterialRenderThread(engine, pointer, cb);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> hasParameter(String propertyName) async {
|
||||
return Material_hasParameter(
|
||||
pointer, propertyName.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
}
|
||||
|
||||
class FFIMaterialInstance extends MaterialInstance {
|
||||
@@ -154,7 +160,13 @@ class FFIMaterialInstance extends MaterialInstance {
|
||||
@override
|
||||
Future setParameterTexture(String name, covariant FFITexture texture,
|
||||
covariant FFITextureSampler sampler) async {
|
||||
MaterialInstance_setParameterTexture(
|
||||
pointer, name.toNativeUtf8().cast<Char>(), texture.pointer, sampler.pointer);
|
||||
MaterialInstance_setParameterTexture(pointer,
|
||||
name.toNativeUtf8().cast<Char>(), texture.pointer, sampler.pointer);
|
||||
}
|
||||
|
||||
@override
|
||||
Future setParameterBool(String name, bool value) async {
|
||||
MaterialInstance_setParameterBool(
|
||||
pointer, name.toNativeUtf8().cast<Char>(), value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,13 @@ external ffi.Pointer<TMaterialInstance> Material_createInstance(
|
||||
ffi.Pointer<TMaterial> tMaterial,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TMaterial>, ffi.Pointer<ffi.Char>)>(
|
||||
isLeaf: true)
|
||||
external bool Material_hasParameter(
|
||||
ffi.Pointer<TMaterial> tMaterial,
|
||||
ffi.Pointer<ffi.Char> propertyName,
|
||||
);
|
||||
|
||||
@ffi.Native<ffi.Bool Function(ffi.Pointer<TMaterialInstance>)>(isLeaf: true)
|
||||
external bool MaterialInstance_isStencilWriteEnabled(
|
||||
ffi.Pointer<TMaterialInstance> materialInstance,
|
||||
@@ -60,7 +67,7 @@ external void MaterialInstance_setDepthCulling(
|
||||
ffi.Double, ffi.Double, ffi.Double, ffi.Double)>(isLeaf: true)
|
||||
external void MaterialInstance_setParameterFloat4(
|
||||
ffi.Pointer<TMaterialInstance> materialInstance,
|
||||
ffi.Pointer<ffi.Char> name,
|
||||
ffi.Pointer<ffi.Char> propertyName,
|
||||
double x,
|
||||
double y,
|
||||
double w,
|
||||
@@ -72,7 +79,7 @@ external void MaterialInstance_setParameterFloat4(
|
||||
ffi.Double, ffi.Double)>(isLeaf: true)
|
||||
external void MaterialInstance_setParameterFloat2(
|
||||
ffi.Pointer<TMaterialInstance> materialInstance,
|
||||
ffi.Pointer<ffi.Char> name,
|
||||
ffi.Pointer<ffi.Char> propertyName,
|
||||
double x,
|
||||
double y,
|
||||
);
|
||||
@@ -82,7 +89,7 @@ external void MaterialInstance_setParameterFloat2(
|
||||
ffi.Double)>(isLeaf: true)
|
||||
external void MaterialInstance_setParameterFloat(
|
||||
ffi.Pointer<TMaterialInstance> materialInstance,
|
||||
ffi.Pointer<ffi.Char> name,
|
||||
ffi.Pointer<ffi.Char> propertyName,
|
||||
double value,
|
||||
);
|
||||
|
||||
@@ -91,10 +98,19 @@ external void MaterialInstance_setParameterFloat(
|
||||
ffi.Int)>(isLeaf: true)
|
||||
external void MaterialInstance_setParameterInt(
|
||||
ffi.Pointer<TMaterialInstance> materialInstance,
|
||||
ffi.Pointer<ffi.Char> name,
|
||||
ffi.Pointer<ffi.Char> propertyName,
|
||||
int value,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<TMaterialInstance>, ffi.Pointer<ffi.Char>,
|
||||
ffi.Bool)>(isLeaf: true)
|
||||
external void MaterialInstance_setParameterBool(
|
||||
ffi.Pointer<TMaterialInstance> materialInstance,
|
||||
ffi.Pointer<ffi.Char> propertyName,
|
||||
bool value,
|
||||
);
|
||||
|
||||
@ffi.Native<
|
||||
ffi.Void Function(ffi.Pointer<TMaterialInstance>, ffi.Pointer<ffi.Char>,
|
||||
ffi.Pointer<TTexture>, ffi.Pointer<TTextureSampler>)>(isLeaf: true)
|
||||
|
||||
@@ -93,6 +93,7 @@ enum TransparencyMode {
|
||||
|
||||
abstract class Material {
|
||||
Future<MaterialInstance> createInstance();
|
||||
Future<bool> hasParameter(String propertyName);
|
||||
Future dispose();
|
||||
}
|
||||
|
||||
@@ -106,6 +107,7 @@ abstract class MaterialInstance {
|
||||
Future setParameterFloat2(String name, double x, double y);
|
||||
Future setParameterFloat(String name, double x);
|
||||
Future setParameterInt(String name, int value);
|
||||
Future setParameterBool(String name, bool value);
|
||||
Future setParameterTexture(
|
||||
String name, covariant Texture texture, covariant TextureSampler sampler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user