From 272ec79bba75f705f7eb1abe04280e271d63a0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pe=C5=82ka?= Date: Fri, 27 Sep 2024 11:10:19 +0200 Subject: [PATCH 1/2] Moved BillboardComponent Signed-off-by: Patryk Antosz Co-authored-by: Patryk Antosz --- Gems/Billboard/.gitignore | 0 Gems/Billboard/CMakeLists.txt | 22 ++ Gems/Billboard/Code/CMakeLists.txt | 221 ++++++++++++++++++ .../Code/Include/Billboard/BillboardTypeIds.h | 19 ++ .../Code/Platform/Android/PAL_android.cmake | 4 + .../Android/billboard_api_files.cmake | 3 + .../Android/billboard_private_files.cmake | 8 + .../Android/billboard_shared_files.cmake | 8 + .../Code/Platform/Linux/PAL_linux.cmake | 4 + .../Platform/Linux/billboard_api_files.cmake | 3 + .../Linux/billboard_editor_api_files.cmake | 3 + .../Linux/billboard_private_files.cmake | 8 + .../Linux/billboard_shared_files.cmake | 8 + .../Billboard/Code/Platform/Mac/PAL_mac.cmake | 4 + .../Platform/Mac/billboard_api_files.cmake | 3 + .../Mac/billboard_editor_api_files.cmake | 3 + .../Mac/billboard_private_files.cmake | 8 + .../Platform/Mac/billboard_shared_files.cmake | 8 + .../Code/Platform/Windows/PAL_windows.cmake | 4 + .../Windows/billboard_api_files.cmake | 3 + .../Windows/billboard_editor_api_files.cmake | 3 + .../Windows/billboard_private_files.cmake | 8 + .../Windows/billboard_shared_files.cmake | 8 + .../Billboard/Code/Platform/iOS/PAL_ios.cmake | 4 + .../Platform/iOS/billboard_api_files.cmake | 3 + .../iOS/billboard_private_files.cmake | 8 + .../Platform/iOS/billboard_shared_files.cmake | 8 + .../Source/Billboard/BillboardComponent.cpp | 167 +++++++++++++ .../Source/Billboard/BillboardComponent.h | 72 ++++++ .../Code/Source/BillboardModuleInterface.cpp | 31 +++ .../Code/Source/BillboardModuleInterface.h | 23 ++ .../Code/Source/Clients/BillboardModule.cpp | 15 ++ .../Source/Tools/BillboardEditorModule.cpp | 33 +++ .../Code/Tests/Clients/BillboardTest.cpp | 4 + .../Code/Tests/Tools/BillboardEditorTest.cpp | 4 + Gems/Billboard/Code/billboard_api_files.cmake | 4 + .../Code/billboard_editor_api_files.cmake | 4 + .../Code/billboard_editor_private_files.cmake | 3 + .../Code/billboard_editor_shared_files.cmake | 4 + .../Code/billboard_editor_tests_files.cmake | 4 + .../Code/billboard_private_files.cmake | 7 + .../Code/billboard_shared_files.cmake | 4 + .../Code/billboard_tests_files.cmake | 4 + .../Registry/assetprocessor_settings.setreg | 13 ++ Gems/Billboard/gem.json | 28 +++ Gems/Billboard/preview.png | Bin 0 -> 4475 bytes readme.md | 6 +- 47 files changed, 815 insertions(+), 1 deletion(-) create mode 100644 Gems/Billboard/.gitignore create mode 100644 Gems/Billboard/CMakeLists.txt create mode 100644 Gems/Billboard/Code/CMakeLists.txt create mode 100644 Gems/Billboard/Code/Include/Billboard/BillboardTypeIds.h create mode 100644 Gems/Billboard/Code/Platform/Android/PAL_android.cmake create mode 100644 Gems/Billboard/Code/Platform/Android/billboard_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Android/billboard_private_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Android/billboard_shared_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Linux/PAL_linux.cmake create mode 100644 Gems/Billboard/Code/Platform/Linux/billboard_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Linux/billboard_editor_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Linux/billboard_private_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Linux/billboard_shared_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Mac/PAL_mac.cmake create mode 100644 Gems/Billboard/Code/Platform/Mac/billboard_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Mac/billboard_editor_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Mac/billboard_private_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Mac/billboard_shared_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Windows/PAL_windows.cmake create mode 100644 Gems/Billboard/Code/Platform/Windows/billboard_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Windows/billboard_editor_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Windows/billboard_private_files.cmake create mode 100644 Gems/Billboard/Code/Platform/Windows/billboard_shared_files.cmake create mode 100644 Gems/Billboard/Code/Platform/iOS/PAL_ios.cmake create mode 100644 Gems/Billboard/Code/Platform/iOS/billboard_api_files.cmake create mode 100644 Gems/Billboard/Code/Platform/iOS/billboard_private_files.cmake create mode 100644 Gems/Billboard/Code/Platform/iOS/billboard_shared_files.cmake create mode 100644 Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp create mode 100644 Gems/Billboard/Code/Source/Billboard/BillboardComponent.h create mode 100644 Gems/Billboard/Code/Source/BillboardModuleInterface.cpp create mode 100644 Gems/Billboard/Code/Source/BillboardModuleInterface.h create mode 100644 Gems/Billboard/Code/Source/Clients/BillboardModule.cpp create mode 100644 Gems/Billboard/Code/Source/Tools/BillboardEditorModule.cpp create mode 100644 Gems/Billboard/Code/Tests/Clients/BillboardTest.cpp create mode 100644 Gems/Billboard/Code/Tests/Tools/BillboardEditorTest.cpp create mode 100644 Gems/Billboard/Code/billboard_api_files.cmake create mode 100644 Gems/Billboard/Code/billboard_editor_api_files.cmake create mode 100644 Gems/Billboard/Code/billboard_editor_private_files.cmake create mode 100644 Gems/Billboard/Code/billboard_editor_shared_files.cmake create mode 100644 Gems/Billboard/Code/billboard_editor_tests_files.cmake create mode 100644 Gems/Billboard/Code/billboard_private_files.cmake create mode 100644 Gems/Billboard/Code/billboard_shared_files.cmake create mode 100644 Gems/Billboard/Code/billboard_tests_files.cmake create mode 100644 Gems/Billboard/Registry/assetprocessor_settings.setreg create mode 100644 Gems/Billboard/gem.json create mode 100644 Gems/Billboard/preview.png diff --git a/Gems/Billboard/.gitignore b/Gems/Billboard/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/Gems/Billboard/CMakeLists.txt b/Gems/Billboard/CMakeLists.txt new file mode 100644 index 0000000..1a163a8 --- /dev/null +++ b/Gems/Billboard/CMakeLists.txt @@ -0,0 +1,22 @@ + +# Query the gem name from the gem.json file if possible +# otherwise fallback to using Billboard +o3de_find_ancestor_gem_root(gem_path gem_name "${CMAKE_CURRENT_SOURCE_DIR}") +if (NOT gem_name) + set(gem_name "Billboard") +endif() + +# Fallback to using the current source CMakeLists.txt directory as the gem root path +if (NOT gem_path) + set(gem_path ${CMAKE_CURRENT_SOURCE_DIR}) +endif() + +set(gem_json ${gem_path}/gem.json) + +o3de_restricted_path(${gem_json} gem_restricted_path gem_parent_relative_path) + +o3de_pal_dir(pal_dir ${CMAKE_CURRENT_SOURCE_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}") + +ly_add_external_target_path(${CMAKE_CURRENT_SOURCE_DIR}/3rdParty) + +add_subdirectory(Code) diff --git a/Gems/Billboard/Code/CMakeLists.txt b/Gems/Billboard/Code/CMakeLists.txt new file mode 100644 index 0000000..3c6a3d8 --- /dev/null +++ b/Gems/Billboard/Code/CMakeLists.txt @@ -0,0 +1,221 @@ + +# Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR} +# Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} +# Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform +# in which case it will see if that platform is present here or in the restricted folder. +# i.e. It could here in our gem : Gems/Billboard/Code/Platform/ or +# //Gems/Billboard/Code +o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}") + +# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the +# traits for this platform. Traits for a platform are defines for things like whether or not something in this gem +# is supported by this platform. +include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) + +# Check to see if building the Gem Modules are supported for the current platform +if(NOT PAL_TRAIT_BILLBOARD_SUPPORTED) + return() +endif() + +# The ${gem_name}.API target declares the common interface that users of this gem should depend on in their targets +ly_add_target( + NAME ${gem_name}.API INTERFACE + NAMESPACE Gem + FILES_CMAKE + billboard_api_files.cmake + ${pal_dir}/billboard_api_files.cmake + INCLUDE_DIRECTORIES + INTERFACE + Include + BUILD_DEPENDENCIES + INTERFACE + AZ::AzCore +) + +# The ${gem_name}.Private.Object target is an internal target +# It should not be used outside of this Gems CMakeLists.txt +ly_add_target( + NAME ${gem_name}.Private.Object STATIC + NAMESPACE Gem + FILES_CMAKE + billboard_private_files.cmake + ${pal_dir}/billboard_private_files.cmake + TARGET_PROPERTIES + O3DE_PRIVATE_TARGET TRUE + INCLUDE_DIRECTORIES + PRIVATE + Include + Source + BUILD_DEPENDENCIES + PUBLIC + AZ::AzCore + AZ::AzFramework + Gem::LmbrCentral.API +) + +# Here add ${gem_name} target, it depends on the Private Object library and Public API interface +ly_add_target( + NAME ${gem_name} ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} + NAMESPACE Gem + FILES_CMAKE + billboard_shared_files.cmake + ${pal_dir}/billboard_shared_files.cmake + INCLUDE_DIRECTORIES + PUBLIC + Include + PRIVATE + Source + BUILD_DEPENDENCIES + PUBLIC + Gem::${gem_name}.API + PRIVATE + Gem::${gem_name}.Private.Object +) + +# By default, we will specify that the above target ${gem_name} would be used by +# Client and Server type targets when this gem is enabled. If you don't want it +# active in Clients or Servers by default, delete one of both of the following lines: +ly_create_alias(NAME ${gem_name}.Clients NAMESPACE Gem TARGETS Gem::${gem_name}) +ly_create_alias(NAME ${gem_name}.Servers NAMESPACE Gem TARGETS Gem::${gem_name}) +ly_create_alias(NAME ${gem_name}.Unified NAMESPACE Gem TARGETS Gem::${gem_name}) + +# For the Client and Server variants of ${gem_name} Gem, an alias to the ${gem_name}.API target will be made +ly_create_alias(NAME ${gem_name}.Clients.API NAMESPACE Gem TARGETS Gem::${gem_name}.API) +ly_create_alias(NAME ${gem_name}.Servers.API NAMESPACE Gem TARGETS Gem::${gem_name}.API) +ly_create_alias(NAME ${gem_name}.Unified.API NAMESPACE Gem TARGETS Gem::${gem_name}.API) + +# Add in CMake dependencies for each gem dependency listed in this gem's gem.json file +# for the Clients, Servers, Unified gem variants +o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Clients Servers Unified) + +# If we are on a host platform, we want to add the host tools targets like the ${gem_name}.Editor MODULE target +if(PAL_TRAIT_BUILD_HOST_TOOLS) + # The ${gem_name}.Editor.API target can be used by other gems that want to interact with the ${gem_name}.Editor module + ly_add_target( + NAME ${gem_name}.Editor.API INTERFACE + NAMESPACE Gem + FILES_CMAKE + billboard_editor_api_files.cmake + ${pal_dir}/billboard_editor_api_files.cmake + INCLUDE_DIRECTORIES + INTERFACE + Include + BUILD_DEPENDENCIES + INTERFACE + AZ::AzToolsFramework + ) + + # The ${gem_name}.Editor.Private.Object target is an internal target + # which is only to be used by this gems CMakeLists.txt and any subdirectories + # Other gems should not use this target + ly_add_target( + NAME ${gem_name}.Editor.Private.Object STATIC + NAMESPACE Gem + FILES_CMAKE + billboard_editor_private_files.cmake + TARGET_PROPERTIES + O3DE_PRIVATE_TARGET TRUE + INCLUDE_DIRECTORIES + PRIVATE + Include + Source + BUILD_DEPENDENCIES + PUBLIC + AZ::AzToolsFramework + $ + Gem::LmbrCentral.API + ) + + ly_add_target( + NAME ${gem_name}.Editor GEM_MODULE + NAMESPACE Gem + AUTOMOC + FILES_CMAKE + billboard_editor_shared_files.cmake + INCLUDE_DIRECTORIES + PRIVATE + Source + PUBLIC + Include + BUILD_DEPENDENCIES + PUBLIC + Gem::${gem_name}.Editor.API + PRIVATE + Gem::${gem_name}.Editor.Private.Object + ) + + # By default, we will specify that the above target ${gem_name} would be used by + # Tool and Builder type targets when this gem is enabled. If you don't want it + # active in Tools or Builders by default, delete one of both of the following lines: + ly_create_alias(NAME ${gem_name}.Tools NAMESPACE Gem TARGETS Gem::${gem_name}.Editor) + ly_create_alias(NAME ${gem_name}.Builders NAMESPACE Gem TARGETS Gem::${gem_name}.Editor) + + # For the Tools and Builders variants of ${gem_name} Gem, an alias to the ${gem_name}.Editor API target will be made + ly_create_alias(NAME ${gem_name}.Tools.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API) + ly_create_alias(NAME ${gem_name}.Builders.API NAMESPACE Gem TARGETS Gem::${gem_name}.Editor.API) + + # Add in CMake dependencies for each gem dependency listed in this gem's gem.json file + # for the Tools and Builders gem variants + o3de_add_variant_dependencies_for_gem_dependencies(GEM_NAME ${gem_name} VARIANTS Tools Builders) +endif() + +################################################################################ +# Tests +################################################################################ +# See if globally, tests are supported +if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) + # We globally support tests, see if we support tests on this platform for ${gem_name}.Tests + if(PAL_TRAIT_BILLBOARD_TEST_SUPPORTED) + # We support ${gem_name}.Tests on this platform, add dependency on the Private Object target + ly_add_target( + NAME ${gem_name}.Tests ${PAL_TRAIT_TEST_TARGET_TYPE} + NAMESPACE Gem + FILES_CMAKE + billboard_tests_files.cmake + INCLUDE_DIRECTORIES + PRIVATE + Tests + Source + Include + BUILD_DEPENDENCIES + PRIVATE + AZ::AzTest + AZ::AzFramework + Gem::${gem_name}.Private.Object + ) + + # Add ${gem_name}.Tests to googletest + ly_add_googletest( + NAME Gem::${gem_name}.Tests + ) + endif() + + # If we are a host platform we want to add tools test like editor tests here + if(PAL_TRAIT_BUILD_HOST_TOOLS) + # We are a host platform, see if Editor tests are supported on this platform + if(PAL_TRAIT_BILLBOARD_EDITOR_TEST_SUPPORTED) + # We support ${gem_name}.Editor.Tests on this platform, add ${gem_name}.Editor.Tests target which depends on + # private ${gem_name}.Editor.Private.Object target + ly_add_target( + NAME ${gem_name}.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE} + NAMESPACE Gem + FILES_CMAKE + billboard_editor_tests_files.cmake + INCLUDE_DIRECTORIES + PRIVATE + Tests + Source + Include + BUILD_DEPENDENCIES + PRIVATE + AZ::AzTest + Gem::${gem_name}.Editor.Private.Object + ) + + # Add ${gem_name}.Editor.Tests to googletest + ly_add_googletest( + NAME Gem::${gem_name}.Editor.Tests + ) + endif() + endif() +endif() diff --git a/Gems/Billboard/Code/Include/Billboard/BillboardTypeIds.h b/Gems/Billboard/Code/Include/Billboard/BillboardTypeIds.h new file mode 100644 index 0000000..a41820f --- /dev/null +++ b/Gems/Billboard/Code/Include/Billboard/BillboardTypeIds.h @@ -0,0 +1,19 @@ + +#pragma once + +namespace BillboardComponent +{ + // System Component TypeIds + inline constexpr const char* BillboardSystemComponentTypeId = "{ACC1D1A3-A0F9-4620-AB9C-742D879E1951}"; + inline constexpr const char* BillboardEditorSystemComponentTypeId = "{F54E7F75-6826-46DC-A2EC-C981BCBD3D92}"; + + // Module derived classes TypeIds + inline constexpr const char* BillboardModuleInterfaceTypeId = "{7F255600-7C6D-437C-B5CC-8BE9882545DD}"; + inline constexpr const char* BillboardModuleTypeId = "{40012893-27E8-4F53-8FF9-34DD51E0050D}"; + // The Editor Module by default is mutually exclusive with the Client Module + // so they use the Same TypeId + inline constexpr const char* BillboardEditorModuleTypeId = BillboardModuleTypeId; + + // Component TypeIds + inline constexpr const char* BillboardComponentTypeId = "{ad8ebcee-5d2b-486b-9d43-06d4c0369812}"; +} // namespace BillboardComponent diff --git a/Gems/Billboard/Code/Platform/Android/PAL_android.cmake b/Gems/Billboard/Code/Platform/Android/PAL_android.cmake new file mode 100644 index 0000000..cfdb263 --- /dev/null +++ b/Gems/Billboard/Code/Platform/Android/PAL_android.cmake @@ -0,0 +1,4 @@ + +set(PAL_TRAIT_BILLBOARD_SUPPORTED TRUE) +set(PAL_TRAIT_BILLBOARD_TEST_SUPPORTED FALSE) +set(PAL_TRAIT_BILLBOARD_EDITOR_TEST_SUPPORTED FALSE) diff --git a/Gems/Billboard/Code/Platform/Android/billboard_api_files.cmake b/Gems/Billboard/Code/Platform/Android/billboard_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/Android/billboard_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Android/billboard_private_files.cmake b/Gems/Billboard/Code/Platform/Android/billboard_private_files.cmake new file mode 100644 index 0000000..a22acc9 --- /dev/null +++ b/Gems/Billboard/Code/Platform/Android/billboard_private_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Android +# i.e. ../Source/Android/BillboardAndroid.cpp +# ../Source/Android/BillboardAndroid.h +# ../Include/Android/BillboardAndroid.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Android/billboard_shared_files.cmake b/Gems/Billboard/Code/Platform/Android/billboard_shared_files.cmake new file mode 100644 index 0000000..a22acc9 --- /dev/null +++ b/Gems/Billboard/Code/Platform/Android/billboard_shared_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Android +# i.e. ../Source/Android/BillboardAndroid.cpp +# ../Source/Android/BillboardAndroid.h +# ../Include/Android/BillboardAndroid.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Linux/PAL_linux.cmake b/Gems/Billboard/Code/Platform/Linux/PAL_linux.cmake new file mode 100644 index 0000000..cfdb263 --- /dev/null +++ b/Gems/Billboard/Code/Platform/Linux/PAL_linux.cmake @@ -0,0 +1,4 @@ + +set(PAL_TRAIT_BILLBOARD_SUPPORTED TRUE) +set(PAL_TRAIT_BILLBOARD_TEST_SUPPORTED FALSE) +set(PAL_TRAIT_BILLBOARD_EDITOR_TEST_SUPPORTED FALSE) diff --git a/Gems/Billboard/Code/Platform/Linux/billboard_api_files.cmake b/Gems/Billboard/Code/Platform/Linux/billboard_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/Linux/billboard_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Linux/billboard_editor_api_files.cmake b/Gems/Billboard/Code/Platform/Linux/billboard_editor_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/Linux/billboard_editor_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Linux/billboard_private_files.cmake b/Gems/Billboard/Code/Platform/Linux/billboard_private_files.cmake new file mode 100644 index 0000000..08a485b --- /dev/null +++ b/Gems/Billboard/Code/Platform/Linux/billboard_private_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Linux +# i.e. ../Source/Linux/BillboardLinux.cpp +# ../Source/Linux/BillboardLinux.h +# ../Include/Linux/BillboardLinux.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Linux/billboard_shared_files.cmake b/Gems/Billboard/Code/Platform/Linux/billboard_shared_files.cmake new file mode 100644 index 0000000..08a485b --- /dev/null +++ b/Gems/Billboard/Code/Platform/Linux/billboard_shared_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Linux +# i.e. ../Source/Linux/BillboardLinux.cpp +# ../Source/Linux/BillboardLinux.h +# ../Include/Linux/BillboardLinux.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Mac/PAL_mac.cmake b/Gems/Billboard/Code/Platform/Mac/PAL_mac.cmake new file mode 100644 index 0000000..cfdb263 --- /dev/null +++ b/Gems/Billboard/Code/Platform/Mac/PAL_mac.cmake @@ -0,0 +1,4 @@ + +set(PAL_TRAIT_BILLBOARD_SUPPORTED TRUE) +set(PAL_TRAIT_BILLBOARD_TEST_SUPPORTED FALSE) +set(PAL_TRAIT_BILLBOARD_EDITOR_TEST_SUPPORTED FALSE) diff --git a/Gems/Billboard/Code/Platform/Mac/billboard_api_files.cmake b/Gems/Billboard/Code/Platform/Mac/billboard_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/Mac/billboard_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Mac/billboard_editor_api_files.cmake b/Gems/Billboard/Code/Platform/Mac/billboard_editor_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/Mac/billboard_editor_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Mac/billboard_private_files.cmake b/Gems/Billboard/Code/Platform/Mac/billboard_private_files.cmake new file mode 100644 index 0000000..ff66c4b --- /dev/null +++ b/Gems/Billboard/Code/Platform/Mac/billboard_private_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Mac +# i.e. ../Source/Mac/BillboardMac.cpp +# ../Source/Mac/BillboardMac.h +# ../Include/Mac/BillboardMac.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Mac/billboard_shared_files.cmake b/Gems/Billboard/Code/Platform/Mac/billboard_shared_files.cmake new file mode 100644 index 0000000..ff66c4b --- /dev/null +++ b/Gems/Billboard/Code/Platform/Mac/billboard_shared_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Mac +# i.e. ../Source/Mac/BillboardMac.cpp +# ../Source/Mac/BillboardMac.h +# ../Include/Mac/BillboardMac.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Windows/PAL_windows.cmake b/Gems/Billboard/Code/Platform/Windows/PAL_windows.cmake new file mode 100644 index 0000000..cfdb263 --- /dev/null +++ b/Gems/Billboard/Code/Platform/Windows/PAL_windows.cmake @@ -0,0 +1,4 @@ + +set(PAL_TRAIT_BILLBOARD_SUPPORTED TRUE) +set(PAL_TRAIT_BILLBOARD_TEST_SUPPORTED FALSE) +set(PAL_TRAIT_BILLBOARD_EDITOR_TEST_SUPPORTED FALSE) diff --git a/Gems/Billboard/Code/Platform/Windows/billboard_api_files.cmake b/Gems/Billboard/Code/Platform/Windows/billboard_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/Windows/billboard_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Windows/billboard_editor_api_files.cmake b/Gems/Billboard/Code/Platform/Windows/billboard_editor_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/Windows/billboard_editor_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Windows/billboard_private_files.cmake b/Gems/Billboard/Code/Platform/Windows/billboard_private_files.cmake new file mode 100644 index 0000000..121efcd --- /dev/null +++ b/Gems/Billboard/Code/Platform/Windows/billboard_private_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Windows +# i.e. ../Source/Windows/BillboardWindows.cpp +# ../Source/Windows/BillboardWindows.h +# ../Include/Windows/BillboardWindows.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/Windows/billboard_shared_files.cmake b/Gems/Billboard/Code/Platform/Windows/billboard_shared_files.cmake new file mode 100644 index 0000000..121efcd --- /dev/null +++ b/Gems/Billboard/Code/Platform/Windows/billboard_shared_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for Windows +# i.e. ../Source/Windows/BillboardWindows.cpp +# ../Source/Windows/BillboardWindows.h +# ../Include/Windows/BillboardWindows.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/iOS/PAL_ios.cmake b/Gems/Billboard/Code/Platform/iOS/PAL_ios.cmake new file mode 100644 index 0000000..cfdb263 --- /dev/null +++ b/Gems/Billboard/Code/Platform/iOS/PAL_ios.cmake @@ -0,0 +1,4 @@ + +set(PAL_TRAIT_BILLBOARD_SUPPORTED TRUE) +set(PAL_TRAIT_BILLBOARD_TEST_SUPPORTED FALSE) +set(PAL_TRAIT_BILLBOARD_EDITOR_TEST_SUPPORTED FALSE) diff --git a/Gems/Billboard/Code/Platform/iOS/billboard_api_files.cmake b/Gems/Billboard/Code/Platform/iOS/billboard_api_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/Platform/iOS/billboard_api_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/iOS/billboard_private_files.cmake b/Gems/Billboard/Code/Platform/iOS/billboard_private_files.cmake new file mode 100644 index 0000000..42b4072 --- /dev/null +++ b/Gems/Billboard/Code/Platform/iOS/billboard_private_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for iOS +# i.e. ../Source/iOS/BillboardiOS.cpp +# ../Source/iOS/BillboardiOS.h +# ../Include/iOS/BillboardiOS.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Platform/iOS/billboard_shared_files.cmake b/Gems/Billboard/Code/Platform/iOS/billboard_shared_files.cmake new file mode 100644 index 0000000..42b4072 --- /dev/null +++ b/Gems/Billboard/Code/Platform/iOS/billboard_shared_files.cmake @@ -0,0 +1,8 @@ + +# Platform specific files for iOS +# i.e. ../Source/iOS/BillboardiOS.cpp +# ../Source/iOS/BillboardiOS.h +# ../Include/iOS/BillboardiOS.h + +set(FILES +) diff --git a/Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp b/Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp new file mode 100644 index 0000000..1bcc2f6 --- /dev/null +++ b/Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp @@ -0,0 +1,167 @@ + +#include "BillboardComponent.h" +#include +#include +#include + +namespace BillboardComponent +{ + void BillboardComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required) + { + required.push_back(AZ_CRC("TransformService", 0x8ee22c50)); + } + + void BillboardComponent::Reflect(AZ::ReflectContext* context) + { + if (auto serializeContext = azrtti_cast(context)) + { + serializeContext->Class() + ->Version(0) + ->Field("ScenePosition", &BillboardComponent::m_scenePosition) + ->Field("Strategy", &BillboardComponent::m_strategy) + ->Field("TargetEntityId", &BillboardComponent::m_targetEntityId) + ->Field("TargetTag", &BillboardComponent::m_targetTag) + ->Field("LocalFaceToBillboard", &BillboardComponent::m_faceToBillboard); + if (auto editContext = serializeContext->GetEditContext()) + { + editContext->Class("BillboardComponent", "Add a billboard to the entity") + ->ClassElement(AZ::Edit::ClassElements::EditorData, "") + ->Attribute(AZ::Edit::Attributes::Category, "RobotecAgriculture") + ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game")) + ->DataElement(AZ::Edit::UIHandlers::ComboBox, &BillboardComponent::m_strategy, "Strategy", "Strategy to use") + ->EnumAttribute(Strategy::FaceLocation, "Face Location") + ->EnumAttribute(Strategy::FaceTag, "Face Tag") + ->EnumAttribute(Strategy::FaceEntity, "Face Entity") + ->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree) + ->DataElement(AZ::Edit::UIHandlers::Default, &BillboardComponent::m_targetEntityId, "Target Entity", "Entity to face") + ->Attribute(AZ::Edit::Attributes::Visibility, &BillboardComponent::VisibilityEntity) + ->DataElement(AZ::Edit::UIHandlers::Default, &BillboardComponent::m_scenePosition, "Scene Position", "Position to face") + ->Attribute(AZ::Edit::Attributes::Visibility, &BillboardComponent::VisibilityLocation) + ->DataElement(AZ::Edit::UIHandlers::Default, &BillboardComponent::m_targetTag, "Target Tag", "Tag to face") + ->Attribute(AZ::Edit::Attributes::Visibility, &BillboardComponent::VisibilityTag) + ->DataElement( + AZ::Edit::UIHandlers::Default, + &BillboardComponent::m_faceToBillboard, + "Local Face To Billboard", + "Local face to billboard"); + } + } + } + + AZ::Crc32 BillboardComponent::VisibilityLocation() const + { + return m_strategy == Strategy::FaceLocation ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide; + } + + AZ::Crc32 BillboardComponent::VisibilityTag() const + { + return m_strategy == Strategy::FaceTag ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide; + } + + AZ::Crc32 BillboardComponent::VisibilityEntity() const + { + return m_strategy == Strategy::FaceEntity ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide; + } + + void BillboardComponent::Activate() + { + m_faceToBillboard.NormalizeSafe(); + + // compute local offset + m_offsetRotation = AZ::Matrix3x3::CreateFromColumns( + m_faceToBillboard, AZ::Vector3::CreateAxisZ().Cross(m_faceToBillboard), AZ::Vector3::CreateAxisZ()); + + if (m_strategy == Strategy::FaceLocation) + { + LookAtZUp(m_scenePosition); + } + else if (m_strategy == Strategy::FaceEntity) + { + AZ::TickBus::Handler::BusConnect(); + } + else if (m_strategy == Strategy::FaceTag) + { + const auto tag = LmbrCentral::Tag(m_targetTag); + AZ::TickBus::Handler::BusConnect(); + LmbrCentral::TagGlobalNotificationBus::Handler::BusConnect(tag); + // get the entities with the tag + AZ::EBusAggregateResults aggregator; + LmbrCentral::TagGlobalRequestBus::EventResult(aggregator, tag, &LmbrCentral::TagGlobalRequests::RequestTaggedEntities); + m_targetEntities.insert(aggregator.values.begin(), aggregator.values.end()); + } + } + + void BillboardComponent::Deactivate() + { + if (AZ::TickBus::Handler::BusIsConnected()) + { + AZ::TickBus::Handler::BusDisconnect(); + } + if (LmbrCentral::TagGlobalNotificationBus::Handler::BusIsConnected()) + { + LmbrCentral::TagGlobalNotificationBus::Handler::BusDisconnect(); + } + } + + void BillboardComponent::OnTick([[maybe_unused]]float deltaTime, [[maybe_unused]]AZ::ScriptTimePoint time) + { + LookAtZUp(GetTargetPosition()); + } + + void BillboardComponent::OnEntityTagAdded(const AZ::EntityId& entityId) + { + m_targetEntities.insert(entityId); + } + + void BillboardComponent::OnEntityTagRemoved(const AZ::EntityId& entityId) + { + m_targetEntities.erase(entityId); + } + + void BillboardComponent::LookAtZUp(const AZ::Vector3& targetPosition) const + { + AZ::Transform transform = AZ::Transform::CreateIdentity(); + AZ::TransformBus::EventResult(transform, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM); + + AZ::Vector3 rayFromObjectToCamera = -transform.GetTranslation() + targetPosition; + rayFromObjectToCamera.SetZ(0.0f); // we want to look at the target position in the XY plane (Z up)ush + rayFromObjectToCamera.NormalizeSafe(); + + const AZ::Vector3 up = AZ::Vector3::CreateAxisZ(); + const AZ::Vector3 right = up.Cross(rayFromObjectToCamera); + + const AZ::Matrix3x3 rotationMatrix = AZ::Matrix3x3::CreateFromColumns(rayFromObjectToCamera, right, up); + AZ::Transform newTransform = + AZ::Transform::CreateFromMatrix3x3AndTranslation(rotationMatrix * m_offsetRotation, transform.GetTranslation()); + + AZ::TransformBus::Event(GetEntityId(), &AZ::TransformBus::Events::SetWorldTM, newTransform); + } + + AZ::Vector3 BillboardComponent::GetTargetPosition() const + { + if (m_strategy == Strategy::FaceLocation) + { + return m_scenePosition; + } + else if (m_strategy == Strategy::FaceEntity) + { + AZ::Vector3 targetPosition = AZ::Vector3::CreateZero(); + AZ::TransformBus::EventResult(targetPosition, m_targetEntityId, &AZ::TransformBus::Events::GetWorldTranslation); + return targetPosition; + } + else if (m_strategy == Strategy::FaceTag) + { + AZ::Vector3 meanPosition = AZ::Vector3::CreateZero(); + for (const auto& entityId : m_targetEntities) + { + AZ::Vector3 targetPosition = AZ::Vector3::CreateZero(); + AZ::TransformBus::EventResult(targetPosition, entityId, &AZ::TransformBus::Events::GetWorldTranslation); + meanPosition += targetPosition; + } + meanPosition /= m_targetEntities.size(); + return meanPosition; + } + return AZ::Vector3::CreateZero(); + } + +} // namespace BillboardComponent diff --git a/Gems/Billboard/Code/Source/Billboard/BillboardComponent.h b/Gems/Billboard/Code/Source/Billboard/BillboardComponent.h new file mode 100644 index 0000000..cb55631 --- /dev/null +++ b/Gems/Billboard/Code/Source/Billboard/BillboardComponent.h @@ -0,0 +1,72 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace BillboardComponent +{ + + //! Component that adjust rotation of the entity to always face the given position, tag or entity + //! In position strategy, the entity will always face the given position, + //! in tag strategy, the entity will always face the mean position of the entities with the given tag, + //! in entity strategy, the entity will always face the given entity + class BillboardComponent + : public AZ::Component + , private AZ::TickBus::Handler + , private LmbrCentral::TagGlobalNotificationBus::Handler + { + public: + enum class Strategy + { + FaceLocation, + FaceTag, + FaceEntity + }; + + AZ_COMPONENT(BillboardComponent, BillboardComponentTypeId); + + BillboardComponent() = default; + ~BillboardComponent() = default; + + static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required); + + static void Reflect(AZ::ReflectContext* context); + + // Component overrides ... + void Activate() override; + void Deactivate() override; + + private: + AZ::Crc32 VisibilityLocation() const; + AZ::Crc32 VisibilityTag() const; + AZ::Crc32 VisibilityEntity() const; + + // AZ::TickBus::Handler overrides ... + void OnTick(float deltaTime, AZ::ScriptTimePoint time) override; + + // LmbrCentral::TagGlobalNotifications::Handler overrides + void OnEntityTagAdded(const AZ::EntityId& entityId) override; + void OnEntityTagRemoved(const AZ::EntityId& entityId) override; + + //! Look at the given position + //! \param targetPosition The position to look at + void LookAtZUp(const AZ::Vector3& targetPosition) const; + + //! Get the position to face taking into account the strategy + //! \return The position to face + AZ::Vector3 GetTargetPosition() const; + + AZ::Vector3 m_faceToBillboard = AZ::Vector3::CreateAxisX(); //! Local axis + AZ::Matrix3x3 m_offsetRotation = AZ::Matrix3x3::CreateIdentity(); //! Offset rotation + + Strategy m_strategy = Strategy::FaceLocation; //! Strategy to use + AZ::Vector3 m_scenePosition; //! Position to face - strategy FaceLocation + AZ::EntityId m_targetEntityId; //! Entity to face - strategy FaceEntity + AZStd::string m_targetTag; //! Tag to face - strategy FaceTag + AZStd::unordered_set m_targetEntities; //! Entities with the tag to face - strategy FaceTag + }; +} // namespace BillboardComponent diff --git a/Gems/Billboard/Code/Source/BillboardModuleInterface.cpp b/Gems/Billboard/Code/Source/BillboardModuleInterface.cpp new file mode 100644 index 0000000..6cbd58f --- /dev/null +++ b/Gems/Billboard/Code/Source/BillboardModuleInterface.cpp @@ -0,0 +1,31 @@ + +#include "BillboardModuleInterface.h" +#include + +#include "Billboard/BillboardComponent.h" +#include + +namespace BillboardComponent +{ + AZ_TYPE_INFO_WITH_NAME_IMPL(BillboardModuleInterface, "BillboardModuleInterface", BillboardModuleInterfaceTypeId); + AZ_RTTI_NO_TYPE_INFO_IMPL(BillboardModuleInterface, AZ::Module); + AZ_CLASS_ALLOCATOR_IMPL(BillboardModuleInterface, AZ::SystemAllocator); + + BillboardModuleInterface::BillboardModuleInterface() + { + // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here. + // Add ALL components descriptors associated with this gem to m_descriptors. + // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext. + // This happens through the [MyComponent]::Reflect() function. + m_descriptors.insert( + m_descriptors.end(), + { + BillboardComponent::CreateDescriptor(), + }); + } + + AZ::ComponentTypeList BillboardModuleInterface::GetRequiredSystemComponents() const + { + return AZ::ComponentTypeList{}; + } +} // namespace BillboardComponent diff --git a/Gems/Billboard/Code/Source/BillboardModuleInterface.h b/Gems/Billboard/Code/Source/BillboardModuleInterface.h new file mode 100644 index 0000000..361e533 --- /dev/null +++ b/Gems/Billboard/Code/Source/BillboardModuleInterface.h @@ -0,0 +1,23 @@ + +#include +#include +#include +#include + +namespace BillboardComponent +{ + class BillboardModuleInterface : public AZ::Module + { + public: + AZ_TYPE_INFO_WITH_NAME_DECL(BillboardModuleInterface) + AZ_RTTI_NO_TYPE_INFO_DECL() + AZ_CLASS_ALLOCATOR_DECL + + BillboardModuleInterface(); + + /** + * Add required SystemComponents to the SystemEntity. + */ + AZ::ComponentTypeList GetRequiredSystemComponents() const override; + }; +} // namespace BillboardComponent diff --git a/Gems/Billboard/Code/Source/Clients/BillboardModule.cpp b/Gems/Billboard/Code/Source/Clients/BillboardModule.cpp new file mode 100644 index 0000000..307d1e2 --- /dev/null +++ b/Gems/Billboard/Code/Source/Clients/BillboardModule.cpp @@ -0,0 +1,15 @@ + +#include +#include + +namespace BillboardComponent +{ + class BillboardModule : public BillboardModuleInterface + { + public: + AZ_RTTI(BillboardModule, BillboardModuleTypeId, BillboardModuleInterface); + AZ_CLASS_ALLOCATOR(BillboardModule, AZ::SystemAllocator); + }; +} // namespace BillboardComponent + +AZ_DECLARE_MODULE_CLASS(Gem_Billboard, BillboardComponent::BillboardModule) diff --git a/Gems/Billboard/Code/Source/Tools/BillboardEditorModule.cpp b/Gems/Billboard/Code/Source/Tools/BillboardEditorModule.cpp new file mode 100644 index 0000000..bca8e6a --- /dev/null +++ b/Gems/Billboard/Code/Source/Tools/BillboardEditorModule.cpp @@ -0,0 +1,33 @@ + +#include +#include + +namespace BillboardComponent +{ + class BillboardEditorModule : public BillboardModuleInterface + { + public: + AZ_RTTI(BillboardEditorModule, BillboardEditorModuleTypeId, BillboardModuleInterface); + AZ_CLASS_ALLOCATOR(BillboardEditorModule, AZ::SystemAllocator); + + BillboardEditorModule() + { + // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here. + // Add ALL components descriptors associated with this gem to m_descriptors. + // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and + // EditContext. This happens through the [MyComponent]::Reflect() function. + m_descriptors.insert(m_descriptors.end(), {}); + } + + /** + * Add required SystemComponents to the SystemEntity. + * Non-SystemComponents should not be added here + */ + AZ::ComponentTypeList GetRequiredSystemComponents() const override + { + return AZ::ComponentTypeList{}; + } + }; +} // namespace BillboardComponent + +AZ_DECLARE_MODULE_CLASS(Gem_Billboard, BillboardComponent::BillboardEditorModule) diff --git a/Gems/Billboard/Code/Tests/Clients/BillboardTest.cpp b/Gems/Billboard/Code/Tests/Clients/BillboardTest.cpp new file mode 100644 index 0000000..274a990 --- /dev/null +++ b/Gems/Billboard/Code/Tests/Clients/BillboardTest.cpp @@ -0,0 +1,4 @@ + +#include + +AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV); diff --git a/Gems/Billboard/Code/Tests/Tools/BillboardEditorTest.cpp b/Gems/Billboard/Code/Tests/Tools/BillboardEditorTest.cpp new file mode 100644 index 0000000..274a990 --- /dev/null +++ b/Gems/Billboard/Code/Tests/Tools/BillboardEditorTest.cpp @@ -0,0 +1,4 @@ + +#include + +AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV); diff --git a/Gems/Billboard/Code/billboard_api_files.cmake b/Gems/Billboard/Code/billboard_api_files.cmake new file mode 100644 index 0000000..b9daa0b --- /dev/null +++ b/Gems/Billboard/Code/billboard_api_files.cmake @@ -0,0 +1,4 @@ + +set(FILES + Include/Billboard/BillboardTypeIds.h +) diff --git a/Gems/Billboard/Code/billboard_editor_api_files.cmake b/Gems/Billboard/Code/billboard_editor_api_files.cmake new file mode 100644 index 0000000..8cd37a5 --- /dev/null +++ b/Gems/Billboard/Code/billboard_editor_api_files.cmake @@ -0,0 +1,4 @@ + + +set(FILES +) diff --git a/Gems/Billboard/Code/billboard_editor_private_files.cmake b/Gems/Billboard/Code/billboard_editor_private_files.cmake new file mode 100644 index 0000000..f5526ee --- /dev/null +++ b/Gems/Billboard/Code/billboard_editor_private_files.cmake @@ -0,0 +1,3 @@ + +set(FILES +) diff --git a/Gems/Billboard/Code/billboard_editor_shared_files.cmake b/Gems/Billboard/Code/billboard_editor_shared_files.cmake new file mode 100644 index 0000000..8ed3224 --- /dev/null +++ b/Gems/Billboard/Code/billboard_editor_shared_files.cmake @@ -0,0 +1,4 @@ + +set(FILES + Source/Tools/BillboardEditorModule.cpp +) diff --git a/Gems/Billboard/Code/billboard_editor_tests_files.cmake b/Gems/Billboard/Code/billboard_editor_tests_files.cmake new file mode 100644 index 0000000..4750081 --- /dev/null +++ b/Gems/Billboard/Code/billboard_editor_tests_files.cmake @@ -0,0 +1,4 @@ + +set(FILES + Tests/Tools/BillboardEditorTest.cpp +) diff --git a/Gems/Billboard/Code/billboard_private_files.cmake b/Gems/Billboard/Code/billboard_private_files.cmake new file mode 100644 index 0000000..5bc34d3 --- /dev/null +++ b/Gems/Billboard/Code/billboard_private_files.cmake @@ -0,0 +1,7 @@ + +set(FILES + Source/BillboardModuleInterface.cpp + Source/BillboardModuleInterface.h + Source/Billboard/BillboardComponent.cpp + Source/Billboard/BillboardComponent.h +) diff --git a/Gems/Billboard/Code/billboard_shared_files.cmake b/Gems/Billboard/Code/billboard_shared_files.cmake new file mode 100644 index 0000000..3d6065b --- /dev/null +++ b/Gems/Billboard/Code/billboard_shared_files.cmake @@ -0,0 +1,4 @@ + +set(FILES + Source/Clients/BillboardModule.cpp +) diff --git a/Gems/Billboard/Code/billboard_tests_files.cmake b/Gems/Billboard/Code/billboard_tests_files.cmake new file mode 100644 index 0000000..f733395 --- /dev/null +++ b/Gems/Billboard/Code/billboard_tests_files.cmake @@ -0,0 +1,4 @@ + +set(FILES + Tests/Clients/BillboardTest.cpp +) diff --git a/Gems/Billboard/Registry/assetprocessor_settings.setreg b/Gems/Billboard/Registry/assetprocessor_settings.setreg new file mode 100644 index 0000000..6828d74 --- /dev/null +++ b/Gems/Billboard/Registry/assetprocessor_settings.setreg @@ -0,0 +1,13 @@ +{ + "Amazon": { + "AssetProcessor": { + "Settings": { + "ScanFolder Billboard/Registry": { + "watch": "@GEMROOT:Billboard@/Registry", + "recursive": 1, + "order": 102 + } + } + } + } +} diff --git a/Gems/Billboard/gem.json b/Gems/Billboard/gem.json new file mode 100644 index 0000000..83deddb --- /dev/null +++ b/Gems/Billboard/gem.json @@ -0,0 +1,28 @@ +{ + "gem_name": "Billboard", + "version": "1.0.0", + "display_name": "Billboard", + "license": "Apache-2.0", + "license_url": "https://opensource.org/licenses/Apache-2.0", + "origin": "Robotec.ai", + "origin_url": "https://www.robotec.ai", + "type": "Code", + "summary": "Component that rotates the entity to ensure it always faces the target position", + "canonical_tags": [ + "Gem" + ], + "user_tags": [ + "Billboard" + ], + "platforms": [ + "" + ], + "icon_path": "preview.png", + "requirements": "", + "documentation_url": "", + "dependencies": [], + "repo_uri": "", + "compatible_engines": [], + "engine_api_dependencies": [], + "restricted": "Billboard" +} diff --git a/Gems/Billboard/preview.png b/Gems/Billboard/preview.png new file mode 100644 index 0000000000000000000000000000000000000000..83afae48b97f808914d4b210c578441b7cdfdcdd GIT binary patch literal 4475 zcmaJ_c|6qJ_n$G;1jIj)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!F9x0RbYu~t*b1uwf6@D^# zAeU?ttt6f$nM8zBE3RnSa)qlLdL49im&{S=)D&RVfv;N7yFspXkp@7^rRck5CbHD0 zd{VcwdL0+WTaK>Hy1dL4Yfo%Z3|+6kb$b^y#^T6+EVdxZJLcYTvnZa=IQ>8|u%~!$ zYDJP;@`#<0c4}_{jwpD2ZuU;u{%cWkiNe4%<;d}t48;hRK~?TcE z7U1RQ?g6-(a%()RjpXLv$;-1Hvl?(;ThpVRKU++bU=ED8Tbuj%F-36m(6%KV*bC#| zD!sdTEq^mK3VcylFHroOe>qB%p!tvX58= Date: Fri, 27 Sep 2024 11:14:20 +0200 Subject: [PATCH 2/2] Code formatted Signed-off-by: Patryk Antosz --- Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp b/Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp index 1bcc2f6..74af7d7 100644 --- a/Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp +++ b/Gems/Billboard/Code/Source/Billboard/BillboardComponent.cpp @@ -103,7 +103,7 @@ namespace BillboardComponent } } - void BillboardComponent::OnTick([[maybe_unused]]float deltaTime, [[maybe_unused]]AZ::ScriptTimePoint time) + void BillboardComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { LookAtZUp(GetTargetPosition()); }