forked from o3de/o3de-extras
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michał <[email protected]>
- Loading branch information
1 parent
b502905
commit 3d8fc0d
Showing
5 changed files
with
148 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Gems/ROS2/Code/Source/SimulationUtils/FollowingCameraConfiguration.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) Contributors to the Open 3D Engine Project. | ||
* For complete copyright and license terms please see the LICENSE at the root of this distribution. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 OR MIT | ||
* | ||
*/ | ||
|
||
#include "FollowingCameraConfiguration.h" | ||
#include <AzCore/Serialization/EditContext.h> | ||
#include <AzCore/Serialization/EditContextConstants.inl> | ||
|
||
namespace ROS2 | ||
{ | ||
void FollowingCameraConfiguration::Reflect(AZ::ReflectContext* context) | ||
{ | ||
if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context)) | ||
{ | ||
serialize->Class<FollowingCameraConfiguration>() | ||
->Version(1) | ||
->Field("PredefinedViews", &FollowingCameraConfiguration::m_predefinedViews) | ||
->Field("SmoothingLength", &FollowingCameraConfiguration::m_smoothingBuffer) | ||
->Field("ZoomSpeed", &FollowingCameraConfiguration::m_zoomSpeed) | ||
->Field("RotationSpeed", &FollowingCameraConfiguration::m_rotationSpeed) | ||
->Field("DefaultView", &FollowingCameraConfiguration::m_defaultView); | ||
|
||
if (AZ::EditContext* ec = serialize->GetEditContext()) | ||
{ | ||
ec->Class<FollowingCameraConfiguration>("ROS2 GNSS Sensor", "GNSS sensor component") | ||
->DataElement( | ||
AZ::Edit::UIHandlers::Default, | ||
&FollowingCameraConfiguration::m_smoothingBuffer, | ||
"Smoothing Length", | ||
"Number of past transform used to smooth, larger value gives smoother result, but more lag") | ||
->Attribute(AZ::Edit::Attributes::Min, 1) | ||
->Attribute(AZ::Edit::Attributes::Max, 100) | ||
->DataElement( | ||
AZ::Edit::UIHandlers::Default, &FollowingCameraConfiguration::m_zoomSpeed, "Zoom Speed", "Speed of zooming") | ||
->DataElement( | ||
AZ::Edit::UIHandlers::Default, | ||
&FollowingCameraConfiguration::m_rotationSpeed, | ||
"Rotation Speed", | ||
"Rotation Speed around the target") | ||
->DataElement( | ||
AZ::Edit::UIHandlers::Default, &FollowingCameraConfiguration::m_predefinedViews, "Views", "Views to follow") | ||
->DataElement( | ||
AZ::Edit::UIHandlers::Default, | ||
&FollowingCameraConfiguration::m_defaultView, | ||
"Default View", | ||
"Default View to follow") | ||
->Attribute(AZ::Edit::Attributes::Min, 0); | ||
} | ||
} | ||
} | ||
|
||
} // namespace ROS2 |
36 changes: 36 additions & 0 deletions
36
Gems/ROS2/Code/Source/SimulationUtils/FollowingCameraConfiguration.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) Contributors to the Open 3D Engine Project. | ||
* For complete copyright and license terms please see the LICENSE at the root of this distribution. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 OR MIT | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include <AzCore/Component/EntityId.h> | ||
#include <AzCore/RTTI/RTTI.h> | ||
#include <AzCore/Serialization/SerializeContext.h> | ||
#include <AzCore/std/containers/vector.h> | ||
#include <AzCore/std/string/string.h> | ||
|
||
namespace ROS2 | ||
{ | ||
//! A structure capturing configuration of Following Camera. | ||
struct FollowingCameraConfiguration | ||
{ | ||
AZ_TYPE_INFO(FollowingCameraConfiguration, "{605fec3d-0152-44f3-b885-669cdcf201eb}"); | ||
static void Reflect(AZ::ReflectContext* context); | ||
|
||
AZStd::vector<AZ::EntityId> m_predefinedViews; //!< List of predefined views. | ||
int m_defaultView{ 0 }; //!< Index of the default view. | ||
|
||
//! The translation offset from the defined view. | ||
|
||
//! The length of the smoothing buffer. | ||
int m_smoothingBuffer = 30; | ||
float m_zoomSpeed = 0.06f; | ||
float m_rotationSpeed = 0.05f; | ||
|
||
const float m_opticalAxisTranslationMin = 0.0f; | ||
}; | ||
} // namespace ROS2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters