Fix svace issue for bullet-physics 94/298194/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 4 Sep 2023 01:19:47 +0000 (10:19 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Mon, 4 Sep 2023 05:58:52 +0000 (14:58 +0900)
Change-Id: Ic9bd3319cde9152168aa353b728aca6b34593414
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
examples/bullet-physics/ball-renderer.cpp
examples/bullet-physics/physics-demo-controller.cpp

index 6c4f852..c5feeff 100644 (file)
@@ -118,7 +118,7 @@ Geometry BallRenderer::CreateBallGeometry()
     vertices.emplace_back(Vertex{Vector3{b, -a, 0}});
     vertices.emplace_back(Vertex{Vector3{-b, -a, 0}});
 
     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();
     }
     {
       vertex.aPosition.Normalize();
     }
index 4052f28..93ec771 100644 (file)
@@ -77,13 +77,13 @@ public:
     mWindow.SetBackgroundColor(Color::DARK_SLATE_GRAY);
     Window::WindowSize windowSize = mWindow.GetSize();
 
     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::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,
     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();
     mWindow.Add(mPhysicsRoot);
 
     auto scopedAccessor = mPhysicsAdaptor.GetPhysicsAccessor();
-    auto bulletWorld = scopedAccessor->GetNative().Get<btDiscreteDynamicsWorld*>();
+    auto bulletWorld    = scopedAccessor->GetNative().Get<btDiscreteDynamicsWorld*>();
     bulletWorld->setGravity(btVector3(0, -200, 0));
 
     CreateGround(scopedAccessor, windowSize);
     bulletWorld->setGravity(btVector3(0, -200, 0));
 
     CreateGround(scopedAccessor, windowSize);
-    mBrick = CreateLargeBrick(scopedAccessor);
+    mBrick         = CreateLargeBrick(scopedAccessor);
     mSelectedActor = mBrick;
 
     CreateBall(scopedAccessor);
     mSelectedActor = mBrick;
 
     CreateBall(scopedAccessor);
@@ -628,7 +628,7 @@ private:
   PhysicsActor   mBrick;
   PhysicsActor   mSelectedActor;
 
   PhysicsActor   mBrick;
   PhysicsActor   mSelectedActor;
 
-  btRigidBody*                     mPickedBody;
+  btRigidBody*                     mPickedBody{nullptr};
   float                            mOldPickingDistance{0.0f};
   int                              mPickedSavedState{0};
   btTypedConstraint*               mPickedConstraint{nullptr};
   float                            mOldPickingDistance{0.0f};
   int                              mPickedSavedState{0};
   btTypedConstraint*               mPickedConstraint{nullptr};