aboutsummaryrefslogtreecommitdiff
path: root/sdk/extensions/converter/source/conversion/NvBlastExtDataConverter.cpp
diff options
context:
space:
mode:
authorAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
committerAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
commit236f03c0b9a4982328ed1201978f7f69d192d9b2 (patch)
treee486f2fa39dba203563895541e92c60ed3e25759 /sdk/extensions/converter/source/conversion/NvBlastExtDataConverter.cpp
parentAdded screens to welcome page (diff)
downloadblast-236f03c0b9a4982328ed1201978f7f69d192d9b2.tar.xz
blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.zip
Blast 1.1 release (windows / linux)
see docs/release_notes.txt for details
Diffstat (limited to 'sdk/extensions/converter/source/conversion/NvBlastExtDataConverter.cpp')
-rw-r--r--sdk/extensions/converter/source/conversion/NvBlastExtDataConverter.cpp103
1 files changed, 0 insertions, 103 deletions
diff --git a/sdk/extensions/converter/source/conversion/NvBlastExtDataConverter.cpp b/sdk/extensions/converter/source/conversion/NvBlastExtDataConverter.cpp
deleted file mode 100644
index fe8c745..0000000
--- a/sdk/extensions/converter/source/conversion/NvBlastExtDataConverter.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-* Copyright (c) 2016-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.
-*/
-
-#include "NvBlastExtDataConverter.h"
-#include "NvBlastExtBinaryBlockConverter.h"
-
-#include <iostream>
-
-// asset converters
-#include "NvBlastExtAssetBlockVersionConverter_v0_v1.h"
-
-
-namespace Nv
-{
-namespace Blast
-{
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Asset Block Converter
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-NV_INLINE std::vector<BinaryBlockConverter::VersionConverterPtr> getAssetConverters()
-{
- /**
- +==========================================+
- | HINT: ADD NEW VERSION CONVERTERS THERE |
- +==========================================+
- */
- BinaryBlockConverter::VersionConverterPtr converters[] =
- {
- std::make_shared<NvBlastAssetBlockVersionConverter_v0_v1>()
- };
-
- return std::vector<BinaryBlockConverter::VersionConverterPtr>(converters, converters + sizeof(converters) / sizeof(converters[0]));
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Family Converter
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-NV_INLINE std::vector<BinaryBlockConverter::VersionConverterPtr> getFamilyConverters()
-{
- /**
- +==========================================+
- | HINT: ADD NEW VERSION CONVERTERS THERE |
- +==========================================+
- */
- BinaryBlockConverter::VersionConverterPtr converters[] =
- {
- nullptr //std::make_shared<NvBlastFamilyVersionConverter_v0_v1>()
- };
-
- return std::vector<BinaryBlockConverter::VersionConverterPtr>(converters, converters + sizeof(converters) / sizeof(converters[0]));
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Generic Block Converter
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-bool convertDataBlock(std::vector<char>& outBlock, const std::vector<char>& inBlock, uint32_t* outBlockVersion)
-{
- // Pick header to determine dataType and version
- if (inBlock.size() < sizeof(NvBlastDataBlock))
- {
- std::cerr << "Conversion failed: invalid block, passed block is too small." << std::endl;
- return false;
- }
- const NvBlastDataBlock* dataBlock = reinterpret_cast<const NvBlastDataBlock*>(inBlock.data());
-
- // Select appropriate converters and version based on dataType
- std::vector<BinaryBlockConverter::VersionConverterPtr> converters;
- uint32_t version;
- switch (dataBlock->dataType)
- {
- case NvBlastDataBlock::AssetDataBlock:
- std::cout << "Input block dataType: NvBlastDataBlock::Asset" << std::endl;
- converters = getAssetConverters();
- version = (outBlockVersion == nullptr ? static_cast<uint32_t>(NvBlastAssetDataFormat::Current) : *outBlockVersion);
- break;
- case NvBlastDataBlock::FamilyDataBlock:
- std::cout << "Input block dataType: NvBlastDataBlock::Family" << std::endl;
- converters = getFamilyConverters();
- version = (outBlockVersion == nullptr ? static_cast<uint32_t>(NvBlastFamilyDataFormat::Current) : *outBlockVersion);
- break;
- default:
- std::cerr << "Conversion failed: unsupported dataType: " << dataBlock->dataType << std::endl;
- return false;
- }
-
- return BinaryBlockConverter::convertBinaryBlock(outBlock, converters, inBlock, version, dataBlock->formatVersion);
-}
-
-} // namespace Blast
-} // namespace Nv