Merge branch 'main' of https://github.com/aws-lumberyard/o3de into LYN-2726-ProjectRoot
This commit is contained in:
@@ -12,4 +12,5 @@
|
||||
set(GEM_DEPENDENCIES
|
||||
Gem::Atom_RHI_Vulkan.Private
|
||||
Gem::Atom_RHI_DX12.Private
|
||||
Gem::Atom_RHI_Null.Private
|
||||
)
|
||||
@@ -15,5 +15,7 @@ set(GEM_DEPENDENCIES
|
||||
Gem::Atom_RHI_Vulkan.Builders
|
||||
Gem::Atom_RHI_DX12.Private
|
||||
Gem::Atom_RHI_DX12.Builders
|
||||
Gem::Atom_RHI_Null.Private
|
||||
Gem::Atom_RHI_Null.Builders
|
||||
Gem::Atom_RHI_Metal.Builders
|
||||
)
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ByteStreamSerializer.h"
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace ByteSerializerInternal
|
||||
{
|
||||
static JsonSerializationResult::Result Load(void* outputValue, const rapidjson::Value& inputValue, JsonDeserializerContext& context)
|
||||
{
|
||||
using JsonSerializationResult::Outcomes;
|
||||
using JsonSerializationResult::Tasks;
|
||||
|
||||
AZ_Assert(outputValue, "Expected a valid pointer to load from json value.");
|
||||
|
||||
switch (inputValue.GetType())
|
||||
{
|
||||
case rapidjson::kStringType: {
|
||||
JsonByteStream buffer;
|
||||
if (AZ::StringFunc::Base64::Decode(buffer, inputValue.GetString(), inputValue.GetStringLength()))
|
||||
{
|
||||
JsonByteStream* valAsByteStream = static_cast<JsonByteStream*>(outputValue);
|
||||
*valAsByteStream = AZStd::move(buffer);
|
||||
return context.Report(Tasks::ReadField, Outcomes::Success, "Successfully read ByteStream.");
|
||||
}
|
||||
return context.Report(Tasks::ReadField, Outcomes::Invalid, "Decode of Base64 encoded ByteStream failed.");
|
||||
}
|
||||
case rapidjson::kArrayType:
|
||||
case rapidjson::kObjectType:
|
||||
case rapidjson::kNullType:
|
||||
case rapidjson::kFalseType:
|
||||
case rapidjson::kTrueType:
|
||||
case rapidjson::kNumberType:
|
||||
return context.Report(
|
||||
Tasks::ReadField, Outcomes::Unsupported,
|
||||
"Unsupported type. ByteStream values cannot be read from arrays, objects, nulls, booleans or numbers.");
|
||||
default:
|
||||
return context.Report(Tasks::ReadField, Outcomes::Unknown, "Unknown json type encountered for ByteStream value.");
|
||||
}
|
||||
}
|
||||
|
||||
static JsonSerializationResult::Result StoreWithDefault(
|
||||
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, JsonSerializerContext& context)
|
||||
{
|
||||
using JsonSerializationResult::Outcomes;
|
||||
using JsonSerializationResult::Tasks;
|
||||
|
||||
const JsonByteStream& valAsByteStream = *static_cast<const JsonByteStream*>(inputValue);
|
||||
if (context.ShouldKeepDefaults() || !defaultValue || (valAsByteStream != *static_cast<const JsonByteStream*>(defaultValue)))
|
||||
{
|
||||
const auto base64ByteStream = AZ::StringFunc::Base64::Encode(valAsByteStream.data(), valAsByteStream.size());
|
||||
outputValue.SetString(base64ByteStream.c_str(), base64ByteStream.size(), context.GetJsonAllocator());
|
||||
return context.Report(Tasks::WriteValue, Outcomes::Success, "ByteStream successfully stored.");
|
||||
}
|
||||
|
||||
return context.Report(Tasks::WriteValue, Outcomes::DefaultsUsed, "Default ByteStream used.");
|
||||
}
|
||||
} // namespace ByteSerializerInternal
|
||||
|
||||
AZ_CLASS_ALLOCATOR_IMPL(JsonByteStreamSerializer, SystemAllocator, 0);
|
||||
|
||||
JsonSerializationResult::Result JsonByteStreamSerializer::Load(
|
||||
void* outputValue, [[maybe_unused]] const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context)
|
||||
{
|
||||
AZ_Assert(
|
||||
azrtti_typeid<JsonByteStream>() == outputValueTypeId,
|
||||
"Unable to deserialize AZStd::vector<AZ::u8>> to json because the provided type is %s",
|
||||
outputValueTypeId.ToString<AZStd::string>().c_str());
|
||||
|
||||
return ByteSerializerInternal::Load(outputValue, inputValue, context);
|
||||
}
|
||||
|
||||
JsonSerializationResult::Result JsonByteStreamSerializer::Store(
|
||||
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, [[maybe_unused]] const Uuid& valueTypeId,
|
||||
JsonSerializerContext& context)
|
||||
{
|
||||
AZ_Assert(
|
||||
azrtti_typeid<JsonByteStream>() == valueTypeId,
|
||||
"Unable to serialize AZStd::vector<AZ::u8> to json because the provided type is %s",
|
||||
valueTypeId.ToString<AZStd::string>().c_str());
|
||||
|
||||
return ByteSerializerInternal::StoreWithDefault(outputValue, inputValue, defaultValue, context);
|
||||
}
|
||||
} // namespace AZ
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Serialization/Json/BaseJsonSerializer.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
using JsonByteStream = AZStd::vector<AZ::u8>; //!< Alias for AZStd::vector<AZ::u8>.
|
||||
|
||||
//! Serialize a stream of bytes (usually binary data) as a json string value.
|
||||
//! @note Related to GenericClassByteStream (part of SerializeGenericTypeInfo<AZStd::vector<AZ::u8>> - see AZStdContainers.inl for more
|
||||
//! details).
|
||||
class JsonByteStreamSerializer : public BaseJsonSerializer
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(JsonByteStreamSerializer, "{30F0EA5A-CD13-4BA7-BAE1-D50D851CAC45}", BaseJsonSerializer);
|
||||
AZ_CLASS_ALLOCATOR_DECL;
|
||||
|
||||
JsonSerializationResult::Result Load(
|
||||
void* outputValue, const Uuid& outputValueTypeId, const rapidjson::Value& inputValue,
|
||||
JsonDeserializerContext& context) override;
|
||||
JsonSerializationResult::Result Store(
|
||||
rapidjson::Value& outputValue, const void* inputValue, const void* defaultValue, const Uuid& valueTypeId,
|
||||
JsonSerializerContext& context) override;
|
||||
};
|
||||
} // namespace AZ
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <AzCore/Serialization/Json/ArraySerializer.h>
|
||||
#include <AzCore/Serialization/Json/BasicContainerSerializer.h>
|
||||
#include <AzCore/Serialization/Json/BoolSerializer.h>
|
||||
#include <AzCore/Serialization/Json/ByteStreamSerializer.h>
|
||||
#include <AzCore/Serialization/Json/DoubleSerializer.h>
|
||||
#include <AzCore/Serialization/Json/IntSerializer.h>
|
||||
#include <AzCore/Serialization/Json/JsonSystemComponent.h>
|
||||
@@ -68,6 +69,8 @@ namespace AZ
|
||||
jsonContext->Serializer<JsonStringSerializer>()->HandlesType<AZStd::string>();
|
||||
jsonContext->Serializer<JsonOSStringSerializer>()->HandlesType<OSString>();
|
||||
|
||||
jsonContext->Serializer<JsonByteStreamSerializer>()->HandlesType<JsonByteStream>();
|
||||
|
||||
jsonContext->Serializer<JsonBasicContainerSerializer>()
|
||||
->HandlesType<AZStd::fixed_vector>()
|
||||
->HandlesType<AZStd::forward_list>()
|
||||
|
||||
@@ -505,6 +505,8 @@ set(FILES
|
||||
Serialization/Json/BasicContainerSerializer.cpp
|
||||
Serialization/Json/BoolSerializer.h
|
||||
Serialization/Json/BoolSerializer.cpp
|
||||
Serialization/Json/ByteStreamSerializer.h
|
||||
Serialization/Json/ByteStreamSerializer.cpp
|
||||
Serialization/Json/CastingHelpers.h
|
||||
Serialization/Json/DoubleSerializer.h
|
||||
Serialization/Json/DoubleSerializer.cpp
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Serialization/Json/ByteStreamSerializer.h>
|
||||
#include <Tests/Serialization/Json/BaseJsonSerializerFixture.h>
|
||||
#include <Tests/Serialization/Json/JsonSerializerConformityTests.h>
|
||||
|
||||
namespace JsonSerializationTests
|
||||
{
|
||||
class ByteStreamSerializerTestDescription : public JsonSerializerConformityTestDescriptor<AZ::JsonByteStream>
|
||||
{
|
||||
public:
|
||||
AZStd::shared_ptr<AZ::BaseJsonSerializer> CreateSerializer() override
|
||||
{
|
||||
return AZStd::make_shared<AZ::JsonByteStreamSerializer>();
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<AZ::JsonByteStream> CreateDefaultInstance() override
|
||||
{
|
||||
return AZStd::make_shared<AZ::JsonByteStream>();
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<AZ::JsonByteStream> CreateFullySetInstance() override
|
||||
{
|
||||
// create a JsonByteStream (AZStd::vector<u8>) with ten 'a's
|
||||
return AZStd::make_shared<AZ::JsonByteStream>(10, 'a');
|
||||
}
|
||||
|
||||
AZStd::string_view GetJsonForFullySetInstance() override
|
||||
{
|
||||
// Base64 encoded version of 'aaaaaaaaaa' (see CreateFullySetInstance)
|
||||
return R"("YWFhYWFhYWFhYQ==")";
|
||||
}
|
||||
|
||||
void ConfigureFeatures(JsonSerializerConformityTestDescriptorFeatures& features) override
|
||||
{
|
||||
features.EnableJsonType(rapidjson::kStringType);
|
||||
features.m_supportsPartialInitialization = false;
|
||||
features.m_supportsInjection = false;
|
||||
}
|
||||
|
||||
bool AreEqual(const AZ::JsonByteStream& lhs, const AZ::JsonByteStream& rhs) override
|
||||
{
|
||||
return lhs == rhs;
|
||||
}
|
||||
};
|
||||
|
||||
using ByteStreamConformityTestTypes = ::testing::Types<ByteStreamSerializerTestDescription>;
|
||||
INSTANTIATE_TYPED_TEST_CASE_P(JsonByteStreamSerialzier, JsonSerializerConformityTests, ByteStreamConformityTestTypes);
|
||||
} // namespace JsonSerializationTests
|
||||
@@ -98,6 +98,7 @@ set(FILES
|
||||
Serialization/Json/BaseJsonSerializerTests.cpp
|
||||
Serialization/Json/BasicContainerSerializerTests.cpp
|
||||
Serialization/Json/BoolSerializerTests.cpp
|
||||
Serialization/Json/ByteStreamSerializerTests.cpp
|
||||
Serialization/Json/ColorSerializerTests.cpp
|
||||
Serialization/Json/DoubleSerializerTests.cpp
|
||||
Serialization/Json/IntSerializerTests.cpp
|
||||
|
||||
@@ -142,6 +142,7 @@ namespace Physics
|
||||
->Field("PhysicsAsset", &PhysicsAssetShapeConfiguration::m_asset)
|
||||
->Field("AssetScale", &PhysicsAssetShapeConfiguration::m_assetScale)
|
||||
->Field("UseMaterialsFromAsset", &PhysicsAssetShapeConfiguration::m_useMaterialsFromAsset)
|
||||
->Field("SubdivisionLevel", &PhysicsAssetShapeConfiguration::m_subdivisionLevel)
|
||||
;
|
||||
|
||||
if (auto editContext = serializeContext->GetEditContext())
|
||||
|
||||
@@ -141,6 +141,7 @@ namespace Physics
|
||||
AZ::Data::Asset<AZ::Data::AssetData> m_asset{ AZ::Data::AssetLoadBehavior::PreLoad };
|
||||
AZ::Vector3 m_assetScale = AZ::Vector3::CreateOne();
|
||||
bool m_useMaterialsFromAsset = true;
|
||||
AZ::u8 m_subdivisionLevel = 4; ///< The level of subdivision if a primitive shape is replaced with a convex mesh due to scaling.
|
||||
};
|
||||
|
||||
class NativeShapeConfiguration : public ShapeConfiguration
|
||||
|
||||
@@ -142,13 +142,6 @@ namespace Physics
|
||||
|
||||
virtual AZStd::shared_ptr<Shape> CreateShape(const ColliderConfiguration& colliderConfiguration, const ShapeConfiguration& configuration) = 0;
|
||||
|
||||
/// Adds an appropriate collider component to the entity based on the provided shape configuration.
|
||||
/// @param entity Entity where the component should be added to.
|
||||
/// @param colliderConfiguration Configuration of the collider.
|
||||
/// @param shapeConfiguration Configuration of the shape of the collider.
|
||||
/// @param addEditorComponents Tells whether to add the Editor version of the collider component or the Game one.
|
||||
virtual void AddColliderComponentToEntity(AZ::Entity* entity, const Physics::ColliderConfiguration& colliderConfiguration, const Physics::ShapeConfiguration& shapeConfiguration, bool addEditorComponents = false) = 0;
|
||||
|
||||
/// Releases the mesh object created by the physics backend.
|
||||
/// @param nativeMeshObject Pointer to the mesh object.
|
||||
virtual void ReleaseNativeMeshObject(void* nativeMeshObject) = 0;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace AzNetworking
|
||||
|
||||
ContainerType m_container;
|
||||
|
||||
template <AZStd::size_t, typename ElementType>
|
||||
template <AZStd::size_t, typename>
|
||||
friend class FixedSizeVectorBitset;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice,
|
||||
m_backgroundImage = QPixmap::fromImage(backgroundImage.scaled(m_enforcedWidth, m_enforcedHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
|
||||
// Draw the Open 3D Engine logo from svg
|
||||
m_ui->m_logo->load(QStringLiteral(":/StartupLogoDialog/lumberyard_logo.svg"));
|
||||
m_ui->m_logo->load(QStringLiteral(":/StartupLogoDialog/o3de_logo.svg"));
|
||||
|
||||
// Prevent re-sizing
|
||||
setFixedSize(m_enforcedWidth, m_enforcedHeight);
|
||||
|
||||
@@ -60,35 +60,35 @@
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_42">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSvgWidget" name="m_logo" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_42">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSvgWidget" name="m_logo" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>161</width>
|
||||
<height>49</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>161</width>
|
||||
<height>49</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_transparentVersion">
|
||||
<property name="text">
|
||||
@@ -251,6 +251,11 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QSvgWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qsvgwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ClickableLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
|
||||
@@ -49,7 +49,7 @@ CStartupLogoDialog::CStartupLogoDialog(QString versionText, QString richTextCopy
|
||||
m_backgroundImage = QPixmap::fromImage(backgroundImage.scaled(m_enforcedWidth, m_enforcedHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
|
||||
// Draw the Open 3D Engine logo from svg
|
||||
m_ui->m_logo->load(QStringLiteral(":/StartupLogoDialog/lumberyard_logo.svg"));
|
||||
m_ui->m_logo->load(QStringLiteral(":/StartupLogoDialog/o3de_logo.svg"));
|
||||
|
||||
m_ui->m_TransparentConfidential->setObjectName("copyrightNotice");
|
||||
m_ui->m_TransparentConfidential->setTextFormat(Qt::RichText);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/StartupLogoDialog">
|
||||
<file>lumberyard_logo.svg</file>
|
||||
<file>o3de_logo.svg</file>
|
||||
<file>splashscreen_1_27.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -42,14 +42,14 @@
|
||||
<widget class="QSvgWidget" name="m_logo" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>60</height>
|
||||
<width>161</width>
|
||||
<height>49</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>60</height>
|
||||
<width>161</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="323px" height="98px" viewBox="0 0 323 98" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Group 12</title>
|
||||
<defs>
|
||||
<polygon id="path-1" points="0 97.741 322.084 97.741 322.084 0 0 0"></polygon>
|
||||
</defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group-12" transform="translate(0.000000, 0.000000)">
|
||||
<path d="M99.7068,20.425 C91.1008,11.686 79.6658,6.841 67.5068,6.782 L67.2838,6.781 C62.9678,6.781 58.7408,7.396 54.6908,8.566 L54.6908,25.339 C58.5158,23.54 62.6988,22.563 67.0218,22.517 C67.1388,22.516 67.2538,22.515 67.3698,22.515 C75.1318,22.515 82.4608,25.519 88.0388,30.996 C93.7828,36.635 96.9708,44.124 97.0168,52.084 C97.0628,60.037 93.9658,67.554 88.2968,73.251 C82.6908,78.884 75.2578,82 67.3558,82.025 L67.2718,82.025 C59.4228,82.025 51.9878,78.959 46.3368,73.393 C40.6918,67.833 37.5578,60.397 37.5108,52.453 C37.4888,48.659 38.1798,44.975 39.5088,41.546 L23.0748,41.546 C19.4908,56.362 23.4348,72.648 34.9328,84.219 C43.5408,92.882 54.9608,97.683 67.0878,97.738 L67.3028,97.738 L67.3058,97.738 C79.3458,97.738 90.7008,93.045 99.2768,84.524 C107.8718,75.984 112.6488,64.62 112.7288,52.524 C112.8088,40.435 108.1838,29.035 99.7068,20.425" id="Fill-1" fill="#FFFFFF"></path>
|
||||
<path d="M175.6326,27.8629 C175.6326,33.3889 173.9586,38.0879 170.6116,41.9599 C167.2646,45.8319 162.5656,48.4939 156.5146,49.9459 L156.5146,50.3089 C163.6536,51.1969 169.0586,53.3629 172.7296,56.8129 C176.3996,60.2619 178.2356,64.9099 178.2356,70.7579 C178.2356,79.2689 175.1496,85.8939 168.9786,90.6319 C162.8076,95.3719 153.9936,97.7409 142.5386,97.7409 C132.9386,97.7409 124.4286,96.1489 117.0076,92.9609 L117.0076,77.0489 C120.4356,78.7839 124.2076,80.1959 128.3216,81.2839 C132.4356,82.3729 136.5096,82.9179 140.5426,82.9179 C146.7146,82.9179 151.2716,81.8699 154.2156,79.7719 C157.1596,77.6749 158.6326,74.3079 158.6326,69.6679 C158.6326,65.5139 156.9386,62.5699 153.5506,60.8349 C150.1626,59.1009 144.7576,58.2329 137.3366,58.2329 L130.6206,58.2329 L130.6206,43.8939 L137.4576,43.8939 C144.3146,43.8939 149.3246,42.9979 152.4916,41.2019 C155.6576,39.4079 157.2406,36.3319 157.2406,31.9759 C157.2406,25.2809 153.0456,21.9329 144.6566,21.9329 C141.7526,21.9329 138.7986,22.4169 135.7936,23.3849 C132.7886,24.3529 129.4506,26.0279 125.7806,28.4069 L117.1306,15.5199 C125.1956,9.7119 134.8166,6.8079 145.9886,6.8079 C155.1446,6.8079 162.3736,8.6639 167.6786,12.3739 C172.9806,16.0869 175.6326,21.2499 175.6326,27.8629" id="Fill-3" fill="#FFFFFF"></path>
|
||||
<path d="M241.8563,51.9425 C241.8563,32.9455 233.4653,23.4465 216.6883,23.4465 L206.7053,23.4465 L206.7053,81.0435 L214.7523,81.0435 C232.8213,81.0435 241.8563,71.3435 241.8563,51.9425 M261.3363,51.4595 C261.3363,66.0195 257.1933,77.1715 248.9043,84.9165 C240.6153,92.6605 228.6463,96.5325 212.9973,96.5325 L187.9503,96.5325 L187.9503,8.0815 L215.7193,8.0815 C230.1593,8.0815 241.3723,11.8925 249.3583,19.5155 C257.3433,27.1365 261.3363,37.7855 261.3363,51.4595" id="Fill-5" fill="#FFFFFF"></path>
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<g id="Clip-8"></g>
|
||||
<polygon id="Fill-7" fill="#FFFFFF" mask="url(#mask-2)" points="23.185 30.421 45.046 30.421 45.046 8.56 23.185 8.56"></polygon>
|
||||
<polygon id="Fill-9" fill="#FFFFFF" mask="url(#mask-2)" points="5.251 9.038 14.289 9.038 14.289 0 5.251 0"></polygon>
|
||||
<polygon id="Fill-10" fill="#FFFFFF" mask="url(#mask-2)" points="0 36.195 14.18 36.195 14.18 22.015 0 22.015"></polygon>
|
||||
<polygon id="Fill-11" fill="#FFFFFF" mask="url(#mask-2)" points="322.0838 96.4337 271.0538 96.4337 271.0538 7.8287 322.0838 7.8287 322.0838 23.2227 289.8418 23.2227 289.8418 42.6767 319.8418 42.6767 319.8418 58.0707 289.8418 58.0707 289.8418 80.9187 322.0838 80.9187"></polygon>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -162,7 +162,7 @@ namespace AZ
|
||||
AZStd::string expectedHigherPrecedenceFileFullPath;
|
||||
AzFramework::StringFunc::Path::Join(gameProjectPath, RPI::ShaderVariantTreeAsset::CommonSubFolder, expectedHigherPrecedenceFileFullPath, false /* handle directory overlap? */, false /* be case insensitive? */);
|
||||
AzFramework::StringFunc::Path::Join(expectedHigherPrecedenceFileFullPath.c_str(), shaderProductFileRelativePath.c_str(), expectedHigherPrecedenceFileFullPath, false /* handle directory overlap? */, false /* be case insensitive? */);
|
||||
AzFramework::StringFunc::Path::ReplaceExtension(expectedHigherPrecedenceFileFullPath, AZ::RPI::ShaderVariantAsset::Extension);
|
||||
AzFramework::StringFunc::Path::ReplaceExtension(expectedHigherPrecedenceFileFullPath, AZ::RPI::ShaderVariantListSourceData::Extension);
|
||||
AzFramework::StringFunc::Path::Normalize(expectedHigherPrecedenceFileFullPath);
|
||||
|
||||
AZStd::string normalizedShaderVariantListFileFullPath = shaderVariantListFileFullPath;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <RayTracing/RayTracingFeatureProcessor.h>
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AtomCore/std/parallel/concurrency_checker.h>
|
||||
#include <AzCore/Console/Console.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -160,8 +161,14 @@ namespace AZ
|
||||
|
||||
// called when reflection probes are modified in the editor so that meshes can re-evaluate their probes
|
||||
void UpdateMeshReflectionProbes();
|
||||
|
||||
private:
|
||||
void ForceRebuildDrawPackets(const AZ::ConsoleCommandContainer& arguments);
|
||||
AZ_CONSOLEFUNC(MeshFeatureProcessor,
|
||||
ForceRebuildDrawPackets,
|
||||
AZ::ConsoleFunctorFlags::Null,
|
||||
"(For Testing) Invalidates all mesh draw packets, causing them to rebuild on the next frame."
|
||||
);
|
||||
|
||||
MeshFeatureProcessor(const MeshFeatureProcessor&) = delete;
|
||||
|
||||
// RPI::SceneNotificationBus::Handler overrides...
|
||||
|
||||
@@ -387,6 +387,11 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void MeshFeatureProcessor::ForceRebuildDrawPackets([[maybe_unused]] const AZ::ConsoleCommandContainer& arguments)
|
||||
{
|
||||
m_forceRebuildDrawPackets = true;
|
||||
}
|
||||
|
||||
void MeshFeatureProcessor::OnRenderPipelineAdded(RPI::RenderPipelinePtr pipeline)
|
||||
{
|
||||
m_forceRebuildDrawPackets = true;;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace AZ
|
||||
AssetBuilderSDK::AssetBuilderDesc builderDescriptor;
|
||||
|
||||
builderDescriptor.m_name = "Atom Resource Pool Asset Builder";
|
||||
builderDescriptor.m_version = 1;
|
||||
builderDescriptor.m_version = 2; //ATOM-15196
|
||||
builderDescriptor.m_patterns.emplace_back(AssetBuilderSDK::AssetBuilderPattern(AZStd::string("*.") + s_sourcePoolAssetExt,
|
||||
AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
|
||||
builderDescriptor.m_busId = azrtti_typeid<ResourcePoolBuilder>();
|
||||
|
||||
@@ -17,11 +17,20 @@
|
||||
#include <Atom/RPI.Public/Scene.h>
|
||||
#include <Atom/RPI.Reflect/Material/MaterialFunctor.h>
|
||||
#include <Atom/RHI/DrawPacketBuilder.h>
|
||||
#include <AzCore/Console/Console.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace RPI
|
||||
{
|
||||
AZ_CVAR(bool,
|
||||
r_forceRootShaderVariantUsage,
|
||||
false,
|
||||
[](const bool&) { AZ::Interface<AZ::IConsole>::Get()->PerformCommand("MeshFeatureProcessor.ForceRebuildDrawPackets"); },
|
||||
ConsoleFunctorFlags::Null,
|
||||
"(For Testing) Forces usage of root shader variant in the mesh draw packet level, ignoring any other shader variants that may exist."
|
||||
);
|
||||
|
||||
MeshDrawPacket::MeshDrawPacket(
|
||||
ModelLod& modelLod,
|
||||
size_t modelLodMeshIndex,
|
||||
@@ -187,7 +196,7 @@ namespace AZ
|
||||
}
|
||||
|
||||
const ShaderVariantId finalVariantId = shaderOptions.GetShaderVariantId();
|
||||
const ShaderVariant& variant = shader->GetVariant(finalVariantId);
|
||||
const ShaderVariant& variant = r_forceRootShaderVariantUsage ? shader->GetRootVariant() : shader->GetVariant(finalVariantId);
|
||||
|
||||
Data::Instance<ShaderResourceGroup> drawSrg;
|
||||
if (drawSrgAsset)
|
||||
|
||||
+2
@@ -37,6 +37,8 @@ namespace MaterialEditor
|
||||
//Connect ok and cancel buttons
|
||||
QObject::connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
QObject::connect(m_ui->m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
void CreateMaterialDialog::InitMaterialTypeSelection()
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QMenu>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
@@ -61,6 +62,8 @@ namespace MaterialEditor
|
||||
m_caller = nullptr;
|
||||
});
|
||||
|
||||
AddGenericContextMenuActions(caller, menu, entry);
|
||||
|
||||
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
|
||||
{
|
||||
const auto source = azalias_cast<const SourceAssetBrowserEntry*>(entry);
|
||||
@@ -84,6 +87,18 @@ namespace MaterialEditor
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialBrowserInteractions::AddGenericContextMenuActions([[maybe_unused]] QWidget* caller, QMenu* menu, const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry)
|
||||
{
|
||||
menu->addAction(QObject::tr("Copy Name To Clipboard"), [=]()
|
||||
{
|
||||
QApplication::clipboard()->setText(entry->GetName().c_str());
|
||||
});
|
||||
menu->addAction(QObject::tr("Copy Path To Clipboard"), [=]()
|
||||
{
|
||||
QApplication::clipboard()->setText(entry->GetFullPath().c_str());
|
||||
});
|
||||
}
|
||||
|
||||
void MaterialBrowserInteractions::AddContextMenuActionsForMaterialTypeSource(QWidget* caller, QMenu* menu, const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* entry)
|
||||
{
|
||||
menu->addAction(AzQtComponents::fileBrowserActionName(), [entry]()
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace MaterialEditor
|
||||
//! AssetBrowserInteractionNotificationBus::Handler overrides...
|
||||
void AddContextMenuActions(QWidget* caller, QMenu* menu, const AZStd::vector<AzToolsFramework::AssetBrowser::AssetBrowserEntry*>& entries) override;
|
||||
|
||||
void AddGenericContextMenuActions(QWidget* caller, QMenu* menu, const AzToolsFramework::AssetBrowser::AssetBrowserEntry* entry);
|
||||
void AddContextMenuActionsForOtherSource(QWidget* caller, QMenu* menu, const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* entry);
|
||||
void AddContextMenuActionsForMaterialSource(QWidget* caller, QMenu* menu, const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* entry);
|
||||
void AddContextMenuActionsForMaterialTypeSource(QWidget* caller, QMenu* menu, const AzToolsFramework::AssetBrowser::SourceAssetBrowserEntry* entry);
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ namespace MaterialEditor
|
||||
SetupPresetList();
|
||||
SetupSearchWidget();
|
||||
SetupDialogButtons();
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
void PresetBrowserDialog::SetupPresetList()
|
||||
|
||||
+7
-14
@@ -25,6 +25,7 @@ AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnin
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileDialog>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
@@ -215,19 +216,10 @@ namespace AZ
|
||||
tableWidget->sortItems(MaterialSlotColumn);
|
||||
|
||||
// Create the bottom row of the dialog with action buttons for exporting or canceling the operation
|
||||
QWidget* buttonRow = new QWidget(&dialog);
|
||||
buttonRow->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
|
||||
QPushButton* confirmButton = new QPushButton("Confirm", buttonRow);
|
||||
QObject::connect(confirmButton, &QPushButton::clicked, confirmButton, [&dialog] { dialog.accept(); });
|
||||
|
||||
QPushButton* cancelButton = new QPushButton("Cancel", buttonRow);
|
||||
QObject::connect(cancelButton, &QPushButton::clicked, cancelButton, [&dialog] { dialog.reject(); });
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonRow);
|
||||
buttonLayout->addStretch();
|
||||
buttonLayout->addWidget(confirmButton);
|
||||
buttonLayout->addWidget(cancelButton);
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(&dialog);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||
QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||
QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||
|
||||
// Create a heading label for the top of the dialog
|
||||
QLabel* labelWidget = new QLabel("\nSelect the material slots that you want to generate new source materials for. Edit the material file name and location using the file picker.\n", &dialog);
|
||||
@@ -236,8 +228,9 @@ namespace AZ
|
||||
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
||||
dialogLayout->addWidget(labelWidget);
|
||||
dialogLayout->addWidget(tableWidget);
|
||||
dialogLayout->addWidget(buttonRow);
|
||||
dialogLayout->addWidget(buttonBox);
|
||||
dialog.setLayout(dialogLayout);
|
||||
dialog.setModal(true);
|
||||
|
||||
// Forcing the initial dialog size to accomodate typical content.
|
||||
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
||||
|
||||
+9
-5
@@ -37,6 +37,7 @@
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||
#include <QApplication>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileInfo>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
@@ -534,7 +535,7 @@ namespace AZ
|
||||
inspector->Populate();
|
||||
inspector->SetOverrides(propertyOverrideMap);
|
||||
|
||||
// Create the menu bottom row with actions for exporting or canceling the operation
|
||||
// Create the menu button
|
||||
QToolButton* menuButton = new QToolButton(&dialog);
|
||||
menuButton->setAutoRaise(true);
|
||||
menuButton->setIcon(QIcon(":/Cards/img/UI20/Cards/menu_ico.svg"));
|
||||
@@ -546,10 +547,6 @@ namespace AZ
|
||||
action = menu.addAction("Clear Overrides", [&] { inspector->SetOverrides(MaterialPropertyOverrideMap()); });
|
||||
action = menu.addAction("Revert Changes", [&] { inspector->SetOverrides(propertyOverrideMap); });
|
||||
|
||||
menu.addSeparator();
|
||||
action = menu.addAction("Confirm Changes", [&] { dialog.accept(); });
|
||||
action = menu.addAction("Cancel Changes", [&] { dialog.reject(); });
|
||||
|
||||
menu.addSeparator();
|
||||
action = menu.addAction("Save Material", [&] { inspector->SaveMaterial(); });
|
||||
action = menu.addAction("Save Material To Source", [&] { inspector->SaveMaterialToSource(); });
|
||||
@@ -563,12 +560,19 @@ namespace AZ
|
||||
menu.exec(QCursor::pos());
|
||||
});
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(&dialog);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||
QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||
QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||
|
||||
QObject::connect(&dialog, &QDialog::rejected, &dialog, [&] { inspector->SetOverrides(propertyOverrideMap); });
|
||||
|
||||
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
||||
dialogLayout->addWidget(menuButton);
|
||||
dialogLayout->addWidget(inspector);
|
||||
dialogLayout->addWidget(buttonBox);
|
||||
dialog.setLayout(dialogLayout);
|
||||
dialog.setModal(true);
|
||||
|
||||
// Forcing the initial dialog size to accomodate typical content.
|
||||
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
||||
|
||||
+2
@@ -269,6 +269,8 @@ namespace AZ
|
||||
|
||||
QAction* action = nullptr;
|
||||
|
||||
menu.addAction("Open Material Editor", [this]() { EditorMaterialSystemComponentRequestBus::Broadcast(&EditorMaterialSystemComponentRequestBus::Events::OpenInMaterialEditor, ""); });
|
||||
|
||||
action = menu.addAction("Clear", [this]() { Clear(); });
|
||||
action->setEnabled(m_materialAsset.GetId().IsValid() || !m_propertyOverrides.empty() || !m_matModUvOverrides.empty());
|
||||
|
||||
|
||||
+23
-31
@@ -32,8 +32,11 @@
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||
#include <QApplication>
|
||||
#include <QDialog>
|
||||
#include <QPushButton>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
AZ_POP_DISABLE_WARNING
|
||||
|
||||
@@ -286,42 +289,31 @@ namespace AZ
|
||||
MaterialModelUvNameMapInspector* inspector = new MaterialModelUvNameMapInspector(assetId, matModUvOverrides, modelUvNames, matModUvOverrideMapChangedCallBack, &dialog);
|
||||
inspector->Populate();
|
||||
|
||||
// Create the bottom row of the dialog with action buttons for exporting or canceling the operation
|
||||
QWidget* buttonRow = new QWidget(&dialog);
|
||||
buttonRow->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
// Create the menu button
|
||||
QToolButton* menuButton = new QToolButton(&dialog);
|
||||
menuButton->setAutoRaise(true);
|
||||
menuButton->setIcon(QIcon(":/Cards/img/UI20/Cards/menu_ico.svg"));
|
||||
menuButton->setVisible(true);
|
||||
QObject::connect(menuButton, &QToolButton::clicked, &dialog, [&]() {
|
||||
QAction* action = nullptr;
|
||||
|
||||
QPushButton* revertButton = new QPushButton("Revert", buttonRow);
|
||||
QObject::connect(revertButton, &QPushButton::clicked, revertButton, [inspector, matModUvOverrides] {
|
||||
inspector->SetUvNameMap(matModUvOverrides);
|
||||
});
|
||||
QMenu menu(&dialog);
|
||||
action = menu.addAction("Clear", [&] { inspector->SetUvNameMap(RPI::MaterialModelUvOverrideMap()); });
|
||||
action = menu.addAction("Revert", [&] { inspector->SetUvNameMap(matModUvOverrides);; });
|
||||
menu.exec(QCursor::pos());
|
||||
});
|
||||
|
||||
QPushButton* clearButton = new QPushButton("Clear", buttonRow);
|
||||
QObject::connect(clearButton, &QPushButton::clicked, clearButton, [inspector] {
|
||||
inspector->SetUvNameMap(RPI::MaterialModelUvOverrideMap());
|
||||
});
|
||||
|
||||
QPushButton* confirmButton = new QPushButton("Confirm", buttonRow);
|
||||
QObject::connect(confirmButton, &QPushButton::clicked, confirmButton, [&dialog] {
|
||||
dialog.accept();
|
||||
});
|
||||
|
||||
QPushButton* cancelButton = new QPushButton("Cancel", buttonRow);
|
||||
QObject::connect(cancelButton, &QPushButton::clicked, cancelButton, [inspector, matModUvOverrides, &dialog] {
|
||||
inspector->SetUvNameMap(matModUvOverrides);
|
||||
dialog.reject();
|
||||
});
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout(buttonRow);
|
||||
buttonLayout->addStretch();
|
||||
buttonLayout->addWidget(revertButton);
|
||||
buttonLayout->addWidget(clearButton);
|
||||
buttonLayout->addWidget(confirmButton);
|
||||
buttonLayout->addWidget(cancelButton);
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(&dialog);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||
QObject::connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||
QObject::connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
|
||||
|
||||
QVBoxLayout* dialogLayout = new QVBoxLayout(&dialog);
|
||||
dialogLayout->addWidget(menuButton);
|
||||
dialogLayout->addWidget(inspector);
|
||||
dialogLayout->addWidget(buttonRow);
|
||||
dialogLayout->addWidget(buttonBox);
|
||||
dialog.setLayout(dialogLayout);
|
||||
dialog.setModal(true);
|
||||
|
||||
// Forcing the initial dialog size to accomodate typical content.
|
||||
// Temporarily settng fixed size because dialog.show/exec invokes WindowDecorationWrapper::showEvent.
|
||||
|
||||
@@ -213,9 +213,6 @@ namespace Blast
|
||||
CreateShape,
|
||||
AZStd::shared_ptr<Physics::Shape>(
|
||||
const Physics::ColliderConfiguration&, const Physics::ShapeConfiguration&));
|
||||
MOCK_METHOD4(
|
||||
AddColliderComponentToEntity,
|
||||
void(AZ::Entity*, const Physics::ColliderConfiguration&, const Physics::ShapeConfiguration&, bool));
|
||||
MOCK_METHOD1(ReleaseNativeMeshObject, void(void*));
|
||||
MOCK_METHOD1(CreateMaterial, AZStd::shared_ptr<Physics::Material>(const Physics::MaterialConfiguration&));
|
||||
MOCK_METHOD0(GetDefaultMaterial, AZStd::shared_ptr<Physics::Material>());
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace Physics
|
||||
BusDisconnect();
|
||||
}
|
||||
MOCK_METHOD2(CreateShape, AZStd::shared_ptr<Physics::Shape>(const Physics::ColliderConfiguration& colliderConfiguration, const Physics::ShapeConfiguration& configuration));
|
||||
MOCK_METHOD4(AddColliderComponentToEntity, void(AZ::Entity* entity, const Physics::ColliderConfiguration& colliderConfiguration, const Physics::ShapeConfiguration& shapeConfiguration, bool addEditorComponents));
|
||||
MOCK_METHOD1(ReleaseNativeMeshObject, void(void* nativeMeshObject));
|
||||
MOCK_METHOD1(CreateMaterial, AZStd::shared_ptr<Physics::Material>(const Physics::MaterialConfiguration& materialConfiguration));
|
||||
MOCK_METHOD0(GetDefaultMaterial, AZStd::shared_ptr<Physics::Material>());
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace LmbrCentral
|
||||
ShapeComponentNotificationsBus::Handler::BusDisconnect();
|
||||
PolygonPrismShapeComponentNotificationBus::Handler::BusDisconnect();
|
||||
AZ::TransformNotificationBus::Handler::BusDisconnect();
|
||||
m_nonUniformScaleChangedHandler.Disconnect();
|
||||
|
||||
DestroyManipulators();
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@ namespace LmbrCentral
|
||||
AZ::TransformBus::EventResult(m_currentTransform, entityId, &AZ::TransformBus::Events::GetWorldTM);
|
||||
m_currentNonUniformScale = AZ::Vector3::CreateOne();
|
||||
AZ::NonUniformScaleRequestBus::EventResult(m_currentNonUniformScale, m_entityId, &AZ::NonUniformScaleRequests::GetScale);
|
||||
m_polygonPrism->SetNonUniformScale(m_currentNonUniformScale);
|
||||
m_intersectionDataCache.InvalidateCache(InvalidateShapeCacheReason::ShapeChange);
|
||||
|
||||
AZ::TransformNotificationBus::Handler::BusConnect(entityId);
|
||||
|
||||
@@ -97,6 +97,10 @@ namespace UnitTest
|
||||
m_mpComponent->OnConnect(&connMock2);
|
||||
|
||||
EXPECT_EQ(m_connectionAcquiredCount, 25);
|
||||
|
||||
// Clean up connection data
|
||||
m_mpComponent->OnDisconnect(&connMock1, AzNetworking::DisconnectReason::None, AzNetworking::TerminationEndpoint::Local);
|
||||
m_mpComponent->OnDisconnect(&connMock2, AzNetworking::DisconnectReason::None, AzNetworking::TerminationEndpoint::Local);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <AzFramework/Physics/CollisionBus.h>
|
||||
#include <AzFramework/Physics/SystemBus.h>
|
||||
#include <AzFramework/Physics/Configuration/CollisionConfiguration.h>
|
||||
#include <AzFramework/Physics/Configuration/SceneConfiguration.h>
|
||||
#include <AzToolsFramework/API/ViewPaneOptions.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <LyViewPaneNames.h>
|
||||
@@ -23,6 +24,8 @@
|
||||
#include <Editor/EditorWindow.h>
|
||||
#include <Editor/ConfigurationWidget.h>
|
||||
#include <System/PhysXSystem.h>
|
||||
#include <PhysX/Configuration/PhysXConfiguration.h>
|
||||
#include <PhysX/Debug/PhysXDebugConfiguration.h>
|
||||
|
||||
namespace PhysX
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
namespace AzPhysics
|
||||
{
|
||||
class CollisionConfiguration;
|
||||
struct SceneConfiguration;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
@@ -28,6 +29,12 @@ namespace Ui
|
||||
|
||||
namespace PhysX
|
||||
{
|
||||
struct PhysXSystemConfiguration;
|
||||
namespace Debug
|
||||
{
|
||||
struct DebugConfiguration;
|
||||
}
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
/// Window pane wrapper for the PhysX Configuration Widget.
|
||||
|
||||
@@ -18,13 +18,15 @@
|
||||
#include <AzFramework/Physics/SystemBus.h>
|
||||
#include <AzFramework/Physics/Collision/CollisionEvents.h>
|
||||
#include <AzFramework/Physics/Common/PhysicsSimulatedBody.h>
|
||||
#include <Editor/ConfigStringLineEditCtrl.h>
|
||||
#include <Editor/EditorJointConfiguration.h>
|
||||
|
||||
#include <I3DEngine.h>
|
||||
#include <IEditor.h>
|
||||
#include <ISurfaceType.h>
|
||||
|
||||
#include <Editor/ConfigStringLineEditCtrl.h>
|
||||
#include <Editor/EditorJointConfiguration.h>
|
||||
#include <Editor/EditorWindow.h>
|
||||
#include <Editor/PropertyTypes.h>
|
||||
#include <System/PhysXSystem.h>
|
||||
|
||||
namespace PhysX
|
||||
@@ -116,18 +118,20 @@ namespace PhysX
|
||||
{
|
||||
AzPhysics::SceneConfiguration editorWorldConfiguration = physicsSystem->GetDefaultSceneConfiguration();
|
||||
editorWorldConfiguration.m_sceneName = AzPhysics::EditorPhysicsSceneName;
|
||||
editorWorldConfiguration.m_sceneName = "EditorScene";
|
||||
m_editorWorldSceneHandle = physicsSystem->AddScene(editorWorldConfiguration);
|
||||
}
|
||||
|
||||
PhysX::RegisterConfigStringLineEditHandler(); // Register custom unique string line edit control
|
||||
PhysX::Editor::RegisterPropertyTypes();
|
||||
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void EditorSystemComponent::Deactivate()
|
||||
{
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
|
||||
Physics::EditorWorldBus::Handler::BusDisconnect();
|
||||
|
||||
if (auto* physicsSystem = AZ::Interface<AzPhysics::SystemInterface>::Get())
|
||||
@@ -164,6 +168,16 @@ namespace PhysX
|
||||
}
|
||||
}
|
||||
|
||||
void EditorSystemComponent::PopulateEditorGlobalContextMenu([[maybe_unused]] QMenu* menu, [[maybe_unused]] const AZ::Vector2& point, [[maybe_unused]] int flags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EditorSystemComponent::NotifyRegisterViews()
|
||||
{
|
||||
PhysX::Editor::EditorWindow::RegisterViewClass();
|
||||
}
|
||||
|
||||
AZ::Data::AssetId EditorSystemComponent::GenerateSurfaceTypesLibrary()
|
||||
{
|
||||
AZ::Data::AssetId resultAssetId;
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace PhysX
|
||||
: public AZ::Component
|
||||
, public Physics::EditorWorldBus::Handler
|
||||
, private AzToolsFramework::EditorEntityContextNotificationBus::Handler
|
||||
, private AzToolsFramework::EditorEvents::Bus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(EditorSystemComponent, "{560F08DC-94F5-4D29-9AD4-CDFB3B57C654}");
|
||||
@@ -60,6 +61,10 @@ namespace PhysX
|
||||
void OnStartPlayInEditorBegin() override;
|
||||
void OnStopPlayInEditor() override;
|
||||
|
||||
// AztoolsFramework::EditorEvents::Bus::Handler
|
||||
void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override;
|
||||
void NotifyRegisterViews() override;
|
||||
|
||||
AZ::Data::AssetId GenerateSurfaceTypesLibrary();
|
||||
|
||||
AzPhysics::SceneHandle m_editorWorldSceneHandle = AzPhysics::InvalidSceneHandle;
|
||||
|
||||
@@ -330,10 +330,8 @@ namespace PhysX
|
||||
}
|
||||
|
||||
const bool hasNonUniformScale = (AZ::NonUniformScaleRequestBus::FindFirstHandler(GetEntityId()) != nullptr);
|
||||
// the value for the subdivision level doesn't matter in the runtime, because any approximation of primitives will already have
|
||||
// happened in the editor, so can pass an arbitrary value here
|
||||
AZ::u8 subdivisionLevel = 0;
|
||||
Utils::GetShapesFromAsset(physicsAssetConfiguration, componentColliderConfiguration, hasNonUniformScale, subdivisionLevel, m_shapes);
|
||||
Utils::GetShapesFromAsset(physicsAssetConfiguration, componentColliderConfiguration, hasNonUniformScale,
|
||||
physicsAssetConfiguration.m_subdivisionLevel, m_shapes);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -391,6 +391,8 @@ namespace PhysX
|
||||
Physics::WorldBodyRequestBus::Handler::BusDisconnect();
|
||||
m_colliderDebugDraw.Disconnect();
|
||||
AZ::Data::AssetBus::MultiHandler::BusDisconnect();
|
||||
m_nonUniformScaleChangedHandler.Disconnect();
|
||||
EditorColliderComponentRequestBus::Handler::BusDisconnect();
|
||||
AZ::Render::MeshComponentNotificationBus::Handler::BusDisconnect();
|
||||
LmbrCentral::MeshComponentNotificationBus::Handler::BusDisconnect();
|
||||
ColliderShapeRequestBus::Handler::BusDisconnect();
|
||||
@@ -514,6 +516,8 @@ namespace PhysX
|
||||
break;
|
||||
case Physics::ShapeType::PhysicsAsset:
|
||||
colliderComponent = gameEntity->CreateComponent<MeshColliderComponent>();
|
||||
|
||||
m_shapeConfiguration.m_physicsAsset.m_configuration.m_subdivisionLevel = m_shapeConfiguration.m_subdivisionLevel;
|
||||
colliderComponent->SetShapeConfigurationList({ AZStd::make_pair(sharedColliderConfig,
|
||||
AZStd::make_shared<Physics::PhysicsAssetShapeConfiguration>(m_shapeConfiguration.m_physicsAsset.m_configuration)) });
|
||||
|
||||
@@ -561,6 +565,8 @@ namespace PhysX
|
||||
|
||||
void EditorColliderComponent::CreateStaticEditorCollider()
|
||||
{
|
||||
m_cachedAabbDirty = true;
|
||||
|
||||
// Don't create static rigid body in the editor if current entity components
|
||||
// don't allow creation of runtime static rigid body component
|
||||
if (!StaticRigidBodyUtils::CanCreateRuntimeComponent(*GetEntity()))
|
||||
@@ -1014,11 +1020,17 @@ namespace PhysX
|
||||
// PhysX::ColliderShapeBus
|
||||
AZ::Aabb EditorColliderComponent::GetColliderShapeAabb()
|
||||
{
|
||||
return PhysX::Utils::GetColliderAabb(GetWorldTM()
|
||||
, m_hasNonUniformScale
|
||||
, m_shapeConfiguration.m_subdivisionLevel
|
||||
, m_shapeConfiguration.GetCurrent()
|
||||
, m_configuration);
|
||||
if (m_cachedAabbDirty)
|
||||
{
|
||||
m_cachedAabb = PhysX::Utils::GetColliderAabb(GetWorldTM()
|
||||
, m_hasNonUniformScale
|
||||
, m_shapeConfiguration.m_subdivisionLevel
|
||||
, m_shapeConfiguration.GetCurrent()
|
||||
, m_configuration);
|
||||
m_cachedAabbDirty = false;
|
||||
}
|
||||
|
||||
return m_cachedAabb;
|
||||
}
|
||||
|
||||
void EditorColliderComponent::UpdateShapeConfigurationScale()
|
||||
|
||||
@@ -261,6 +261,8 @@ namespace PhysX
|
||||
bool m_hasNonUniformScale = false; //!< Whether there is a non-uniform scale component on this entity.
|
||||
AZ::Vector3 m_cachedNonUniformScale = AZ::Vector3::CreateOne(); //!< Caches the current non-uniform scale.
|
||||
mutable AZStd::optional<Physics::CookedMeshShapeConfiguration> m_scaledPrimitive; //!< Approximation for non-uniformly scaled primitive.
|
||||
AZ::Aabb m_cachedAabb = AZ::Aabb::CreateNull(); //!< Cache the Aabb to avoid recalculating it.
|
||||
bool m_cachedAabbDirty = true; //!< Track whether the cached Aabb needs to be recomputed.
|
||||
|
||||
AZ::ComponentDescriptor::StringWarningArray m_componentWarnings;
|
||||
};
|
||||
|
||||
@@ -277,6 +277,7 @@ namespace PhysX
|
||||
force.Deactivate();
|
||||
}
|
||||
|
||||
m_nonUniformScaleChangedHandler.Disconnect();
|
||||
AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect();
|
||||
EditorComponentBase::Deactivate();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace PhysX
|
||||
|
||||
const bool hasNonUniformScaleComponent = (AZ::NonUniformScaleRequestBus::FindFirstHandler(entity->GetId()) != nullptr);
|
||||
|
||||
const AZStd::vector<EditorColliderComponent*> colliders = entity->FindComponents<EditorColliderComponent>();
|
||||
const AZStd::vector<EditorColliderComponent*> colliders = entity->FindComponents<EditorColliderComponent>();
|
||||
for (const EditorColliderComponent* collider : colliders)
|
||||
{
|
||||
const EditorProxyShapeConfig& shapeConfigurationProxy = collider->GetShapeConfiguration();
|
||||
@@ -45,12 +45,14 @@ namespace PhysX
|
||||
continue;
|
||||
}
|
||||
|
||||
const Physics::ColliderConfiguration colliderConfiguration = collider->GetColliderConfigurationScaled();
|
||||
const Physics::ColliderConfiguration colliderConfigurationScaled = collider->GetColliderConfigurationScaled();
|
||||
const Physics::ColliderConfiguration colliderConfigurationUnscaled = collider->GetColliderConfiguration();
|
||||
|
||||
if (shapeConfigurationProxy.IsAssetConfig())
|
||||
{
|
||||
AZStd::vector<AZStd::shared_ptr<Physics::Shape>> shapes;
|
||||
Utils::GetShapesFromAsset(shapeConfigurationProxy.m_physicsAsset.m_configuration,
|
||||
colliderConfiguration, hasNonUniformScaleComponent, shapeConfigurationProxy.m_subdivisionLevel, shapes);
|
||||
colliderConfigurationUnscaled, hasNonUniformScaleComponent, shapeConfigurationProxy.m_subdivisionLevel, shapes);
|
||||
|
||||
for (const auto& shape : shapes)
|
||||
{
|
||||
@@ -64,7 +66,7 @@ namespace PhysX
|
||||
if (!hasNonUniformScaleComponent)
|
||||
{
|
||||
AZStd::shared_ptr<Physics::Shape> shape = AZ::Interface<Physics::System>::Get()->CreateShape(
|
||||
colliderConfiguration, shapeConfiguration);
|
||||
colliderConfigurationScaled, shapeConfiguration);
|
||||
AZ_Assert(shape, "CreateEditorWorldRigidBody: Shape must not be null!");
|
||||
if (shape)
|
||||
{
|
||||
@@ -73,7 +75,6 @@ namespace PhysX
|
||||
}
|
||||
else
|
||||
{
|
||||
const Physics::ColliderConfiguration colliderConfigurationUnscaled = collider->GetColliderConfiguration();
|
||||
auto convexConfig = Utils::CreateConvexFromPrimitive(colliderConfigurationUnscaled, shapeConfiguration,
|
||||
shapeConfigurationProxy.m_subdivisionLevel, shapeConfiguration.m_scale);
|
||||
auto colliderConfigurationNoOffset = colliderConfigurationUnscaled;
|
||||
@@ -272,6 +273,7 @@ namespace PhysX
|
||||
m_debugDisplayDataChangeHandler.Disconnect();
|
||||
|
||||
Physics::WorldBodyRequestBus::Handler::BusDisconnect();
|
||||
m_nonUniformScaleChangedHandler.Disconnect();
|
||||
m_sceneStartSimHandler.Disconnect();
|
||||
Physics::ColliderComponentEventBus::Handler::BusDisconnect();
|
||||
AZ::TransformNotificationBus::Handler::BusDisconnect();
|
||||
@@ -377,7 +379,7 @@ namespace PhysX
|
||||
configuration.m_kinematic = m_config.m_kinematic;
|
||||
configuration.m_colliderAndShapeData = Internal::GetCollisionShapes(GetEntity());
|
||||
|
||||
if (auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get())
|
||||
if (auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get())
|
||||
{
|
||||
m_rigidBodyHandle = sceneInterface->AddSimulatedBody(m_editorSceneHandle, &configuration);
|
||||
m_editorBody = azdynamic_cast<AzPhysics::RigidBody*>(sceneInterface->GetSimulatedBodyFromHandle(m_editorSceneHandle, m_rigidBodyHandle));
|
||||
|
||||
@@ -666,6 +666,7 @@ namespace PhysX
|
||||
Physics::WorldBodyRequestBus::Handler::BusDisconnect();
|
||||
m_colliderDebugDraw.Disconnect();
|
||||
|
||||
m_nonUniformScaleChangedHandler.Disconnect();
|
||||
PhysX::ColliderShapeRequestBus::Handler::BusDisconnect();
|
||||
LmbrCentral::ShapeComponentNotificationsBus::Handler::BusDisconnect();
|
||||
AZ::TransformNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
@@ -15,38 +15,18 @@
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <AzFramework/Physics/Utils.h>
|
||||
#include <AzFramework/Physics/Material.h>
|
||||
#include <AzFramework/Physics/Common/PhysicsSimulatedBody.h>
|
||||
#include <AzFramework/Physics/Configuration/RigidBodyConfiguration.h>
|
||||
#include <AzFramework/Physics/Configuration/StaticRigidBodyConfiguration.h>
|
||||
#include <AzFramework/Asset/AssetSystemBus.h>
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <PhysX/MeshAsset.h>
|
||||
#include <PhysX/HeightFieldAsset.h>
|
||||
#include <Source/RigidBody.h>
|
||||
#include <Source/RigidBodyStatic.h>
|
||||
#include <Source/Utils.h>
|
||||
#include <Source/Collision.h>
|
||||
#include <Source/Shape.h>
|
||||
#include <Source/Joint.h>
|
||||
#include <Source/SphereColliderComponent.h>
|
||||
#include <Source/BoxColliderComponent.h>
|
||||
#include <Source/CapsuleColliderComponent.h>
|
||||
#include <Source/Pipeline/MeshAssetHandler.h>
|
||||
#include <Source/Pipeline/HeightFieldAssetHandler.h>
|
||||
#include <Source/PhysXCharacters/API/CharacterUtils.h>
|
||||
#include <Source/PhysXCharacters/API/CharacterController.h>
|
||||
#include <Source/WindProvider.h>
|
||||
|
||||
#ifdef PHYSX_EDITOR
|
||||
#include <Source/EditorColliderComponent.h>
|
||||
#include <Editor/EditorWindow.h>
|
||||
#include <Editor/PropertyTypes.h>
|
||||
#include <AzToolsFramework/SourceControl/SourceControlAPI.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
|
||||
#endif
|
||||
|
||||
#include <PhysX/Debug/PhysXDebugInterface.h>
|
||||
#include <System/PhysXSystem.h>
|
||||
|
||||
@@ -233,21 +213,11 @@ namespace PhysX
|
||||
Physics::CollisionRequestBus::Handler::BusConnect();
|
||||
Physics::CharacterSystemRequestBus::Handler::BusConnect();
|
||||
|
||||
#ifdef PHYSX_EDITOR
|
||||
PhysX::Editor::RegisterPropertyTypes();
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
#endif
|
||||
|
||||
ActivatePhysXSystem();
|
||||
}
|
||||
|
||||
void SystemComponent::Deactivate()
|
||||
{
|
||||
#ifdef PHYSX_EDITOR
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
|
||||
#endif
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
Physics::CharacterSystemRequestBus::Handler::BusDisconnect();
|
||||
Physics::CollisionRequestBus::Handler::BusDisconnect();
|
||||
@@ -272,19 +242,6 @@ namespace PhysX
|
||||
m_assetHandlers.clear(); //this need to be after m_physXSystem->Shutdown(); For it will drop the default material library reference.
|
||||
}
|
||||
|
||||
#ifdef PHYSX_EDITOR
|
||||
|
||||
// AztoolsFramework::EditorEvents::Bus::Handler overrides
|
||||
void SystemComponent::PopulateEditorGlobalContextMenu([[maybe_unused]] QMenu* menu, [[maybe_unused]] const AZ::Vector2& point, [[maybe_unused]] int flags)
|
||||
{
|
||||
}
|
||||
|
||||
void SystemComponent::NotifyRegisterViews()
|
||||
{
|
||||
PhysX::Editor::EditorWindow::RegisterViewClass();
|
||||
}
|
||||
#endif
|
||||
|
||||
physx::PxConvexMesh* SystemComponent::CreateConvexMesh(const void* vertices, AZ::u32 vertexNum, AZ::u32 vertexStride)
|
||||
{
|
||||
physx::PxConvexMeshDesc desc;
|
||||
@@ -464,54 +421,6 @@ namespace PhysX
|
||||
}
|
||||
}
|
||||
|
||||
void SystemComponent::AddColliderComponentToEntity(AZ::Entity* entity, const Physics::ColliderConfiguration& colliderConfiguration, const Physics::ShapeConfiguration& shapeConfiguration, [[maybe_unused]] bool addEditorComponents)
|
||||
{
|
||||
[[maybe_unused]] Physics::ShapeType shapeType = shapeConfiguration.GetShapeType();
|
||||
|
||||
#ifdef PHYSX_EDITOR
|
||||
if (addEditorComponents)
|
||||
{
|
||||
entity->CreateComponent<EditorColliderComponent>(colliderConfiguration, shapeConfiguration);
|
||||
}
|
||||
else
|
||||
#else
|
||||
{
|
||||
if (shapeType == Physics::ShapeType::Sphere)
|
||||
{
|
||||
const Physics::SphereShapeConfiguration& sphereConfiguration = static_cast<const Physics::SphereShapeConfiguration&>(shapeConfiguration);
|
||||
auto sphereColliderComponent = entity->CreateComponent<SphereColliderComponent>();
|
||||
sphereColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(
|
||||
AZStd::make_shared<Physics::ColliderConfiguration>(colliderConfiguration),
|
||||
AZStd::make_shared<Physics::SphereShapeConfiguration>(sphereConfiguration)) });
|
||||
}
|
||||
else if (shapeType == Physics::ShapeType::Box)
|
||||
{
|
||||
const Physics::BoxShapeConfiguration& boxConfiguration = static_cast<const Physics::BoxShapeConfiguration&>(shapeConfiguration);
|
||||
auto boxColliderComponent = entity->CreateComponent<BoxColliderComponent>();
|
||||
boxColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(
|
||||
AZStd::make_shared<Physics::ColliderConfiguration>(colliderConfiguration),
|
||||
AZStd::make_shared<Physics::BoxShapeConfiguration>(boxConfiguration)) });
|
||||
}
|
||||
else if (shapeType == Physics::ShapeType::Capsule)
|
||||
{
|
||||
const Physics::CapsuleShapeConfiguration& capsuleConfiguration = static_cast<const Physics::CapsuleShapeConfiguration&>(shapeConfiguration);
|
||||
auto capsuleColliderComponent = entity->CreateComponent<CapsuleColliderComponent>();
|
||||
capsuleColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(
|
||||
AZStd::make_shared<Physics::ColliderConfiguration>(colliderConfiguration),
|
||||
AZStd::make_shared<Physics::CapsuleShapeConfiguration>(capsuleConfiguration)) });
|
||||
}
|
||||
}
|
||||
|
||||
AZ_Error("PhysX System", !addEditorComponents, "AddColliderComponentToEntity(): Trying to add an Editor collider component in a stand alone build.",
|
||||
static_cast<AZ::u8>(shapeType));
|
||||
|
||||
#endif
|
||||
{
|
||||
AZ_Error("PhysX System", shapeType == Physics::ShapeType::Sphere || shapeType == Physics::ShapeType::Box || shapeType == Physics::ShapeType::Capsule,
|
||||
"AddColliderComponentToEntity(): Using Shape of type %d is not implemented.", static_cast<AZ::u8>(shapeType));
|
||||
}
|
||||
}
|
||||
|
||||
// Physics::CharacterSystemRequestBus
|
||||
AZStd::unique_ptr<Physics::Character> SystemComponent::CreateCharacter(const Physics::CharacterConfiguration&
|
||||
characterConfig, const Physics::ShapeConfiguration& shapeConfig, AzPhysics::SceneHandle& sceneHandle)
|
||||
|
||||
@@ -36,9 +36,6 @@
|
||||
#include <DefaultWorldComponent.h>
|
||||
#include <Material.h>
|
||||
|
||||
#ifdef PHYSX_EDITOR
|
||||
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
|
||||
#endif
|
||||
namespace AzPhysics
|
||||
{
|
||||
struct StaticRigidBodyConfiguration;
|
||||
@@ -61,10 +58,6 @@ namespace PhysX
|
||||
, public Physics::SystemRequestBus::Handler
|
||||
, public PhysX::SystemRequestsBus::Handler
|
||||
, public Physics::CharacterSystemRequestBus::Handler
|
||||
#ifdef PHYSX_EDITOR
|
||||
, public AzToolsFramework::EditorEntityContextNotificationBus::Handler
|
||||
, private AzToolsFramework::EditorEvents::Bus::Handler
|
||||
#endif
|
||||
, private Physics::CollisionRequestBus::Handler
|
||||
, private AZ::TickBus::Handler
|
||||
{
|
||||
@@ -100,8 +93,6 @@ namespace PhysX
|
||||
bool CookTriangleMeshToMemory(const AZ::Vector3* vertices, AZ::u32 vertexCount,
|
||||
const AZ::u32* indices, AZ::u32 indexCount, AZStd::vector<AZ::u8>& result) override;
|
||||
|
||||
void AddColliderComponentToEntity(AZ::Entity* entity, const Physics::ColliderConfiguration& colliderConfiguration, const Physics::ShapeConfiguration& shapeConfiguration, bool addEditorComponents = false) override;
|
||||
|
||||
physx::PxFilterData CreateFilterData(const AzPhysics::CollisionLayer& layer, const AzPhysics::CollisionGroup& group) override;
|
||||
physx::PxCooking* GetCooking() override;
|
||||
|
||||
@@ -125,13 +116,6 @@ namespace PhysX
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
|
||||
#ifdef PHYSX_EDITOR
|
||||
|
||||
// AztoolsFramework::EditorEvents::Bus::Handler overrides
|
||||
void PopulateEditorGlobalContextMenu(QMenu* menu, const AZ::Vector2& point, int flags) override;
|
||||
void NotifyRegisterViews() override;
|
||||
#endif
|
||||
|
||||
// Physics::SystemRequestBus::Handler
|
||||
AZStd::shared_ptr<Physics::Shape> CreateShape(const Physics::ColliderConfiguration& colliderConfiguration, const Physics::ShapeConfiguration& configuration) override;
|
||||
AZStd::shared_ptr<Physics::Material> CreateMaterial(const Physics::MaterialConfiguration& materialConfiguration) override;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <AzFramework/Components/TransformComponent.h>
|
||||
#include <PhysX/ComponentTypeIds.h>
|
||||
#include <PhysX/SystemComponentBus.h>
|
||||
#include <Source/SphereColliderComponent.h>
|
||||
#include <Source/CapsuleColliderComponent.h>
|
||||
#include <System/PhysXSystem.h>
|
||||
#include <Tests/PhysXTestFixtures.h>
|
||||
#include <Tests/PhysXTestUtil.h>
|
||||
@@ -31,6 +33,51 @@
|
||||
|
||||
namespace PhysX
|
||||
{
|
||||
namespace Internal
|
||||
{
|
||||
void AddColliderComponentToEntity(AZ::Entity* entity, const Physics::ColliderConfiguration& colliderConfiguration, const Physics::ShapeConfiguration& shapeConfiguration)
|
||||
{
|
||||
Physics::ShapeType shapeType = shapeConfiguration.GetShapeType();
|
||||
|
||||
switch (shapeType)
|
||||
{
|
||||
case Physics::ShapeType::Sphere:
|
||||
{
|
||||
const Physics::SphereShapeConfiguration& sphereConfiguration = static_cast<const Physics::SphereShapeConfiguration&>(shapeConfiguration);
|
||||
auto sphereColliderComponent = entity->CreateComponent<SphereColliderComponent>();
|
||||
sphereColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(
|
||||
AZStd::make_shared<Physics::ColliderConfiguration>(colliderConfiguration),
|
||||
AZStd::make_shared<Physics::SphereShapeConfiguration>(sphereConfiguration)) });
|
||||
}
|
||||
break;
|
||||
case Physics::ShapeType::Box:
|
||||
{
|
||||
const Physics::BoxShapeConfiguration& boxConfiguration = static_cast<const Physics::BoxShapeConfiguration&>(shapeConfiguration);
|
||||
auto boxColliderComponent = entity->CreateComponent<BoxColliderComponent>();
|
||||
boxColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(
|
||||
AZStd::make_shared<Physics::ColliderConfiguration>(colliderConfiguration),
|
||||
AZStd::make_shared<Physics::BoxShapeConfiguration>(boxConfiguration)) });
|
||||
}
|
||||
break;
|
||||
case Physics::ShapeType::Capsule:
|
||||
{
|
||||
const Physics::CapsuleShapeConfiguration& capsuleConfiguration = static_cast<const Physics::CapsuleShapeConfiguration&>(shapeConfiguration);
|
||||
auto capsuleColliderComponent = entity->CreateComponent<CapsuleColliderComponent>();
|
||||
capsuleColliderComponent->SetShapeConfigurationList({ AZStd::make_pair(
|
||||
AZStd::make_shared<Physics::ColliderConfiguration>(colliderConfiguration),
|
||||
AZStd::make_shared<Physics::CapsuleShapeConfiguration>(capsuleConfiguration)) });
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
AZ_Error("PhysX", false,
|
||||
"AddColliderComponentToEntity(): Using Shape of type %d is not implemented.", static_cast<AZ::u8>(shapeType));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// transform for a floor centred at x = 0, y = 0, with top at level z = 0
|
||||
static const AZ::Transform DefaultFloorTransform = AZ::Transform::CreateTranslation(AZ::Vector3::CreateAxisZ(-0.5f));
|
||||
|
||||
@@ -367,8 +414,7 @@ namespace PhysX
|
||||
auto triggerEntity = AZStd::make_unique<AZ::Entity>("TriggerEntity");
|
||||
triggerEntity->CreateComponent<AzFramework::TransformComponent>()->SetWorldTM(AZ::Transform::Identity());
|
||||
triggerEntity->CreateComponent(PhysX::StaticRigidBodyComponentTypeId);
|
||||
Physics::SystemRequestBus::Broadcast(&Physics::SystemRequests::AddColliderComponentToEntity,
|
||||
triggerEntity.get(), triggerConfig, boxConfig, false);
|
||||
Internal::AddColliderComponentToEntity(triggerEntity.get(), triggerConfig, boxConfig);
|
||||
triggerEntity->Init();
|
||||
triggerEntity->Activate();
|
||||
|
||||
|
||||
@@ -11,6 +11,4 @@
|
||||
|
||||
set(FILES
|
||||
Source/Module.cpp
|
||||
Source/SystemComponent.cpp
|
||||
Source/SystemComponent.h
|
||||
)
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
set(FILES
|
||||
Source/Module.cpp
|
||||
Source/SystemComponent.cpp
|
||||
Source/SystemComponent.h
|
||||
Tests/PhysXTestCommon.cpp
|
||||
Tests/PhysXTestCommon.h
|
||||
Tests/ColliderScalingTests.cpp
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
set(FILES
|
||||
Source/PhysX_precompiled.cpp
|
||||
Source/PhysX_precompiled.h
|
||||
Source/SystemComponent.cpp
|
||||
Source/SystemComponent.h
|
||||
Include/PhysX/SystemComponentBus.h
|
||||
Include/PhysX/ColliderComponentBus.h
|
||||
Include/PhysX/NativeTypeIdentifiers.h
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
set(FILES
|
||||
Source/Module.cpp
|
||||
Source/SystemComponent.cpp
|
||||
Source/SystemComponent.h
|
||||
Source/ComponentDescriptors.cpp
|
||||
Source/ComponentDescriptors.h
|
||||
)
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#
|
||||
|
||||
set(FILES
|
||||
Source/SystemComponent.cpp
|
||||
Source/SystemComponent.h
|
||||
Source/ComponentDescriptors.cpp
|
||||
Source/ComponentDescriptors.h
|
||||
Tests/PhysXComponentBusTests.cpp
|
||||
|
||||
@@ -102,6 +102,9 @@ namespace WhiteBox
|
||||
//! Alias for a collection of faces.
|
||||
using Faces = AZStd::vector<Face>;
|
||||
|
||||
//! Underlying representation of the White Box mesh (serialized halfedge data).
|
||||
using WhiteBoxMeshStream = AZStd::vector<AZ::u8>;
|
||||
|
||||
//! Represents the vertex handles to be used to form a new face.
|
||||
struct FaceVertHandles
|
||||
{
|
||||
@@ -726,19 +729,33 @@ namespace WhiteBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Serialization
|
||||
|
||||
//! The result of attempting to deserialize a white box mesh from a white box mesh stream.
|
||||
enum class ReadResult
|
||||
{
|
||||
Full, //!< The white box mesh stream was full and was read into white box mesh (it is now initialized).
|
||||
Empty, //!< The white box mesh stream was empty so no white box mesh was loaded.
|
||||
Error //!< An error occurred while trying to deserialize white box mesh stream.
|
||||
};
|
||||
|
||||
//! Take an input stream of bytes and create a white box mesh from the deserialized data.
|
||||
//! @return Will return false if any error was encountered during deserialization, true otherwise.
|
||||
//! @return Will return ReadResult::Full if the white box mesh stream was filled with data and
|
||||
//! the white box mesh was initialized, ReadResult::Empty if white box mesh stream did not contain
|
||||
//! any data (white box mesh will be left empty) or ReadResult::Error if any error was encountered
|
||||
//! during deserialization.
|
||||
//! @note A white box mesh must have been created first.
|
||||
bool ReadMesh(WhiteBoxMesh& whiteBox, const AZStd::vector<AZ::u8>& input);
|
||||
ReadResult ReadMesh(WhiteBoxMesh& whiteBox, const WhiteBoxMeshStream& input);
|
||||
|
||||
//! Take an input stream and create a white box mesh from the deserialized data.
|
||||
//! @return Will return false if any error was encountered during deserialization, true otherwise.
|
||||
//! @return Will return ReadResult::Full if the white box mesh stream was filled with data and
|
||||
//! the white box mesh was initialized, ReadResult::Empty if white box mesh stream did not contain
|
||||
//! any data (white box mesh will be left empty) or ReadResult::Error if any error was encountered
|
||||
//! during deserialization.
|
||||
//! @note The input stream must not skip white space characters (std::noskipws must be set on the stream).
|
||||
bool ReadMesh(WhiteBoxMesh& whiteBox, std::istream& input);
|
||||
ReadResult ReadMesh(WhiteBoxMesh& whiteBox, std::istream& input);
|
||||
|
||||
//! Take a white box mesh and write it out to a stream of bytes.
|
||||
//! @return Will return false if any error was encountered during serialization, true otherwise.
|
||||
bool WriteMesh(const WhiteBoxMesh& whiteBox, AZStd::vector<AZ::u8>& output);
|
||||
bool WriteMesh(const WhiteBoxMesh& whiteBox, WhiteBoxMeshStream& output);
|
||||
|
||||
//! Clones the white box mesh object into a new mesh.
|
||||
//! @return Will return null if any error was encountered during serialization, otherwise the cloned mesh.
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace WhiteBox
|
||||
{
|
||||
success = assetHandler->SaveAssetData(meshAsset, &fileStream);
|
||||
AZ_Printf(
|
||||
"EditorWhiteBoxComponent", "Save %s. Location: %s", success ? "succeeded" : "failed",
|
||||
"EditorWhiteBoxMeshAsset", "Save %s. Location: %s", success ? "succeeded" : "failed",
|
||||
absoluteFilePath.c_str());
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,15 @@ namespace WhiteBox
|
||||
{
|
||||
if (asset == m_meshAsset)
|
||||
{
|
||||
AZ_Warning("EditorWhiteBoxComponent", false, "OnAssetError: %s", asset.GetHint().c_str());
|
||||
AZ_Warning("EditorWhiteBoxMeshAsset", false, "OnAssetError: %s", asset.GetHint().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void EditorWhiteBoxMeshAsset::OnAssetReloadError(AZ::Data::Asset<AZ::Data::AssetData> asset)
|
||||
{
|
||||
if (asset == m_meshAsset)
|
||||
{
|
||||
AZ_Warning("EditorWhiteBoxMeshAsset", false, "OnAssetReloadError: %s", asset.GetHint().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ namespace WhiteBox
|
||||
void OnAssetReady(AZ::Data::Asset<AZ::Data::AssetData> asset) override;
|
||||
void OnAssetReloaded(AZ::Data::Asset<AZ::Data::AssetData> asset) override;
|
||||
void OnAssetError(AZ::Data::Asset<AZ::Data::AssetData> asset) override;
|
||||
void OnAssetReloadError(AZ::Data::Asset<AZ::Data::AssetData> asset) override;
|
||||
|
||||
// WhiteBoxMeshAssetNotificationBus ...
|
||||
void OnWhiteBoxMeshAssetModified(AZ::Data::Asset<AZ::Data::AssetData> asset) override;
|
||||
|
||||
@@ -51,12 +51,12 @@ namespace WhiteBox
|
||||
return AZStd::move(m_mesh);
|
||||
}
|
||||
|
||||
void SetWhiteBoxData(AZStd::vector<AZ::u8> whiteBoxData)
|
||||
void SetWhiteBoxData(Api::WhiteBoxMeshStream whiteBoxData)
|
||||
{
|
||||
m_whiteBoxData = AZStd::move(whiteBoxData);
|
||||
}
|
||||
|
||||
const AZStd::vector<AZ::u8>& GetWhiteBoxData() const
|
||||
const Api::WhiteBoxMeshStream& GetWhiteBoxData() const
|
||||
{
|
||||
return m_whiteBoxData;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace WhiteBox
|
||||
}
|
||||
|
||||
Api::WhiteBoxMeshPtr m_mesh;
|
||||
AZStd::vector<AZ::u8> m_whiteBoxData; //! Data used for creating undo commands.
|
||||
Api::WhiteBoxMeshStream m_whiteBoxData; //! Data used for creating undo commands.
|
||||
};
|
||||
} // namespace Pipeline
|
||||
} // namespace WhiteBox
|
||||
|
||||
@@ -112,16 +112,21 @@ namespace WhiteBox
|
||||
|
||||
const auto size = stream->GetLength();
|
||||
|
||||
AZStd::vector<AZ::u8> whiteBoxData(size);
|
||||
Api::WhiteBoxMeshStream whiteBoxData;
|
||||
whiteBoxData.resize(size);
|
||||
|
||||
stream->Read(size, whiteBoxData.data());
|
||||
|
||||
auto whiteBoxMesh = WhiteBox::Api::CreateWhiteBoxMesh();
|
||||
const bool success = WhiteBox::Api::ReadMesh(*whiteBoxMesh, whiteBoxData);
|
||||
const auto result = WhiteBox::Api::ReadMesh(*whiteBoxMesh, whiteBoxData);
|
||||
|
||||
// if result is not 'Full', then whiteBoxMeshAsset could be empty which is most likely an error
|
||||
// as no data was loaded from the asset, or it was not correctly read in stream->Read(..)
|
||||
const auto success = result == Api::ReadResult::Full;
|
||||
if (success)
|
||||
{
|
||||
whiteBoxMeshAsset->SetMesh(AZStd::move(whiteBoxMesh));
|
||||
whiteBoxMeshAsset->SetWhiteBoxData(whiteBoxData);
|
||||
whiteBoxMeshAsset->SetWhiteBoxData(AZStd::move(whiteBoxData));
|
||||
}
|
||||
|
||||
return success ? AZ::Data::AssetHandler::LoadResult::LoadComplete
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace WhiteBox
|
||||
m_asset = asset;
|
||||
}
|
||||
|
||||
void WhiteBoxMeshAssetUndoCommand::SetUndoState(const AZStd::vector<AZ::u8>& undoState)
|
||||
void WhiteBoxMeshAssetUndoCommand::SetUndoState(const Api::WhiteBoxMeshStream& undoState)
|
||||
{
|
||||
m_undoState = undoState;
|
||||
}
|
||||
|
||||
void WhiteBoxMeshAssetUndoCommand::SetRedoState(const AZStd::vector<AZ::u8>& redoState)
|
||||
void WhiteBoxMeshAssetUndoCommand::SetRedoState(const Api::WhiteBoxMeshStream& redoState)
|
||||
{
|
||||
m_redoState = redoState;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace WhiteBox
|
||||
~WhiteBoxMeshAssetUndoCommand() override = default;
|
||||
|
||||
void SetAsset(AZ::Data::Asset<Pipeline::WhiteBoxMeshAsset> asset);
|
||||
void SetUndoState(const AZStd::vector<AZ::u8>& undoState);
|
||||
void SetRedoState(const AZStd::vector<AZ::u8>& redoState);
|
||||
void SetUndoState(const Api::WhiteBoxMeshStream& undoState);
|
||||
void SetRedoState(const Api::WhiteBoxMeshStream& redoState);
|
||||
|
||||
// AzToolsFramework::UndoSystem::URSequencePoint ...
|
||||
void Undo() override;
|
||||
@@ -44,7 +44,7 @@ namespace WhiteBox
|
||||
|
||||
protected:
|
||||
AZ::Data::Asset<Pipeline::WhiteBoxMeshAsset> m_asset;
|
||||
AZStd::vector<AZ::u8> m_undoState;
|
||||
AZStd::vector<AZ::u8> m_redoState;
|
||||
Api::WhiteBoxMeshStream m_undoState;
|
||||
Api::WhiteBoxMeshStream m_redoState;
|
||||
};
|
||||
} // namespace WhiteBox
|
||||
|
||||
@@ -3379,7 +3379,7 @@ namespace WhiteBox
|
||||
CalculatePlanarUVs(whiteBox);
|
||||
}
|
||||
|
||||
bool WriteMesh(const WhiteBoxMesh& whiteBox, AZStd::vector<AZ::u8>& output)
|
||||
bool WriteMesh(const WhiteBoxMesh& whiteBox, WhiteBoxMeshStream& output)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
@@ -3403,10 +3403,15 @@ namespace WhiteBox
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReadMesh(WhiteBoxMesh& whiteBox, const AZStd::vector<AZ::u8>& input)
|
||||
ReadResult ReadMesh(WhiteBoxMesh& whiteBox, const WhiteBoxMeshStream& input)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
if (input.empty())
|
||||
{
|
||||
return ReadResult::Empty;
|
||||
}
|
||||
|
||||
std::string inputStr;
|
||||
inputStr.reserve(input.size());
|
||||
AZStd::copy(input.cbegin(), input.cend(), AZStd::back_inserter(inputStr));
|
||||
@@ -3418,33 +3423,33 @@ namespace WhiteBox
|
||||
return ReadMesh(whiteBox, whiteBoxStream);
|
||||
}
|
||||
|
||||
bool ReadMesh(WhiteBoxMesh& whiteBox, std::istream& input)
|
||||
ReadResult ReadMesh(WhiteBoxMesh& whiteBox, std::istream& input)
|
||||
{
|
||||
const auto skipws = input.flags() & std::ios_base::skipws;
|
||||
AZ_Assert(skipws == 0, "Input stream must not skip white space characters");
|
||||
|
||||
if (skipws != 0)
|
||||
{
|
||||
return false;
|
||||
return ReadResult::Error;
|
||||
}
|
||||
|
||||
AZStd::lock_guard lg(g_omSerializationLock);
|
||||
OpenMesh::IO::Options options{OpenMesh::IO::Options::FaceTexCoord | OpenMesh::IO::Options::FaceNormal};
|
||||
return OpenMesh::IO::read_mesh(whiteBox.mesh, input, ".om", options);
|
||||
return OpenMesh::IO::read_mesh(whiteBox.mesh, input, ".om", options) ? ReadResult::Full : ReadResult::Error;
|
||||
}
|
||||
|
||||
WhiteBoxMeshPtr CloneMesh(const WhiteBoxMesh& whiteBox)
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
AZStd::vector<AZ::u8> clonedData;
|
||||
WhiteBoxMeshStream clonedData;
|
||||
if (!WriteMesh(whiteBox, clonedData))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WhiteBoxMeshPtr newMesh = CreateWhiteBoxMesh();
|
||||
if (!ReadMesh(*newMesh, clonedData))
|
||||
if (ReadMesh(*newMesh, clonedData) != ReadResult::Full)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3461,7 +3466,7 @@ namespace WhiteBox
|
||||
|
||||
bool SaveToWbm(const WhiteBoxMesh& whiteBox, AZ::IO::GenericStream& stream)
|
||||
{
|
||||
AZStd::vector<AZ::u8> buffer;
|
||||
WhiteBoxMeshStream buffer;
|
||||
const bool success = WhiteBox::Api::WriteMesh(whiteBox, buffer);
|
||||
|
||||
const auto bytesWritten = stream.Write(buffer.size(), buffer.data());
|
||||
|
||||
@@ -348,14 +348,14 @@ namespace WhiteBox
|
||||
else
|
||||
{
|
||||
// attempt to load the mesh
|
||||
if (Api::ReadMesh(*m_whiteBox, m_whiteBoxData))
|
||||
const auto result = Api::ReadMesh(*m_whiteBox, m_whiteBoxData);
|
||||
AZ_Error("EditorWhiteBoxComponent", result != WhiteBox::Api::ReadResult::Error, "Error deserializing white box mesh stream");
|
||||
|
||||
// if the read was successful but the byte stream is empty
|
||||
// (there was nothing to load), create a default mesh
|
||||
if (result == Api::ReadResult::Empty)
|
||||
{
|
||||
// if the read was successful but the byte stream is empty
|
||||
// (there was nothing to load), create a default mesh
|
||||
if (m_whiteBoxData.empty())
|
||||
{
|
||||
Api::InitializeAsUnitCube(*m_whiteBox);
|
||||
}
|
||||
Api::InitializeAsUnitCube(*m_whiteBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace WhiteBox
|
||||
AZStd::optional<AZStd::unique_ptr<RenderMeshInterface>>
|
||||
m_renderMesh; //!< The render mesh to use for the White Box mesh data.
|
||||
AZ::Transform m_worldFromLocal = AZ::Transform::CreateIdentity(); //!< Cached world transform of Entity.
|
||||
AZStd::vector<AZ::u8> m_whiteBoxData; //!< Serialized White Box mesh data.
|
||||
Api::WhiteBoxMeshStream m_whiteBoxData; //!< Serialized White Box mesh data.
|
||||
//! Holds a reference to an optional WhiteBoxMeshAsset and manages the lifecycle of adding/removing an asset.
|
||||
EditorWhiteBoxMeshAsset* m_editorMeshAsset = nullptr;
|
||||
AZStd::optional<AZ::Aabb> m_worldAabb; //!< Cached world aabb (used for selection/view determination).
|
||||
|
||||
@@ -470,6 +470,7 @@ namespace UnitTest
|
||||
TEST_F(WhiteBoxTestFixture, MeshNotDeserializedWithSkipWhiteSpaceStream)
|
||||
{
|
||||
namespace Api = WhiteBox::Api;
|
||||
using testing::Eq;
|
||||
|
||||
Api::InitializeAsUnitCube(*m_whiteBox);
|
||||
AZStd::vector<AZ::u8> serializedWhiteBox;
|
||||
@@ -485,7 +486,7 @@ namespace UnitTest
|
||||
// note: std::stringstream will default to skip white space characters
|
||||
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_FALSE(Api::ReadMesh(*m_whiteBox, whiteBoxStream));
|
||||
EXPECT_THAT(Api::ReadMesh(*m_whiteBox, whiteBoxStream), Eq(Api::ReadResult::Error));
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,4 +11,5 @@
|
||||
|
||||
set(GEM_DEPENDENCIES
|
||||
Gem::Atom_RHI_Metal.Private
|
||||
Gem::Atom_RHI_Null.Private
|
||||
)
|
||||
|
||||
@@ -14,4 +14,5 @@ set(GEM_DEPENDENCIES
|
||||
Gem::Atom_RHI_Metal.Builders
|
||||
Gem::Atom_RHI_Vulkan.Builders
|
||||
Gem::Atom_RHI_DX12.Builders
|
||||
Gem::Atom_RHI_Null.Builders
|
||||
)
|
||||
|
||||
+1
@@ -12,4 +12,5 @@
|
||||
set(GEM_DEPENDENCIES
|
||||
Gem::Atom_RHI_Vulkan.Private
|
||||
Gem::Atom_RHI_DX12.Private
|
||||
Gem::Atom_RHI_Null.Private
|
||||
)
|
||||
|
||||
+2
@@ -14,4 +14,6 @@ set(GEM_DEPENDENCIES
|
||||
Gem::Atom_RHI_Vulkan.Builders
|
||||
Gem::Atom_RHI_DX12.Private
|
||||
Gem::Atom_RHI_DX12.Builders
|
||||
Gem::Atom_RHI_Null.Private
|
||||
Gem::Atom_RHI_Null.Builders
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user