From 3d3d351696b04922142de41b59189abb6d130851 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Mon, 4 Sep 2023 10:19:47 +0900 Subject: [PATCH] Fix svace issue for bullet-physics Change-Id: Ic9bd3319cde9152168aa353b728aca6b34593414 Signed-off-by: Eunki, Hong --- examples/bullet-physics/ball-renderer.cpp | 2 +- examples/bullet-physics/physics-demo-controller.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/bullet-physics/ball-renderer.cpp b/examples/bullet-physics/ball-renderer.cpp index 6c4f852..c5feeff 100644 --- a/examples/bullet-physics/ball-renderer.cpp +++ b/examples/bullet-physics/ball-renderer.cpp @@ -118,7 +118,7 @@ Geometry BallRenderer::CreateBallGeometry() vertices.emplace_back(Vertex{Vector3{b, -a, 0}}); vertices.emplace_back(Vertex{Vector3{-b, -a, 0}}); - for(auto vertex : vertices) + for(auto& vertex : vertices) { vertex.aPosition.Normalize(); } diff --git a/examples/bullet-physics/physics-demo-controller.cpp b/examples/bullet-physics/physics-demo-controller.cpp index 4052f28..93ec771 100644 --- a/examples/bullet-physics/physics-demo-controller.cpp +++ b/examples/bullet-physics/physics-demo-controller.cpp @@ -77,13 +77,13 @@ public: mWindow.SetBackgroundColor(Color::DARK_SLATE_GRAY); Window::WindowSize windowSize = mWindow.GetSize(); - auto cameraActor = mWindow.GetRenderTaskList().GetTask(0).GetCameraActor(); - cameraActor[CameraActor::Property::FIELD_OF_VIEW] = Math::PI/2.5f; // 72 degrees - cameraActor[Actor::Property::POSITION_X] = 500; - float z = cameraActor[Actor::Property::POSITION_Z]; - cameraActor[Actor::Property::POSITION_Z] = z-100; + auto cameraActor = mWindow.GetRenderTaskList().GetTask(0).GetCameraActor(); + cameraActor[CameraActor::Property::FIELD_OF_VIEW] = Math::PI / 2.5f; // 72 degrees + cameraActor[Actor::Property::POSITION_X] = 500; + float z = cameraActor[Actor::Property::POSITION_Z]; + cameraActor[Actor::Property::POSITION_Z] = z - 100; cameraActor[CameraActor::Property::TARGET_POSITION] = Vector3(); - cameraActor[CameraActor::Property::TYPE] = Camera::LOOK_AT_TARGET; + cameraActor[CameraActor::Property::TYPE] = Camera::LOOK_AT_TARGET; mPhysicsTransform.SetIdentityAndScale(Vector3(1.0f, -1.0f, 1.0f)); mPhysicsTransform.SetTranslation(Vector3(windowSize.GetWidth() * 0.5f, windowSize.GetHeight() * 0.5f, @@ -98,11 +98,11 @@ public: mWindow.Add(mPhysicsRoot); auto scopedAccessor = mPhysicsAdaptor.GetPhysicsAccessor(); - auto bulletWorld = scopedAccessor->GetNative().Get(); + auto bulletWorld = scopedAccessor->GetNative().Get(); bulletWorld->setGravity(btVector3(0, -200, 0)); CreateGround(scopedAccessor, windowSize); - mBrick = CreateLargeBrick(scopedAccessor); + mBrick = CreateLargeBrick(scopedAccessor); mSelectedActor = mBrick; CreateBall(scopedAccessor); @@ -628,7 +628,7 @@ private: PhysicsActor mBrick; PhysicsActor mSelectedActor; - btRigidBody* mPickedBody; + btRigidBody* mPickedBody{nullptr}; float mOldPickingDistance{0.0f}; int mPickedSavedState{0}; btTypedConstraint* mPickedConstraint{nullptr}; -- 2.7.4