diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md index 14aed5d74..c0d482a67 100644 --- a/Content/Documentation/ScriptingAPI-Documentation.md +++ b/Content/Documentation/ScriptingAPI-Documentation.md @@ -144,6 +144,11 @@ You can use the Renderer with the following functions, all of which are in the g ### Sprite Render images on the screen. +- Params : ImageParams +- Anim : SpriteAnim + +
+ - [constructor]Sprite(opt string texture, opt string maskTexture) - SetParams(ImageParams effects) - GetParams() : ImageParams result @@ -152,6 +157,19 @@ Render images on the screen. #### ImageParams Specify Sprite properties, like position, size, etc. +- Pos : Vector +- Size : Vector +- Pivot : Vector +- Color : Vector +- Opacity : float +- Fade : float +- Rotation : float +- MipLevel : float +- TexOffset : Vector +- TexOffset2 : Vector + +
+ - [constructor]ImageParams(opt float width, opt float height) - [constructor]ImageParams(float posX, float posY, float width, opt float height) - GetPos() : Vector result @@ -222,6 +240,19 @@ Specify Sprite properties, like position, size, etc. #### SpriteAnim Animate Sprites easily with this helper. +- Rot : float +- Rotation : float +- Opacity : float +- Fade : float +- Repeatable : boolean +- Velocity : Vector +- ScaleX : float +- ScaleY : float +- MovingTexAnim : GetMovingTexAnim +- DrawRectAnim : GetDrawRectAnim + +
+ - [constructor]SpriteAnim() - SetRot(float val) - SetRotation(float val) @@ -265,6 +296,21 @@ Animate sprite frame by frame. ### SpriteFont Gives you the ability to render text with a custom font. +- Text : string +- Size : int +- Pos : Vector +- Spacing : Vector +- Align : WIFALIGN halign +- Color : Vector +- ShadowColor : Vector +- Bolden : float +- Softness : float +- ShadowBolden : float +- ShadowSoftness : float +- ShadowOffset : Vector + +
+ - [constructor]SpriteFont(opt string text) - SetStyle(string fontstyle, opt int size = 16) - SetText(opt string text) @@ -530,6 +576,12 @@ An integer mask that can be used to group entities together for certain operatio #### TransformComponent Describes an orientation in 3D space. +- Translation_local : Vector XYZ -- query the position in world space +- Rotation_local : Vector Quaternion -- query the rotation as a quaternion in world space +- Scale_local : Vector XYZ -- query the scaling in world space + +
+ - Scale(Vector vectorXYZ) -- Applies scaling - Rotate(Vector vectorRollPitchYaw) -- Applies rotation as roll,pitch,yaw - Translate(Vector vectorXYZ) -- Applies translation (position offset) @@ -595,6 +647,36 @@ Describes an orientation in 3D space. - GetAmount() : float result #### MaterialComponent +- BaseColor : Vector +- EmissiveColor : Vector +- EngineStencilRef : int +- UserStencilRef : int +- ShaderType : int +- UserBlendMode : int +- SpecularColor : Vector +- SubsurfaceScattering : Vector +- TexMulAdd : Vector +- Roughness : float +- Reflectance : float +- Metalness : float +- NormalMapStrength : float +- ParallaxOcclusionMapping : float +- DisplacementMapping : float +- Refraction : float +- Transmission : float +- AlphaRef : float +- SheenColor : Vector +- SheenRoughness : float +- Clearcoat : float +- ClearcoatRoughness : float +- ShadingRate : int +- TexAnimDirection : Vector +- TexAnimFrameRate : float +- texAnimElapsedTime : float +- customShaderID : int + +
+ - SetBaseColor(Vector value) - SetEmissiveColor(Vector value) - SetEngineStencilRef(int value) @@ -728,11 +810,10 @@ Describes a Rigid Body Physics object. - Restitution : float - LinearDamping : float - AngularDamping : float -- BoxParams : Vector -- SphereParams : float -- CapsuleParams : table -- [inner]radius : float -- [inner]height : float +- BoxParams_HalfExtents : Vector +- SphereParams_Radius : floatd +- CapsuleParams_Radius : float +- CapsuleParams_Reight : float - TargetMeshLOD : int
@@ -756,10 +837,9 @@ Describes a Force Field effector. #### WeatherComponent Describes a Rigid Body Physics object. -- WeatherParams: table -- Returns a table to modify weather parameters -- OceanParams : table -- Returns a table to modify ocean parameters (if ocean is enabled) -- AtmosphereParams : table -- Returns a table to modify atmosphere parameters -- VolumetricCloudParams : table -- Returns a table to modify volumetric cloud parameters +- OceanParameters : OceanParameters -- Returns a table to modify ocean parameters (if ocean is enabled) +- AtmosphereParameters : AtmosphereParameters -- Returns a table to modify atmosphere parameters +- VolumetricCloudParameters : VolumetricCloudParameters -- Returns a table to modify volumetric cloud parameters - SkyMapName : string -- Resource name for sky texture - ColorGradingMapName : string -- Resource name for color grading map @@ -923,6 +1003,11 @@ Axis Aligned Bounding Box. Can be intersected with other primitives. #### Sphere Sphere defined by center Vector and radius. Can be intersected with other primitives. +- Center : Vector +- Radius : float + +
+ - [constructor]Sphere(Vector center, float radius) - Intersects(AABB aabb) : bool result - Intersects(Sphere sphere) : bool result @@ -934,6 +1019,12 @@ Sphere defined by center Vector and radius. Can be intersected with other primit #### Capsule It's like two spheres connected by a cylinder. Base and Tip are the two endpoints, radius is the cylinder's radius. +- Base : Vector +- Tip : Vector +- Radius : float + +
+ - [constructor]Capsule(Vector base, tip, float radius) - Intersects(Capsule other) : bool result, Vector position, indicent_normal, float penetration_depth - Intersects(Ray ray) : bool result diff --git a/Content/scripts/class_parameters.lua b/Content/scripts/class_parameters.lua index 2215749d8..3aff0a775 100644 --- a/Content/scripts/class_parameters.lua +++ b/Content/scripts/class_parameters.lua @@ -8,7 +8,7 @@ ClearWorld() local scene = GetScene() -local sun_entity = scene.Entity_Create() +local sun_entity = CreateEntity() local sun_name = scene.Component_CreateName(sun_entity) sun_name.SetName("THE SUN") scene.Component_CreateLayer(sun_entity) @@ -18,23 +18,18 @@ local sun = scene.Component_CreateLight(sun_entity) sun.Type = 0 sun.Intensity = 10.0 -local weather_entity = scene.Entity_Create() +local weather_entity = CreateEntity() local weather_name = scene.Component_CreateName(weather_entity) weather_name.SetName("My Animated Weather") local weather = scene.Component_CreateWeather(weather_entity) weather.SetRealisticSky(true) weather.SetVolumetricClouds(true) +weather.skyExposure = 1.2 --- This is similiar to cloudparams = weather.GetVolumetricCloudParams() -local cloudparams = weather.VolumetricCloudParams -for key, _ in pairs(cloudparams) do - backlog_post("cloudparams." .. key) -end -cloudparams.CloudStartHeight = -100.0 -cloudparams.WeatherScale = 0.04 -cloudparams.WeatherDensityAmount = 0.5 -cloudparams.SkewAlongWindDirection = 5.0 -weather.VolumetricCloudParams = cloudparams +weather.VolumetricCloudParameters.CloudStartHeight = -100.0 +weather.VolumetricCloudParameters.WeatherScale = 0.04 +weather.VolumetricCloudParameters.WeatherDensityAmount = 0.5 +weather.VolumetricCloudParameters.SkewAlongWindDirection = 5.0 runProcess(function() while true do diff --git a/WickedEngine/wiImageParams_BindLua.cpp b/WickedEngine/wiImageParams_BindLua.cpp index 8ad3aaf27..aa6691ab0 100644 --- a/WickedEngine/wiImageParams_BindLua.cpp +++ b/WickedEngine/wiImageParams_BindLua.cpp @@ -50,6 +50,15 @@ namespace wi::lua { nullptr, nullptr } }; Luna::PropertyType ImageParams_BindLua::properties[] = { + lunaproperty(ImageParams_BindLua, Pos), + lunaproperty(ImageParams_BindLua, Size), + lunaproperty(ImageParams_BindLua, Pivot), + lunaproperty(ImageParams_BindLua, Color), + lunaproperty(ImageParams_BindLua, Opacity), + lunaproperty(ImageParams_BindLua, Fade), + lunaproperty(ImageParams_BindLua, Rotation), + lunaproperty(ImageParams_BindLua, TexOffset), + lunaproperty(ImageParams_BindLua, TexOffset2), { nullptr, nullptr } }; diff --git a/WickedEngine/wiLua.cpp b/WickedEngine/wiLua.cpp index 901e77827..5238f8e8d 100644 --- a/WickedEngine/wiLua.cpp +++ b/WickedEngine/wiLua.cpp @@ -436,6 +436,78 @@ namespace wi::lua lua_pushnil(L); } + int IntProperty::Get(lua_State* L) + { + SSetInt(L, *data); + return 1; + } + int IntProperty::Set(lua_State* L) + { + *data = SGetInt(L, 1); + return 0; + } + int LongProperty::Get(lua_State* L) + { + SSetLong(L, *data); + return 1; + } + int LongProperty::Set(lua_State* L) + { + *data = SGetLong(L, 1); + return 0; + } + int LongLongProperty::Get(lua_State* L) + { + SSetLongLong(L, *data); + return 1; + } + int LongLongProperty::Set(lua_State* L) + { + *data = SGetLongLong(L, 1); + return 0; + } + int FloatProperty::Get(lua_State* L) + { + SSetFloat(L, *data); + return 1; + } + int FloatProperty::Set(lua_State* L) + { + *data = SGetFloat(L, 1); + return 0; + } + int DoubleProperty::Get(lua_State* L) + { + SSetDouble(L, *data); + return 1; + } + int DoubleProperty::Set(lua_State* L) + { + *data = SGetDouble(L, 1); + return 0; + } + int StringProperty::Get(lua_State* L) + { + SSetString(L, *data); + return 1; + } + int StringProperty::Set(lua_State* L) + { + *data = SGetString(L, 1); + return 0; + } + int BoolProperty::Get(lua_State* L) + { + SSetBool(L, *data); + return 1; + } + int BoolProperty::Set(lua_State* L) + { + *data = SGetBool(L, 1); + return 0; + } + + void SError(lua_State* L, const std::string& error) { //retrieve line number for error info diff --git a/WickedEngine/wiLua.h b/WickedEngine/wiLua.h index 523c1b0b2..ccd0a3033 100644 --- a/WickedEngine/wiLua.h +++ b/WickedEngine/wiLua.h @@ -124,6 +124,84 @@ namespace wi::lua //push null to lua stack void SSetNull(lua_State* L); + //get-setters template for custom types + class LuaProperty + { + public: + virtual int Get(lua_State*L) = 0; + virtual int Set(lua_State*L) = 0; + }; + //get-setters for int type + class IntProperty final : public LuaProperty + { + public: + int *data; + IntProperty(){} + IntProperty(int* data): data(data) {} + int Get(lua_State* L); + int Set(lua_State* L); + }; + //get-setters for long type + class LongProperty final : public LuaProperty + { + public: + long* data; + LongProperty(){} + LongProperty(long* data): data(data) {} + int Get(lua_State* L); + int Set(lua_State* L); + }; + //get-setters for long long type + class LongLongProperty final : public LuaProperty + { + public: + long long* data; + LongLongProperty(){} + LongLongProperty(long long* data): data(data) {} + int Get(lua_State* L); + int Set(lua_State* L); + }; + //get-setters for int type + class FloatProperty final : public LuaProperty + { + public: + float* data; + FloatProperty(){} + FloatProperty(float* data): data(data) {} + int Get(lua_State* L); + int Set(lua_State* L); + }; + //get-setters for double type + class DoubleProperty final : public LuaProperty + { + public: + double* data; + DoubleProperty(){} + DoubleProperty(double* data): data(data) {} + int Get(lua_State* L); + int Set(lua_State* L); + }; + //get-setters for string type + class StringProperty final : public LuaProperty + { + public: + std::string* data; + StringProperty(){} + StringProperty(std::string* data): data(data) {} + int Get(lua_State* L); + int Set(lua_State* L); + }; + //get-setters for bool type + class BoolProperty final : public LuaProperty + { + public: + bool* data; + BoolProperty(){} + BoolProperty(bool* data): data(data) {} + int Get(lua_State* L); + int Set(lua_State* L); + }; + //throw error void SError(lua_State* L, const std::string& error = ""); diff --git a/WickedEngine/wiLuna.h b/WickedEngine/wiLuna.h index c21eda44e..c532127ed 100644 --- a/WickedEngine/wiLuna.h +++ b/WickedEngine/wiLuna.h @@ -6,6 +6,10 @@ #define lunamethod(class, name) {#name, &class::name} #define lunaproperty(class, name) {#name, &class::Get##name, &class::Set##name} +#define PropertyFunction(property) \ +int Get##property (lua_State* L) { return property.Get(L); }\ +int Set##property (lua_State* L) { return property.Set(L); } + template < class T > class Luna { public: diff --git a/WickedEngine/wiMath_BindLua.cpp b/WickedEngine/wiMath_BindLua.cpp index dedbdc52e..54ba30c90 100644 --- a/WickedEngine/wiMath_BindLua.cpp +++ b/WickedEngine/wiMath_BindLua.cpp @@ -437,6 +437,53 @@ namespace wi::lua + int VectorProperty::Get(lua_State* L) + { + if(data_f2) + { + Luna::push(L, new Vector_BindLua(XMLoadFloat2(data_f2))); + } + if(data_f3) + { + Luna::push(L, new Vector_BindLua(XMLoadFloat3(data_f3))); + } + if(data_f4) + { + Luna::push(L, new Vector_BindLua(XMLoadFloat4(data_f4))); + } + if(data_v) + { + Luna::push(L, new Vector_BindLua(*data_v)); + } + return 1; + } + int VectorProperty::Set(lua_State* L) + { + Vector_BindLua* get = Luna::lightcheck(L, 1); + if(get) + { + if(data_f2) + { + XMStoreFloat2(data_f2, XMLoadFloat4(get)); + } + if(data_f3) + { + XMStoreFloat3(data_f3, XMLoadFloat4(get)); + } + if(data_f4) + { + *data_f4 = *get; + } + if(data_v) + { + *data_v = XMLoadFloat4(get); + } + } + return 0; + } + + + const char Matrix_BindLua::className[] = "Matrix"; @@ -757,4 +804,34 @@ namespace wi::lua } } + + + int MatrixProperty::Get(lua_State *L) + { + if(data_f4x4) + { + Luna::push(L, new Matrix_BindLua(*data_f4x4)); + } + if(data_m) + { + Luna::push(L, new Matrix_BindLua(*data_m)); + } + return 1; + } + int MatrixProperty::Set(lua_State *L) + { + Matrix_BindLua* get = Luna::check(L, 1); + if(get) + { + if(data_f4x4) + { + *data_f4x4 = *get; + } + if(data_m) + { + *data_m = XMLoadFloat4x4(get); + } + } + return 0; + } } diff --git a/WickedEngine/wiMath_BindLua.h b/WickedEngine/wiMath_BindLua.h index 8d17c8a54..8c5914060 100644 --- a/WickedEngine/wiMath_BindLua.h +++ b/WickedEngine/wiMath_BindLua.h @@ -53,6 +53,23 @@ namespace wi::lua static void Bind(); }; + class VectorProperty final : public LuaProperty + { + public: + VectorProperty(){} + VectorProperty(XMFLOAT2* data): data_f2(data) {} + VectorProperty(XMFLOAT3* data): data_f3(data) {} + VectorProperty(XMFLOAT4* data): data_f4(data) {} + VectorProperty(XMVECTOR* data): data_v(data) {} + + int Get(lua_State*L); + int Set(lua_State*L); + private: + XMFLOAT2* data_f2; + XMFLOAT3* data_f3; + XMFLOAT4* data_f4; + XMVECTOR* data_v; + }; class Matrix_BindLua : public XMFLOAT4X4 { @@ -85,5 +102,17 @@ namespace wi::lua static void Bind(); }; - + class MatrixProperty final : public LuaProperty + { + public: + MatrixProperty(){} + MatrixProperty(XMFLOAT4X4* data): data_f4x4(data) {} + MatrixProperty(XMMATRIX* data): data_m(data) {} + + int Get(lua_State*L); + int Set(lua_State*L); + private: + XMFLOAT4X4* data_f4x4; + XMMATRIX* data_m; + }; } diff --git a/WickedEngine/wiPrimitive_BindLua.cpp b/WickedEngine/wiPrimitive_BindLua.cpp index ae2a661ee..5978dc4e3 100644 --- a/WickedEngine/wiPrimitive_BindLua.cpp +++ b/WickedEngine/wiPrimitive_BindLua.cpp @@ -276,6 +276,8 @@ namespace wi::lua::primitive { NULL, NULL } }; Luna::PropertyType Sphere_BindLua::properties[] = { + lunaproperty(Sphere_BindLua, Center), + lunaproperty(Sphere_BindLua, Radius), { NULL, NULL } }; @@ -399,6 +401,9 @@ namespace wi::lua::primitive { NULL, NULL } }; Luna::PropertyType Capsule_BindLua::properties[] = { + lunaproperty(Capsule_BindLua, Base), + lunaproperty(Capsule_BindLua, Tip), + lunaproperty(Capsule_BindLua, Radius), { NULL, NULL } }; diff --git a/WickedEngine/wiScene_BindLua.cpp b/WickedEngine/wiScene_BindLua.cpp index 2b4da91aa..565cb3f35 100644 --- a/WickedEngine/wiScene_BindLua.cpp +++ b/WickedEngine/wiScene_BindLua.cpp @@ -323,6 +323,9 @@ void Bind() Luna::Register(L); Luna::Register(L); Luna::Register(L); + Luna::Register(L); + Luna::Register(L); + Luna::Register(L); Luna::Register(L); Luna::Register(L); Luna::Register(L); @@ -337,7 +340,6 @@ Luna::FunctionType Scene_BindLua::methods[] = { lunamethod(Scene_BindLua, Update), lunamethod(Scene_BindLua, Clear), lunamethod(Scene_BindLua, Merge), - lunamethod(Scene_BindLua, Entity_Create), lunamethod(Scene_BindLua, Entity_FindByName), lunamethod(Scene_BindLua, Entity_Remove), lunamethod(Scene_BindLua, Entity_Duplicate), @@ -467,12 +469,6 @@ int Scene_BindLua::Merge(lua_State* L) return 0; } -int Scene_BindLua::Entity_Create(lua_State* L) -{ - Entity entity = wi::ecs::CreateEntity(); - wi::lua::SSetLongLong(L, entity); - return 1; -} int Scene_BindLua::Entity_FindByName(lua_State* L) { int argc = wi::lua::SGetArgCount(L); @@ -1782,6 +1778,9 @@ Luna::FunctionType TransformComponent_BindLua::metho { NULL, NULL } }; Luna::PropertyType TransformComponent_BindLua::properties[] = { + lunaproperty(TransformComponent_BindLua, Translation_local), + lunaproperty(TransformComponent_BindLua, Rotation_local), + lunaproperty(TransformComponent_BindLua, Scale_local), { NULL, NULL } }; @@ -2399,6 +2398,34 @@ Luna::FunctionType MaterialComponent_BindLua::methods { NULL, NULL } }; Luna::PropertyType MaterialComponent_BindLua::properties[] = { + lunaproperty(MaterialComponent_BindLua, BaseColor), + lunaproperty(MaterialComponent_BindLua, EmissiveColor), + lunaproperty(MaterialComponent_BindLua, EngineStencilRef), + lunaproperty(MaterialComponent_BindLua, UserStencilRef), + + lunaproperty(MaterialComponent_BindLua, ShaderType), + lunaproperty(MaterialComponent_BindLua, UserBlendMode), + lunaproperty(MaterialComponent_BindLua, SpecularColor), + lunaproperty(MaterialComponent_BindLua, SubsurfaceScattering), + lunaproperty(MaterialComponent_BindLua, TexMulAdd), + lunaproperty(MaterialComponent_BindLua, Roughness), + lunaproperty(MaterialComponent_BindLua, Reflectance), + lunaproperty(MaterialComponent_BindLua, Metalness), + lunaproperty(MaterialComponent_BindLua, NormalMapStrength), + lunaproperty(MaterialComponent_BindLua, ParallaxOcclusionMapping), + lunaproperty(MaterialComponent_BindLua, DisplacementMapping), + lunaproperty(MaterialComponent_BindLua, Refraction), + lunaproperty(MaterialComponent_BindLua, Transmission), + lunaproperty(MaterialComponent_BindLua, AlphaRef), + lunaproperty(MaterialComponent_BindLua, SheenColor), + lunaproperty(MaterialComponent_BindLua, SheenRoughness), + lunaproperty(MaterialComponent_BindLua, Clearcoat), + lunaproperty(MaterialComponent_BindLua, ClearcoatRoughness), + lunaproperty(MaterialComponent_BindLua, ShadingRate), + lunaproperty(MaterialComponent_BindLua, TexAnimDirection), + lunaproperty(MaterialComponent_BindLua, TexAnimFrameRate), + lunaproperty(MaterialComponent_BindLua, texAnimElapsedTime), + lunaproperty(MaterialComponent_BindLua, customShaderID), { NULL, NULL } }; @@ -2415,6 +2442,11 @@ MaterialComponent_BindLua::~MaterialComponent_BindLua() } } +int MaterialComponent_BindLua::GetBaseColor(lua_State* L) +{ + Luna::push(L, new Vector_BindLua(component->baseColor)); + return 1; +} int MaterialComponent_BindLua::SetBaseColor(lua_State* L) { int argc = wi::lua::SGetArgCount(L); @@ -2439,6 +2471,11 @@ int MaterialComponent_BindLua::SetBaseColor(lua_State* L) return 0; } +int MaterialComponent_BindLua::GetEmissiveColor(lua_State* L) +{ + Luna::push(L, new Vector_BindLua(component->emissiveColor)); + return 1; +} int MaterialComponent_BindLua::SetEmissiveColor(lua_State* L) { int argc = wi::lua::SGetArgCount(L); @@ -2463,6 +2500,11 @@ int MaterialComponent_BindLua::SetEmissiveColor(lua_State* L) return 0; } +int MaterialComponent_BindLua::GetEngineStencilRef(lua_State* L) +{ + wi::lua::SSetInt(L, (int)component->engineStencilRef); + return 1; +} int MaterialComponent_BindLua::SetEngineStencilRef(lua_State* L) { int argc = wi::lua::SGetArgCount(L); @@ -2477,6 +2519,11 @@ int MaterialComponent_BindLua::SetEngineStencilRef(lua_State* L) return 0; } +int MaterialComponent_BindLua::GetUserStencilRef(lua_State* L) +{ + wi::lua::SSetInt(L, (int)component->userStencilRef); + return 1; +} int MaterialComponent_BindLua::SetUserStencilRef(lua_State* L) { int argc = wi::lua::SGetArgCount(L); @@ -3501,6 +3548,10 @@ int ScriptComponent_BindLua::Stop(lua_State* L) const char RigidBodyPhysicsComponent_BindLua::className[] = "RigidBodyPhysicsComponent"; Luna::FunctionType RigidBodyPhysicsComponent_BindLua::methods[] = { + lunamethod(RigidBodyPhysicsComponent_BindLua, IsDisableDeactivation), + lunamethod(RigidBodyPhysicsComponent_BindLua, IsKinematic), + lunamethod(RigidBodyPhysicsComponent_BindLua, SetDisableDeactivation), + lunamethod(RigidBodyPhysicsComponent_BindLua, SetKinematic), { NULL, NULL } }; Luna::PropertyType RigidBodyPhysicsComponent_BindLua::properties[] = { @@ -3510,9 +3561,10 @@ Luna::PropertyType RigidBodyPhysicsComponent_ lunaproperty(RigidBodyPhysicsComponent_BindLua, Restitution), lunaproperty(RigidBodyPhysicsComponent_BindLua, LinearDamping), lunaproperty(RigidBodyPhysicsComponent_BindLua, AngularDamping), - lunaproperty(RigidBodyPhysicsComponent_BindLua, BoxParams), - lunaproperty(RigidBodyPhysicsComponent_BindLua, SphereParams), - lunaproperty(RigidBodyPhysicsComponent_BindLua, CapsuleParams), + lunaproperty(RigidBodyPhysicsComponent_BindLua, BoxParams_HalfExtents), + lunaproperty(RigidBodyPhysicsComponent_BindLua, SphereParams_Radius), + lunaproperty(RigidBodyPhysicsComponent_BindLua, CapsuleParams_Radius), + lunaproperty(RigidBodyPhysicsComponent_BindLua, CapsuleParams_Height), lunaproperty(RigidBodyPhysicsComponent_BindLua, TargetMeshLOD), { NULL, NULL } }; @@ -3530,247 +3582,6 @@ RigidBodyPhysicsComponent_BindLua::~RigidBodyPhysicsComponent_BindLua() } } -int RigidBodyPhysicsComponent_BindLua::GetShape(lua_State* L) -{ - wi::lua::SSetInt(L, component->shape); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetShape(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->shape = (RigidBodyPhysicsComponent::CollisionShape)wi::lua::SGetInt(L, 1); - } - else - { - wi::lua::SError(L, "SetShape(enum shape) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetMass(lua_State* L) -{ - wi::lua::SSetFloat(L, component->mass); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetMass(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->mass = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetMass(float value) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetFriction(lua_State* L) -{ - wi::lua::SSetFloat(L, component->friction); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetFriction(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->friction = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetMass(float value) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetRestitution(lua_State* L) -{ - wi::lua::SSetFloat(L, component->restitution); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetRestitution(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->restitution = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetRestitution(float value) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetLinearDamping(lua_State* L) -{ - wi::lua::SSetFloat(L, component->damping_linear); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetLinearDamping(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->damping_linear = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetLinearDamping(float value) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetAngularDamping(lua_State* L) -{ - wi::lua::SSetFloat(L, component->damping_angular); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetAngularDamping(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->damping_angular = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetAngularDamping(float value) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetBoxParams(lua_State* L) -{ - lua_newtable(L); - XMVECTOR V = XMLoadFloat3(&component->box.halfextents); - Luna::push(L, new Vector_BindLua(V)); - lua_setfield(L, -2, "halfextents"); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetBoxParams(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - bool error = false; - lua_pushnil(L); - Vector_BindLua* halfextents = Luna::lightcheck(L, -1); - if (halfextents != nullptr) - { - XMStoreFloat3(&component->box.halfextents, XMLoadFloat4(halfextents)); - } - else error = true; - - if (error) - { - wi::lua::SError(L,"SetBoxParams(table params) supplied data is invalid!"); - } - } - else - { - wi::lua::SError(L, "SetBoxParams(table params) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetSphereParams(lua_State* L) -{ - lua_newtable(L); - wi::lua::SSetFloat(L, component->sphere.radius); - lua_setfield(L, -2, "radius"); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetSphereParams(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - bool error = false; - lua_pushnil(L); - if (lua_type(L, -1) == LUA_TNUMBER) - { - component->sphere.radius = wi::lua::SGetFloat(L, -1); - } - else error = true; - - if (error) - { - wi::lua::SError(L,"SetSphereParams(table params) supplied data is invalid!"); - } - } - else - { - wi::lua::SError(L, "SetSphereParams(table params) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetCapsuleParams(lua_State* L) -{ - lua_newtable(L); - wi::lua::SSetFloat(L, component->capsule.radius); - lua_setfield(L, -2, "radius"); - wi::lua::SSetFloat(L, component->capsule.height); - lua_setfield(L, -2, "height"); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetCapsuleParams(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - bool error = false; - - lua_pushnil(L); - while(lua_next(L, 1)) - { - std::string header = wi::lua::SGetString(L, -2); - if (lua_type(L, -1) == LUA_TNUMBER) - { - if(header == "radius") - { - component->capsule.radius = wi::lua::SGetFloat(L, -1); - } - if(header == "height") - { - component->capsule.height = wi::lua::SGetFloat(L, -1); - } - } - else - { - error = true; - break; - } - - lua_pop(L, 1); - } - - if (error) - { - wi::lua::SError(L,"SetCapsuleParams(table params) supplied data is invalid!"); - } - } - else - { - wi::lua::SError(L, "SetCapsuleParams(table params) not enough arguments!"); - } - return 0; -} -int RigidBodyPhysicsComponent_BindLua::GetTargetMeshLOD(lua_State* L) -{ - wi::lua::SSetInt(L, component->mesh_lod); - return 1; -} -int RigidBodyPhysicsComponent_BindLua::SetTargetMeshLOD(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->mesh_lod = wi::lua::SGetInt(L, 1); - } - else - { - wi::lua::SError(L, "SetAngularDamping(float value) not enough arguments!"); - } - return 0; -} int RigidBodyPhysicsComponent_BindLua::IsDisableDeactivation(lua_State* L) { wi::lua::SSetBool(L, component->IsDisableDeactivation()); @@ -3819,6 +3630,9 @@ int RigidBodyPhysicsComponent_BindLua::SetKinematic(lua_State* L) const char SoftBodyPhysicsComponent_BindLua::className[] = "SoftBodyPhysicsComponent"; Luna::FunctionType SoftBodyPhysicsComponent_BindLua::methods[] = { + lunamethod(SoftBodyPhysicsComponent_BindLua, SetDisableDeactivation), + lunamethod(SoftBodyPhysicsComponent_BindLua, IsDisableDeactivation), + lunamethod(SoftBodyPhysicsComponent_BindLua, CreateFromMesh), { NULL, NULL } }; Luna::PropertyType SoftBodyPhysicsComponent_BindLua::properties[] = { @@ -3841,58 +3655,21 @@ SoftBodyPhysicsComponent_BindLua::~SoftBodyPhysicsComponent_BindLua() } } -int SoftBodyPhysicsComponent_BindLua::GetMass(lua_State* L) +int SoftBodyPhysicsComponent_BindLua::SetDisableDeactivation(lua_State *L) { - wi::lua::SSetFloat(L, component->mass); - return 1; -} -int SoftBodyPhysicsComponent_BindLua::SetMass(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->mass = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetMass(float value) not enough arguments!"); - } + bool value = wi::lua::SGetBool(L, 1); + component->SetDisableDeactivation(value); return 0; } -int SoftBodyPhysicsComponent_BindLua::GetFriction(lua_State* L) +int SoftBodyPhysicsComponent_BindLua::IsDisableDeactivation(lua_State *L) { - wi::lua::SSetFloat(L, component->friction); + wi::lua::SSetBool(L, component->IsDisableDeactivation()); return 1; } -int SoftBodyPhysicsComponent_BindLua::SetFriction(lua_State* L) +int SoftBodyPhysicsComponent_BindLua::CreateFromMesh(lua_State *L) { - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->friction = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetMass(float value) not enough arguments!"); - } - return 0; -} -int SoftBodyPhysicsComponent_BindLua::GetRestitution(lua_State* L) -{ - wi::lua::SSetFloat(L, component->restitution); - return 1; -} -int SoftBodyPhysicsComponent_BindLua::SetRestitution(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->restitution = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetRestitution(float value) not enough arguments!"); - } + //TODO + //wi::lua::SSetBool(L, component->IsDisableDeactivation()); return 0; } @@ -3927,57 +3704,193 @@ ForceFieldComponent_BindLua::~ForceFieldComponent_BindLua() } } -int ForceFieldComponent_BindLua::GetType(lua_State* L) + + + + + + +const char Weather_OceanParams_BindLua::className[] = "OceanParameters"; + +Luna::FunctionType Weather_OceanParams_BindLua::methods[] = { + { NULL, NULL } +}; +Luna::PropertyType Weather_OceanParams_BindLua::properties[] = { + lunaproperty(Weather_OceanParams_BindLua, dmap_dim), + lunaproperty(Weather_OceanParams_BindLua, patch_length), + lunaproperty(Weather_OceanParams_BindLua, time_scale), + lunaproperty(Weather_OceanParams_BindLua, wave_amplitude), + lunaproperty(Weather_OceanParams_BindLua, wind_dir), + lunaproperty(Weather_OceanParams_BindLua, wind_speed), + lunaproperty(Weather_OceanParams_BindLua, wind_dependency), + lunaproperty(Weather_OceanParams_BindLua, choppy_scale), + lunaproperty(Weather_OceanParams_BindLua, waterColor), + lunaproperty(Weather_OceanParams_BindLua, waterHeight), + lunaproperty(Weather_OceanParams_BindLua, surfaceDetail), + lunaproperty(Weather_OceanParams_BindLua, surfaceDisplacement), + { NULL, NULL } +}; + +Weather_OceanParams_BindLua::Weather_OceanParams_BindLua(lua_State* L) { - wi::lua::SSetInt(L, component->type); + owning = true; + parameter = new wi::Ocean::OceanParameters; +} +Weather_OceanParams_BindLua::~Weather_OceanParams_BindLua() +{ + if (owning) + { + delete parameter; + } +} + +int Weather_OceanParams_Property::Get(lua_State *L) +{ + Luna::push(L, new Weather_OceanParams_BindLua(data)); return 1; } -int ForceFieldComponent_BindLua::SetType(lua_State* L) +int Weather_OceanParams_Property::Set(lua_State *L) { - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) + Weather_OceanParams_BindLua* get = Luna::lightcheck(L, 1); + if(get) { - component->type = wi::lua::SGetInt(L, 1); - } - else - { - wi::lua::SError(L, "SetType(int type) not enough arguments!"); + *data = *get->parameter; } return 0; } -int ForceFieldComponent_BindLua::GetGravity(lua_State* L) + + + + + + + +const char Weather_AtmosphereParams_BindLua::className[] = "AtmosphereParameters"; + +Luna::FunctionType Weather_AtmosphereParams_BindLua::methods[] = { + { NULL, NULL } +}; +Luna::PropertyType Weather_AtmosphereParams_BindLua::properties[] = { + lunaproperty(Weather_AtmosphereParams_BindLua, bottomRadius), + lunaproperty(Weather_AtmosphereParams_BindLua, topRadius), + lunaproperty(Weather_AtmosphereParams_BindLua, planetCenter), + lunaproperty(Weather_AtmosphereParams_BindLua, rayleighDensityExpScale), + lunaproperty(Weather_AtmosphereParams_BindLua, rayleighScattering), + lunaproperty(Weather_AtmosphereParams_BindLua, mieDensityExpScale), + lunaproperty(Weather_AtmosphereParams_BindLua, mieScattering), + lunaproperty(Weather_AtmosphereParams_BindLua, mieExtinction), + lunaproperty(Weather_AtmosphereParams_BindLua, mieAbsorption), + lunaproperty(Weather_AtmosphereParams_BindLua, miePhaseG), + + lunaproperty(Weather_AtmosphereParams_BindLua, absorptionDensity0LayerWidth), + lunaproperty(Weather_AtmosphereParams_BindLua, absorptionDensity0ConstantTerm), + lunaproperty(Weather_AtmosphereParams_BindLua, absorptionDensity0LinearTerm), + lunaproperty(Weather_AtmosphereParams_BindLua, absorptionDensity1ConstantTerm), + lunaproperty(Weather_AtmosphereParams_BindLua, absorptionDensity1LinearTerm), + + lunaproperty(Weather_AtmosphereParams_BindLua, absorptionExtinction), + lunaproperty(Weather_AtmosphereParams_BindLua, groundAlbedo), + { NULL, NULL } +}; + +Weather_AtmosphereParams_BindLua::Weather_AtmosphereParams_BindLua(lua_State* L) { - wi::lua::SSetFloat(L, component->gravity); + owning = true; + parameter = new AtmosphereParameters; +} +Weather_AtmosphereParams_BindLua::~Weather_AtmosphereParams_BindLua() +{ + if (owning) + { + delete parameter; + } +} + +int Weather_AtmosphereParams_Property::Get(lua_State *L) +{ + Luna::push(L, new Weather_AtmosphereParams_BindLua(data)); return 1; } -int ForceFieldComponent_BindLua::SetGravity(lua_State* L) +int Weather_AtmosphereParams_Property::Set(lua_State *L) { - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) + Weather_AtmosphereParams_BindLua* get = Luna::lightcheck(L, 1); + if(get) { - component->gravity = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetGravity(float value) not enough arguments!"); + *data = *get->parameter; } return 0; } -int ForceFieldComponent_BindLua::GetRange(lua_State* L) + + + + + + + +const char Weather_VolumetricCloudParams_BindLua::className[] = "VolumetricCloudParameters"; + +Luna::FunctionType Weather_VolumetricCloudParams_BindLua::methods[] = { + { NULL, NULL } +}; +Luna::PropertyType Weather_VolumetricCloudParams_BindLua::properties[] = { + lunaproperty(Weather_VolumetricCloudParams_BindLua,Albedo), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CloudAmbientGroundMultiplier), + lunaproperty(Weather_VolumetricCloudParams_BindLua,ExtinctionCoefficient), + lunaproperty(Weather_VolumetricCloudParams_BindLua,HorizonBlendAmount), + lunaproperty(Weather_VolumetricCloudParams_BindLua,HorizonBlendPower), + lunaproperty(Weather_VolumetricCloudParams_BindLua,WeatherDensityAmount), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CloudStartHeight), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CloudThickness), + lunaproperty(Weather_VolumetricCloudParams_BindLua,SkewAlongWindDirection), + lunaproperty(Weather_VolumetricCloudParams_BindLua,TotalNoiseScale), + lunaproperty(Weather_VolumetricCloudParams_BindLua,DetailScale), + lunaproperty(Weather_VolumetricCloudParams_BindLua,WeatherScale), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CurlScale), + lunaproperty(Weather_VolumetricCloudParams_BindLua,ShapeNoiseHeightGradientAmount), + lunaproperty(Weather_VolumetricCloudParams_BindLua,ShapeNoiseMultiplier), + lunaproperty(Weather_VolumetricCloudParams_BindLua,ShapeNoiseMinMax), + lunaproperty(Weather_VolumetricCloudParams_BindLua,ShapeNoisePower), + lunaproperty(Weather_VolumetricCloudParams_BindLua,DetailNoiseModifier), + lunaproperty(Weather_VolumetricCloudParams_BindLua,TypeAmount), + lunaproperty(Weather_VolumetricCloudParams_BindLua,TypeOverall), + lunaproperty(Weather_VolumetricCloudParams_BindLua,AnvilAmount), + lunaproperty(Weather_VolumetricCloudParams_BindLua,AnvilOverhangHeight), + lunaproperty(Weather_VolumetricCloudParams_BindLua,AnimationMultiplier), + lunaproperty(Weather_VolumetricCloudParams_BindLua,WindSpeed), + lunaproperty(Weather_VolumetricCloudParams_BindLua,WindAngle), + lunaproperty(Weather_VolumetricCloudParams_BindLua,WindUpAmount), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CoverageWindSpeed), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CoverageWindAngle), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CloudGradientSmall), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CloudGradientMedium), + lunaproperty(Weather_VolumetricCloudParams_BindLua,CloudGradientLarge), + { NULL, NULL } +}; + +Weather_VolumetricCloudParams_BindLua::Weather_VolumetricCloudParams_BindLua(lua_State* L) { - wi::lua::SSetFloat(L, component->range); + owning = true; + parameter = new VolumetricCloudParameters; +} +Weather_VolumetricCloudParams_BindLua::~Weather_VolumetricCloudParams_BindLua() +{ + if (owning) + { + delete parameter; + } +} + +int Weather_VolumetricCloudParams_Property::Get(lua_State *L) +{ + Luna::push(L, new Weather_VolumetricCloudParams_BindLua(data)); return 1; } -int ForceFieldComponent_BindLua::SetRange(lua_State* L) +int Weather_VolumetricCloudParams_Property::Set(lua_State *L) { - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) + Weather_VolumetricCloudParams_BindLua* get = Luna::lightcheck(L, 1); + if(get) { - component->range = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetRange(float value) not enough arguments!"); + *data = *get->parameter; } return 0; } @@ -3991,14 +3904,6 @@ int ForceFieldComponent_BindLua::SetRange(lua_State* L) const char WeatherComponent_BindLua::className[] = "WeatherComponent"; Luna::FunctionType WeatherComponent_BindLua::methods[] = { - lunamethod(WeatherComponent_BindLua, GetWeatherParams), - lunamethod(WeatherComponent_BindLua, GetOceanParams), - lunamethod(WeatherComponent_BindLua, GetAtmosphereParams), - lunamethod(WeatherComponent_BindLua, GetVolumetricCloudParams), - lunamethod(WeatherComponent_BindLua, SetWeatherParams), - lunamethod(WeatherComponent_BindLua, SetOceanParams), - lunamethod(WeatherComponent_BindLua, SetAtmosphereParams), - lunamethod(WeatherComponent_BindLua, SetVolumetricCloudParams), lunamethod(WeatherComponent_BindLua, IsOceanEnabled), lunamethod(WeatherComponent_BindLua, IsSimpleSky), lunamethod(WeatherComponent_BindLua, IsRealisticSky), @@ -4012,10 +3917,33 @@ Luna::FunctionType WeatherComponent_BindLua::methods[] { NULL, NULL } }; Luna::PropertyType WeatherComponent_BindLua::properties[] = { - lunaproperty(WeatherComponent_BindLua, WeatherParams), - lunaproperty(WeatherComponent_BindLua, OceanParams), - lunaproperty(WeatherComponent_BindLua, AtmosphereParams), - lunaproperty(WeatherComponent_BindLua, VolumetricCloudParams), + lunaproperty(WeatherComponent_BindLua, sunColor), + lunaproperty(WeatherComponent_BindLua, sunDirection), + lunaproperty(WeatherComponent_BindLua, skyExposure), + lunaproperty(WeatherComponent_BindLua, horizon), + lunaproperty(WeatherComponent_BindLua, zenith), + lunaproperty(WeatherComponent_BindLua, ambient), + lunaproperty(WeatherComponent_BindLua, fogStart), + lunaproperty(WeatherComponent_BindLua, fogEnd), + lunaproperty(WeatherComponent_BindLua, fogHeightStart), + lunaproperty(WeatherComponent_BindLua, fogHeightEnd), + lunaproperty(WeatherComponent_BindLua, fogHeightSky), + lunaproperty(WeatherComponent_BindLua, cloudiness), + lunaproperty(WeatherComponent_BindLua, cloudScale), + lunaproperty(WeatherComponent_BindLua, cloudSpeed), + lunaproperty(WeatherComponent_BindLua, cloud_shadow_amount), + lunaproperty(WeatherComponent_BindLua, cloud_shadow_scale), + lunaproperty(WeatherComponent_BindLua, cloud_shadow_speed), + lunaproperty(WeatherComponent_BindLua, windDirection), + lunaproperty(WeatherComponent_BindLua, windRandomness), + lunaproperty(WeatherComponent_BindLua, windWaveSize), + lunaproperty(WeatherComponent_BindLua, windSpeed), + lunaproperty(WeatherComponent_BindLua, stars), + + lunaproperty(WeatherComponent_BindLua, OceanParameters), + lunaproperty(WeatherComponent_BindLua, AtmosphereParameters), + lunaproperty(WeatherComponent_BindLua, VolumetricCloudParameters), + lunaproperty(WeatherComponent_BindLua, SkyMapName), lunaproperty(WeatherComponent_BindLua, ColorGradingMapName), { NULL, NULL } @@ -4034,443 +3962,6 @@ WeatherComponent_BindLua::~WeatherComponent_BindLua() } } -void WeatherComponent_BindLua::InitParameters(){ - // Weather Parameters - weatherparams_xmfloat3["sunColor"] = &component->sunColor; - weatherparams_xmfloat3["sunDirection"] = &component->sunDirection; - weatherparams_xmfloat3["horizon"] = &component->horizon; - weatherparams_xmfloat3["zenith"] = &component->zenith; - weatherparams_xmfloat3["ambient"] = &component->ambient; - weatherparams_xmfloat3["windDirection"] = &component->windDirection; - weatherparams_float["skyExposure"] = &component->skyExposure; - weatherparams_float["fogStart"] = &component->fogStart; - weatherparams_float["fogEnd"] = &component->fogEnd; - weatherparams_float["fogHeightStart"] = &component->fogHeightStart; - weatherparams_float["fogHeightSky"] = &component->fogHeightSky; - weatherparams_float["cloudiness"] = &component->cloudiness; - weatherparams_float["cloudScale"] = &component->cloudScale; - weatherparams_float["cloudSpeed"] = &component->cloudSpeed; - weatherparams_float["cloud_shadow_amount"] = &component->cloud_shadow_amount; - weatherparams_float["cloud_shadow_scale"] = &component->cloud_shadow_scale; - weatherparams_float["cloud_shadow_speed"] = &component->cloud_shadow_speed; - weatherparams_float["windRandomness"] = &component->windRandomness; - weatherparams_float["windWaveSize"] = &component->windWaveSize; - weatherparams_float["windSpeed"] = &component->windSpeed; - weatherparams_float["stars"] = &component->stars; - - //Ocean Parameters - oceanparams_int["dmap_dim"] = &component->oceanParameters.dmap_dim; - oceanparams_uint32["dmap_dim"] = &component->oceanParameters.surfaceDetail; - oceanparams_xmfloat2["wind_dir"] = &component->oceanParameters.wind_dir; - oceanparams_xmfloat4["waterColor"] = &component->oceanParameters.waterColor; - oceanparams_float["patch_length"] = &component->oceanParameters.patch_length; - oceanparams_float["time_scale"] = &component->oceanParameters.time_scale; - oceanparams_float["wave_amplitude"] = &component->oceanParameters.wave_amplitude; - oceanparams_float["wind_speed"] = &component->oceanParameters.wind_speed; - oceanparams_float["wind_dependency"] = &component->oceanParameters.wind_dependency; - oceanparams_float["choppy_scale"] = &component->oceanParameters.choppy_scale; - oceanparams_float["waterHeight"] = &component->oceanParameters.waterHeight; - oceanparams_float["surfaceDisplacementTolerance"] = &component->oceanParameters.surfaceDisplacementTolerance; - - //Atmosphere Parameters - atmosphereparams_xmfloat3["planetCenter"] = &component->atmosphereParameters.planetCenter; - atmosphereparams_xmfloat3["rayleighScattering"] = &component->atmosphereParameters.rayleighScattering; - atmosphereparams_xmfloat3["mieScattering"] = &component->atmosphereParameters.mieScattering; - atmosphereparams_xmfloat3["mieExtinction"] = &component->atmosphereParameters.mieExtinction; - atmosphereparams_xmfloat3["mieAbsorption"] = &component->atmosphereParameters.mieAbsorption; - atmosphereparams_xmfloat3["absorptionExtinction"] = &component->atmosphereParameters.absorptionExtinction; - atmosphereparams_xmfloat3["groundAlbedo"] = &component->atmosphereParameters.groundAlbedo; - atmosphereparams_float["bottomRadius"] = &component->atmosphereParameters.bottomRadius; - atmosphereparams_float["topRadius"] = &component->atmosphereParameters.topRadius; - atmosphereparams_float["rayleighDensityExpScale"] = &component->atmosphereParameters.rayleighDensityExpScale; - atmosphereparams_float["mieDensityExpScale"] = &component->atmosphereParameters.mieDensityExpScale; - atmosphereparams_float["miePhaseG"] = &component->atmosphereParameters.miePhaseG; - atmosphereparams_float["absorptionDensity0LayerWidth"] = &component->atmosphereParameters.absorptionDensity0LayerWidth; - atmosphereparams_float["absorptionDensity0ConstantTerm"] = &component->atmosphereParameters.absorptionDensity0ConstantTerm; - atmosphereparams_float["absorptionDensity0LinearTerm"] = &component->atmosphereParameters.absorptionDensity0LinearTerm; - atmosphereparams_float["absorptionDensity1ConstantTerm"] = &component->atmosphereParameters.absorptionDensity1ConstantTerm; - atmosphereparams_float["absorptionDensity1LinearTerm"] = &component->atmosphereParameters.absorptionDensity1LinearTerm; - - //Volumetric Cloud Parameters - volumetriccloudparams_xmfloat3["Albedo"] = &component->volumetricCloudParameters.Albedo; - volumetriccloudparams_xmfloat3["ExtinctionCoefficient"] = &component->volumetricCloudParameters.ExtinctionCoefficient; - volumetriccloudparams_xmfloat4["CloudGradientSmall"] = &component->volumetricCloudParameters.CloudGradientSmall; - volumetriccloudparams_xmfloat4["CloudGradientMedium"] = &component->volumetricCloudParameters.CloudGradientMedium; - volumetriccloudparams_xmfloat4["CloudGradientLarge"] = &component->volumetricCloudParameters.CloudGradientLarge; - volumetriccloudparams_float["CloudAmbientGroundMultiplier"] = &component->volumetricCloudParameters.CloudAmbientGroundMultiplier; - volumetriccloudparams_float["CoverageAmount"] = &component->volumetricCloudParameters.CoverageAmount; - volumetriccloudparams_float["CoverageMinimum"] = &component->volumetricCloudParameters.CoverageMinimum; - volumetriccloudparams_float["HorizonBlendAmount"] = &component->volumetricCloudParameters.HorizonBlendAmount; - volumetriccloudparams_float["HorizonBlendPower"] = &component->volumetricCloudParameters.HorizonBlendPower; - volumetriccloudparams_float["WeatherDensityAmount"] = &component->volumetricCloudParameters.WeatherDensityAmount; - volumetriccloudparams_float["CloudStartHeight"] = &component->volumetricCloudParameters.CloudStartHeight; - volumetriccloudparams_float["SkewAlongWindDirection"] = &component->volumetricCloudParameters.SkewAlongWindDirection; - volumetriccloudparams_float["TotalNoiseScale"] = &component->volumetricCloudParameters.TotalNoiseScale; - volumetriccloudparams_float["DetailScale"] = &component->volumetricCloudParameters.DetailScale; - volumetriccloudparams_float["WeatherScale"] = &component->volumetricCloudParameters.WeatherScale; - volumetriccloudparams_float["CurlScale"] = &component->volumetricCloudParameters.CurlScale; - volumetriccloudparams_float["ShapeNoiseHeightGradientAmount"] = &component->volumetricCloudParameters.ShapeNoiseHeightGradientAmount; - volumetriccloudparams_float["ShapeNoiseMultiplier"] = &component->volumetricCloudParameters.ShapeNoiseMultiplier; -} - -int WeatherComponent_BindLua::GetWeatherParams(lua_State* L) -{ - lua_newtable(L); - for (auto& pair_xmfloat3 : weatherparams_xmfloat3){ - Luna::push(L, new Vector_BindLua(XMLoadFloat3(pair_xmfloat3.second))); - lua_setfield(L, -2, pair_xmfloat3.first.c_str()); - } - for (auto& pair_float : weatherparams_float){ - wi::lua::SSetFloat(L, *pair_float.second); - lua_setfield(L, -2, pair_float.first.c_str()); - } - - return 1; -} -int WeatherComponent_BindLua::SetWeatherParams(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - bool error = false; - - lua_pushnil(L); - while(lua_next(L, 1)) - { - std::string header = wi::lua::SGetString(L, -2); - - auto find_header_xmfloat3 = weatherparams_xmfloat3.find(header); - if(find_header_xmfloat3 != weatherparams_xmfloat3.end()) - { - auto xmfloat3 = Luna::lightcheck(L, -1); - if(xmfloat3) - { - XMStoreFloat3(find_header_xmfloat3->second, XMLoadFloat4(xmfloat3)); - } - else - { - error = true; - } - } - - auto find_header_float = weatherparams_float.find(header); - if(find_header_float != weatherparams_float.end()) - { - if(lua_type(L, -1) == LUA_TNUMBER) - { - *(find_header_float->second) = wi::lua::SGetFloat(L, -1); - } - else - { - error = true; - } - } - - if(error) - { - break; - } - - lua_pop(L, 1); - } - - if (error) - { - wi::lua::SError(L,"SetWeatherParams(table params) supplied data is invalid!"); - } - } - else - { - wi::lua::SError(L, "SetWeatherParams(table params) not enough arguments!"); - } - return 0; -} -int WeatherComponent_BindLua::GetOceanParams(lua_State* L) -{ - lua_newtable(L); - for (auto& pair_int : oceanparams_int){ - wi::lua::SSetInt(L, *pair_int.second); - lua_setfield(L, -2, pair_int.first.c_str()); - } - for (auto& pair_uint32 : oceanparams_uint32){ - wi::lua::SSetInt(L, *pair_uint32.second); - lua_setfield(L, -2, pair_uint32.first.c_str()); - } - for (auto& pair_xmfloat2 : oceanparams_xmfloat2){ - Luna::push(L, new Vector_BindLua(XMLoadFloat2(pair_xmfloat2.second))); - lua_setfield(L, -2, pair_xmfloat2.first.c_str()); - } - for (auto& pair_xmfloat4 : oceanparams_xmfloat4){ - Luna::push(L, new Vector_BindLua(XMLoadFloat4(pair_xmfloat4.second))); - lua_setfield(L, -2, pair_xmfloat4.first.c_str()); - } - for (auto& pair_float : oceanparams_float){ - wi::lua::SSetFloat(L, *pair_float.second); - lua_setfield(L, -2, pair_float.first.c_str()); - } - - return 1; -} -int WeatherComponent_BindLua::SetOceanParams(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - bool error = false; - - lua_pushnil(L); - while(lua_next(L, 1)) - { - std::string header = wi::lua::SGetString(L, -2); - - auto find_header_xmfloat2 = oceanparams_xmfloat2.find(header); - if(find_header_xmfloat2 != oceanparams_xmfloat2.end()) - { - auto xmfloat2 = Luna::lightcheck(L, -1); - if(xmfloat2) - { - XMStoreFloat2(find_header_xmfloat2->second, XMLoadFloat4(xmfloat2)); - } - else - { - error = true; - } - } - - auto find_header_xmfloat4 = oceanparams_xmfloat4.find(header); - if(find_header_xmfloat4 != oceanparams_xmfloat4.end()) - { - auto xmfloat4 = Luna::lightcheck(L, -1); - if(xmfloat4) - { - XMStoreFloat4(find_header_xmfloat4->second, XMLoadFloat4(xmfloat4)); - } - else - { - error = true; - } - } - - auto find_header_float = oceanparams_float.find(header); - if(find_header_float != oceanparams_float.end()) - { - if(lua_type(L, -1) == LUA_TNUMBER) - { - *(find_header_float->second) = wi::lua::SGetFloat(L, -1); - } - else - { - error = true; - } - } - - auto find_header_int = oceanparams_int.find(header); - if(find_header_int != oceanparams_int.end()) - { - if(lua_type(L, -1) == LUA_TNUMBER) - { - *(find_header_int->second) = wi::lua::SGetInt(L, -1); - } - else - { - error = true; - } - } - - auto find_header_uint32 = oceanparams_uint32.find(header); - if(find_header_uint32 != oceanparams_uint32.end()) - { - if(lua_type(L, -1) == LUA_TNUMBER) - { - *(find_header_uint32->second) = wi::lua::SGetInt(L, -1); - } - else - { - error = true; - } - } - - if(error) - { - break; - } - - lua_pop(L, 1); - } - - if (error) - { - wi::lua::SError(L,"SetOceanParams(table params) supplied data is invalid!"); - } - } - else - { - wi::lua::SError(L, "SetOceanParams(table params) not enough arguments!"); - } - return 0; -} -int WeatherComponent_BindLua::GetAtmosphereParams(lua_State* L) -{ - lua_newtable(L); - for (auto& pair_xmfloat3 : atmosphereparams_xmfloat3){ - Luna::push(L, new Vector_BindLua(XMLoadFloat3(pair_xmfloat3.second))); - lua_setfield(L, -2, pair_xmfloat3.first.c_str()); - } - for (auto& pair_float : atmosphereparams_float){ - wi::lua::SSetFloat(L, *pair_float.second); - lua_setfield(L, -2, pair_float.first.c_str()); - } - - return 1; -} -int WeatherComponent_BindLua::SetAtmosphereParams(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - bool error = false; - - lua_pushnil(L); - while(lua_next(L, 1)) - { - std::string header = wi::lua::SGetString(L, -2); - - auto find_header_xmfloat3 = atmosphereparams_xmfloat3.find(header); - if(find_header_xmfloat3 != atmosphereparams_xmfloat3.end()) - { - auto xmfloat3 = Luna::lightcheck(L, -1); - if(xmfloat3) - { - XMStoreFloat3(find_header_xmfloat3->second, XMLoadFloat4(xmfloat3)); - } - else - { - error = true; - } - } - - auto find_header_float = atmosphereparams_float.find(header); - if(find_header_float != atmosphereparams_float.end()) - { - if(lua_type(L, -1) == LUA_TNUMBER) - { - *(find_header_float->second) = wi::lua::SGetFloat(L, -1); - } - else - { - error = true; - } - } - - if(error) - { - break; - } - - lua_pop(L, 1); - } - - if (error) - { - wi::lua::SError(L,"SetWeatherParams(table params) supplied data is invalid!"); - } - } - else - { - wi::lua::SError(L, "SetWeatherParams(table params) not enough arguments!"); - } - return 0; -} -int WeatherComponent_BindLua::GetVolumetricCloudParams(lua_State* L) -{ - lua_newtable(L); - for (auto& pair_xmfloat3 : volumetriccloudparams_xmfloat3){ - Luna::push(L, new Vector_BindLua(XMLoadFloat3(pair_xmfloat3.second))); - lua_setfield(L, -2, pair_xmfloat3.first.c_str()); - } - for (auto& pair_xmfloat4 : volumetriccloudparams_xmfloat4){ - Luna::push(L, new Vector_BindLua(XMLoadFloat4(pair_xmfloat4.second))); - lua_setfield(L, -2, pair_xmfloat4.first.c_str()); - } - for (auto& pair_float : volumetriccloudparams_float){ - wi::lua::SSetFloat(L, *pair_float.second); - lua_setfield(L, -2, pair_float.first.c_str()); - } - - return 1; -} -int WeatherComponent_BindLua::SetVolumetricCloudParams(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - bool error = false; - - lua_pushnil(L); - while(lua_next(L, 1)) - { - std::string header = wi::lua::SGetString(L, -2); - - auto find_header_xmfloat3 = volumetriccloudparams_xmfloat3.find(header); - if(find_header_xmfloat3 != volumetriccloudparams_xmfloat3.end()) - { - auto xmfloat3 = Luna::lightcheck(L, -1); - if(xmfloat3) - { - XMStoreFloat3(find_header_xmfloat3->second, XMLoadFloat4(xmfloat3)); - } - else - { - error = true; - } - } - - auto find_header_xmfloat4 = volumetriccloudparams_xmfloat4.find(header); - if(find_header_xmfloat4 != volumetriccloudparams_xmfloat4.end()) - { - auto xmfloat4 = Luna::lightcheck(L, -1); - if(xmfloat4) - { - XMStoreFloat4(find_header_xmfloat4->second, XMLoadFloat4(xmfloat4)); - } - else - { - error = true; - } - } - - auto find_header_float = volumetriccloudparams_float.find(header); - if(find_header_float != volumetriccloudparams_float.end()) - { - if(lua_type(L, -1) == LUA_TNUMBER) - { - *(find_header_float->second) = wi::lua::SGetFloat(L, -1); - } - else - { - error = true; - } - } - - if(error) - { - break; - } - - lua_pop(L, 1); - } - - if (error) - { - wi::lua::SError(L,"SetWeatherParams(table params) supplied data is invalid!"); - } - } - else - { - wi::lua::SError(L, "SetWeatherParams(table params) not enough arguments!"); - } - return 0; -} int WeatherComponent_BindLua::IsOceanEnabled(lua_State* L) { wi::lua::SSetBool(L, component->IsOceanEnabled()); @@ -4644,42 +4135,6 @@ SoundComponent_BindLua::~SoundComponent_BindLua() } } -int SoundComponent_BindLua::GetFilename(lua_State* L) -{ - wi::lua::SSetString(L, component->filename); - return 1; -} -int SoundComponent_BindLua::SetFilename(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->filename = wi::lua::SGetString(L, 1); - } - else - { - wi::lua::SError(L, "SetFilename(string filename) not enough arguments!"); - } - return 0; -} -int SoundComponent_BindLua::GetVolume(lua_State* L) -{ - wi::lua::SSetFloat(L, component->volume); - return 1; -} -int SoundComponent_BindLua::SetVolume(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->volume = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetVolume(float value) not enough arguments!"); - } - return 0; -} int SoundComponent_BindLua::IsPlaying(lua_State* L) { wi::lua::SSetBool(L, component->IsPlaying()); @@ -4767,87 +4222,4 @@ ColliderComponent_BindLua::~ColliderComponent_BindLua() } } -int ColliderComponent_BindLua::GetShape(lua_State* L) -{ - wi::lua::SSetInt(L, (uint32_t)component->shape); - return 1; -} -int ColliderComponent_BindLua::SetShape(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->shape = (ColliderComponent::Shape)wi::lua::SGetInt(L, 1); - } - else - { - wi::lua::SError(L, "SetShape(int type) not enough arguments!"); - } - return 0; -} -int ColliderComponent_BindLua::GetRadius(lua_State* L) -{ - wi::lua::SSetFloat(L, component->radius); - return 1; -} -int ColliderComponent_BindLua::SetRadius(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - component->radius = wi::lua::SGetFloat(L, 1); - } - else - { - wi::lua::SError(L, "SetRadius(float value) not enough arguments!"); - } - return 0; -} -int ColliderComponent_BindLua::GetOffset(lua_State* L) -{ - XMVECTOR V = XMLoadFloat3(&component->offset); - Luna::push(L, new Vector_BindLua(V)); - return 1; -} -int ColliderComponent_BindLua::SetOffset(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - Vector_BindLua* offset = Luna::lightcheck(L, 1); - if(offset) - { - XMStoreFloat3(&component->offset, XMLoadFloat4(offset)); - } - } - else - { - wi::lua::SError(L, "SetOffset(vector value) not enough arguments!"); - } - return 0; -} -int ColliderComponent_BindLua::GetTail(lua_State* L) -{ - XMVECTOR V = XMLoadFloat3(&component->tail); - Luna::push(L, new Vector_BindLua(V)); - return 1; -} -int ColliderComponent_BindLua::SetTail(lua_State* L) -{ - int argc = wi::lua::SGetArgCount(L); - if (argc > 0) - { - Vector_BindLua* tail = Luna::lightcheck(L, 1); - if(tail) - { - XMStoreFloat3(&component->tail, XMLoadFloat4(tail)); - } - } - else - { - wi::lua::SError(L, "SetTail(vector value) not enough arguments!"); - } - return 0; -} - } diff --git a/WickedEngine/wiScene_BindLua.h b/WickedEngine/wiScene_BindLua.h index d15868758..c6d2579da 100644 --- a/WickedEngine/wiScene_BindLua.h +++ b/WickedEngine/wiScene_BindLua.h @@ -3,6 +3,7 @@ #include "wiLuna.h" #include "wiScene.h" #include +#include namespace wi::lua::scene { @@ -38,7 +39,6 @@ namespace wi::lua::scene int Clear(lua_State* L); int Merge(lua_State* L); - int Entity_Create(lua_State* L); int Entity_FindByName(lua_State* L); int Entity_Remove(lua_State* L); int Entity_Duplicate(lua_State* L); @@ -172,10 +172,23 @@ namespace wi::lua::scene static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - TransformComponent_BindLua(wi::scene::TransformComponent* component) :component(component) {} + TransformComponent_BindLua(wi::scene::TransformComponent* component) :component(component) + { + Translation_local = VectorProperty(&component->translation_local); + Rotation_local = VectorProperty(&component->rotation_local); + Scale_local = VectorProperty(&component->scale_local); + } TransformComponent_BindLua(lua_State *L); ~TransformComponent_BindLua(); + VectorProperty Translation_local; + VectorProperty Rotation_local; + VectorProperty Scale_local; + + PropertyFunction(Translation_local) + PropertyFunction(Rotation_local) + PropertyFunction(Scale_local) + int Scale(lua_State* L); int Rotate(lua_State* L); int Translate(lua_State* L); @@ -266,14 +279,91 @@ namespace wi::lua::scene static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - MaterialComponent_BindLua(wi::scene::MaterialComponent* component) :component(component) {} + MaterialComponent_BindLua(wi::scene::MaterialComponent* component) :component(component) + { + ShaderType = IntProperty(reinterpret_cast(&component->shaderType)); + UserBlendMode = IntProperty(reinterpret_cast(&component->roughness)); + SpecularColor = VectorProperty(&component->specularColor); + SubsurfaceScattering = VectorProperty(&component->subsurfaceScattering); + TexMulAdd = VectorProperty(&component->texMulAdd); + Roughness = FloatProperty(&component->roughness); + Reflectance = FloatProperty(&component->reflectance); + Metalness = FloatProperty(&component->metalness); + NormalMapStrength = FloatProperty(&component->normalMapStrength); + ParallaxOcclusionMapping = FloatProperty(&component->parallaxOcclusionMapping); + DisplacementMapping = FloatProperty(&component->displacementMapping); + Refraction = FloatProperty(&component->refraction); + Transmission = FloatProperty(&component->transmission); + AlphaRef = FloatProperty(&component->alphaRef); + SheenColor = VectorProperty(&component->sheenColor); + SheenRoughness = FloatProperty(&component->sheenRoughness); + Clearcoat = FloatProperty(&component->clearcoat); + ClearcoatRoughness = FloatProperty(&component->clearcoatRoughness); + ShadingRate = IntProperty(reinterpret_cast(&component->roughness)); + TexAnimDirection = VectorProperty(&component->texAnimDirection); + TexAnimFrameRate = FloatProperty(&component->roughness); + texAnimElapsedTime = FloatProperty(&component->roughness); + customShaderID = IntProperty(&component->customShaderID); + } MaterialComponent_BindLua(lua_State *L); ~MaterialComponent_BindLua(); + IntProperty ShaderType; + IntProperty UserBlendMode; + VectorProperty SpecularColor; + VectorProperty SubsurfaceScattering; + VectorProperty TexMulAdd; + FloatProperty Roughness; + FloatProperty Reflectance; + FloatProperty Metalness; + FloatProperty NormalMapStrength; + FloatProperty ParallaxOcclusionMapping; + FloatProperty DisplacementMapping; + FloatProperty Refraction; + FloatProperty Transmission; + FloatProperty AlphaRef; + VectorProperty SheenColor; + FloatProperty SheenRoughness; + FloatProperty Clearcoat; + FloatProperty ClearcoatRoughness; + IntProperty ShadingRate; + VectorProperty TexAnimDirection; + FloatProperty TexAnimFrameRate; + FloatProperty texAnimElapsedTime; + IntProperty customShaderID; + + PropertyFunction(ShaderType) + PropertyFunction(UserBlendMode) + PropertyFunction(SpecularColor) + PropertyFunction(SubsurfaceScattering) + PropertyFunction(TexMulAdd) + PropertyFunction(Roughness) + PropertyFunction(Reflectance) + PropertyFunction(Metalness) + PropertyFunction(NormalMapStrength) + PropertyFunction(ParallaxOcclusionMapping) + PropertyFunction(DisplacementMapping) + PropertyFunction(Refraction) + PropertyFunction(Transmission) + PropertyFunction(AlphaRef) + PropertyFunction(SheenColor) + PropertyFunction(SheenRoughness) + PropertyFunction(Clearcoat) + PropertyFunction(ClearcoatRoughness) + PropertyFunction(ShadingRate) + PropertyFunction(TexAnimDirection) + PropertyFunction(TexAnimFrameRate) + PropertyFunction(texAnimElapsedTime) + PropertyFunction(customShaderID) + int SetBaseColor(lua_State* L); + int GetBaseColor(lua_State* L); int SetEmissiveColor(lua_State* L); + int GetEmissiveColor(lua_State* L); int SetEngineStencilRef(lua_State* L); + int GetEngineStencilRef(lua_State* L); int SetUserStencilRef(lua_State* L); + int GetUserStencilRef(lua_State* L); int GetStencilRef(lua_State* L); }; @@ -461,31 +551,46 @@ namespace wi::lua::scene static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - RigidBodyPhysicsComponent_BindLua(wi::scene::RigidBodyPhysicsComponent* component) :component(component) {} + RigidBodyPhysicsComponent_BindLua(wi::scene::RigidBodyPhysicsComponent* component) :component(component) + { + Shape = IntProperty(reinterpret_cast(&component->shape)); + Mass = FloatProperty(&component->mass); + Friction = FloatProperty(&component->friction); + Restitution = FloatProperty(&component->restitution); + LinearDamping = FloatProperty(&component->damping_linear); + AngularDamping = FloatProperty(&component->damping_angular); + BoxParams_HalfExtents = VectorProperty(&component->box.halfextents); + SphereParams_Radius = FloatProperty(&component->sphere.radius); + CapsuleParams_Radius = FloatProperty(&component->capsule.radius); + CapsuleParams_Height = FloatProperty(&component->capsule.height); + TargetMeshLOD = LongLongProperty(reinterpret_cast(&component->mesh_lod)); + } RigidBodyPhysicsComponent_BindLua(lua_State* L); ~RigidBodyPhysicsComponent_BindLua(); - int GetShape(lua_State* L); - int GetMass(lua_State* L); - int GetFriction(lua_State* L); - int GetRestitution(lua_State* L); - int GetLinearDamping(lua_State* L); - int GetAngularDamping(lua_State* L); - int GetBoxParams(lua_State* L); - int GetSphereParams(lua_State* L); - int GetCapsuleParams(lua_State* L); - int GetTargetMeshLOD(lua_State* L); - - int SetShape(lua_State* L); - int SetMass(lua_State* L); - int SetFriction(lua_State* L); - int SetRestitution(lua_State* L); - int SetLinearDamping(lua_State* L); - int SetAngularDamping(lua_State* L); - int SetBoxParams(lua_State* L); - int SetSphereParams(lua_State* L); - int SetCapsuleParams(lua_State* L); - int SetTargetMeshLOD(lua_State* L); + IntProperty Shape; + FloatProperty Mass; + FloatProperty Friction; + FloatProperty Restitution; + FloatProperty LinearDamping; + FloatProperty AngularDamping; + VectorProperty BoxParams_HalfExtents; + FloatProperty SphereParams_Radius; + FloatProperty CapsuleParams_Radius; + FloatProperty CapsuleParams_Height; + LongLongProperty TargetMeshLOD; + + PropertyFunction(Shape) + PropertyFunction(Mass) + PropertyFunction(Friction) + PropertyFunction(Restitution) + PropertyFunction(LinearDamping) + PropertyFunction(AngularDamping) + PropertyFunction(BoxParams_HalfExtents) + PropertyFunction(SphereParams_Radius) + PropertyFunction(CapsuleParams_Radius) + PropertyFunction(CapsuleParams_Height) + PropertyFunction(TargetMeshLOD) int SetDisableDeactivation(lua_State* L); int SetKinematic(lua_State* L); @@ -504,17 +609,26 @@ namespace wi::lua::scene static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - SoftBodyPhysicsComponent_BindLua(wi::scene::SoftBodyPhysicsComponent* component) :component(component) {} + SoftBodyPhysicsComponent_BindLua(wi::scene::SoftBodyPhysicsComponent* component) :component(component) + { + Mass = wi::lua::FloatProperty(&component->mass); + Friction = wi::lua::FloatProperty(&component->friction); + Restitution = wi::lua::FloatProperty(&component->restitution); + } SoftBodyPhysicsComponent_BindLua(lua_State* L); ~SoftBodyPhysicsComponent_BindLua(); - int GetMass(lua_State* L); - int GetFriction(lua_State* L); - int GetRestitution(lua_State* L); + wi::lua::FloatProperty Mass; + wi::lua::FloatProperty Friction; + wi::lua::FloatProperty Restitution; - int SetMass(lua_State* L); - int SetFriction(lua_State* L); - int SetRestitution(lua_State* L); + PropertyFunction(Mass) + PropertyFunction(Friction) + PropertyFunction(Restitution) + + int SetDisableDeactivation(lua_State* L); + int IsDisableDeactivation(lua_State* L); + int CreateFromMesh(lua_State* L); }; class ForceFieldComponent_BindLua @@ -527,17 +641,314 @@ namespace wi::lua::scene static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - ForceFieldComponent_BindLua(wi::scene::ForceFieldComponent* component) :component(component) {} + ForceFieldComponent_BindLua(wi::scene::ForceFieldComponent* component) :component(component) + { + Type = IntProperty(reinterpret_cast(&component->type)); + Gravity = FloatProperty(&component->gravity); + Range = FloatProperty(&component->range); + } ForceFieldComponent_BindLua(lua_State* L); ~ForceFieldComponent_BindLua(); - int GetType(lua_State* L); - int GetGravity(lua_State* L); - int GetRange(lua_State* L); + IntProperty Type; + FloatProperty Gravity; + FloatProperty Range; - int SetType(lua_State* L); - int SetGravity(lua_State* L); - int SetRange(lua_State* L); + PropertyFunction(Type) + PropertyFunction(Gravity) + PropertyFunction(Range) + }; + + class Weather_OceanParams_BindLua + { + public: + bool owning = false; + wi::Ocean::OceanParameters* parameter = nullptr; + + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + Weather_OceanParams_BindLua(wi::Ocean::OceanParameters* parameter) :parameter(parameter) + { + dmap_dim = IntProperty(¶meter->dmap_dim); + patch_length = FloatProperty(¶meter->patch_length); + time_scale = FloatProperty(¶meter->time_scale); + wave_amplitude = FloatProperty(¶meter->wave_amplitude); + wind_dir = VectorProperty(¶meter->wind_dir); + wind_speed = FloatProperty(¶meter->wind_speed); + wind_dependency = FloatProperty(¶meter->wind_dependency); + choppy_scale = FloatProperty(¶meter->choppy_scale); + } + Weather_OceanParams_BindLua(lua_State* L); + ~Weather_OceanParams_BindLua(); + + IntProperty dmap_dim; + FloatProperty patch_length; + FloatProperty time_scale; + FloatProperty wave_amplitude; + VectorProperty wind_dir; + FloatProperty wind_speed; + FloatProperty wind_dependency; + FloatProperty choppy_scale; + VectorProperty waterColor; + FloatProperty waterHeight; + LongLongProperty surfaceDetail; + FloatProperty surfaceDisplacement; + + PropertyFunction(dmap_dim) + PropertyFunction(patch_length) + PropertyFunction(time_scale) + PropertyFunction(wave_amplitude) + PropertyFunction(wind_dir) + PropertyFunction(wind_speed) + PropertyFunction(wind_dependency) + PropertyFunction(choppy_scale) + PropertyFunction(waterColor) + PropertyFunction(waterHeight) + PropertyFunction(surfaceDetail) + PropertyFunction(surfaceDisplacement) + }; + class Weather_OceanParams_Property final : public LuaProperty + { + public: + wi::Ocean::OceanParameters* data; + Weather_OceanParams_Property(){} + Weather_OceanParams_Property(wi::Ocean::OceanParameters* data) :data(data){} + int Get(lua_State* L); + int Set(lua_State* L); + }; + + class Weather_AtmosphereParams_BindLua + { + public: + bool owning = false; + AtmosphereParameters* parameter = nullptr; + + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + Weather_AtmosphereParams_BindLua(AtmosphereParameters* parameter) :parameter(parameter) + { + bottomRadius = FloatProperty(¶meter->bottomRadius); + topRadius = FloatProperty(¶meter->topRadius); + planetCenter = VectorProperty(¶meter->planetCenter); + rayleighDensityExpScale = FloatProperty(¶meter->rayleighDensityExpScale); + rayleighScattering = VectorProperty(¶meter->rayleighScattering); + mieDensityExpScale = FloatProperty(¶meter->mieDensityExpScale); + mieScattering = VectorProperty(¶meter->mieScattering); + mieExtinction = VectorProperty(¶meter->mieExtinction); + mieAbsorption = VectorProperty(¶meter->mieAbsorption); + miePhaseG = FloatProperty(¶meter->miePhaseG); + + absorptionDensity0LayerWidth = FloatProperty(¶meter->absorptionDensity0LayerWidth); + absorptionDensity0ConstantTerm = FloatProperty(¶meter->absorptionDensity0ConstantTerm); + absorptionDensity0LinearTerm = FloatProperty(¶meter->absorptionDensity0LinearTerm); + absorptionDensity1ConstantTerm = FloatProperty(¶meter->absorptionDensity1ConstantTerm); + absorptionDensity1LinearTerm = FloatProperty(¶meter->absorptionDensity1LinearTerm); + + absorptionExtinction = VectorProperty(¶meter->absorptionExtinction); + groundAlbedo = VectorProperty(¶meter->groundAlbedo); + } + Weather_AtmosphereParams_BindLua(lua_State* L); + ~Weather_AtmosphereParams_BindLua(); + + FloatProperty bottomRadius; + FloatProperty topRadius; + VectorProperty planetCenter; + FloatProperty rayleighDensityExpScale; + VectorProperty rayleighScattering; + FloatProperty mieDensityExpScale; + VectorProperty mieScattering; + VectorProperty mieExtinction; + VectorProperty mieAbsorption; + FloatProperty miePhaseG; + + FloatProperty absorptionDensity0LayerWidth; + FloatProperty absorptionDensity0ConstantTerm; + FloatProperty absorptionDensity0LinearTerm; + FloatProperty absorptionDensity1ConstantTerm; + FloatProperty absorptionDensity1LinearTerm; + + VectorProperty absorptionExtinction; + VectorProperty groundAlbedo; + + + PropertyFunction(bottomRadius) + PropertyFunction(topRadius) + PropertyFunction(planetCenter) + PropertyFunction(rayleighDensityExpScale) + PropertyFunction(rayleighScattering) + PropertyFunction(mieDensityExpScale) + PropertyFunction(mieScattering) + PropertyFunction(mieExtinction) + PropertyFunction(mieAbsorption) + PropertyFunction(miePhaseG) + + PropertyFunction(absorptionDensity0LayerWidth) + PropertyFunction(absorptionDensity0ConstantTerm) + PropertyFunction(absorptionDensity0LinearTerm) + PropertyFunction(absorptionDensity1ConstantTerm) + PropertyFunction(absorptionDensity1LinearTerm) + + PropertyFunction(absorptionExtinction) + PropertyFunction(groundAlbedo) + }; + class Weather_AtmosphereParams_Property final : public LuaProperty + { + public: + AtmosphereParameters* data; + Weather_AtmosphereParams_Property(){} + Weather_AtmosphereParams_Property(AtmosphereParameters* data) :data(data){} + int Get(lua_State* L); + int Set(lua_State* L); + }; + + class Weather_VolumetricCloudParams_BindLua + { + public: + bool owning = false; + VolumetricCloudParameters* parameter = nullptr; + + static const char className[]; + static Luna::FunctionType methods[]; + static Luna::PropertyType properties[]; + + Weather_VolumetricCloudParams_BindLua(VolumetricCloudParameters* parameter) :parameter(parameter) + { + Albedo = VectorProperty(¶meter->Albedo); + CloudAmbientGroundMultiplier = FloatProperty(¶meter->CloudAmbientGroundMultiplier); + ExtinctionCoefficient = VectorProperty(¶meter->ExtinctionCoefficient); + + HorizonBlendAmount = FloatProperty(¶meter->HorizonBlendAmount); + HorizonBlendPower = FloatProperty(¶meter->HorizonBlendPower); + WeatherDensityAmount = FloatProperty(¶meter->WeatherDensityAmount); + CloudStartHeight = FloatProperty(¶meter->CloudStartHeight); + + CloudThickness = FloatProperty(¶meter->CloudThickness); + SkewAlongWindDirection = FloatProperty(¶meter->SkewAlongWindDirection); + TotalNoiseScale = FloatProperty(¶meter->TotalNoiseScale); + DetailScale = FloatProperty(¶meter->DetailScale); + + WeatherScale = FloatProperty(¶meter->WeatherScale); + CurlScale = FloatProperty(¶meter->CurlScale); + ShapeNoiseHeightGradientAmount = FloatProperty(¶meter->ShapeNoiseHeightGradientAmount); + ShapeNoiseMultiplier = FloatProperty(¶meter->ShapeNoiseMultiplier); + + ShapeNoiseMinMax = VectorProperty(¶meter->ShapeNoiseMinMax); + ShapeNoisePower = FloatProperty(¶meter->ShapeNoisePower); + DetailNoiseModifier = FloatProperty(¶meter->DetailNoiseModifier); + + TypeAmount = FloatProperty(¶meter->TypeAmount); + TypeOverall = FloatProperty(¶meter->TypeOverall); + AnvilAmount = FloatProperty(¶meter->AnvilAmount); + AnvilOverhangHeight = FloatProperty(¶meter->AnvilOverhangHeight); + + AnimationMultiplier = FloatProperty(¶meter->AnimationMultiplier); + WindSpeed = FloatProperty(¶meter->WindSpeed); + WindAngle = FloatProperty(¶meter->WindAngle); + WindUpAmount = FloatProperty(¶meter->WindUpAmount); + + CoverageWindSpeed = FloatProperty(¶meter->CoverageWindSpeed); + CoverageWindAngle = FloatProperty(¶meter->CoverageWindAngle); + + CloudGradientSmall = VectorProperty(¶meter->CloudGradientSmall); + CloudGradientMedium = VectorProperty(¶meter->CloudGradientMedium); + CloudGradientLarge = VectorProperty(¶meter->CloudGradientLarge); + } + Weather_VolumetricCloudParams_BindLua(lua_State* L); + ~Weather_VolumetricCloudParams_BindLua(); + + VectorProperty Albedo; + FloatProperty CloudAmbientGroundMultiplier; + VectorProperty ExtinctionCoefficient; + + FloatProperty HorizonBlendAmount; + FloatProperty HorizonBlendPower; + FloatProperty WeatherDensityAmount; + FloatProperty CloudStartHeight; + + FloatProperty CloudThickness; + FloatProperty SkewAlongWindDirection; + FloatProperty TotalNoiseScale; + FloatProperty DetailScale; + + FloatProperty WeatherScale; + FloatProperty CurlScale; + FloatProperty ShapeNoiseHeightGradientAmount; + FloatProperty ShapeNoiseMultiplier; + + VectorProperty ShapeNoiseMinMax; + FloatProperty ShapeNoisePower; + FloatProperty DetailNoiseModifier; + + FloatProperty TypeAmount; + FloatProperty TypeOverall; + FloatProperty AnvilAmount; + FloatProperty AnvilOverhangHeight; + + FloatProperty AnimationMultiplier; + FloatProperty WindSpeed; + FloatProperty WindAngle; + FloatProperty WindUpAmount; + + FloatProperty CoverageWindSpeed; + FloatProperty CoverageWindAngle; + + VectorProperty CloudGradientSmall; + VectorProperty CloudGradientMedium; + VectorProperty CloudGradientLarge; + + PropertyFunction(Albedo) + PropertyFunction(CloudAmbientGroundMultiplier) + PropertyFunction(ExtinctionCoefficient) + + PropertyFunction(HorizonBlendAmount) + PropertyFunction(HorizonBlendPower) + PropertyFunction(WeatherDensityAmount) + PropertyFunction(CloudStartHeight) + + PropertyFunction(CloudThickness) + PropertyFunction(SkewAlongWindDirection) + PropertyFunction(TotalNoiseScale) + PropertyFunction(DetailScale) + + PropertyFunction(WeatherScale) + PropertyFunction(CurlScale) + PropertyFunction(ShapeNoiseHeightGradientAmount) + PropertyFunction(ShapeNoiseMultiplier) + + PropertyFunction(ShapeNoiseMinMax) + PropertyFunction(ShapeNoisePower) + PropertyFunction(DetailNoiseModifier) + + PropertyFunction(TypeAmount) + PropertyFunction(TypeOverall) + PropertyFunction(AnvilAmount) + PropertyFunction(AnvilOverhangHeight) + + PropertyFunction(AnimationMultiplier) + PropertyFunction(WindSpeed) + PropertyFunction(WindAngle) + PropertyFunction(WindUpAmount) + + PropertyFunction(CoverageWindSpeed) + PropertyFunction(CoverageWindAngle) + + PropertyFunction(CloudGradientSmall) + PropertyFunction(CloudGradientMedium) + PropertyFunction(CloudGradientLarge) + + }; + class Weather_VolumetricCloudParams_Property final : public LuaProperty + { + public: + VolumetricCloudParameters* data; + Weather_VolumetricCloudParams_Property(){} + Weather_VolumetricCloudParams_Property(VolumetricCloudParameters* data) :data(data){} + int Get(lua_State* L); + int Set(lua_State* L); }; class WeatherComponent_BindLua @@ -546,41 +957,95 @@ namespace wi::lua::scene bool owning = false; wi::scene::WeatherComponent* component = nullptr; - void InitParameters(); - static const char className[]; static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - WeatherComponent_BindLua(wi::scene::WeatherComponent* component) :component(component) { InitParameters(); } + WeatherComponent_BindLua(wi::scene::WeatherComponent* component) :component(component) + { + sunColor = VectorProperty(&component->sunColor); + sunDirection = VectorProperty(&component->sunDirection); + skyExposure = FloatProperty(&component->skyExposure); + horizon = VectorProperty(&component->horizon); + zenith = VectorProperty(&component->zenith); + ambient = VectorProperty(&component->ambient); + fogStart = FloatProperty(&component->fogStart); + fogEnd = FloatProperty(&component->fogEnd); + fogHeightStart = FloatProperty(&component->fogHeightStart); + fogHeightEnd = FloatProperty(&component->fogHeightEnd); + fogHeightSky = FloatProperty(&component->fogHeightSky); + cloudiness = FloatProperty(&component->cloudiness); + cloudScale = FloatProperty(&component->cloudScale); + cloudSpeed = FloatProperty(&component->cloudSpeed); + cloud_shadow_amount = FloatProperty(&component->cloud_shadow_amount); + cloud_shadow_scale = FloatProperty(&component->cloud_shadow_scale); + cloud_shadow_speed = FloatProperty(&component->cloud_shadow_speed); + windDirection = VectorProperty(&component->windDirection); + windRandomness = FloatProperty(&component->windRandomness); + windWaveSize = FloatProperty(&component->windWaveSize); + windSpeed = FloatProperty(&component->windSpeed); + stars = FloatProperty(&component->stars); + + OceanParameters = Weather_OceanParams_Property(&component->oceanParameters); + AtmosphereParameters = Weather_AtmosphereParams_Property(&component->atmosphereParameters); + VolumetricCloudParameters = Weather_VolumetricCloudParams_Property(&component->volumetricCloudParameters); + } WeatherComponent_BindLua(lua_State* L); ~WeatherComponent_BindLua(); - wi::unordered_map weatherparams_xmfloat3; - wi::unordered_map weatherparams_float; + VectorProperty sunColor; + VectorProperty sunDirection; + FloatProperty skyExposure; + VectorProperty horizon; + VectorProperty zenith; + VectorProperty ambient; + FloatProperty fogStart; + FloatProperty fogEnd; + FloatProperty fogHeightStart; + FloatProperty fogHeightEnd; + FloatProperty fogHeightSky; + FloatProperty cloudiness; + FloatProperty cloudScale; + FloatProperty cloudSpeed; + FloatProperty cloud_shadow_amount; + FloatProperty cloud_shadow_scale; + FloatProperty cloud_shadow_speed; + VectorProperty windDirection; + FloatProperty windRandomness; + FloatProperty windWaveSize; + FloatProperty windSpeed; + FloatProperty stars; - wi::unordered_map oceanparams_int; - wi::unordered_map oceanparams_uint32; - wi::unordered_map oceanparams_xmfloat2; - wi::unordered_map oceanparams_xmfloat4; - wi::unordered_map oceanparams_float; + PropertyFunction(sunColor) + PropertyFunction(sunDirection) + PropertyFunction(skyExposure) + PropertyFunction(horizon) + PropertyFunction(zenith) + PropertyFunction(ambient) + PropertyFunction(fogStart) + PropertyFunction(fogEnd) + PropertyFunction(fogHeightStart) + PropertyFunction(fogHeightEnd) + PropertyFunction(fogHeightSky) + PropertyFunction(cloudiness) + PropertyFunction(cloudScale) + PropertyFunction(cloudSpeed) + PropertyFunction(cloud_shadow_amount) + PropertyFunction(cloud_shadow_scale) + PropertyFunction(cloud_shadow_speed) + PropertyFunction(windDirection) + PropertyFunction(windRandomness) + PropertyFunction(windWaveSize) + PropertyFunction(windSpeed) + PropertyFunction(stars) - wi::unordered_map atmosphereparams_xmfloat3; - wi::unordered_map atmosphereparams_float; - - wi::unordered_map volumetriccloudparams_xmfloat3; - wi::unordered_map volumetriccloudparams_xmfloat4; - wi::unordered_map volumetriccloudparams_float; - - int GetWeatherParams(lua_State* L); - int GetOceanParams(lua_State* L); - int GetAtmosphereParams(lua_State* L); - int GetVolumetricCloudParams(lua_State* L); - - int SetWeatherParams(lua_State* L); - int SetOceanParams(lua_State* L); - int SetAtmosphereParams(lua_State* L); - int SetVolumetricCloudParams(lua_State* L); + Weather_OceanParams_Property OceanParameters; + Weather_AtmosphereParams_Property AtmosphereParameters; + Weather_VolumetricCloudParams_Property VolumetricCloudParameters; + + PropertyFunction(OceanParameters) + PropertyFunction(AtmosphereParameters) + PropertyFunction(VolumetricCloudParameters) int IsOceanEnabled(lua_State* L); int IsSimpleSky(lua_State* L); @@ -611,15 +1076,19 @@ namespace wi::lua::scene static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - SoundComponent_BindLua(wi::scene::SoundComponent* component) :component(component) {} + SoundComponent_BindLua(wi::scene::SoundComponent* component) :component(component) + { + Filename = StringProperty(&component->filename); + Volume = FloatProperty(&component->volume); + } SoundComponent_BindLua(lua_State* L); ~SoundComponent_BindLua(); - int SetFilename(lua_State* L); - int SetVolume(lua_State* L); + StringProperty Filename; + FloatProperty Volume; - int GetFilename(lua_State* L); - int GetVolume(lua_State* L); + PropertyFunction(Filename) + PropertyFunction(Volume) int IsPlaying(lua_State* L); int IsLooped(lua_State* L); @@ -641,19 +1110,25 @@ namespace wi::lua::scene static Luna::FunctionType methods[]; static Luna::PropertyType properties[]; - ColliderComponent_BindLua(wi::scene::ColliderComponent* component) :component(component) {} + ColliderComponent_BindLua(wi::scene::ColliderComponent* component) :component(component) + { + Shape = IntProperty(reinterpret_cast(&component->shape)); + Radius = FloatProperty(&component->radius); + Offset = VectorProperty(&component->offset); + Tail = VectorProperty(&component->tail); + } ColliderComponent_BindLua(lua_State* L); ~ColliderComponent_BindLua(); + + IntProperty Shape; + FloatProperty Radius; + VectorProperty Offset; + VectorProperty Tail; - int GetShape(lua_State* L); - int GetRadius(lua_State* L); - int GetOffset(lua_State* L); - int GetTail(lua_State* L); - - int SetShape(lua_State* L); - int SetRadius(lua_State* L); - int SetOffset(lua_State* L); - int SetTail(lua_State* L); + PropertyFunction(Shape) + PropertyFunction(Radius) + PropertyFunction(Offset) + PropertyFunction(Tail) }; } diff --git a/WickedEngine/wiSpriteAnim_BindLua.cpp b/WickedEngine/wiSpriteAnim_BindLua.cpp index 92b9a3502..2bf9ae12d 100644 --- a/WickedEngine/wiSpriteAnim_BindLua.cpp +++ b/WickedEngine/wiSpriteAnim_BindLua.cpp @@ -31,6 +31,16 @@ namespace wi::lua { nullptr, nullptr } }; Luna::PropertyType SpriteAnim_BindLua::properties[] = { + lunaproperty(SpriteAnim_BindLua, Rot), + lunaproperty(SpriteAnim_BindLua, Rotation), + lunaproperty(SpriteAnim_BindLua, Opacity), + lunaproperty(SpriteAnim_BindLua, Fade), + lunaproperty(SpriteAnim_BindLua, Repeatable), + lunaproperty(SpriteAnim_BindLua, Velocity), + lunaproperty(SpriteAnim_BindLua, ScaleX), + lunaproperty(SpriteAnim_BindLua, ScaleY), + lunaproperty(SpriteAnim_BindLua, MovingTexAnim), + lunaproperty(SpriteAnim_BindLua, DrawRecAnim), { nullptr, nullptr } }; diff --git a/WickedEngine/wiSpriteFont_BindLua.cpp b/WickedEngine/wiSpriteFont_BindLua.cpp index bcd342caf..29844b069 100644 --- a/WickedEngine/wiSpriteFont_BindLua.cpp +++ b/WickedEngine/wiSpriteFont_BindLua.cpp @@ -8,7 +8,7 @@ namespace wi::lua const char SpriteFont_BindLua::className[] = "SpriteFont"; Luna::FunctionType SpriteFont_BindLua::methods[] = { - lunamethod(SpriteFont_BindLua, GetText), + lunamethod(SpriteFont_BindLua, SetText), lunamethod(SpriteFont_BindLua, SetSize), lunamethod(SpriteFont_BindLua, SetPos), lunamethod(SpriteFont_BindLua, SetSpacing), @@ -22,7 +22,7 @@ namespace wi::lua lunamethod(SpriteFont_BindLua, SetShadowOffset), lunamethod(SpriteFont_BindLua, SetStyle), - lunamethod(SpriteFont_BindLua, SetText), + lunamethod(SpriteFont_BindLua, GetText), lunamethod(SpriteFont_BindLua, GetSize), lunamethod(SpriteFont_BindLua, GetPos), lunamethod(SpriteFont_BindLua, GetSpacing), @@ -38,6 +38,18 @@ namespace wi::lua { NULL, NULL } }; Luna::PropertyType SpriteFont_BindLua::properties[] = { + lunaproperty(SpriteFont_BindLua, Text), + lunaproperty(SpriteFont_BindLua, Size), + lunaproperty(SpriteFont_BindLua, Pos), + lunaproperty(SpriteFont_BindLua, Spacing), + lunaproperty(SpriteFont_BindLua, Align), + lunaproperty(SpriteFont_BindLua, Color), + lunaproperty(SpriteFont_BindLua, ShadowColor), + lunaproperty(SpriteFont_BindLua, Bolden), + lunaproperty(SpriteFont_BindLua, Softness), + lunaproperty(SpriteFont_BindLua, ShadowBolden), + lunaproperty(SpriteFont_BindLua, ShadowSoftness), + lunaproperty(SpriteFont_BindLua, ShadowOffset), { NULL, NULL } }; diff --git a/WickedEngine/wiSprite_BindLua.cpp b/WickedEngine/wiSprite_BindLua.cpp index a0fc10f15..f41c52fb2 100644 --- a/WickedEngine/wiSprite_BindLua.cpp +++ b/WickedEngine/wiSprite_BindLua.cpp @@ -16,6 +16,8 @@ namespace wi::lua { NULL, NULL } }; Luna::PropertyType Sprite_BindLua::properties[] = { + lunaproperty(Sprite_BindLua, Params), + lunaproperty(Sprite_BindLua, Anim), { NULL, NULL } };