diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md index 001e93401..74eb3409f 100644 --- a/Content/Documentation/ScriptingAPI-Documentation.md +++ b/Content/Documentation/ScriptingAPI-Documentation.md @@ -1364,30 +1364,30 @@ Describes a Collider object. - GetRagdollHeadSize() : float [outer] HumanoidBone = { - Hips = 0, - Spine = 1, + Hips = 0, -- included in ragdoll + Spine = 1, -- included in ragdoll Chest = 2, UpperChest = 3, - Neck = 4, - Head = 5, + Neck = 4, -- included in ragdoll + Head = 5, -- included in ragdoll if Neck is not available LeftEye = 6, RightEye = 7, Jaw = 8, - LeftUpperLeg = 9, - LeftLowerLeg = 10, + LeftUpperLeg = 9, -- included in ragdoll + LeftLowerLeg = 10, -- included in ragdoll LeftFoot = 11, LeftToes = 12, - RightUpperLeg = 13, - RightLowerLeg = 14, + RightUpperLeg = 13, -- included in ragdoll + RightLowerLeg = 14, -- included in ragdoll RightFoot = 15, RightToes = 16, LeftShoulder = 17, - LeftUpperArm = 18, - LeftLowerArm = 19, + LeftUpperArm = 18, -- included in ragdoll + LeftLowerArm = 19, -- included in ragdoll LeftHand = 20, RightShoulder = 21, - RightUpperArm = 22, - RightLowerArm = 23, + RightUpperArm = 22, -- included in ragdoll + RightLowerArm = 23, -- included in ragdoll RightHand = 24, LeftThumbMetacarpal = 25, LeftThumbProximal = 26, @@ -1635,6 +1635,7 @@ Sphere defined by center Vector and radius. Can be intersected with other primit - [constructor]Sphere(Vector center, float radius) - Intersects(AABB aabb) : bool result - Intersects(Sphere sphere) : bool result +- Intersects(Capsule capsule) : bool result - Intersects(Ray ray) : bool result - GetCenter() : Vector result - GetRadius() : float result diff --git a/Editor/HierarchyWindow.cpp b/Editor/HierarchyWindow.cpp index 938fd602d..1ed938dd7 100644 --- a/Editor/HierarchyWindow.cpp +++ b/Editor/HierarchyWindow.cpp @@ -17,7 +17,7 @@ void HierarchyWindow::Create(EditorComponent* _editor) archive << EditorComponent::HISTORYOP_COMPONENT_DATA; editor->RecordEntity(archive, entity); - editor->GetCurrentScene().hierarchy.Remove(entity); + editor->GetCurrentScene().Component_Detach(entity); editor->RecordEntity(archive, entity); diff --git a/Editor/ObjectWindow.cpp b/Editor/ObjectWindow.cpp index 150e259cf..d5971c600 100644 --- a/Editor/ObjectWindow.cpp +++ b/Editor/ObjectWindow.cpp @@ -257,7 +257,7 @@ void ObjectWindow::Create(EditorComponent* _editor) editor = _editor; wi::gui::Window::Create(ICON_OBJECT " Object", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(670, 820)); + SetSize(XMFLOAT2(670, 840)); closeButton.SetTooltip("Delete ObjectComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -431,6 +431,19 @@ void ObjectWindow::Create(EditorComponent* _editor) }); AddWidget(&ditherSlider); + alphaRefSlider.Create(0, 1, 0, 1000, "Alpha Ref: "); + alphaRefSlider.SetTooltip("Adjust alpha ref per instance.\nThis is an additional value on top of material's alpha ref, used for alpha testing (alpha cutout)."); + alphaRefSlider.SetSize(XMFLOAT2(wid, hei)); + alphaRefSlider.SetPos(XMFLOAT2(x, y += step)); + alphaRefSlider.OnSlide([&](wi::gui::EventArgs args) { + ObjectComponent* object = editor->GetCurrentScene().objects.GetComponent(entity); + if (object != nullptr) + { + object->alphaRef = args.fValue; + } + }); + AddWidget(&alphaRefSlider); + cascadeMaskSlider.Create(0, 3, 0, 3, "Cascade Mask: "); cascadeMaskSlider.SetTooltip("How many shadow cascades to skip when rendering this object into shadow maps? (0: skip none, it will be in all cascades, 1: skip first (biggest cascade), ...etc..."); cascadeMaskSlider.SetSize(XMFLOAT2(wid, hei)); @@ -956,6 +969,7 @@ void ObjectWindow::SetEntity(Entity entity) navmeshCheckBox.SetCheck(object->filterMask & wi::enums::FILTER_NAVIGATION_MESH); cascadeMaskSlider.SetValue((float)object->cascadeMask); ditherSlider.SetValue(object->GetTransparency()); + alphaRefSlider.SetValue(object->alphaRef); lodSlider.SetValue(object->lod_distance_multiplier); drawdistanceSlider.SetValue(object->draw_distance); sortPrioritySlider.SetValue((int)object->sort_priority); @@ -1033,6 +1047,7 @@ void ObjectWindow::ResizeLayout() add_right(notVisibleInReflectionsCheckBox); add_right(navmeshCheckBox); add(ditherSlider); + add(alphaRefSlider); add(cascadeMaskSlider); add(lodSlider); add(drawdistanceSlider); diff --git a/Editor/ObjectWindow.h b/Editor/ObjectWindow.h index d82916c2f..d90fabd63 100644 --- a/Editor/ObjectWindow.h +++ b/Editor/ObjectWindow.h @@ -18,6 +18,7 @@ public: wi::gui::CheckBox notVisibleInMainCameraCheckBox; wi::gui::CheckBox notVisibleInReflectionsCheckBox; wi::gui::Slider ditherSlider; + wi::gui::Slider alphaRefSlider; wi::gui::Slider cascadeMaskSlider; wi::gui::Slider lodSlider; wi::gui::Slider drawdistanceSlider; diff --git a/Editor/RigidBodyWindow.cpp b/Editor/RigidBodyWindow.cpp index ac6bab1b8..f38d1109c 100644 --- a/Editor/RigidBodyWindow.cpp +++ b/Editor/RigidBodyWindow.cpp @@ -9,7 +9,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) editor = _editor; wi::gui::Window::Create(ICON_RIGIDBODY " Rigid Body Physics", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE); - SetSize(XMFLOAT2(670, 300)); + SetSize(XMFLOAT2(670, 400)); closeButton.SetTooltip("Delete RigidBodyPhysicsComponent"); OnClose([=](wi::gui::EventArgs args) { @@ -38,6 +38,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) collisionShapeComboBox.AddItem("Box", RigidBodyPhysicsComponent::CollisionShape::BOX); collisionShapeComboBox.AddItem("Sphere", RigidBodyPhysicsComponent::CollisionShape::SPHERE); collisionShapeComboBox.AddItem("Capsule", RigidBodyPhysicsComponent::CollisionShape::CAPSULE); + collisionShapeComboBox.AddItem("Cylinder", RigidBodyPhysicsComponent::CollisionShape::CYLINDER); collisionShapeComboBox.AddItem("Convex Hull", RigidBodyPhysicsComponent::CollisionShape::CONVEX_HULL); collisionShapeComboBox.AddItem("Triangle Mesh", RigidBodyPhysicsComponent::CollisionShape::TRIANGLE_MESH); collisionShapeComboBox.OnSelect([&](wi::gui::EventArgs args) @@ -67,6 +68,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) switch (shape) { case RigidBodyPhysicsComponent::CollisionShape::BOX: + case RigidBodyPhysicsComponent::CollisionShape::CYLINDER: XSlider.SetEnabled(true); YSlider.SetEnabled(true); ZSlider.SetEnabled(true); @@ -120,6 +122,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) { default: case RigidBodyPhysicsComponent::CollisionShape::BOX: + case RigidBodyPhysicsComponent::CollisionShape::CYLINDER: physicscomponent->box.halfextents.x = args.fValue; break; case RigidBodyPhysicsComponent::CollisionShape::SPHERE: @@ -145,6 +148,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) { default: case RigidBodyPhysicsComponent::CollisionShape::BOX: + case RigidBodyPhysicsComponent::CollisionShape::CYLINDER: physicscomponent->box.halfextents.y = args.fValue; break; case RigidBodyPhysicsComponent::CollisionShape::CAPSULE: @@ -167,6 +171,7 @@ void RigidBodyWindow::Create(EditorComponent* _editor) { default: case RigidBodyPhysicsComponent::CollisionShape::BOX: + case RigidBodyPhysicsComponent::CollisionShape::CYLINDER: physicscomponent->box.halfextents.z = args.fValue; break; } @@ -300,6 +305,50 @@ void RigidBodyWindow::Create(EditorComponent* _editor) + offsetXSlider.Create(-10, 10, 0, 100000, "Local Offset X: "); + offsetXSlider.SetTooltip("Set a local offset relative to the object transform"); + offsetXSlider.SetSize(XMFLOAT2(wid, hei)); + offsetXSlider.SetPos(XMFLOAT2(x, y += step)); + offsetXSlider.OnSlide([&](wi::gui::EventArgs args) { + RigidBodyPhysicsComponent* physicscomponent = editor->GetCurrentScene().rigidbodies.GetComponent(entity); + if (physicscomponent != nullptr) + { + physicscomponent->local_offset.x = args.fValue; + physicscomponent->physicsobject = {}; + } + }); + AddWidget(&offsetXSlider); + + offsetYSlider.Create(-10, 10, 0, 100000, "Local Offset Y: "); + offsetYSlider.SetTooltip("Set a local offset relative to the object transform"); + offsetYSlider.SetSize(XMFLOAT2(wid, hei)); + offsetYSlider.SetPos(XMFLOAT2(x, y += step)); + offsetYSlider.OnSlide([&](wi::gui::EventArgs args) { + RigidBodyPhysicsComponent* physicscomponent = editor->GetCurrentScene().rigidbodies.GetComponent(entity); + if (physicscomponent != nullptr) + { + physicscomponent->local_offset.y = args.fValue; + physicscomponent->physicsobject = {}; + } + }); + AddWidget(&offsetYSlider); + + offsetZSlider.Create(-10, 10, 0, 100000, "Local Offset Z: "); + offsetZSlider.SetTooltip("Set a local offset relative to the object transform"); + offsetZSlider.SetSize(XMFLOAT2(wid, hei)); + offsetZSlider.SetPos(XMFLOAT2(x, y += step)); + offsetZSlider.OnSlide([&](wi::gui::EventArgs args) { + RigidBodyPhysicsComponent* physicscomponent = editor->GetCurrentScene().rigidbodies.GetComponent(entity); + if (physicscomponent != nullptr) + { + physicscomponent->local_offset.z = args.fValue; + physicscomponent->physicsobject = {}; + } + }); + AddWidget(&offsetZSlider); + + + SetMinimized(true); SetVisible(false); @@ -325,6 +374,10 @@ void RigidBodyWindow::SetEntity(Entity entity) angulardampingSlider.SetValue(physicsComponent->damping_angular); physicsMeshLODSlider.SetValue(float(physicsComponent->mesh_lod)); + offsetXSlider.SetValue(physicsComponent->local_offset.x); + offsetYSlider.SetValue(physicsComponent->local_offset.y); + offsetZSlider.SetValue(physicsComponent->local_offset.z); + kinematicCheckBox.SetCheck(physicsComponent->IsKinematic()); disabledeactivationCheckBox.SetCheck(physicsComponent->IsDisableDeactivation()); @@ -385,6 +438,9 @@ void RigidBodyWindow::ResizeLayout() add(lineardampingSlider); add(angulardampingSlider); add(physicsMeshLODSlider); + add(offsetXSlider); + add(offsetYSlider); + add(offsetZSlider); add_right(disabledeactivationCheckBox); add_right(kinematicCheckBox); diff --git a/Editor/RigidBodyWindow.h b/Editor/RigidBodyWindow.h index a3bcb74ce..f1e6364c0 100644 --- a/Editor/RigidBodyWindow.h +++ b/Editor/RigidBodyWindow.h @@ -22,6 +22,9 @@ public: wi::gui::Slider physicsMeshLODSlider; wi::gui::CheckBox disabledeactivationCheckBox; wi::gui::CheckBox kinematicCheckBox; + wi::gui::Slider offsetXSlider; + wi::gui::Slider offsetYSlider; + wi::gui::Slider offsetZSlider; void ResizeLayout() override; }; diff --git a/WickedEngine/shaders/ShaderInterop_Renderer.h b/WickedEngine/shaders/ShaderInterop_Renderer.h index 29b1b4fcb..a0eb32ecf 100644 --- a/WickedEngine/shaders/ShaderInterop_Renderer.h +++ b/WickedEngine/shaders/ShaderInterop_Renderer.h @@ -579,7 +579,7 @@ struct ShaderMeshInstance float radius; int vb_ao; - int padding0; + float alphaTest; int padding1; int padding2; @@ -604,6 +604,7 @@ struct ShaderMeshInstance center = float3(0, 0, 0); radius = 0; vb_ao = -1; + alphaTest = 0; transform.init(); transformInverseTranspose.init(); transformPrev.init(); diff --git a/WickedEngine/shaders/objectHF.hlsli b/WickedEngine/shaders/objectHF.hlsli index 69dc2bdf7..82ba61863 100644 --- a/WickedEngine/shaders/objectHF.hlsli +++ b/WickedEngine/shaders/objectHF.hlsli @@ -93,6 +93,7 @@ inline ShaderMaterial GetMaterial() #endif // OBJECTSHADER_LAYOUT_SHADOW #ifdef OBJECTSHADER_LAYOUT_SHADOW_TEX +#define OBJECTSHADER_USE_INSTANCEINDEX #define OBJECTSHADER_USE_UVSETS #endif // OBJECTSHADER_LAYOUT_SHADOW_TEX @@ -579,7 +580,7 @@ float4 main(PixelInput input, in bool is_frontface : SV_IsFrontFace) : SV_Target // Alpha test is only done for transparents // - Prepass will write alpha coverage mask // - Opaque will use [earlydepthstencil] and COMPARISON_EQUAL depth test on top of depth prepass - clip(surface.baseColor.a - GetMaterial().alphaTest); + clip(surface.baseColor.a - GetMaterial().alphaTest - meshinstance.alphaTest); #endif // DISABLE_ALPHATEST #endif // TRANSPARENT @@ -1025,7 +1026,7 @@ float4 main(PixelInput input, in bool is_frontface : SV_IsFrontFace) : SV_Target // end point: #ifdef PREPASS - coverage = AlphaToCoverage(color.a, GetMaterial().alphaTest, input.pos); + coverage = AlphaToCoverage(color.a, GetMaterial().alphaTest + meshinstance.alphaTest, input.pos); #ifndef DEPTHONLY PrimitiveID prim; prim.primitiveIndex = primitiveID; diff --git a/WickedEngine/shaders/shadowPS_alphatest.hlsl b/WickedEngine/shaders/shadowPS_alphatest.hlsl index 1f2d6097e..974fa22dd 100644 --- a/WickedEngine/shaders/shadowPS_alphatest.hlsl +++ b/WickedEngine/shaders/shadowPS_alphatest.hlsl @@ -17,5 +17,7 @@ void main(PixelInput input) alpha *= GetMaterial().textures[TRANSPARENCYMAP].Sample(sampler_point_wrap, input.GetUVSets()).r; } - clip(alpha - GetMaterial().alphaTest); + ShaderMeshInstance meshinstance = load_instance(input.GetInstanceIndex()); + + clip(alpha - GetMaterial().alphaTest - meshinstance.alphaTest); } diff --git a/WickedEngine/shaders/shadowPS_transparent.hlsl b/WickedEngine/shaders/shadowPS_transparent.hlsl index aa57a2a89..f9cd97639 100644 --- a/WickedEngine/shaders/shadowPS_transparent.hlsl +++ b/WickedEngine/shaders/shadowPS_transparent.hlsl @@ -24,8 +24,10 @@ float4 main(PixelInput input) : SV_TARGET } color *= input.color; + + ShaderMeshInstance meshinstance = load_instance(input.GetInstanceIndex()); - clip(color.a - GetMaterial().alphaTest); + clip(color.a - GetMaterial().alphaTest - meshinstance.alphaTest); float opacity = color.a; diff --git a/WickedEngine/wiHairParticle.cpp b/WickedEngine/wiHairParticle.cpp index 63ae8eace..dcdd41258 100644 --- a/WickedEngine/wiHairParticle.cpp +++ b/WickedEngine/wiHairParticle.cpp @@ -457,6 +457,9 @@ namespace wi return; } + if (renderPass == RENDERPASS_SHADOW && !material.IsCastingShadow()) + return; + GraphicsDevice* device = wi::graphics::GetDevice(); device->EventBegin("HairParticle - Draw", cmd); diff --git a/WickedEngine/wiPhysics_Bullet.cpp b/WickedEngine/wiPhysics_Bullet.cpp index 9520994e8..539a40d92 100644 --- a/WickedEngine/wiPhysics_Bullet.cpp +++ b/WickedEngine/wiPhysics_Bullet.cpp @@ -215,6 +215,9 @@ namespace wi::physics case RigidBodyPhysicsComponent::CollisionShape::CAPSULE: physicsobject.shape = std::make_unique(btScalar(physicscomponent.capsule.radius), btScalar(physicscomponent.capsule.height)); break; + case RigidBodyPhysicsComponent::CollisionShape::CYLINDER: + physicsobject.shape = std::make_unique(btVector3(physicscomponent.box.halfextents.x, physicscomponent.box.halfextents.y, physicscomponent.box.halfextents.z)); + break; case RigidBodyPhysicsComponent::CollisionShape::CONVEX_HULL: if(mesh != nullptr) @@ -312,6 +315,13 @@ namespace wi::physics XMStoreFloat4(&rot, ROT); XMStoreFloat3(&tra, TRA); + tra.x += physicscomponent.local_offset.x; + tra.y += physicscomponent.local_offset.y; + tra.z += physicscomponent.local_offset.z; + + physicsobject.additionalTransform.setOrigin(btVector3(physicscomponent.local_offset.x, physicscomponent.local_offset.y, physicscomponent.local_offset.z)); + physicsobject.additionalTransformInverse = physicsobject.additionalTransform.inverse(); + //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects btTransform shapeTransform; shapeTransform.setIdentity(); diff --git a/WickedEngine/wiPrimitive_BindLua.cpp b/WickedEngine/wiPrimitive_BindLua.cpp index 59b59abd6..37f70d074 100644 --- a/WickedEngine/wiPrimitive_BindLua.cpp +++ b/WickedEngine/wiPrimitive_BindLua.cpp @@ -462,6 +462,14 @@ namespace wi::lua::primitive return 1; } + Capsule_BindLua* _capsule = Luna::lightcheck(L, 1); + if (_capsule) + { + bool intersects = sphere.intersects(_capsule->capsule); + wi::lua::SSetBool(L, intersects); + return 1; + } + Ray_BindLua* ray = Luna::lightcheck(L, 1); if (ray) { diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index f3261aa5e..031dbcb20 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -2990,6 +2990,10 @@ void RenderMeshes( { instancedBatch.forceAlphatestForDithering = 1; } + if (instance.alphaRef < 1) + { + instancedBatch.forceAlphatestForDithering = 1; + } if (forwardLightmaskRequest) { diff --git a/WickedEngine/wiScene.cpp b/WickedEngine/wiScene.cpp index 8835e506a..c90875e66 100644 --- a/WickedEngine/wiScene.cpp +++ b/WickedEngine/wiScene.cpp @@ -4208,6 +4208,7 @@ namespace wi::scene inst.center = object.center; inst.radius = object.radius; inst.vb_ao = object.vb_ao_srv; + inst.alphaTest = 1 - object.alphaRef; inst.SetUserStencilRef(object.userStencilRef); std::memcpy(instanceArrayMapped + args.jobIndex, &inst, sizeof(inst)); // memcpy whole structure into mapped pointer to avoid read from uncached memory diff --git a/WickedEngine/wiScene.h b/WickedEngine/wiScene.h index af0535f86..d6b180e31 100644 --- a/WickedEngine/wiScene.h +++ b/WickedEngine/wiScene.h @@ -36,7 +36,7 @@ namespace wi::scene wi::ecs::ComponentManager& meshes = componentLibrary.Register("wi::scene::Scene::meshes", 2); // version = 2 wi::ecs::ComponentManager& impostors = componentLibrary.Register("wi::scene::Scene::impostors"); wi::ecs::ComponentManager& objects = componentLibrary.Register("wi::scene::Scene::objects", 3); // version = 3 - wi::ecs::ComponentManager& rigidbodies = componentLibrary.Register("wi::scene::Scene::rigidbodies", 1); // version = 1 + wi::ecs::ComponentManager& rigidbodies = componentLibrary.Register("wi::scene::Scene::rigidbodies", 2); // version = 2 wi::ecs::ComponentManager& softbodies = componentLibrary.Register("wi::scene::Scene::softbodies"); wi::ecs::ComponentManager& armatures = componentLibrary.Register("wi::scene::Scene::armatures"); wi::ecs::ComponentManager& lights = componentLibrary.Register("wi::scene::Scene::lights", 2); // version = 2 diff --git a/WickedEngine/wiScene_BindLua.cpp b/WickedEngine/wiScene_BindLua.cpp index 94a6d260b..7733a8704 100644 --- a/WickedEngine/wiScene_BindLua.cpp +++ b/WickedEngine/wiScene_BindLua.cpp @@ -5093,6 +5093,7 @@ Luna::FunctionType ObjectComponent_BindLua::methods[] = lunamethod(ObjectComponent_BindLua, GetCascadeMask), lunamethod(ObjectComponent_BindLua, GetRendertypeMask), lunamethod(ObjectComponent_BindLua, GetColor), + lunamethod(ObjectComponent_BindLua, GetAlphaRef), lunamethod(ObjectComponent_BindLua, GetEmissiveColor), lunamethod(ObjectComponent_BindLua, GetUserStencilRef), lunamethod(ObjectComponent_BindLua, GetDrawDistance), @@ -5104,6 +5105,7 @@ Luna::FunctionType ObjectComponent_BindLua::methods[] = lunamethod(ObjectComponent_BindLua, SetCascadeMask), lunamethod(ObjectComponent_BindLua, SetRendertypeMask), lunamethod(ObjectComponent_BindLua, SetColor), + lunamethod(ObjectComponent_BindLua, SetAlphaRef), lunamethod(ObjectComponent_BindLua, SetEmissiveColor), lunamethod(ObjectComponent_BindLua, SetUserStencilRef), lunamethod(ObjectComponent_BindLua, SetDrawDistance), @@ -5142,6 +5144,11 @@ int ObjectComponent_BindLua::GetColor(lua_State* L) Luna::push(L, XMLoadFloat4(&component->color)); return 1; } +int ObjectComponent_BindLua::GetAlphaRef(lua_State* L) +{ + wi::lua::SSetFloat(L, component->alphaRef); + return 1; +} int ObjectComponent_BindLua::GetEmissiveColor(lua_State* L) { Luna::push(L, XMLoadFloat4(&component->emissiveColor)); @@ -5242,6 +5249,20 @@ int ObjectComponent_BindLua::SetColor(lua_State* L) return 0; } +int ObjectComponent_BindLua::SetAlphaRef(lua_State* L) +{ + int argc = wi::lua::SGetArgCount(L); + if (argc > 0) + { + component->alphaRef = wi::lua::SGetFloat(L, 1); + } + else + { + wi::lua::SError(L, "SetAlphaRef(float value) not enough arguments!"); + } + + return 0; +} int ObjectComponent_BindLua::SetEmissiveColor(lua_State* L) { int argc = wi::lua::SGetArgCount(L); diff --git a/WickedEngine/wiScene_BindLua.h b/WickedEngine/wiScene_BindLua.h index 0577d99e7..6a8a41ee0 100644 --- a/WickedEngine/wiScene_BindLua.h +++ b/WickedEngine/wiScene_BindLua.h @@ -771,6 +771,7 @@ namespace wi::lua::scene int GetCascadeMask(lua_State* L); int GetRendertypeMask(lua_State* L); int GetColor(lua_State* L); + int GetAlphaRef(lua_State* L); int GetEmissiveColor(lua_State* L); int GetUserStencilRef(lua_State* L); int GetLodDistanceMultiplier(lua_State* L); @@ -783,6 +784,7 @@ namespace wi::lua::scene int SetCascadeMask(lua_State* L); int SetRendertypeMask(lua_State* L); int SetColor(lua_State* L); + int SetAlphaRef(lua_State* L); int SetEmissiveColor(lua_State* L); int SetUserStencilRef(lua_State* L); int SetLodDistanceMultiplier(lua_State* L); diff --git a/WickedEngine/wiScene_Components.h b/WickedEngine/wiScene_Components.h index 1201f0cb7..7fc48a4a4 100644 --- a/WickedEngine/wiScene_Components.h +++ b/WickedEngine/wiScene_Components.h @@ -826,6 +826,7 @@ namespace wi::scene wi::vector lightmapTextureData; uint32_t sort_priority = 0; // increase to draw earlier (currently 4 bits will be used) wi::vector vertex_ao; + float alphaRef = 1; // Non-serialized attributes: uint32_t filterMaskDynamic = 0; @@ -911,6 +912,7 @@ namespace wi::scene CAPSULE, CONVEX_HULL, TRIANGLE_MESH, + CYLINDER, ENUM_FORCE_UINT32 = 0xFFFFFFFF }; CollisionShape shape; @@ -919,11 +921,12 @@ namespace wi::scene float restitution = 0.0f; float damping_linear = 0.0f; float damping_angular = 0.0f; + XMFLOAT3 local_offset = XMFLOAT3(0, 0, 0); struct BoxParams { XMFLOAT3 halfextents = XMFLOAT3(1, 1, 1); - } box; + } box; // also cylinder params struct SphereParams { float radius = 1; diff --git a/WickedEngine/wiScene_Serializers.cpp b/WickedEngine/wiScene_Serializers.cpp index 8b7e08a8a..4eb2f4ec6 100644 --- a/WickedEngine/wiScene_Serializers.cpp +++ b/WickedEngine/wiScene_Serializers.cpp @@ -702,6 +702,10 @@ namespace wi::scene { archive >> mesh_lod; } + if (seri.GetVersion() >= 2) + { + archive >> local_offset; + } } else { @@ -729,6 +733,10 @@ namespace wi::scene { archive << mesh_lod; } + if (seri.GetVersion() >= 2) + { + archive << local_offset; + } } } void SoftBodyPhysicsComponent::Serialize(wi::Archive& archive, EntitySerializer& seri) diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 37dc7de3a..7b59cce7c 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 487; + const int revision = 488; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);