-
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.
* Basic pointcloud support for O3DE. Signed-off-by: Michał Pełka <[email protected]>
- Loading branch information
1 parent
904f448
commit fca84ee
Showing
44 changed files
with
4,191 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
54 changes: 54 additions & 0 deletions
54
Gems/Pointcloud/Assets/Shaders/Pointclouds/Pointclouds.azsl
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,54 @@ | ||
/* | ||
* 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 <Atom/Features/ColorManagement/TransformColor.azsli> | ||
#include <Atom/Features/SrgSemantics.azsli> | ||
#include <scenesrg.srgi> | ||
#include <viewsrg.srgi> | ||
|
||
ShaderResourceGroup PerDrawSrg : SRG_PerDraw | ||
{ | ||
float m_pointSize; | ||
float4x4 m_modelMatrix; | ||
} | ||
|
||
struct VSInput | ||
{ | ||
float3 m_position : POSITION; | ||
float4 m_color : COLOR0; | ||
}; | ||
|
||
struct VSOutput | ||
{ | ||
float4 m_position : SV_Position; | ||
float4 m_color : COLOR0; | ||
[[vk::builtin("PointSize")]] float PointSize : PSIZE; | ||
}; | ||
|
||
VSOutput MainVS(VSInput IN) | ||
{ | ||
VSOutput OUT; | ||
const float4 pos = float4(IN.m_position, 1.0); | ||
const float4 pos2 = mul(PerDrawSrg::m_modelMatrix, pos); | ||
OUT.m_position = mul(ViewSrg::m_viewProjectionMatrix, pos2); | ||
OUT.m_color = IN.m_color; | ||
OUT.PointSize = PerDrawSrg::m_pointSize; | ||
return OUT; | ||
}; | ||
|
||
struct PSOutput | ||
{ | ||
float4 m_color : SV_Target; | ||
}; | ||
|
||
PSOutput MainPS(VSOutput IN) | ||
{ | ||
PSOutput OUT; | ||
OUT.m_color = IN.m_color; | ||
return OUT; | ||
}; |
28 changes: 28 additions & 0 deletions
28
Gems/Pointcloud/Assets/Shaders/Pointclouds/Pointclouds.shader
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,28 @@ | ||
{ | ||
"Source": "Pointclouds.azsl", | ||
"DepthStencilState": { | ||
"Depth": { | ||
"Enable": true, | ||
"CompareFunc": "GreaterEqual" | ||
} | ||
}, | ||
"GlobalTargetBlendState" : { | ||
"Enable" : false, | ||
"BlendSource" : "Zero", | ||
"BlendDest" : "One", | ||
"BlendOp" : "Add" | ||
}, | ||
"DrawList": "auxgeom", | ||
"ProgramSettings": { | ||
"EntryPoints": [ | ||
{ | ||
"name": "MainVS", | ||
"type": "Vertex" | ||
}, | ||
{ | ||
"name": "MainPS", | ||
"type": "Fragment" | ||
} | ||
] | ||
} | ||
} |
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,29 @@ | ||
# | ||
# 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 | ||
# | ||
# | ||
|
||
# Query the gem name from the gem.json file if possible | ||
# otherwise fallback to using Pointcloud | ||
o3de_find_ancestor_gem_root(gem_path gem_name "${CMAKE_CURRENT_SOURCE_DIR}") | ||
if (NOT gem_name) | ||
set(gem_name "Pointcloud") | ||
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) |
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,242 @@ | ||
# | ||
# 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 | ||
# | ||
# | ||
|
||
# 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/Pointcloud/Code/Platform/<platorm_name> or | ||
# <restricted_folder>/<platform_name>/Gems/Pointcloud/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_POINTCLOUD_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 | ||
pointcloud_api_files.cmake | ||
INCLUDE_DIRECTORIES | ||
INTERFACE | ||
Include | ||
BUILD_DEPENDENCIES | ||
INTERFACE | ||
AZ::AzCore | ||
Gem::Atom_RPI.Public | ||
Gem::Atom_Feature_Common | ||
Gem::Atom_Feature_Common.Public | ||
Gem::Atom_Feature_Common.Static | ||
) | ||
|
||
# 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 | ||
PLATFORM_INCLUDE_FILES | ||
${CMAKE_CURRENT_LIST_DIR}/Platform/Common/${PAL_TRAIT_COMPILER_ID}/pointcloud_editor_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake | ||
FILES_CMAKE | ||
pointcloud_private_files.cmake | ||
TARGET_PROPERTIES | ||
O3DE_PRIVATE_TARGET TRUE | ||
INCLUDE_DIRECTORIES | ||
PRIVATE | ||
Include | ||
Source | ||
BUILD_DEPENDENCIES | ||
PUBLIC | ||
AZ::AzCore | ||
AZ::AzFramework | ||
Gem::Atom_RPI.Public | ||
Gem::Atom_Utils.Static | ||
Gem::Atom_Feature_Common | ||
Gem::AtomLyIntegration_CommonFeatures.Static | ||
) | ||
|
||
# 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 | ||
PLATFORM_INCLUDE_FILES | ||
${CMAKE_CURRENT_LIST_DIR}/Platform/Common/${PAL_TRAIT_COMPILER_ID}/pointcloud_editor_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake | ||
FILES_CMAKE | ||
pointcloud_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 and 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 | ||
pointcloud_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 | ||
PLATFORM_INCLUDE_FILES | ||
${CMAKE_CURRENT_LIST_DIR}/Platform/Common/${PAL_TRAIT_COMPILER_ID}/pointcloud_editor_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake | ||
FILES_CMAKE | ||
pointcloud_editor_private_files.cmake | ||
TARGET_PROPERTIES | ||
O3DE_PRIVATE_TARGET TRUE | ||
INCLUDE_DIRECTORIES | ||
PRIVATE | ||
Include | ||
Source | ||
BUILD_DEPENDENCIES | ||
PUBLIC | ||
AZ::AzToolsFramework | ||
$<TARGET_OBJECTS:Gem::${gem_name}.Private.Object> | ||
Gem::Atom_Utils.Static | ||
Gem::Atom_Feature_Common.Static | ||
Gem::AtomLyIntegration_CommonFeatures.Static | ||
PRIVATE | ||
AZ::AssetBuilderSDK | ||
) | ||
|
||
ly_add_target( | ||
NAME ${gem_name}.Editor GEM_MODULE | ||
NAMESPACE Gem | ||
AUTOMOC | ||
FILES_CMAKE | ||
pointcloud_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_POINTCLOUD_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 | ||
pointcloud_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_POINTCLOUD_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 | ||
pointcloud_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() |
Oops, something went wrong.