diff options
Diffstat (limited to 'sdk/extensions/serialization/source/DTO')
29 files changed, 1582 insertions, 978 deletions
diff --git a/sdk/extensions/serialization/source/DTO/AssetDTO.cpp b/sdk/extensions/serialization/source/DTO/AssetDTO.cpp index 8d035fc..b500fe6 100644 --- a/sdk/extensions/serialization/source/DTO/AssetDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/AssetDTO.cpp @@ -1,187 +1,202 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "AssetDTO.h" +#include "NvBlastGlobals.h" #include "NvBlastIDDTO.h" #include "NvBlastChunkDTO.h" #include "NvBlastBondDTO.h" #include "NvBlastAsset.h" -#include "NvBlastExtSerializationLLImpl.h" -#include "NvBlastExtGlobals.h" -#if !defined(BLAST_LL_ALLOC) -#include "NvBlastExtAllocator.h" -#endif namespace Nv { - namespace Blast +namespace Blast +{ + +bool AssetDTO::serialize(Nv::Blast::Serialization::Asset::Builder builder, const Nv::Blast::Asset * poco) +{ + NvBlastIDDTO::serialize(builder.initID(), &poco->m_ID); + + builder.setLeafChunkCount(poco->m_leafChunkCount); + + builder.setFirstSubsupportChunkIndex(poco->m_firstSubsupportChunkIndex); + + capnp::List<Nv::Blast::Serialization::NvBlastChunk>::Builder chunks = builder.initChunks(poco->m_chunkCount); + + builder.setChunkCount(poco->m_chunkCount); + + NVBLAST_ASSERT_WITH_MESSAGE(builder.getChunkCount() == poco->m_chunkCount, "WTF"); + + for (uint32_t i = 0; i < poco->m_chunkCount; i++) + { + NvBlastChunk& chunk = poco->getChunks()[i]; + + NvBlastChunkDTO::serialize(chunks[i], &chunk); + } + + NVBLAST_ASSERT_WITH_MESSAGE(builder.getChunkCount() == poco->m_chunkCount, "WTF"); + + capnp::List<Nv::Blast::Serialization::NvBlastBond>::Builder bonds = builder.initBonds(poco->m_bondCount); + + builder.setBondCount(poco->m_bondCount); + + for (uint32_t i = 0; i < poco->m_bondCount; i++) + { + NvBlastBond& bond = poco->getBonds()[i]; + + NvBlastBondDTO::serialize(bonds[i], &bond); + } + + kj::ArrayPtr<uint32_t> stlcArray(poco->getSubtreeLeafChunkCounts(), poco->m_chunkCount); + builder.initSubtreeLeafChunkCounts(poco->m_chunkCount); + builder.setSubtreeLeafChunkCounts(stlcArray); + + kj::ArrayPtr<uint32_t> ctgnArray(poco->getChunkToGraphNodeMap(), poco->m_chunkCount); + builder.setChunkToGraphNodeMap(ctgnArray); + + Nv::Blast::Serialization::NvBlastSupportGraph::Builder graphBulder = builder.initGraph(); + + graphBulder.setNodeCount(poco->m_graph.m_nodeCount); + + uint32_t* ciPtr = poco->m_graph.getChunkIndices(); + + kj::ArrayPtr<const uint32_t> ciArray(ciPtr, poco->m_graph.m_nodeCount); + graphBulder.setChunkIndices(ciArray); + + kj::ArrayPtr<const uint32_t> adjPart(poco->m_graph.getAdjacencyPartition(), poco->m_graph.m_nodeCount + 1); + graphBulder.setAdjacencyPartition(adjPart); + + NVBLAST_ASSERT(graphBulder.getAdjacencyPartition().size() == poco->m_graph.m_nodeCount + 1); + + kj::ArrayPtr<const uint32_t> nodeIndices(poco->m_graph.getAdjacentNodeIndices(), poco->m_bondCount * 2); + graphBulder.setAdjacentNodeIndices(nodeIndices); + + NVBLAST_ASSERT(graphBulder.getAdjacentNodeIndices().size() == poco->m_bondCount * 2); + + kj::ArrayPtr<const uint32_t> bondIndices(poco->m_graph.getAdjacentBondIndices(), poco->m_bondCount * 2); + graphBulder.setAdjacentBondIndices(bondIndices); + + return true; +} + + +Nv::Blast::Asset* AssetDTO::deserialize(Nv::Blast::Serialization::Asset::Reader reader) +{ + NvBlastID EmptyId; + memset(EmptyId.data, 0, sizeof(NvBlastID)); + + void* mem = NVBLAST_ALLOC(reader.totalSize().wordCount * sizeof(uint64_t)); + + auto asset = Nv::Blast::initializeAsset(mem, EmptyId, reader.getChunkCount(), reader.getGraph().getNodeCount(), reader.getLeafChunkCount(), reader.getFirstSubsupportChunkIndex(), reader.getBondCount(), logLL); + + bool result = deserializeInto(reader, asset); + + return result ? asset : nullptr; +} + + +bool AssetDTO::deserializeInto(Nv::Blast::Serialization::Asset::Reader reader, Nv::Blast::Asset * poco) +{ + NvBlastIDDTO::deserializeInto(reader.getID(), &poco->m_ID); + + NvBlastBond* bonds = poco->getBonds(); + + uint32_t bondCount = reader.getBondCount(); + auto readerBonds = reader.getBonds(); + for (uint32_t i = 0; i < bondCount; i++) + { + auto bondReader = readerBonds[i]; + + NvBlastBondDTO::deserializeInto(bondReader, &bonds[i]); + } + + NvBlastChunk* chunks = poco->getChunks(); + + uint32_t chunkCount = reader.getChunkCount(); + auto readerChunks = reader.getChunks(); + for (uint32_t i = 0; i < chunkCount; i++) + { + auto chunkReader = readerChunks[i]; + + NvBlastChunkDTO::deserializeInto(chunkReader, &chunks[i]); + } + + poco->m_graph.m_nodeCount = reader.getGraph().getNodeCount(); + + NVBLAST_ASSERT(reader.getSubtreeLeafChunkCounts().size() == poco->m_chunkCount); + auto readerSubtreeLeafChunkCounts = reader.getSubtreeLeafChunkCounts(); + for (uint32_t i = 0; i < poco->m_chunkCount; i++) { - bool AssetDTO::serialize(Nv::Blast::Serialization::Asset::Builder builder, const Nv::Blast::Asset * poco) - { - NvBlastIDDTO::serialize(builder.initID(), &poco->m_ID); - - builder.setLeafChunkCount(poco->m_leafChunkCount); - - builder.setFirstSubsupportChunkIndex(poco->m_firstSubsupportChunkIndex); - - capnp::List<Nv::Blast::Serialization::NvBlastChunk>::Builder chunks = builder.initChunks(poco->m_chunkCount); - - builder.setChunkCount(poco->m_chunkCount); - - NVBLAST_ASSERT_WITH_MESSAGE(builder.getChunkCount() == poco->m_chunkCount, "WTF"); - - for (uint32_t i = 0; i < poco->m_chunkCount; i++) - { - NvBlastChunk& chunk = poco->getChunks()[i]; - - NvBlastChunkDTO::serialize(chunks[i], &chunk); - } - - NVBLAST_ASSERT_WITH_MESSAGE(builder.getChunkCount() == poco->m_chunkCount, "WTF"); - - capnp::List<Nv::Blast::Serialization::NvBlastBond>::Builder bonds = builder.initBonds(poco->m_bondCount); - - builder.setBondCount(poco->m_bondCount); - - for (uint32_t i = 0; i < poco->m_bondCount; i++) - { - NvBlastBond& bond = poco->getBonds()[i]; - - NvBlastBondDTO::serialize(bonds[i], &bond); - } - - kj::ArrayPtr<uint32_t> stlcArray(poco->getSubtreeLeafChunkCounts(), poco->m_chunkCount); - builder.initSubtreeLeafChunkCounts(poco->m_chunkCount); - builder.setSubtreeLeafChunkCounts(stlcArray); - - kj::ArrayPtr<uint32_t> ctgnArray(poco->getChunkToGraphNodeMap(), poco->m_chunkCount); - builder.setChunkToGraphNodeMap(ctgnArray); - - Nv::Blast::Serialization::NvBlastSupportGraph::Builder graphBulder = builder.initGraph(); - - graphBulder.setNodeCount(poco->m_graph.m_nodeCount); - - uint32_t* ciPtr = poco->m_graph.getChunkIndices(); - - kj::ArrayPtr<const uint32_t> ciArray(ciPtr, poco->m_graph.m_nodeCount); - graphBulder.setChunkIndices(ciArray); - - kj::ArrayPtr<const uint32_t> adjPart(poco->m_graph.getAdjacencyPartition(), poco->m_graph.m_nodeCount + 1); - graphBulder.setAdjacencyPartition(adjPart); - - NVBLAST_ASSERT(graphBulder.getAdjacencyPartition().size() == poco->m_graph.m_nodeCount + 1); - - kj::ArrayPtr<const uint32_t> nodeIndices(poco->m_graph.getAdjacentNodeIndices(), poco->m_bondCount * 2); - graphBulder.setAdjacentNodeIndices(nodeIndices); - - NVBLAST_ASSERT(graphBulder.getAdjacentNodeIndices().size() == poco->m_bondCount * 2); - - kj::ArrayPtr<const uint32_t> bondIndices(poco->m_graph.getAdjacentBondIndices(), poco->m_bondCount * 2); - graphBulder.setAdjacentBondIndices(bondIndices); - - return true; - } - - Nv::Blast::Asset* AssetDTO::deserialize(Nv::Blast::Serialization::Asset::Reader reader) - { - NvBlastID EmptyId = {}; - - NvBlastExtAlloc allocFn = gAlloc; - NvBlastLog logFn = gLog; - -#if !defined(BLAST_LL_ALLOC) - allocFn = ExtAllocator::alignedAlloc16; - logFn = NvBlastTkFrameworkGet()->getLogFn(); -#endif - - void* mem = allocFn(reader.totalSize().wordCount * sizeof(uint64_t)); - - auto asset = Nv::Blast::initializeAsset(mem, EmptyId, reader.getChunkCount(), reader.getGraph().getNodeCount(), reader.getLeafChunkCount(), reader.getFirstSubsupportChunkIndex(), reader.getBondCount(), - logFn); - - bool result = deserializeInto(reader, asset); - - return result ? asset : nullptr; - } - - bool AssetDTO::deserializeInto(Nv::Blast::Serialization::Asset::Reader reader, Nv::Blast::Asset * poco) - { - NvBlastIDDTO::deserializeInto(reader.getID(), &poco->m_ID); - - NvBlastBond* bonds = poco->getBonds(); - - uint32_t bondCount = reader.getBondCount(); - for (uint32_t i = 0; i < bondCount; i++) - { - auto bondReader = reader.getBonds()[i]; - - NvBlastBondDTO::deserializeInto(bondReader, &bonds[i]); - } - - NvBlastChunk* chunks = poco->getChunks(); - - uint32_t chunkCount = reader.getChunkCount(); - for (uint32_t i = 0; i < chunkCount; i++) - { - auto chunkReader = reader.getChunks()[i]; - - NvBlastChunkDTO::deserializeInto(chunkReader, &chunks[i]); - } - - poco->m_graph.m_nodeCount = reader.getGraph().getNodeCount(); - - NVBLAST_ASSERT(reader.getSubtreeLeafChunkCounts().size() == poco->m_chunkCount); - for (uint32_t i = 0; i < poco->m_chunkCount; i++) - { - poco->getSubtreeLeafChunkCounts()[i] = reader.getSubtreeLeafChunkCounts()[i]; - } - - for (uint32_t i = 0; i < chunkCount; i++) - { - poco->getChunkToGraphNodeMap()[i] = reader.getChunkToGraphNodeMap()[i]; - } - - uint32_t* ciPtr = poco->m_graph.getChunkIndices(); - - NVBLAST_ASSERT(reader.getGraph().getChunkIndices().size() == poco->m_graph.m_nodeCount); - for (uint32_t i = 0; i < poco->m_graph.m_nodeCount; i++) - { - ciPtr[i] = reader.getGraph().getChunkIndices()[i]; - } - - uint32_t* adjPartition = poco->m_graph.getAdjacencyPartition(); - uint32_t idx = 0; - - for (uint32_t adjPartIndex : reader.getGraph().getAdjacencyPartition()) - { - adjPartition[idx++] = adjPartIndex; - } - - uint32_t* adjNodes = poco->m_graph.getAdjacentNodeIndices(); - idx = 0; - - for (uint32_t adjNodeIndex : reader.getGraph().getAdjacentNodeIndices()) - { - adjNodes[idx++] = adjNodeIndex; - } - - uint32_t* adjBonds = poco->m_graph.getAdjacentBondIndices(); - idx = 0; - - for (uint32_t adjBondIndex : reader.getGraph().getAdjacentBondIndices()) - { - adjBonds[idx++] = adjBondIndex; - } - - return true; - } + poco->getSubtreeLeafChunkCounts()[i] = readerSubtreeLeafChunkCounts[i]; } + + auto readerChunkToGraphNodeMap = reader.getChunkToGraphNodeMap(); + for (uint32_t i = 0; i < chunkCount; i++) + { + poco->getChunkToGraphNodeMap()[i] = readerChunkToGraphNodeMap[i]; + } + + uint32_t* ciPtr = poco->m_graph.getChunkIndices(); + + NVBLAST_ASSERT(reader.getGraph().getChunkIndices().size() == poco->m_graph.m_nodeCount); + auto readerGraphChunkIndices = reader.getGraph().getChunkIndices(); + for (uint32_t i = 0; i < poco->m_graph.m_nodeCount; i++) + { + ciPtr[i] = readerGraphChunkIndices[i]; + } + + uint32_t* adjPartition = poco->m_graph.getAdjacencyPartition(); + const uint32_t graphAdjacencyPartitionSize = reader.getGraph().getAdjacencyPartition().size(); + auto readerGraphAdjacencyPartition = reader.getGraph().getAdjacencyPartition(); + for (uint32_t i = 0; i < graphAdjacencyPartitionSize; ++i) + { + adjPartition[i] = readerGraphAdjacencyPartition[i]; + } + + uint32_t* adjNodes = poco->m_graph.getAdjacentNodeIndices(); + const uint32_t graphAdjacentNodeIndicesSize = reader.getGraph().getAdjacentNodeIndices().size(); + auto readerGraphAdjacentNodeIndices = reader.getGraph().getAdjacentNodeIndices(); + for (uint32_t i = 0; i < graphAdjacentNodeIndicesSize; ++i) + { + adjNodes[i] = readerGraphAdjacentNodeIndices[i]; + } + + uint32_t* adjBonds = poco->m_graph.getAdjacentBondIndices(); + const uint32_t graphAdjacentBondIndicesSize = reader.getGraph().getAdjacentBondIndices().size(); + auto readerGraphAdjacentBondIndices = reader.getGraph().getAdjacentBondIndices(); + for (uint32_t i = 0; i < graphAdjacentBondIndicesSize; ++i) + { + adjBonds[i] = readerGraphAdjacentBondIndices[i]; + } + + return true; } + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/AssetDTO.h b/sdk/extensions/serialization/source/DTO/AssetDTO.h index c090b5f..492e847 100644 --- a/sdk/extensions/serialization/source/DTO/AssetDTO.h +++ b/sdk/extensions/serialization/source/DTO/AssetDTO.h @@ -1,16 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "NvBlastAsset.h" -#include "generated/NvBlastExtSerializationLL.capn.h" +#include "generated/NvBlastExtLlSerialization.capn.h" -DTO_CLASS_LL(Asset, Nv::Blast::Asset, Nv::Blast::Serialization::Asset) +DTO_CLASS(Asset, Nv::Blast::Asset, Nv::Blast::Serialization::Asset) diff --git a/sdk/extensions/serialization/source/DTO/DTOMacros.h b/sdk/extensions/serialization/source/DTO/DTOMacros.h index a234aec..b3b71ef 100644 --- a/sdk/extensions/serialization/source/DTO/DTOMacros.h +++ b/sdk/extensions/serialization/source/DTO/DTOMacros.h @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once @@ -16,29 +34,10 @@ namespace Blast { \ class _NAME ## DTO \ { \ public: \ - static class physx::PxCooking* Cooking; \ - static class physx::PxPhysics* Physics; \ - \ - static bool serialize(_SERIALIZER::Builder builder, const _POCO * poco); \ - static _POCO* deserialize(_SERIALIZER::Reader reader); \ - static bool deserializeInto(_SERIALIZER::Reader reader, _POCO * poco); \ -}; \ -} \ -} \ - \ - -#define DTO_CLASS_LL(_NAME, _POCO, _SERIALIZER) \ -namespace Nv { \ -namespace Blast { \ -class _NAME ## DTO \ -{ \ -public: \ \ static bool serialize(_SERIALIZER::Builder builder, const _POCO * poco); \ static _POCO* deserialize(_SERIALIZER::Reader reader); \ static bool deserializeInto(_SERIALIZER::Reader reader, _POCO * poco); \ }; \ } \ -} \ - \ - +} diff --git a/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.cpp b/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.cpp index cf4cadc..865f141 100644 --- a/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.cpp @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "ExtPxAssetDTO.h" #include "TkAssetDTO.h" @@ -14,65 +32,127 @@ #include "ExtPxSubchunkDTO.h" #include "physics/NvBlastExtPxAssetImpl.h" #include "NvBlastAssert.h" +#include "NvBlast.h" + namespace Nv { - namespace Blast +namespace Blast +{ + +bool ExtPxAssetDTO::serialize(Nv::Blast::Serialization::ExtPxAsset::Builder builder, const Nv::Blast::ExtPxAsset * poco) +{ + TkAssetDTO::serialize(builder.getAsset(), &poco->getTkAsset()); + + auto chunks = builder.initChunks(poco->getChunkCount()); + + for (uint32_t i = 0; i <poco->getChunkCount(); i++) { - bool ExtPxAssetDTO::serialize(Nv::Blast::Serialization::ExtPxAsset::Builder builder, const Nv::Blast::ExtPxAsset * poco) - { - TkAssetDTO::serialize(builder.getAsset(), &poco->getTkAsset()); - - auto chunks = builder.initChunks(poco->getChunkCount()); - - for (uint32_t i = 0; i <poco->getChunkCount(); i++) - { - ExtPxChunkDTO::serialize(chunks[i], &poco->getChunks()[i]); - } - - auto subchunks = builder.initSubchunks(poco->getSubchunkCount()); - - for (uint32_t i = 0; i < poco->getSubchunkCount(); i++) - { - ExtPxSubchunkDTO::serialize(subchunks[i], &poco->getSubchunks()[i]); - } - - return true; - } - - Nv::Blast::ExtPxAsset* ExtPxAssetDTO::deserialize(Nv::Blast::Serialization::ExtPxAsset::Reader reader) + ExtPxChunkDTO::serialize(chunks[i], &poco->getChunks()[i]); + } + + auto subchunks = builder.initSubchunks(poco->getSubchunkCount()); + + for (uint32_t i = 0; i < poco->getSubchunkCount(); i++) + { + ExtPxSubchunkDTO::serialize(subchunks[i], &poco->getSubchunks()[i]); + } + + const NvBlastActorDesc& actorDesc = poco->getDefaultActorDesc(); + + builder.setUniformInitialBondHealth(actorDesc.uniformInitialBondHealth); + + if (actorDesc.initialBondHealths != nullptr) + { + const uint32_t bondCount = poco->getTkAsset().getBondCount(); + kj::ArrayPtr<const float> bondHealthArray(actorDesc.initialBondHealths, bondCount); + builder.initBondHealths(bondCount); + builder.setBondHealths(bondHealthArray); + } + + builder.setUniformInitialLowerSupportChunkHealth(actorDesc.uniformInitialLowerSupportChunkHealth); + + if (actorDesc.initialSupportChunkHealths != nullptr) + { + const uint32_t supportChunkCount = NvBlastAssetGetSupportChunkCount(poco->getTkAsset().getAssetLL(), logLL); + kj::ArrayPtr<const float> supportChunkHealthArray(actorDesc.initialSupportChunkHealths, supportChunkCount); + builder.initSupportChunkHealths(supportChunkCount); + builder.setSupportChunkHealths(supportChunkHealthArray); + } + + return true; +} + + +Nv::Blast::ExtPxAsset* ExtPxAssetDTO::deserialize(Nv::Blast::Serialization::ExtPxAsset::Reader reader) +{ + auto tkAsset = TkAssetDTO::deserialize(reader.getAsset()); + + Nv::Blast::ExtPxAssetImpl* asset = reinterpret_cast<Nv::Blast::ExtPxAssetImpl*>(Nv::Blast::ExtPxAsset::create(tkAsset)); + + NVBLAST_ASSERT(asset != nullptr); + + auto& chunks = asset->getChunksArray(); + const uint32_t chunkCount = reader.getChunks().size(); + chunks.resize(chunkCount); + auto readerChunks = reader.getChunks(); + for (uint32_t i = 0; i < chunkCount; i++) + { + ExtPxChunkDTO::deserializeInto(readerChunks[i], &chunks[i]); + } + + auto& subchunks = asset->getSubchunksArray(); + const uint32_t subChunkCount = reader.getSubchunks().size(); + subchunks.resize(subChunkCount); + auto readerSubchunks = reader.getSubchunks(); + for (uint32_t i = 0; i < subChunkCount; i++) + { + ExtPxSubchunkDTO::deserializeInto(readerSubchunks[i], &subchunks[i]); + } + + NvBlastActorDesc& actorDesc = asset->getDefaultActorDesc(); + + actorDesc.uniformInitialBondHealth = reader.getUniformInitialBondHealth(); + + actorDesc.initialBondHealths = nullptr; + if (reader.hasBondHealths()) + { + const uint32_t bondCount = asset->getTkAsset().getBondCount(); + Nv::Blast::Array<float>::type& bondHealths = asset->getBondHealthsArray(); + bondHealths.resize(bondCount); + auto readerBondHealths = reader.getBondHealths(); + for (uint32_t i = 0; i < bondCount; ++i) { - auto tkAsset = TkAssetDTO::deserialize(reader.getAsset()); - - Nv::Blast::ExtPxAssetImpl* asset = reinterpret_cast<Nv::Blast::ExtPxAssetImpl*>(Nv::Blast::ExtPxAsset::create(tkAsset)); - - NVBLAST_ASSERT(asset != nullptr); - - auto chunks = asset->getChunksArray(); - - chunks.resize(reader.getChunks().size()); - for (uint32_t i = 0; i < reader.getChunks().size(); i++) - { - ExtPxChunkDTO::deserializeInto(reader.getChunks()[i], &chunks[i]); - } - - auto subchunks = asset->getSubchunksArray(); - - subchunks.resize(reader.getSubchunks().size()); - for (uint32_t i = 0; i < reader.getSubchunks().size(); i++) - { - ExtPxSubchunkDTO::deserializeInto(reader.getSubchunks()[i], &subchunks[i]); - } - - return asset; + bondHealths[i] = readerBondHealths[i]; } - - bool ExtPxAssetDTO::deserializeInto(Nv::Blast::Serialization::ExtPxAsset::Reader reader, Nv::Blast::ExtPxAsset * poco) + } + + actorDesc.uniformInitialLowerSupportChunkHealth = reader.getUniformInitialLowerSupportChunkHealth(); + + actorDesc.initialSupportChunkHealths = nullptr; + if (reader.hasSupportChunkHealths()) + { + const uint32_t supportChunkCount = NvBlastAssetGetSupportChunkCount(asset->getTkAsset().getAssetLL(), logLL); + Nv::Blast::Array<float>::type& supportChunkHealths = asset->getSupportChunkHealthsArray(); + supportChunkHealths.resize(supportChunkCount); + auto readerSupportChunkHealths = reader.getSupportChunkHealths(); + for (uint32_t i = 0; i < supportChunkCount; ++i) { - reader = reader; - poco = nullptr; - //NOTE: Because of the way this is structured, can't do this. - return false; + supportChunkHealths[i] = readerSupportChunkHealths[i]; } } + + return asset; +} + + +bool ExtPxAssetDTO::deserializeInto(Nv::Blast::Serialization::ExtPxAsset::Reader reader, Nv::Blast::ExtPxAsset * poco) +{ + reader = reader; + poco = nullptr; + //NOTE: Because of the way this is structured, can't do this. + return false; } + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.h b/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.h index a35d38a..9729ec9 100644 --- a/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.h +++ b/sdk/extensions/serialization/source/DTO/ExtPxAssetDTO.h @@ -1,16 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "NvBlastBondDTO.h" #include "NvBlastExtPxAsset.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtPxSerialization.capn.h" DTO_CLASS(ExtPxAsset, Nv::Blast::ExtPxAsset, Nv::Blast::Serialization::ExtPxAsset) diff --git a/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.cpp b/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.cpp index e096bc1..74333b6 100644 --- a/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.cpp @@ -1,43 +1,65 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "ExtPxChunkDTO.h" namespace Nv { - namespace Blast - { - bool ExtPxChunkDTO::serialize(Nv::Blast::Serialization::ExtPxChunk::Builder builder, const Nv::Blast::ExtPxChunk * poco) - { - builder.setFirstSubchunkIndex(poco->firstSubchunkIndex); - builder.setSubchunkCount(poco->subchunkCount); - builder.setIsStatic(poco->isStatic); - - return true; - } - - Nv::Blast::ExtPxChunk* ExtPxChunkDTO::deserialize(Nv::Blast::Serialization::ExtPxChunk::Reader reader) - { - reader = reader; - //TODO: Allocate with ExtContext and return - - return nullptr; - } - - bool ExtPxChunkDTO::deserializeInto(Nv::Blast::Serialization::ExtPxChunk::Reader reader, Nv::Blast::ExtPxChunk * poco) - { - poco->firstSubchunkIndex = reader.getFirstSubchunkIndex(); - poco->subchunkCount = reader.getSubchunkCount(); - poco->isStatic = reader.getIsStatic(); - - return true; - } - } -}
\ No newline at end of file +namespace Blast +{ + +bool ExtPxChunkDTO::serialize(Nv::Blast::Serialization::ExtPxChunk::Builder builder, const Nv::Blast::ExtPxChunk * poco) +{ + builder.setFirstSubchunkIndex(poco->firstSubchunkIndex); + builder.setSubchunkCount(poco->subchunkCount); + builder.setIsStatic(poco->isStatic); + + return true; +} + + +Nv::Blast::ExtPxChunk* ExtPxChunkDTO::deserialize(Nv::Blast::Serialization::ExtPxChunk::Reader reader) +{ + reader = reader; + //TODO: Allocate with ExtContext and return + + return nullptr; +} + + +bool ExtPxChunkDTO::deserializeInto(Nv::Blast::Serialization::ExtPxChunk::Reader reader, Nv::Blast::ExtPxChunk * poco) +{ + poco->firstSubchunkIndex = reader.getFirstSubchunkIndex(); + poco->subchunkCount = reader.getSubchunkCount(); + poco->isStatic = reader.getIsStatic(); + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.h b/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.h index 1ff36df..e9935c3 100644 --- a/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.h +++ b/sdk/extensions/serialization/source/DTO/ExtPxChunkDTO.h @@ -1,16 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "NvBlastExtPxAsset.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtPxSerialization.capn.h" DTO_CLASS(ExtPxChunk, Nv::Blast::ExtPxChunk, Nv::Blast::Serialization::ExtPxChunk) diff --git a/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.cpp b/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.cpp index cc2be96..c3e290b 100644 --- a/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.cpp @@ -1,43 +1,66 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "ExtPxSubchunkDTO.h" #include "PxTransformDTO.h" #include "PxConvexMeshGeometryDTO.h" + namespace Nv { - namespace Blast - { - bool ExtPxSubchunkDTO::serialize(Nv::Blast::Serialization::ExtPxSubchunk::Builder builder, const Nv::Blast::ExtPxSubchunk * poco) - { - PxTransformDTO::serialize(builder.getTransform(), &poco->transform); - PxConvexMeshGeometryDTO::serialize(builder.getGeometry(), &poco->geometry); - - return true; - } - - Nv::Blast::ExtPxSubchunk* ExtPxSubchunkDTO::deserialize(Nv::Blast::Serialization::ExtPxSubchunk::Reader reader) - { - reader = reader; - //TODO: Allocate with ExtContext and return - - return nullptr; - } - - bool ExtPxSubchunkDTO::deserializeInto(Nv::Blast::Serialization::ExtPxSubchunk::Reader reader, Nv::Blast::ExtPxSubchunk * poco) - { - PxTransformDTO::deserializeInto(reader.getTransform(), &poco->transform); - - return true; - } - - } +namespace Blast +{ + +bool ExtPxSubchunkDTO::serialize(Nv::Blast::Serialization::ExtPxSubchunk::Builder builder, const Nv::Blast::ExtPxSubchunk * poco) +{ + PxTransformDTO::serialize(builder.getTransform(), &poco->transform); + PxConvexMeshGeometryDTO::serialize(builder.getGeometry(), &poco->geometry); + + return true; } + + +Nv::Blast::ExtPxSubchunk* ExtPxSubchunkDTO::deserialize(Nv::Blast::Serialization::ExtPxSubchunk::Reader reader) +{ + reader = reader; + //TODO: Allocate with ExtContext and return + + return nullptr; +} + + +bool ExtPxSubchunkDTO::deserializeInto(Nv::Blast::Serialization::ExtPxSubchunk::Reader reader, Nv::Blast::ExtPxSubchunk * poco) +{ + PxTransformDTO::deserializeInto(reader.getTransform(), &poco->transform); + PxConvexMeshGeometryDTO::deserializeInto(reader.getGeometry(), &poco->geometry); + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.h b/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.h index 91f78e0..72b6c24 100644 --- a/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.h +++ b/sdk/extensions/serialization/source/DTO/ExtPxSubchunkDTO.h @@ -1,16 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "NvBlastExtPxAsset.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtPxSerialization.capn.h" #include "DTOMacros.h" DTO_CLASS(ExtPxSubchunk, Nv::Blast::ExtPxSubchunk, Nv::Blast::Serialization::ExtPxSubchunk) diff --git a/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.cpp b/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.cpp index 27cbb11..7865eb3 100644 --- a/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.cpp @@ -1,63 +1,86 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "NvBlastBondDTO.h" #include "NvBlastAssert.h" namespace Nv { - namespace Blast - { - - bool NvBlastBondDTO::serialize(Nv::Blast::Serialization::NvBlastBond::Builder builder, const NvBlastBond * poco) - { - NVBLAST_ASSERT(poco != nullptr); - - kj::ArrayPtr<const float> normArray(poco->normal, 3); - - builder.setNormal(normArray); - - builder.setArea(poco->area); - - kj::ArrayPtr<const float> centArray(poco->centroid, 3); - - builder.setCentroid(centArray); - - builder.setUserData(poco->userData); - - return true; - } - - NvBlastBond* NvBlastBondDTO::deserialize(Nv::Blast::Serialization::NvBlastBond::Reader reader) - { - //FIXME - reader = reader; - //TODO: Allocate with ExtContext and return - return nullptr; - } - - bool NvBlastBondDTO::deserializeInto(Nv::Blast::Serialization::NvBlastBond::Reader reader, NvBlastBond * poco) - { - poco->area = reader.getArea(); - - poco->centroid[0] = reader.getCentroid()[0]; - poco->centroid[1] = reader.getCentroid()[1]; - poco->centroid[2] = reader.getCentroid()[2]; - - poco->normal[0] = reader.getNormal()[0]; - poco->normal[1] = reader.getNormal()[1]; - poco->normal[2] = reader.getNormal()[2]; - - poco->userData = reader.getUserData(); - - return true; - } - } +namespace Blast +{ + +bool NvBlastBondDTO::serialize(Nv::Blast::Serialization::NvBlastBond::Builder builder, const NvBlastBond * poco) +{ + NVBLAST_ASSERT(poco != nullptr); + + kj::ArrayPtr<const float> normArray(poco->normal, 3); + + builder.setNormal(normArray); + + builder.setArea(poco->area); + + kj::ArrayPtr<const float> centArray(poco->centroid, 3); + + builder.setCentroid(centArray); + + builder.setUserData(poco->userData); + + return true; +} + + +NvBlastBond* NvBlastBondDTO::deserialize(Nv::Blast::Serialization::NvBlastBond::Reader reader) +{ + //FIXME + reader = reader; + //TODO: Allocate with ExtContext and return + return nullptr; +} + + +bool NvBlastBondDTO::deserializeInto(Nv::Blast::Serialization::NvBlastBond::Reader reader, NvBlastBond * poco) +{ + poco->area = reader.getArea(); + + auto readerCentroid = reader.getCentroid(); + poco->centroid[0] = readerCentroid[0]; + poco->centroid[1] = readerCentroid[1]; + poco->centroid[2] = readerCentroid[2]; + + auto readerNormal = reader.getNormal(); + poco->normal[0] = readerNormal[0]; + poco->normal[1] = readerNormal[1]; + poco->normal[2] = readerNormal[2]; + + poco->userData = reader.getUserData(); + + return true; } + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.h b/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.h index 8b67bd7..3a8e0d1 100644 --- a/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.h +++ b/sdk/extensions/serialization/source/DTO/NvBlastBondDTO.h @@ -1,16 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "NvBlastTypes.h" -#include "generated/NvBlastExtSerializationLL.capn.h" +#include "generated/NvBlastExtLlSerialization.capn.h" -DTO_CLASS_LL(NvBlastBond, NvBlastBond, Nv::Blast::Serialization::NvBlastBond) +DTO_CLASS(NvBlastBond, NvBlastBond, Nv::Blast::Serialization::NvBlastBond) diff --git a/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.cpp b/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.cpp index 38814ed..71924f3 100644 --- a/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.cpp @@ -1,60 +1,83 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "NvBlastChunkDTO.h" #include "NvBlastAssert.h" namespace Nv { - namespace Blast - { - bool NvBlastChunkDTO::serialize(Nv::Blast::Serialization::NvBlastChunk::Builder builder, const NvBlastChunk* poco) - { - NVBLAST_ASSERT(poco != nullptr); - - kj::ArrayPtr<const float> centArray(poco->centroid, 3); - builder.setCentroid(centArray); - - builder.setVolume(poco->volume); - - builder.setParentChunkIndex(poco->parentChunkIndex); - builder.setFirstChildIndex(poco->firstChildIndex); - builder.setChildIndexStop(poco->childIndexStop); - builder.setUserData(poco->userData); - - return true; - } - - NvBlastChunk* NvBlastChunkDTO::deserialize(Nv::Blast::Serialization::NvBlastChunk::Reader reader) - { - //FIXME - reader = reader; - - return nullptr; - } - - bool NvBlastChunkDTO::deserializeInto(Nv::Blast::Serialization::NvBlastChunk::Reader reader, NvBlastChunk* target) - { - NVBLAST_ASSERT(target != nullptr); - - target->centroid[0] = reader.getCentroid()[0]; - target->centroid[1] = reader.getCentroid()[1]; - target->centroid[2] = reader.getCentroid()[2]; - - target->childIndexStop = reader.getChildIndexStop(); - target->firstChildIndex = reader.getFirstChildIndex(); - target->parentChunkIndex = reader.getParentChunkIndex(); - target->userData = reader.getUserData(); - target->volume = reader.getVolume(); - - return true; - } - } +namespace Blast +{ + +bool NvBlastChunkDTO::serialize(Nv::Blast::Serialization::NvBlastChunk::Builder builder, const NvBlastChunk* poco) +{ + NVBLAST_ASSERT(poco != nullptr); + + kj::ArrayPtr<const float> centArray(poco->centroid, 3); + builder.setCentroid(centArray); + + builder.setVolume(poco->volume); + + builder.setParentChunkIndex(poco->parentChunkIndex); + builder.setFirstChildIndex(poco->firstChildIndex); + builder.setChildIndexStop(poco->childIndexStop); + builder.setUserData(poco->userData); + + return true; } + + +NvBlastChunk* NvBlastChunkDTO::deserialize(Nv::Blast::Serialization::NvBlastChunk::Reader reader) +{ + //FIXME + reader = reader; + + return nullptr; +} + + +bool NvBlastChunkDTO::deserializeInto(Nv::Blast::Serialization::NvBlastChunk::Reader reader, NvBlastChunk* target) +{ + NVBLAST_ASSERT(target != nullptr); + + auto readerCentroid = reader.getCentroid(); + target->centroid[0] = readerCentroid[0]; + target->centroid[1] = readerCentroid[1]; + target->centroid[2] = readerCentroid[2]; + + target->childIndexStop = reader.getChildIndexStop(); + target->firstChildIndex = reader.getFirstChildIndex(); + target->parentChunkIndex = reader.getParentChunkIndex(); + target->userData = reader.getUserData(); + target->volume = reader.getVolume(); + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.h b/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.h index 5fec498..e4c3f1f 100644 --- a/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.h +++ b/sdk/extensions/serialization/source/DTO/NvBlastChunkDTO.h @@ -1,18 +1,36 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "NvBlastTypes.h" -#include "generated/NvBlastExtSerializationLL.capn.h" +#include "generated/NvBlastExtLlSerialization.capn.h" -DTO_CLASS_LL(NvBlastChunk, NvBlastChunk, Nv::Blast::Serialization::NvBlastChunk) +DTO_CLASS(NvBlastChunk, NvBlastChunk, Nv::Blast::Serialization::NvBlastChunk) diff --git a/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.cpp b/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.cpp index e540cd8..0be5863 100644 --- a/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.cpp @@ -1,48 +1,70 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "NvBlastIDDTO.h" #include "NvBlastTypes.h" #include "NvBlastAssert.h" -#include "generated/NvBlastExtSerializationLL.capn.h" +#include "generated/NvBlastExtLlSerialization.capn.h" namespace Nv { - namespace Blast - { - - bool NvBlastIDDTO::serialize(Nv::Blast::Serialization::UUID::Builder builder, const NvBlastID * poco) - { - capnp::Data::Reader idArrayReader((unsigned char *)poco->data, 16); - builder.setValue(idArrayReader); - - return true; - } - - NvBlastID* NvBlastIDDTO::deserialize(Nv::Blast::Serialization::UUID::Reader reader) - { - //FIXME - reader = reader; - //TODO: Allocate with ExtContext and return - - return nullptr; - } - - bool NvBlastIDDTO::deserializeInto(Nv::Blast::Serialization::UUID::Reader reader, NvBlastID * poco) - { - NVBLAST_ASSERT_WITH_MESSAGE(reader.getValue().size() == 16, "BlastID must be 16 bytes"); - - memcpy(poco, reader.getValue().begin(), 16); - - return true; - } - } -}
\ No newline at end of file +namespace Blast +{ + + +bool NvBlastIDDTO::serialize(Nv::Blast::Serialization::UUID::Builder builder, const NvBlastID * poco) +{ + capnp::Data::Reader idArrayReader((unsigned char *)poco->data, 16); + builder.setValue(idArrayReader); + + return true; +} + + +NvBlastID* NvBlastIDDTO::deserialize(Nv::Blast::Serialization::UUID::Reader reader) +{ + //FIXME + reader = reader; + //TODO: Allocate with ExtContext and return + + return nullptr; +} + + +bool NvBlastIDDTO::deserializeInto(Nv::Blast::Serialization::UUID::Reader reader, NvBlastID * poco) +{ + NVBLAST_ASSERT_WITH_MESSAGE(reader.getValue().size() == 16, "BlastID must be 16 bytes"); + + memcpy(poco, reader.getValue().begin(), 16); + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.h b/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.h index afe6cf0..ac4b1c0 100644 --- a/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.h +++ b/sdk/extensions/serialization/source/DTO/NvBlastIDDTO.h @@ -1,16 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "NvBlastTypes.h" -#include "generated/NvBlastExtSerializationLL.capn.h" +#include "generated/NvBlastExtLlSerialization.capn.h" #include "DTOMacros.h" -DTO_CLASS_LL(NvBlastID, NvBlastID, ::Nv::Blast::Serialization::UUID) +DTO_CLASS(NvBlastID, NvBlastID, ::Nv::Blast::Serialization::UUID) diff --git a/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.cpp b/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.cpp index 1c46f9e..099e458 100644 --- a/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.cpp @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "PxConvexMeshGeometryDTO.h" #include "PxMeshScaleDTO.h" @@ -17,111 +35,108 @@ #include "NvBlastExtSerialization.h" #include "PxVec3.h" #include <algorithm> +#include <vector> #include "PxPhysics.h" +#include "NvBlastPxCallbacks.h" +#include "PxDefaultStreams.h" namespace Nv { - namespace Blast - { - physx::PxCooking* PxConvexMeshGeometryDTO::Cooking = nullptr; - physx::PxPhysics* PxConvexMeshGeometryDTO::Physics = nullptr; +namespace Blast +{ + +extern physx::PxPhysics* sExtPxSerializerPhysics; +extern physx::PxCooking* sExtPxSerializerCooking; + + +bool PxConvexMeshGeometryDTO::serialize(Nv::Blast::Serialization::PxConvexMeshGeometry::Builder builder, const physx::PxConvexMeshGeometry * poco) +{ + NVBLAST_ASSERT(sExtPxSerializerCooking != nullptr); + + PxMeshScaleDTO::serialize(builder.getScale(), &poco->scale); + + //TODO: Use cooking.cookConvexMesh to cook the mesh to a stream - then get that backing buffer and put it into the Data field - bool PxConvexMeshGeometryDTO::serialize(Nv::Blast::Serialization::PxConvexMeshGeometry::Builder builder, const physx::PxConvexMeshGeometry * poco) + physx::PxConvexMeshDesc desc; + desc.points.data = poco->convexMesh->getVertices(); + desc.points.count = poco->convexMesh->getNbVertices(); + desc.points.stride = sizeof(physx::PxVec3); + + std::vector<uint32_t> indicesScratch; + std::vector<physx::PxHullPolygon> hullPolygonsScratch; + + hullPolygonsScratch.resize(poco->convexMesh->getNbPolygons()); + + uint32_t indexCount = 0; + for (uint32_t i = 0; i < hullPolygonsScratch.size(); i++) + { + physx::PxHullPolygon polygon; + poco->convexMesh->getPolygonData(i, polygon); + if (polygon.mNbVerts) { - PxMeshScaleDTO::serialize(builder.getScale(), &poco->scale); - - //TODO: Use cooking.cookConvexMesh to cook the mesh to a stream - then get that backing buffer and put it into the Data field - - physx::PxConvexMeshDesc desc; - desc.points.data = poco->convexMesh->getVertices(); - desc.points.count = poco->convexMesh->getNbVertices(); - desc.points.stride = sizeof(physx::PxVec3); - - std::vector<uint32_t> indicesScratch; - std::vector<physx::PxHullPolygon> hullPolygonsScratch; - - hullPolygonsScratch.resize(poco->convexMesh->getNbPolygons()); - - uint32_t indexCount = 0; - for (uint32_t i = 0; i < hullPolygonsScratch.size(); i++) - { - physx::PxHullPolygon polygon; - poco->convexMesh->getPolygonData(i, polygon); - if (polygon.mNbVerts) - { - indexCount = std::max<uint32_t>(indexCount, polygon.mIndexBase + polygon.mNbVerts); - } - } - indicesScratch.resize(indexCount); - - for (uint32_t i = 0; i < hullPolygonsScratch.size(); i++) - { - physx::PxHullPolygon polygon; - poco->convexMesh->getPolygonData(i, polygon); - for (uint32_t j = 0; j < polygon.mNbVerts; j++) - { - indicesScratch[polygon.mIndexBase + j] = poco->convexMesh->getIndexBuffer()[polygon.mIndexBase + j]; - } - - hullPolygonsScratch[i] = polygon; - } - - desc.indices.count = indexCount; - desc.indices.data = indicesScratch.data(); - desc.indices.stride = sizeof(uint32_t); - - desc.polygons.count = poco->convexMesh->getNbPolygons(); - desc.polygons.data = hullPolygonsScratch.data(); - desc.polygons.stride = sizeof(physx::PxHullPolygon); - - - std::vector<unsigned char> buffer; - buffer.resize(16 * 1024 * 1024); // No idea how much memory is needed! Allocate 16MB - kj::ArrayPtr<unsigned char> bufferArray(buffer.data(), buffer.size()); - - Nv::Blast::ExtKJPxOutputStream outputStream(bufferArray); - - bool cookResult = Cooking->cookConvexMesh(desc, outputStream); - - if (!cookResult) - { - return false; - } - - kj::ArrayPtr<unsigned char> cookedBuffer(outputStream.getBuffer().begin(), outputStream.getWrittenBytes()); - - builder.setConvexMesh(cookedBuffer); - - // builder.getConvexMesh(). - - return true; + indexCount = std::max<uint32_t>(indexCount, polygon.mIndexBase + polygon.mNbVerts); } - - physx::PxConvexMeshGeometry* PxConvexMeshGeometryDTO::deserialize(Nv::Blast::Serialization::PxConvexMeshGeometry::Reader reader) - { - NVBLAST_ASSERT(PxConvexMeshGeometryDTO::Cooking != nullptr); - - reader = reader; - - return nullptr; - } - - bool PxConvexMeshGeometryDTO::deserializeInto(Nv::Blast::Serialization::PxConvexMeshGeometry::Reader reader, physx::PxConvexMeshGeometry * poco) + } + indicesScratch.resize(indexCount); + + for (uint32_t i = 0; i < hullPolygonsScratch.size(); i++) + { + physx::PxHullPolygon polygon; + poco->convexMesh->getPolygonData(i, polygon); + for (uint32_t j = 0; j < polygon.mNbVerts; j++) { - NVBLAST_ASSERT(PxConvexMeshGeometryDTO::Cooking != nullptr); - - PxMeshScaleDTO::deserializeInto(reader.getScale(), &poco->scale); - - Nv::Blast::ExtKJPxInputStream inputStream(reader.getConvexMesh()); - - //NOTE: Naive approach, no shared convex hulls - poco->convexMesh = Physics->createConvexMesh(inputStream); - - return false; + indicesScratch[polygon.mIndexBase + j] = poco->convexMesh->getIndexBuffer()[polygon.mIndexBase + j]; } + + hullPolygonsScratch[i] = polygon; + } + + desc.indices.count = indexCount; + desc.indices.data = indicesScratch.data(); + desc.indices.stride = sizeof(uint32_t); + + desc.polygons.count = poco->convexMesh->getNbPolygons(); + desc.polygons.data = hullPolygonsScratch.data(); + desc.polygons.stride = sizeof(physx::PxHullPolygon); - - + physx::PxDefaultMemoryOutputStream outStream(NvBlastGetPxAllocatorCallback()); + if (!sExtPxSerializerCooking->cookConvexMesh(desc, outStream)) + { + return false; } + + kj::ArrayPtr<unsigned char> cookedBuffer(outStream.getData(), outStream.getSize()); + + builder.setConvexMesh(cookedBuffer); + + return true; } + + +physx::PxConvexMeshGeometry* PxConvexMeshGeometryDTO::deserialize(Nv::Blast::Serialization::PxConvexMeshGeometry::Reader reader) +{ + NVBLAST_ASSERT(sExtPxSerializerCooking != nullptr); + + reader = reader; + + return nullptr; +} + + +bool PxConvexMeshGeometryDTO::deserializeInto(Nv::Blast::Serialization::PxConvexMeshGeometry::Reader reader, physx::PxConvexMeshGeometry * poco) +{ + NVBLAST_ASSERT(sExtPxSerializerPhysics != nullptr); + + PxMeshScaleDTO::deserializeInto(reader.getScale(), &poco->scale); + + Nv::Blast::ExtKJPxInputStream inputStream(reader.getConvexMesh()); + + //NOTE: Naive approach, no shared convex hulls + poco->convexMesh = sExtPxSerializerPhysics->createConvexMesh(inputStream); + + return poco->convexMesh != nullptr; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.h b/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.h index 27b3754..0628518 100644 --- a/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.h +++ b/sdk/extensions/serialization/source/DTO/PxConvexMeshGeometryDTO.h @@ -1,16 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtPxSerialization.capn.h" #include "PxConvexMeshGeometry.h" #include "PxCooking.h" diff --git a/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.cpp b/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.cpp index 8fee6ad..76f0d90 100644 --- a/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.cpp @@ -1,42 +1,64 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "PxMeshScaleDTO.h" #include "PxVec3DTO.h" #include "PxQuatDTO.h" + namespace Nv { - namespace Blast - { - bool PxMeshScaleDTO::serialize(Nv::Blast::Serialization::PxMeshScale::Builder builder, const physx::PxMeshScale * poco) - { - PxVec3DTO::serialize(builder.getScale(), &poco->scale); - PxQuatDTO::serialize(builder.getRotation(), &poco->rotation); - - return true; - } - - physx::PxMeshScale* PxMeshScaleDTO::deserialize(Nv::Blast::Serialization::PxMeshScale::Reader reader) - { - reader = reader; - return nullptr; - } - - bool PxMeshScaleDTO::deserializeInto(Nv::Blast::Serialization::PxMeshScale::Reader reader, physx::PxMeshScale * poco) - { - PxVec3DTO::deserializeInto(reader.getScale(), &poco->scale); - PxQuatDTO::deserializeInto(reader.getRotation(), &poco->rotation); - - return true; - } - } +namespace Blast +{ + +bool PxMeshScaleDTO::serialize(Nv::Blast::Serialization::PxMeshScale::Builder builder, const physx::PxMeshScale * poco) +{ + PxVec3DTO::serialize(builder.getScale(), &poco->scale); + PxQuatDTO::serialize(builder.getRotation(), &poco->rotation); + + return true; +} + + +physx::PxMeshScale* PxMeshScaleDTO::deserialize(Nv::Blast::Serialization::PxMeshScale::Reader reader) +{ + reader = reader; + return nullptr; +} + + +bool PxMeshScaleDTO::deserializeInto(Nv::Blast::Serialization::PxMeshScale::Reader reader, physx::PxMeshScale * poco) +{ + PxVec3DTO::deserializeInto(reader.getScale(), &poco->scale); + PxQuatDTO::deserializeInto(reader.getRotation(), &poco->rotation); + + return true; } +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.h b/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.h index 7b758c8..bf3c521 100644 --- a/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.h +++ b/sdk/extensions/serialization/source/DTO/PxMeshScaleDTO.h @@ -1,17 +1,35 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "PxMeshScale.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtPxSerialization.capn.h" #include "PxCooking.h" DTO_CLASS(PxMeshScale, physx::PxMeshScale, Nv::Blast::Serialization::PxMeshScale) diff --git a/sdk/extensions/serialization/source/DTO/PxQuatDTO.cpp b/sdk/extensions/serialization/source/DTO/PxQuatDTO.cpp index 8faeaa6..05490af 100644 --- a/sdk/extensions/serialization/source/DTO/PxQuatDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/PxQuatDTO.cpp @@ -1,45 +1,65 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "PxQuatDTO.h" namespace Nv { - namespace Blast - { - - bool PxQuatDTO::serialize(Nv::Blast::Serialization::PxQuat::Builder builder, const physx::PxQuat * poco) - { - builder.setX(poco->x); - builder.setY(poco->y); - builder.setZ(poco->z); - builder.setW(poco->w); - - return true; - } - - physx::PxQuat* PxQuatDTO::deserialize(Nv::Blast::Serialization::PxQuat::Reader reader) - { - reader = reader; - return nullptr; - } - - bool PxQuatDTO::deserializeInto(Nv::Blast::Serialization::PxQuat::Reader reader, physx::PxQuat * poco) - { - poco->x = reader.getX(); - poco->y = reader.getY(); - poco->z = reader.getZ(); - poco->w = reader.getW(); - - return true; - } - - } +namespace Blast +{ + +bool PxQuatDTO::serialize(Nv::Blast::Serialization::PxQuat::Builder builder, const physx::PxQuat * poco) +{ + builder.setX(poco->x); + builder.setY(poco->y); + builder.setZ(poco->z); + builder.setW(poco->w); + + return true; } + + +physx::PxQuat* PxQuatDTO::deserialize(Nv::Blast::Serialization::PxQuat::Reader reader) +{ + reader = reader; + return nullptr; +} + + +bool PxQuatDTO::deserializeInto(Nv::Blast::Serialization::PxQuat::Reader reader, physx::PxQuat * poco) +{ + poco->x = reader.getX(); + poco->y = reader.getY(); + poco->z = reader.getZ(); + poco->w = reader.getW(); + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/PxQuatDTO.h b/sdk/extensions/serialization/source/DTO/PxQuatDTO.h index 460d6c5..b7d15b9 100644 --- a/sdk/extensions/serialization/source/DTO/PxQuatDTO.h +++ b/sdk/extensions/serialization/source/DTO/PxQuatDTO.h @@ -1,17 +1,35 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "PxQuat.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtPxSerialization.capn.h" #include "PxCooking.h" DTO_CLASS(PxQuat, physx::PxQuat, Nv::Blast::Serialization::PxQuat) diff --git a/sdk/extensions/serialization/source/DTO/PxTransformDTO.cpp b/sdk/extensions/serialization/source/DTO/PxTransformDTO.cpp index 20a7cbb..0b1a240 100644 --- a/sdk/extensions/serialization/source/DTO/PxTransformDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/PxTransformDTO.cpp @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "PxTransformDTO.h" #include "PxQuatDTO.h" @@ -14,29 +32,32 @@ namespace Nv { - namespace Blast - { - - bool PxTransformDTO::serialize(Nv::Blast::Serialization::PxTransform::Builder builder, const physx::PxTransform * poco) - { - PxQuatDTO::serialize(builder.getQ(), &poco->q); - PxVec3DTO::serialize(builder.getP(), &poco->p); - - return true; - } - - physx::PxTransform* PxTransformDTO::deserialize(Nv::Blast::Serialization::PxTransform::Reader reader) - { - reader = reader; - return nullptr; - } - - bool PxTransformDTO::deserializeInto(Nv::Blast::Serialization::PxTransform::Reader reader, physx::PxTransform * poco) - { - PxQuatDTO::deserializeInto(reader.getQ(), &poco->q); - PxVec3DTO::deserializeInto(reader.getP(), &poco->p); +namespace Blast +{ - return true; - } - } +bool PxTransformDTO::serialize(Nv::Blast::Serialization::PxTransform::Builder builder, const physx::PxTransform * poco) +{ + PxQuatDTO::serialize(builder.getQ(), &poco->q); + PxVec3DTO::serialize(builder.getP(), &poco->p); + + return true; +} + + +physx::PxTransform* PxTransformDTO::deserialize(Nv::Blast::Serialization::PxTransform::Reader reader) +{ + reader = reader; + return nullptr; } + + +bool PxTransformDTO::deserializeInto(Nv::Blast::Serialization::PxTransform::Reader reader, physx::PxTransform * poco) +{ + PxQuatDTO::deserializeInto(reader.getQ(), &poco->q); + PxVec3DTO::deserializeInto(reader.getP(), &poco->p); + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/PxTransformDTO.h b/sdk/extensions/serialization/source/DTO/PxTransformDTO.h index 49a6b73..3523375 100644 --- a/sdk/extensions/serialization/source/DTO/PxTransformDTO.h +++ b/sdk/extensions/serialization/source/DTO/PxTransformDTO.h @@ -1,17 +1,35 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "PxTransform.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtPxSerialization.capn.h" #include "PxCooking.h" DTO_CLASS(PxTransform, physx::PxTransform, Nv::Blast::Serialization::PxTransform) diff --git a/sdk/extensions/serialization/source/DTO/PxVec3DTO.cpp b/sdk/extensions/serialization/source/DTO/PxVec3DTO.cpp index 9827cd0..995bb44 100644 --- a/sdk/extensions/serialization/source/DTO/PxVec3DTO.cpp +++ b/sdk/extensions/serialization/source/DTO/PxVec3DTO.cpp @@ -1,45 +1,65 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "PxVec3DTO.h" #include "NvBlastAssert.h" namespace Nv { - namespace Blast - { - bool PxVec3DTO::serialize(Nv::Blast::Serialization::PxVec3::Builder builder, const physx::PxVec3 * poco) - { - NVBLAST_ASSERT(poco != nullptr); - - builder.setX(poco->x); - builder.setY(poco->y); - builder.setZ(poco->z); - - return true; - } - - physx::PxVec3* PxVec3DTO::deserialize(Nv::Blast::Serialization::PxVec3::Reader reader) - { - //TODO: Allocate using ExtContext and return - reader = reader; - return nullptr; - } - - bool PxVec3DTO::deserializeInto(Nv::Blast::Serialization::PxVec3::Reader reader, physx::PxVec3* target) - { - target->x = reader.getX(); - target->y = reader.getY(); - target->z = reader.getZ(); - - return true; - } - } +namespace Blast +{ + +bool PxVec3DTO::serialize(Nv::Blast::Serialization::PxVec3::Builder builder, const physx::PxVec3 * poco) +{ + NVBLAST_ASSERT(poco != nullptr); + + builder.setX(poco->x); + builder.setY(poco->y); + builder.setZ(poco->z); + + return true; +} + +physx::PxVec3* PxVec3DTO::deserialize(Nv::Blast::Serialization::PxVec3::Reader reader) +{ + //TODO: Allocate using ExtContext and return + reader = reader; + return nullptr; } + +bool PxVec3DTO::deserializeInto(Nv::Blast::Serialization::PxVec3::Reader reader, physx::PxVec3* target) +{ + target->x = reader.getX(); + target->y = reader.getY(); + target->z = reader.getZ(); + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/PxVec3DTO.h b/sdk/extensions/serialization/source/DTO/PxVec3DTO.h index 8a04c8b..84fce39 100644 --- a/sdk/extensions/serialization/source/DTO/PxVec3DTO.h +++ b/sdk/extensions/serialization/source/DTO/PxVec3DTO.h @@ -1,17 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" -#include "generated/NvBlastExtSerialization.capn.h" +#include "generated/NvBlastExtTkSerialization.capn.h" #include "PxVec3.h" -#include "PxCooking.h" DTO_CLASS(PxVec3, physx::PxVec3, Nv::Blast::Serialization::PxVec3) diff --git a/sdk/extensions/serialization/source/DTO/TkAssetDTO.cpp b/sdk/extensions/serialization/source/DTO/TkAssetDTO.cpp index acc55ba..7ba6d4f 100644 --- a/sdk/extensions/serialization/source/DTO/TkAssetDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/TkAssetDTO.cpp @@ -1,67 +1,94 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "TkAssetDTO.h" #include "AssetDTO.h" #include "TkAssetJointDescDTO.h" #include <vector> #include "NvBlastTkFramework.h" - +#include "NvBlastGlobals.h" namespace Nv { - namespace Blast +namespace Blast +{ + +extern TkFramework* sExtTkSerializerFramework; + + +bool TkAssetDTO::serialize(Nv::Blast::Serialization::TkAsset::Builder builder, const Nv::Blast::TkAsset * poco) +{ + const Asset* assetLL = reinterpret_cast<const Nv::Blast::Asset*>(poco->getAssetLL()); + + Nv::Blast::AssetDTO::serialize(builder.getAssetLL(), assetLL); + + uint32_t jointDescCount = poco->getJointDescCount(); + + capnp::List<Nv::Blast::Serialization::TkAssetJointDesc>::Builder jointDescs = builder.initJointDescs(jointDescCount); + + for (uint32_t i = 0; i < jointDescCount; i++) { - bool TkAssetDTO::serialize(Nv::Blast::Serialization::TkAsset::Builder builder, const Nv::Blast::TkAsset * poco) - { - const Asset* assetLL = reinterpret_cast<const Nv::Blast::Asset*>(poco->getAssetLL()); - - Nv::Blast::AssetDTO::serialize(builder.getAssetLL(), assetLL); - - uint32_t jointDescCount = poco->getJointDescCount(); - - capnp::List<Nv::Blast::Serialization::TkAssetJointDesc>::Builder jointDescs = builder.initJointDescs(jointDescCount); - - for (uint32_t i = 0; i < jointDescCount; i++) - { - TkAssetJointDescDTO::serialize(jointDescs[i], &poco->getJointDescs()[i]); - } - - return true; - } - - Nv::Blast::TkAsset* TkAssetDTO::deserialize(Nv::Blast::Serialization::TkAsset::Reader reader) - { - const NvBlastAsset* assetLL = reinterpret_cast<const NvBlastAsset*>(AssetDTO::deserialize(reader.getAssetLL())); - - std::vector<Nv::Blast::TkAssetJointDesc> jointDescs; - jointDescs.resize(reader.getJointDescs().size()); - - for (uint32_t i = 0; i < jointDescs.size(); i++) - { - TkAssetJointDescDTO::deserializeInto(reader.getJointDescs()[i], &jointDescs[i]); - } - - // Make sure to set ownsAsset to true - this is serialization and no one else owns it. - Nv::Blast::TkAsset* asset = NvBlastTkFrameworkGet()->createAsset(assetLL, jointDescs.data(), jointDescs.size(), true); - - return asset; - } - - bool TkAssetDTO::deserializeInto(Nv::Blast::Serialization::TkAsset::Reader reader, Nv::Blast::TkAsset * poco) - { - reader = reader; - poco = nullptr; - // NOTE: Because of the way TkAsset is currently structured, this won't work. - return false; - } + TkAssetJointDescDTO::serialize(jointDescs[i], &poco->getJointDescs()[i]); } + + return true; } + + +Nv::Blast::TkAsset* TkAssetDTO::deserialize(Nv::Blast::Serialization::TkAsset::Reader reader) +{ + const NvBlastAsset* assetLL = reinterpret_cast<const NvBlastAsset*>(AssetDTO::deserialize(reader.getAssetLL())); + + std::vector<Nv::Blast::TkAssetJointDesc> jointDescs; + + const uint32_t jointDescCount = reader.getJointDescs().size(); + jointDescs.resize(jointDescCount); + auto readerJointDescs = reader.getJointDescs(); + for (uint32_t i = 0; i < jointDescCount; i++) + { + TkAssetJointDescDTO::deserializeInto(readerJointDescs[i], &jointDescs[i]); + } + + // Make sure to set ownsAsset to true - this is serialization and no one else owns it. + Nv::Blast::TkAsset* asset = NvBlastTkFrameworkGet()->createAsset(assetLL, jointDescs.data(), jointDescCount, true); + + return asset; +} + + +bool TkAssetDTO::deserializeInto(Nv::Blast::Serialization::TkAsset::Reader reader, Nv::Blast::TkAsset * poco) +{ + reader = reader; + poco = nullptr; + // NOTE: Because of the way TkAsset is currently structured, this won't work. + return false; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/TkAssetDTO.h b/sdk/extensions/serialization/source/DTO/TkAssetDTO.h index 1b21eba..d0eceea 100644 --- a/sdk/extensions/serialization/source/DTO/TkAssetDTO.h +++ b/sdk/extensions/serialization/source/DTO/TkAssetDTO.h @@ -1,17 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "NvBlastTkAsset.h" -#include "generated/NvBlastExtSerialization.capn.h" -#include "PxCooking.h" +#include "generated/NvBlastExtTkSerialization.capn.h" DTO_CLASS(TkAsset, Nv::Blast::TkAsset, Nv::Blast::Serialization::TkAsset) diff --git a/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.cpp b/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.cpp index 9118d19..cbc1ef8 100644 --- a/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.cpp +++ b/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.cpp @@ -1,12 +1,30 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #include "TkAssetJointDescDTO.h" #include "PxVec3DTO.h" @@ -14,40 +32,45 @@ namespace Nv { - namespace Blast +namespace Blast +{ + +bool TkAssetJointDescDTO::serialize(Nv::Blast::Serialization::TkAssetJointDesc::Builder builder, const Nv::Blast::TkAssetJointDesc * poco) +{ + kj::ArrayPtr<const uint32_t> nodeIndices(poco->nodeIndices, 2); + builder.setNodeIndices(nodeIndices); + + for (int i = 0; i < 2; i++) { - - bool TkAssetJointDescDTO::serialize(Nv::Blast::Serialization::TkAssetJointDesc::Builder builder, const Nv::Blast::TkAssetJointDesc * poco) - { - kj::ArrayPtr<const uint32_t> nodeIndices(poco->nodeIndices, 2); - builder.setNodeIndices(nodeIndices); - - for (int i = 0; i < 2; i++) - { - PxVec3DTO::serialize(builder.getAttachPositions()[i], &poco->attachPositions[i]); - } - - return true; - } - - Nv::Blast::TkAssetJointDesc* TkAssetJointDescDTO::deserialize(Nv::Blast::Serialization::TkAssetJointDesc::Reader reader) - { - //TODO: Allocate with ExtContent and return - - reader = reader; - - return nullptr; - } - - bool TkAssetJointDescDTO::deserializeInto(Nv::Blast::Serialization::TkAssetJointDesc::Reader reader, Nv::Blast::TkAssetJointDesc * poco) - { - PxVec3DTO::deserializeInto(reader.getAttachPositions()[0], &poco->attachPositions[0]); - PxVec3DTO::deserializeInto(reader.getAttachPositions()[1], &poco->attachPositions[1]); - - poco->nodeIndices[0] = reader.getNodeIndices()[0]; - poco->nodeIndices[1] = reader.getNodeIndices()[1]; - - return true; - } + PxVec3DTO::serialize(builder.getAttachPositions()[i], &poco->attachPositions[i]); } -}
\ No newline at end of file + + return true; +} + + +Nv::Blast::TkAssetJointDesc* TkAssetJointDescDTO::deserialize(Nv::Blast::Serialization::TkAssetJointDesc::Reader reader) +{ + //TODO: Allocate with ExtContent and return + + reader = reader; + + return nullptr; +} + + +bool TkAssetJointDescDTO::deserializeInto(Nv::Blast::Serialization::TkAssetJointDesc::Reader reader, Nv::Blast::TkAssetJointDesc * poco) +{ + auto readerAttachPositions = reader.getAttachPositions(); + PxVec3DTO::deserializeInto(readerAttachPositions[0], &poco->attachPositions[0]); + PxVec3DTO::deserializeInto(readerAttachPositions[1], &poco->attachPositions[1]); + + auto readerNodeIndices = reader.getNodeIndices(); + poco->nodeIndices[0] = readerNodeIndices[0]; + poco->nodeIndices[1] = readerNodeIndices[1]; + + return true; +} + +} // namespace Blast +} // namespace Nv diff --git a/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.h b/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.h index 88364bd..1dca2f9 100644 --- a/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.h +++ b/sdk/extensions/serialization/source/DTO/TkAssetJointDescDTO.h @@ -1,17 +1,34 @@ -/* -* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. -* -* NVIDIA CORPORATION and its licensors retain all intellectual property -* and proprietary rights in and to this software, related documentation -* and any modifications thereto. Any use, reproduction, disclosure or -* distribution of this software and related documentation without an express -* license agreement from NVIDIA CORPORATION is strictly prohibited. -*/ +// This code contains NVIDIA Confidential Information and is disclosed to you +// under a form of NVIDIA software license agreement provided separately to you. +// +// Notice +// NVIDIA Corporation and its licensors retain all intellectual property and +// proprietary rights in and to this software and related documentation and +// any modifications thereto. Any use, reproduction, disclosure, or +// distribution of this software and related documentation without an express +// license agreement from NVIDIA Corporation is strictly prohibited. +// +// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES +// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO +// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, +// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Information and code furnished is believed to be accurate and reliable. +// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such +// information or for any infringement of patents or other rights of third parties that may +// result from its use. No license is granted by implication or otherwise under any patent +// or patent rights of NVIDIA Corporation. Details are subject to change without notice. +// This code supersedes and replaces all information previously supplied. +// NVIDIA Corporation products are not authorized for use as critical +// components in life support devices or systems without express written approval of +// NVIDIA Corporation. +// +// Copyright (c) 2017 NVIDIA Corporation. All rights reserved. + #pragma once #include "DTOMacros.h" #include "NvBlastTkAsset.h" -#include "generated/NvBlastExtSerialization.capn.h" -#include "PxCooking.h" +#include "generated/NvBlastExtTkSerialization.capn.h" DTO_CLASS(TkAssetJointDesc, Nv::Blast::TkAssetJointDesc, Nv::Blast::Serialization::TkAssetJointDesc) |