aboutsummaryrefslogtreecommitdiff
path: root/tools/common
diff options
context:
space:
mode:
Diffstat (limited to 'tools/common')
-rwxr-xr-x[-rw-r--r--]tools/common/BlastDataExporter.cpp282
-rwxr-xr-x[-rw-r--r--]tools/common/BlastDataExporter.h198
-rwxr-xr-x[-rw-r--r--]tools/common/Log.cpp174
-rwxr-xr-x[-rw-r--r--]tools/common/Log.h300
-rwxr-xr-x[-rw-r--r--]tools/common/Utils.cpp388
-rwxr-xr-x[-rw-r--r--]tools/common/Utils.h282
6 files changed, 812 insertions, 812 deletions
diff --git a/tools/common/BlastDataExporter.cpp b/tools/common/BlastDataExporter.cpp
index 3ffffb1..2f88476 100644..100755
--- a/tools/common/BlastDataExporter.cpp
+++ b/tools/common/BlastDataExporter.cpp
@@ -1,141 +1,141 @@
-// 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) 2018 NVIDIA Corporation. All rights reserved.
-
-
-#include "BlastDataExporter.h"
-#include "NvBlastExtPxManager.h"
-#include <NvBlastExtAuthoringCollisionBuilder.h>
-#include "NvBlastExtSerialization.h"
-#include "NvBlastExtLlSerialization.h"
-#include "NvBlastExtTkSerialization.h"
-#include "NvBlastExtPxSerialization.h"
-#include <Log.h>
-#include "PsFileBuffer.h"
-#include "NvBlastExtPxAsset.h"
-#include "NvBlast.h"
-#include "NvBlastGlobals.h"
-#include <NvBlastTkAsset.h>
-#include <fstream>
-using namespace Nv::Blast;
-
-
-BlastDataExporter::BlastDataExporter(TkFramework* framework, physx::PxPhysics* physics, physx::PxCooking* cooking) : mFramework(framework)
-{
- mSerialization = NvBlastExtSerializationCreate();
- if (mSerialization != nullptr && physics != nullptr && cooking != nullptr && framework != nullptr)
- {
- NvBlastExtTkSerializerLoadSet(*framework, *mSerialization);
- NvBlastExtPxSerializerLoadSet(*framework, *physics, *cooking, *mSerialization);
- mSerialization->setSerializationEncoding(NVBLAST_FOURCC('C', 'P', 'N', 'B'));
- }
-}
-
-
-BlastDataExporter::~BlastDataExporter()
-{
- if (mSerialization != nullptr)
- {
- mSerialization->release();
- }
-}
-
-
-ExtPxAsset* BlastDataExporter::createExtBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs,
- std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks)
-{
- ExtPxAssetDesc descriptor;
- descriptor.bondCount = static_cast<uint32_t>(bondDescs.size());
- descriptor.bondDescs = bondDescs.data();
- descriptor.chunkCount = static_cast<uint32_t>(chunkDescs.size());
- descriptor.chunkDescs = chunkDescs.data();
- descriptor.bondFlags = nullptr;
- descriptor.pxChunks = physicsChunks.data();
- ExtPxAsset* asset = ExtPxAsset::create(descriptor, *mFramework);
- return asset;
-}
-
-
-NvBlastAsset* BlastDataExporter::createLlBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs)
-{
- NvBlastAssetDesc assetDesc;
- assetDesc.bondCount = static_cast<uint32_t>(bondDescs.size());
- assetDesc.bondDescs = bondDescs.data();
-
- assetDesc.chunkCount = static_cast<uint32_t>(chunkDescs.size());
- assetDesc.chunkDescs = chunkDescs.data();
-
- std::vector<uint8_t> scratch(static_cast<unsigned int>(NvBlastGetRequiredScratchForCreateAsset(&assetDesc, logLL)));
- void* mem = NVBLAST_ALLOC(NvBlastGetAssetMemorySize(&assetDesc, logLL));
- NvBlastAsset* asset = NvBlastCreateAsset(mem, &assetDesc, scratch.data(), logLL);
- return asset;
-}
-
-
-TkAsset* BlastDataExporter::createTkBlastAsset(const std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs)
-{
- TkAssetDesc desc;
- desc.bondCount = static_cast<uint32_t>(bondDescs.size());
- desc.bondDescs = bondDescs.data();
- desc.chunkCount = static_cast<uint32_t>(chunkDescs.size());
- desc.chunkDescs = chunkDescs.data();
- desc.bondFlags = nullptr;
- TkAsset* asset = mFramework->createAsset(desc);
- return asset;
-};
-
-
-bool BlastDataExporter::saveBlastObject(const std::string& outputDir, const std::string& objectName, const void* object, uint32_t objectTypeID)
-{
- void* buffer;
- const uint64_t bufferSize = mSerialization->serializeIntoBuffer(buffer, object, objectTypeID);
- if (bufferSize == 0)
- {
- std::cerr << "saveBlastObject: Serialization failed.\n";
- return false;
- }
-
- physx::PsFileBuffer fileBuf((outputDir + "/" + objectName + ".blast").c_str(), physx::PxFileBuf::OPEN_WRITE_ONLY);
- bool result = fileBuf.isOpen();
-
- if (!result)
- {
- std::cerr << "Can't open output buffer.\n";
- }
- else
- {
- result = (bufferSize == (size_t)fileBuf.write(buffer, (uint32_t)bufferSize));
- if (!result)
- {
- std::cerr << "Buffer write failed.\n";
- }
- fileBuf.close();
- }
-
- NVBLAST_FREE(buffer);
-
- return result;
-};
+// 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) 2018 NVIDIA Corporation. All rights reserved.
+
+
+#include "BlastDataExporter.h"
+#include "NvBlastExtPxManager.h"
+#include <NvBlastExtAuthoringCollisionBuilder.h>
+#include "NvBlastExtSerialization.h"
+#include "NvBlastExtLlSerialization.h"
+#include "NvBlastExtTkSerialization.h"
+#include "NvBlastExtPxSerialization.h"
+#include <Log.h>
+#include "PsFileBuffer.h"
+#include "NvBlastExtPxAsset.h"
+#include "NvBlast.h"
+#include "NvBlastGlobals.h"
+#include <NvBlastTkAsset.h>
+#include <fstream>
+using namespace Nv::Blast;
+
+
+BlastDataExporter::BlastDataExporter(TkFramework* framework, physx::PxPhysics* physics, physx::PxCooking* cooking) : mFramework(framework)
+{
+ mSerialization = NvBlastExtSerializationCreate();
+ if (mSerialization != nullptr && physics != nullptr && cooking != nullptr && framework != nullptr)
+ {
+ NvBlastExtTkSerializerLoadSet(*framework, *mSerialization);
+ NvBlastExtPxSerializerLoadSet(*framework, *physics, *cooking, *mSerialization);
+ mSerialization->setSerializationEncoding(NVBLAST_FOURCC('C', 'P', 'N', 'B'));
+ }
+}
+
+
+BlastDataExporter::~BlastDataExporter()
+{
+ if (mSerialization != nullptr)
+ {
+ mSerialization->release();
+ }
+}
+
+
+ExtPxAsset* BlastDataExporter::createExtBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs,
+ std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks)
+{
+ ExtPxAssetDesc descriptor;
+ descriptor.bondCount = static_cast<uint32_t>(bondDescs.size());
+ descriptor.bondDescs = bondDescs.data();
+ descriptor.chunkCount = static_cast<uint32_t>(chunkDescs.size());
+ descriptor.chunkDescs = chunkDescs.data();
+ descriptor.bondFlags = nullptr;
+ descriptor.pxChunks = physicsChunks.data();
+ ExtPxAsset* asset = ExtPxAsset::create(descriptor, *mFramework);
+ return asset;
+}
+
+
+NvBlastAsset* BlastDataExporter::createLlBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs)
+{
+ NvBlastAssetDesc assetDesc;
+ assetDesc.bondCount = static_cast<uint32_t>(bondDescs.size());
+ assetDesc.bondDescs = bondDescs.data();
+
+ assetDesc.chunkCount = static_cast<uint32_t>(chunkDescs.size());
+ assetDesc.chunkDescs = chunkDescs.data();
+
+ std::vector<uint8_t> scratch(static_cast<unsigned int>(NvBlastGetRequiredScratchForCreateAsset(&assetDesc, logLL)));
+ void* mem = NVBLAST_ALLOC(NvBlastGetAssetMemorySize(&assetDesc, logLL));
+ NvBlastAsset* asset = NvBlastCreateAsset(mem, &assetDesc, scratch.data(), logLL);
+ return asset;
+}
+
+
+TkAsset* BlastDataExporter::createTkBlastAsset(const std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs)
+{
+ TkAssetDesc desc;
+ desc.bondCount = static_cast<uint32_t>(bondDescs.size());
+ desc.bondDescs = bondDescs.data();
+ desc.chunkCount = static_cast<uint32_t>(chunkDescs.size());
+ desc.chunkDescs = chunkDescs.data();
+ desc.bondFlags = nullptr;
+ TkAsset* asset = mFramework->createAsset(desc);
+ return asset;
+};
+
+
+bool BlastDataExporter::saveBlastObject(const std::string& outputDir, const std::string& objectName, const void* object, uint32_t objectTypeID)
+{
+ void* buffer;
+ const uint64_t bufferSize = mSerialization->serializeIntoBuffer(buffer, object, objectTypeID);
+ if (bufferSize == 0)
+ {
+ std::cerr << "saveBlastObject: Serialization failed.\n";
+ return false;
+ }
+
+ physx::PsFileBuffer fileBuf((outputDir + "/" + objectName + ".blast").c_str(), physx::PxFileBuf::OPEN_WRITE_ONLY);
+ bool result = fileBuf.isOpen();
+
+ if (!result)
+ {
+ std::cerr << "Can't open output buffer.\n";
+ }
+ else
+ {
+ result = (bufferSize == (size_t)fileBuf.write(buffer, (uint32_t)bufferSize));
+ if (!result)
+ {
+ std::cerr << "Buffer write failed.\n";
+ }
+ fileBuf.close();
+ }
+
+ NVBLAST_FREE(buffer);
+
+ return result;
+};
diff --git a/tools/common/BlastDataExporter.h b/tools/common/BlastDataExporter.h
index f3cae31..54e2bbf 100644..100755
--- a/tools/common/BlastDataExporter.h
+++ b/tools/common/BlastDataExporter.h
@@ -1,100 +1,100 @@
-// 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) 2018 NVIDIA Corporation. All rights reserved.
-
-
-#ifndef BLAST_DATA_EXPORTER
-#define BLAST_DATA_EXPORTER
-
-
-#include <NvBlastIndexFns.h>
-#include <NvBlastExtAuthoringTypes.h>
-#include <NvBlastExtPxAsset.h>
-#include <vector>
-#include <string>
-
-using namespace Nv::Blast;
-
-namespace physx
-{
-class PxPhysics;
-class PxCooking;
-}
-
-
-struct NvBlastBondDesc;
-struct NvBlastChunkDesc;
-
-struct NvBlastAsset;
-namespace Nv
-{
-namespace Blast
-{
-class TkAsset;
-class ExtPxAsset;
-class ExtSerialization;
-}
-}
-
-
-/**
- Tool for Blast asset creation and exporting
-*/
-class BlastDataExporter
-{
-public:
- BlastDataExporter(TkFramework* framework, physx::PxPhysics* physics, physx::PxCooking* cooking);
- ~BlastDataExporter();
-
- /**
- Creates ExtPxAsset
- */
- ExtPxAsset* createExtBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs,
- std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks);
- /**
- Creates Low Level Blast asset
- */
- NvBlastAsset* createLlBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs);
-
- /**
- Creates Blast Toolkit Asset asset
- */
- TkAsset* createTkBlastAsset(const std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs);
-
- /*
- Saves a Blast object to given path
- */
- bool saveBlastObject(const std::string& outputDir, const std::string& objectName, const void* object, uint32_t objectTypeID);
-
-private:
- TkFramework* mFramework;
- ExtSerialization* mSerialization;
-};
-
-
-
-
+// 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) 2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef BLAST_DATA_EXPORTER
+#define BLAST_DATA_EXPORTER
+
+
+#include <NvBlastIndexFns.h>
+#include <NvBlastExtAuthoringTypes.h>
+#include <NvBlastExtPxAsset.h>
+#include <vector>
+#include <string>
+
+using namespace Nv::Blast;
+
+namespace physx
+{
+class PxPhysics;
+class PxCooking;
+}
+
+
+struct NvBlastBondDesc;
+struct NvBlastChunkDesc;
+
+struct NvBlastAsset;
+namespace Nv
+{
+namespace Blast
+{
+class TkAsset;
+class ExtPxAsset;
+class ExtSerialization;
+}
+}
+
+
+/**
+ Tool for Blast asset creation and exporting
+*/
+class BlastDataExporter
+{
+public:
+ BlastDataExporter(TkFramework* framework, physx::PxPhysics* physics, physx::PxCooking* cooking);
+ ~BlastDataExporter();
+
+ /**
+ Creates ExtPxAsset
+ */
+ ExtPxAsset* createExtBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs,
+ std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks);
+ /**
+ Creates Low Level Blast asset
+ */
+ NvBlastAsset* createLlBlastAsset(std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs);
+
+ /**
+ Creates Blast Toolkit Asset asset
+ */
+ TkAsset* createTkBlastAsset(const std::vector<NvBlastBondDesc>& bondDescs, const std::vector<NvBlastChunkDesc>& chunkDescs);
+
+ /*
+ Saves a Blast object to given path
+ */
+ bool saveBlastObject(const std::string& outputDir, const std::string& objectName, const void* object, uint32_t objectTypeID);
+
+private:
+ TkFramework* mFramework;
+ ExtSerialization* mSerialization;
+};
+
+
+
+
#endif \ No newline at end of file
diff --git a/tools/common/Log.cpp b/tools/common/Log.cpp
index 0d4c8f7..57a25b4 100644..100755
--- a/tools/common/Log.cpp
+++ b/tools/common/Log.cpp
@@ -1,87 +1,87 @@
-// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
-
-
-#include "Log.h"
-
-#include "PsString.h"
-
-#include <iomanip>
-#include <stdarg.h>
-#include <stdio.h>
-
-///////////////////////////////////////////////////////////////////////////
-
-namespace Nv
-{
-namespace Blast
-{
-
-void fLogf(const char* format, ...)
-{
- char buf[4096], *p = buf;
- va_list args;
- int n;
-
- va_start(args, format);
- //n = _vsnprintf(p, sizeof buf - 3, format, args);
- n = vsprintf_s(p, sizeof(buf)-3, format, args);
- va_end(args);
-
- p += (n < 0) ? sizeof buf - 3 : n;
-
- while (p > buf && isspace((unsigned char)p[-1]))
- {
- *--p = '\0';
- }
-
- *p++ = '\r';
- *p++ = '\n';
- *p = '\0';
-
- fLog(buf, Log::TYPE_INFO);
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-void Log::flushDeferredMessages()
-{
- if (mDeferredMessages.size() == 0) return;
-
- std::cout << std::endl;
- for (std::vector<std::string>::iterator it = mDeferredMessages.begin(); it != mDeferredMessages.end(); ++it)
- {
- log(*it, mMinVerbosity);
- }
- mDeferredMessages.clear();
-}
-
-
-
-} // namespace Blast
-} // namespace Nv
+// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#include "Log.h"
+
+#include "PsString.h"
+
+#include <iomanip>
+#include <stdarg.h>
+#include <stdio.h>
+
+///////////////////////////////////////////////////////////////////////////
+
+namespace Nv
+{
+namespace Blast
+{
+
+void fLogf(const char* format, ...)
+{
+ char buf[4096], *p = buf;
+ va_list args;
+ int n;
+
+ va_start(args, format);
+ //n = _vsnprintf(p, sizeof buf - 3, format, args);
+ n = vsprintf_s(p, sizeof(buf)-3, format, args);
+ va_end(args);
+
+ p += (n < 0) ? sizeof buf - 3 : n;
+
+ while (p > buf && isspace((unsigned char)p[-1]))
+ {
+ *--p = '\0';
+ }
+
+ *p++ = '\r';
+ *p++ = '\n';
+ *p = '\0';
+
+ fLog(buf, Log::TYPE_INFO);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+void Log::flushDeferredMessages()
+{
+ if (mDeferredMessages.size() == 0) return;
+
+ std::cout << std::endl;
+ for (std::vector<std::string>::iterator it = mDeferredMessages.begin(); it != mDeferredMessages.end(); ++it)
+ {
+ log(*it, mMinVerbosity);
+ }
+ mDeferredMessages.clear();
+}
+
+
+
+} // namespace Blast
+} // namespace Nv
diff --git a/tools/common/Log.h b/tools/common/Log.h
index 8df9660..588c32b 100644..100755
--- a/tools/common/Log.h
+++ b/tools/common/Log.h
@@ -1,150 +1,150 @@
-// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
-
-
-#ifndef LOG_H
-#define LOG_H
-
-#include "Utils.h"
-#include "PxVec3.h"
-
-#include <sstream>
-
-namespace Nv
-{
-namespace Blast
-{
-
-
-//////////////////////////////////////////////////////////////////////////////
-
-void fLogf(const char* format, ...);
-
-class Log : public Singleton<Log>
-{
- friend class Singleton<Log>;
-
-public:
-
- enum MessageType {
- TYPE_INFO = 0,
- TYPE_WARNING,
- TYPE_ERROR,
- TYPE_DEFERRED,
-
- NUM_TYPES,
- MOST_VERBOSE = TYPE_INFO,
- LEAST_VERBOSE = TYPE_ERROR
-#if defined(_DEBUG)
- , DEFAULT_VERBOSITY = MOST_VERBOSE
-#else
- , DEFAULT_VERBOSITY = LEAST_VERBOSE
-#endif
- };
- typedef MessageType Verbosity;
-
- ///////////////////////////////////////////////////////////////////////////
-
- template<typename T>
- Log& log(const T& value, MessageType messageType);
-
- void flushDeferredMessages();
-
- ///////////////////////////////////////////////////////////////////////////
-
- void setCurrentVerbosity(Verbosity verbosity) { mCurrentVerbosity = verbosity; }
- Verbosity getCurrentVerbosity() const { return mCurrentVerbosity; }
-
- // Messages types below this level will be ignored
- void setMinVerbosity(Verbosity verbosity) { mMinVerbosity = verbosity; }
- Verbosity getMinVerbosity() const { return mMinVerbosity; }
-
- ///////////////////////////////////////////////////////////////////////////
-
-protected:
- Log(MessageType verbosity = DEFAULT_VERBOSITY)
- : mCurrentVerbosity(LEAST_VERBOSE),
- mMinVerbosity(verbosity) { }
-
-private:
- Verbosity mCurrentVerbosity;
- Verbosity mMinVerbosity;
- std::vector<std::string> mDeferredMessages;
-};
-
-///////////////////////////////////////////////////////////////////////////
-
-PX_INLINE std::ostream& operator<< (std::ostream& stream, const physx::PxVec3& vec)
-{
- return stream << "(" << vec.x << ", " << vec.y << ", " << vec.z << ")";
-}
-
-template<typename T>
-Log& Log::log(const T& value, Log::MessageType messageType)
-{
- if (TYPE_DEFERRED == messageType)
- {
- std::stringstream ss;
- ss << value;
- mDeferredMessages.push_back(ss.str());
- }
- else if(mMinVerbosity <= messageType)
- {
- std::cout << value;
- }
- return *this;
-}
-
-PX_INLINE Log& lout() { return Log::instance(); }
-
-template <typename T>
-PX_INLINE void fLog(const T& value, Log::MessageType messageType = Log::TYPE_INFO)
-{
- lout().log<T>(value, messageType);
-}
-template <typename T>
-PX_INLINE Log& operator<<(Log& logger, const T& value)
-{
- return logger.log<T>(value, logger.getCurrentVerbosity());
-}
-PX_INLINE Log& operator<<(Log& logger, Log::MessageType verbosity)
-{
- logger.setCurrentVerbosity(verbosity);
- return logger;
-}
-typedef std::ostream& (*ostream_manipulator)(std::ostream&);
-PX_INLINE Log& operator<<(Log& logger, ostream_manipulator pf)
-{
- return operator<< <ostream_manipulator> (logger, pf);
-}
-
-
-} // namespace Blast
-} // namespace Nv
-
-
-#endif
+// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef LOG_H
+#define LOG_H
+
+#include "Utils.h"
+#include "PxVec3.h"
+
+#include <sstream>
+
+namespace Nv
+{
+namespace Blast
+{
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+void fLogf(const char* format, ...);
+
+class Log : public Singleton<Log>
+{
+ friend class Singleton<Log>;
+
+public:
+
+ enum MessageType {
+ TYPE_INFO = 0,
+ TYPE_WARNING,
+ TYPE_ERROR,
+ TYPE_DEFERRED,
+
+ NUM_TYPES,
+ MOST_VERBOSE = TYPE_INFO,
+ LEAST_VERBOSE = TYPE_ERROR
+#if defined(_DEBUG)
+ , DEFAULT_VERBOSITY = MOST_VERBOSE
+#else
+ , DEFAULT_VERBOSITY = LEAST_VERBOSE
+#endif
+ };
+ typedef MessageType Verbosity;
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ template<typename T>
+ Log& log(const T& value, MessageType messageType);
+
+ void flushDeferredMessages();
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ void setCurrentVerbosity(Verbosity verbosity) { mCurrentVerbosity = verbosity; }
+ Verbosity getCurrentVerbosity() const { return mCurrentVerbosity; }
+
+ // Messages types below this level will be ignored
+ void setMinVerbosity(Verbosity verbosity) { mMinVerbosity = verbosity; }
+ Verbosity getMinVerbosity() const { return mMinVerbosity; }
+
+ ///////////////////////////////////////////////////////////////////////////
+
+protected:
+ Log(MessageType verbosity = DEFAULT_VERBOSITY)
+ : mCurrentVerbosity(LEAST_VERBOSE),
+ mMinVerbosity(verbosity) { }
+
+private:
+ Verbosity mCurrentVerbosity;
+ Verbosity mMinVerbosity;
+ std::vector<std::string> mDeferredMessages;
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+PX_INLINE std::ostream& operator<< (std::ostream& stream, const physx::PxVec3& vec)
+{
+ return stream << "(" << vec.x << ", " << vec.y << ", " << vec.z << ")";
+}
+
+template<typename T>
+Log& Log::log(const T& value, Log::MessageType messageType)
+{
+ if (TYPE_DEFERRED == messageType)
+ {
+ std::stringstream ss;
+ ss << value;
+ mDeferredMessages.push_back(ss.str());
+ }
+ else if(mMinVerbosity <= messageType)
+ {
+ std::cout << value;
+ }
+ return *this;
+}
+
+PX_INLINE Log& lout() { return Log::instance(); }
+
+template <typename T>
+PX_INLINE void fLog(const T& value, Log::MessageType messageType = Log::TYPE_INFO)
+{
+ lout().log<T>(value, messageType);
+}
+template <typename T>
+PX_INLINE Log& operator<<(Log& logger, const T& value)
+{
+ return logger.log<T>(value, logger.getCurrentVerbosity());
+}
+PX_INLINE Log& operator<<(Log& logger, Log::MessageType verbosity)
+{
+ logger.setCurrentVerbosity(verbosity);
+ return logger;
+}
+typedef std::ostream& (*ostream_manipulator)(std::ostream&);
+PX_INLINE Log& operator<<(Log& logger, ostream_manipulator pf)
+{
+ return operator<< <ostream_manipulator> (logger, pf);
+}
+
+
+} // namespace Blast
+} // namespace Nv
+
+
+#endif
diff --git a/tools/common/Utils.cpp b/tools/common/Utils.cpp
index d42ed81..8355f48 100644..100755
--- a/tools/common/Utils.cpp
+++ b/tools/common/Utils.cpp
@@ -1,194 +1,194 @@
-// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
-
-
-#include "Utils.h"
-
-#include "Log.h"
-
-#include <string.h>
-
-#if PX_WINDOWS_FAMILY
-#include <direct.h>
-#define getCwd _getcwd
-#else
-#include <unistd.h>
-#define getCwd getcwd
-#endif
-
-///////////////////////////////////////////////////////////////////////////
-
-namespace Nv
-{
-namespace Blast
-{
-
-//////////////////////////////////////////////////////////////////////////////
-
-static void addSlashToPath(std::string& path)
-{
- if (path[path.length() - 1] != '/' && path[path.length() - 1] != '\\')
- {
- path.append("/");
- }
-}
-
-FileUtils::FileUtils()
-{
- mSearchPaths.push_back("");
- char currentPathTemp[FILENAME_MAX];
- if (getCwd(currentPathTemp, sizeof(currentPathTemp)))
- {
- std::string currentPath(currentPathTemp);
- addSlashToPath(currentPath);
- addAbsolutePath(currentPath);
- mCurrentPath = currentPath;
- }
-}
-
-std::string FileUtils::getDirectory(const std::string& filePath)
-{
- return filePath.substr(0, filePath.find_last_of("/\\") + 1);
-}
-
-std::string FileUtils::getFilename(const std::string& filePath, bool bWithExtension)
-{
- size_t p0 = filePath.find_last_of("/\\") + 1;
- if (bWithExtension)
- {
- return filePath.substr(p0);
- }
- else
- {
- return filePath.substr(p0, filePath.find_last_of(".") - p0);
- }
-}
-
-std::string FileUtils::getFileExtension(const std::string& filePath)
-{
- std::string filename = getFilename(filePath);
- size_t p0 = filename.find_last_of(".");
- if (p0 != std::string::npos)
- return filePath.substr(p0);// + 1);
- return "";
-}
-
-void FileUtils::addAbsolutePath(const std::string& path)
-{
- if (path.empty())
- {
- return;
- }
-
- std::string newPath = path;
- addSlashToPath(newPath);
-
- mSearchPaths.push_back(newPath);
-}
-
-void FileUtils::addRelativePath(const std::string& relPath)
-{
- addAbsolutePath(mCurrentPath + relPath);
-}
-
-void FileUtils::clearPaths()
-{
- mSearchPaths.clear();
-}
-
-FILE* FileUtils::findFile(const std::string& path, bool bVerbose)
-{
- FILE* file;
- if (find(path, &file, NULL, bVerbose))
- {
- return file;
- }
- else
- {
- return NULL;
- }
-}
-
-std::string FileUtils::findPath(const std::string& path, bool bVerbose)
-{
- std::string fullPath;
- if (find(path, NULL, &fullPath, bVerbose))
- {
- return fullPath;
- }
- else
- {
- return path;
- }
-}
-
-bool FileUtils::find(const std::string& path, FILE** ppFile, std::string* pFullPath, bool bVerbose)
-{
- if (mSearchPaths.empty() || path.empty())
- {
- if (bVerbose)
- {
- lout() << Log::TYPE_ERROR << "Error: Invalid search path configuration.";
- }
- return false;
- }
-
- std::string fullPath;
-
- FILE* file = NULL;
- const uint32_t numSearchPaths = (uint32_t)mSearchPaths.size();
- for (uint32_t i = 0; i < numSearchPaths; ++i)
- {
- fullPath = mSearchPaths[i] + path;
- fopen_s(&file, fullPath.c_str(), "rb");
- if (file)
- {
- break;
- }
- }
-
- if (!file)
- {
- if (bVerbose)
- lout() << Log::TYPE_ERROR << std::endl << "Error: Unable to find file " << path << std::endl;
- return false;
- }
-
- if (ppFile)
- *ppFile = file;
- else
- fclose(file);
-
- if (pFullPath)
- *pFullPath = fullPath;
-
- return true;
-}
-
-
-} // namespace Blast
-} // namespace Nv
+// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#include "Utils.h"
+
+#include "Log.h"
+
+#include <string.h>
+
+#if PX_WINDOWS_FAMILY
+#include <direct.h>
+#define getCwd _getcwd
+#else
+#include <unistd.h>
+#define getCwd getcwd
+#endif
+
+///////////////////////////////////////////////////////////////////////////
+
+namespace Nv
+{
+namespace Blast
+{
+
+//////////////////////////////////////////////////////////////////////////////
+
+static void addSlashToPath(std::string& path)
+{
+ if (path[path.length() - 1] != '/' && path[path.length() - 1] != '\\')
+ {
+ path.append("/");
+ }
+}
+
+FileUtils::FileUtils()
+{
+ mSearchPaths.push_back("");
+ char currentPathTemp[FILENAME_MAX];
+ if (getCwd(currentPathTemp, sizeof(currentPathTemp)))
+ {
+ std::string currentPath(currentPathTemp);
+ addSlashToPath(currentPath);
+ addAbsolutePath(currentPath);
+ mCurrentPath = currentPath;
+ }
+}
+
+std::string FileUtils::getDirectory(const std::string& filePath)
+{
+ return filePath.substr(0, filePath.find_last_of("/\\") + 1);
+}
+
+std::string FileUtils::getFilename(const std::string& filePath, bool bWithExtension)
+{
+ size_t p0 = filePath.find_last_of("/\\") + 1;
+ if (bWithExtension)
+ {
+ return filePath.substr(p0);
+ }
+ else
+ {
+ return filePath.substr(p0, filePath.find_last_of(".") - p0);
+ }
+}
+
+std::string FileUtils::getFileExtension(const std::string& filePath)
+{
+ std::string filename = getFilename(filePath);
+ size_t p0 = filename.find_last_of(".");
+ if (p0 != std::string::npos)
+ return filePath.substr(p0);// + 1);
+ return "";
+}
+
+void FileUtils::addAbsolutePath(const std::string& path)
+{
+ if (path.empty())
+ {
+ return;
+ }
+
+ std::string newPath = path;
+ addSlashToPath(newPath);
+
+ mSearchPaths.push_back(newPath);
+}
+
+void FileUtils::addRelativePath(const std::string& relPath)
+{
+ addAbsolutePath(mCurrentPath + relPath);
+}
+
+void FileUtils::clearPaths()
+{
+ mSearchPaths.clear();
+}
+
+FILE* FileUtils::findFile(const std::string& path, bool bVerbose)
+{
+ FILE* file;
+ if (find(path, &file, NULL, bVerbose))
+ {
+ return file;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+std::string FileUtils::findPath(const std::string& path, bool bVerbose)
+{
+ std::string fullPath;
+ if (find(path, NULL, &fullPath, bVerbose))
+ {
+ return fullPath;
+ }
+ else
+ {
+ return path;
+ }
+}
+
+bool FileUtils::find(const std::string& path, FILE** ppFile, std::string* pFullPath, bool bVerbose)
+{
+ if (mSearchPaths.empty() || path.empty())
+ {
+ if (bVerbose)
+ {
+ lout() << Log::TYPE_ERROR << "Error: Invalid search path configuration.";
+ }
+ return false;
+ }
+
+ std::string fullPath;
+
+ FILE* file = NULL;
+ const uint32_t numSearchPaths = (uint32_t)mSearchPaths.size();
+ for (uint32_t i = 0; i < numSearchPaths; ++i)
+ {
+ fullPath = mSearchPaths[i] + path;
+ fopen_s(&file, fullPath.c_str(), "rb");
+ if (file)
+ {
+ break;
+ }
+ }
+
+ if (!file)
+ {
+ if (bVerbose)
+ lout() << Log::TYPE_ERROR << std::endl << "Error: Unable to find file " << path << std::endl;
+ return false;
+ }
+
+ if (ppFile)
+ *ppFile = file;
+ else
+ fclose(file);
+
+ if (pFullPath)
+ *pFullPath = fullPath;
+
+ return true;
+}
+
+
+} // namespace Blast
+} // namespace Nv
diff --git a/tools/common/Utils.h b/tools/common/Utils.h
index 5d01480..8eb3530 100644..100755
--- a/tools/common/Utils.h
+++ b/tools/common/Utils.h
@@ -1,141 +1,141 @@
-// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
-
-
-#ifndef UTILS_H
-#define UTILS_H
-
-#include "PsString.h"
-
-#include <string>
-#include <iostream>
-#include <vector>
-#include <map>
-
-//////////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace Nv
-{
-namespace Blast
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-template<class T>
-PX_INLINE bool isNull(const T* p) { return nullptr == p; }
-
-template<class Releasable, class Releaser> class ScopedResource;
-template<class Releasable, class Releaser>
-PX_INLINE bool isNull(const ScopedResource<Releasable,Releaser>& p) { return !p; }
-
-PX_INLINE bool isNullString(const char* pString)
-{
- return (nullptr == pString || pString[0] == '\0' || physx::shdfnd::strcmp(pString, "null") == 0);
-}
-
-template<class T>
-PX_INLINE bool isValid(const T& p) { return !isNull(p.get()); }
-
-PX_INLINE bool isValidString(const char* pString) { return !isNullString(pString); }
-
-///////////////////////////////////////////////////////////////////////////
-
-// Note: This is not a thread safe singleton class
-template <class T>
-class Singleton
-{
- // The fact that I cannot declare T a friend directly is rather absurd...
- typedef T Type;
- friend typename Singleton<T>::Type;
-
- //////////////////////////////////////////////////////////////////////////////
-
-public:
- static T& instance()
- {
- static T _instance;
- return _instance;
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
-private:
- Singleton() { }
- ~Singleton() { };
- Singleton(const Singleton&);
- Singleton& operator=(const Singleton&);
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-class FileUtils : public Singleton<FileUtils>
-{
- friend class Singleton<FileUtils>;
-
-public:
- void addAbsolutePath(const std::string&);
- void addRelativePath(const std::string&);
- void clearPaths();
-
- //////////////////////////////////////////////////////////////////////////////
-
- FILE* findFile(const std::string&, bool bVerbose = true);
- std::string findPath(const std::string&, bool bVerbose = true);
- bool find(const std::string&, FILE**, std::string*, bool bVerbose = true);
-
- //////////////////////////////////////////////////////////////////////////////
-
- const std::string& getCurrentPath() const
- {
- return mCurrentPath;
- }
-
- //////////////////////////////////////////////////////////////////////////////
-
- static std::string getDirectory(const std::string&);
- static std::string getFilename(const std::string&, bool bWithExtension = true);
- static std::string getFileExtension(const std::string&);
-
- //////////////////////////////////////////////////////////////////////////////
-
-protected:
- FileUtils();
-
- //////////////////////////////////////////////////////////////////////////////
-
- std::string mCurrentPath;
- std::vector<std::string> mSearchPaths;
-};
-
-
-} // namespace Blast
-} // namespace Nv
-
-
-#endif
+// 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) 2016-2018 NVIDIA Corporation. All rights reserved.
+
+
+#ifndef UTILS_H
+#define UTILS_H
+
+#include "PsString.h"
+
+#include <string>
+#include <iostream>
+#include <vector>
+#include <map>
+
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace Nv
+{
+namespace Blast
+{
+
+///////////////////////////////////////////////////////////////////////////
+
+template<class T>
+PX_INLINE bool isNull(const T* p) { return nullptr == p; }
+
+template<class Releasable, class Releaser> class ScopedResource;
+template<class Releasable, class Releaser>
+PX_INLINE bool isNull(const ScopedResource<Releasable,Releaser>& p) { return !p; }
+
+PX_INLINE bool isNullString(const char* pString)
+{
+ return (nullptr == pString || pString[0] == '\0' || physx::shdfnd::strcmp(pString, "null") == 0);
+}
+
+template<class T>
+PX_INLINE bool isValid(const T& p) { return !isNull(p.get()); }
+
+PX_INLINE bool isValidString(const char* pString) { return !isNullString(pString); }
+
+///////////////////////////////////////////////////////////////////////////
+
+// Note: This is not a thread safe singleton class
+template <class T>
+class Singleton
+{
+ // The fact that I cannot declare T a friend directly is rather absurd...
+ typedef T Type;
+ friend typename Singleton<T>::Type;
+
+ //////////////////////////////////////////////////////////////////////////////
+
+public:
+ static T& instance()
+ {
+ static T _instance;
+ return _instance;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+
+private:
+ Singleton() { }
+ ~Singleton() { };
+ Singleton(const Singleton&);
+ Singleton& operator=(const Singleton&);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class FileUtils : public Singleton<FileUtils>
+{
+ friend class Singleton<FileUtils>;
+
+public:
+ void addAbsolutePath(const std::string&);
+ void addRelativePath(const std::string&);
+ void clearPaths();
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ FILE* findFile(const std::string&, bool bVerbose = true);
+ std::string findPath(const std::string&, bool bVerbose = true);
+ bool find(const std::string&, FILE**, std::string*, bool bVerbose = true);
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ const std::string& getCurrentPath() const
+ {
+ return mCurrentPath;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ static std::string getDirectory(const std::string&);
+ static std::string getFilename(const std::string&, bool bWithExtension = true);
+ static std::string getFileExtension(const std::string&);
+
+ //////////////////////////////////////////////////////////////////////////////
+
+protected:
+ FileUtils();
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ std::string mCurrentPath;
+ std::vector<std::string> mSearchPaths;
+};
+
+
+} // namespace Blast
+} // namespace Nv
+
+
+#endif