aboutsummaryrefslogtreecommitdiff
path: root/sdk/toolkit/source/NvBlastTkFrameworkImpl.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/toolkit/source/NvBlastTkFrameworkImpl.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/toolkit/source/NvBlastTkFrameworkImpl.cpp')
-rw-r--r--sdk/toolkit/source/NvBlastTkFrameworkImpl.cpp292
1 files changed, 71 insertions, 221 deletions
diff --git a/sdk/toolkit/source/NvBlastTkFrameworkImpl.cpp b/sdk/toolkit/source/NvBlastTkFrameworkImpl.cpp
index 6201101..f409785 100644
--- a/sdk/toolkit/source/NvBlastTkFrameworkImpl.cpp
+++ b/sdk/toolkit/source/NvBlastTkFrameworkImpl.cpp
@@ -1,12 +1,30 @@
-/*
-* 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.
-*/
+// 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-2017 NVIDIA Corporation. All rights reserved.
+
#include "NvBlastAssert.h"
@@ -18,16 +36,13 @@
#include "NvBlastTkJointImpl.h"
#include "NvBlastTkTypeImpl.h"
-#include "PxAllocatorCallback.h"
-#include "PxErrorCallback.h"
-#include "PxFileBuf.h"
+#include "NvBlastGlobals.h"
#include <algorithm>
using namespace physx;
using namespace physx::shdfnd;
-using namespace physx::general_PxIOStream2;
NV_INLINE bool operator < (const NvBlastID& id1, const NvBlastID& id2)
@@ -83,13 +98,11 @@ bool TkFrameworkImpl::set(TkFrameworkImpl* framework)
{
if (framework != nullptr)
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::set: framework already set. Pass NULL to this function to destroy framework.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::set: framework already set. Pass NULL to this function to destroy framework.");
return false;
}
- PxAllocatorCallback& allocator = s_framework->getAllocatorCallbackInternal();
- s_framework->~TkFrameworkImpl();
- allocator.deallocate(s_framework);
+ NVBLAST_DELETE(s_framework, TkFrameworkImpl);
}
s_framework = framework;
@@ -98,70 +111,11 @@ bool TkFrameworkImpl::set(TkFrameworkImpl* framework)
}
-void TkFrameworkImpl::log(int type, const char* msg, const char* file, int line)
-{
- if (s_framework == nullptr)
- {
- return;
- }
-
- PxErrorCode::Enum pxErrorCode = PxErrorCode::eNO_ERROR;
- switch (type)
- {
- case NvBlastMessage::Error: pxErrorCode = PxErrorCode::eINVALID_OPERATION; break;
- case NvBlastMessage::Warning: pxErrorCode = PxErrorCode::eDEBUG_WARNING; break;
- case NvBlastMessage::Info: pxErrorCode = PxErrorCode::eDEBUG_INFO; break;
- case NvBlastMessage::Debug: pxErrorCode = PxErrorCode::eNO_ERROR; break;
- }
-
- s_framework->getErrorCallback().reportError(pxErrorCode, msg, file, line);
-}
-
-
-void* TkFrameworkImpl::alloc(size_t size)
-{
- if (s_framework == nullptr)
- {
- return nullptr;
- }
-
- NV_COMPILE_TIME_ASSERT(Alignment > 0 && Alignment <= 256);
-
- unsigned char* mem = reinterpret_cast<unsigned char*>(s_framework->m_allocatorCallback->allocate(size + (size_t)Alignment, "NvBlast", __FILE__, __LINE__));
-
- const unsigned char offset = (unsigned char)((uintptr_t)Alignment - (uintptr_t)mem % (size_t)Alignment - 1);
- mem += offset;
- *mem++ = offset;
-
- return mem;
-}
-
-
-void TkFrameworkImpl::free(void* mem)
-{
- if (s_framework == nullptr)
- {
- return;
- }
-
- unsigned char* ptr = reinterpret_cast<unsigned char*>(mem);
- const unsigned char offset = *--ptr;
-
- return s_framework->m_allocatorCallback->deallocate(ptr - offset);
-}
-
-
//////// TkFrameworkImpl methods ////////
-TkFrameworkImpl::TkFrameworkImpl(const TkFrameworkDesc& desc)
+TkFrameworkImpl::TkFrameworkImpl()
: TkFramework()
- , m_errorCallback(desc.errorCallback)
- , m_allocatorCallback(desc.allocatorCallback)
{
- // Static create() function should ensure these pointers are not NULL
- NVBLAST_ASSERT(m_errorCallback != nullptr);
- NVBLAST_ASSERT(m_allocatorCallback != nullptr);
-
// Register types
m_types.resize(TkTypeIndex::TypeCount);
m_objects.resize(TkTypeIndex::TypeCount);
@@ -179,7 +133,7 @@ TkFrameworkImpl::~TkFrameworkImpl()
void TkFrameworkImpl::release()
{
// Special release of joints, which are not TkIdentifiable:
- TkArray<TkJointImpl*>::type joints; // Since the EraseIterator is not exposed
+ Array<TkJointImpl*>::type joints; // Since the EraseIterator is not exposed
joints.reserve(m_joints.size());
for (auto j = m_joints.getIterator(); !j.done(); ++j)
{
@@ -195,75 +149,6 @@ void TkFrameworkImpl::release()
NVBLASTTK_RELEASE_TYPE(Group);
NVBLASTTK_RELEASE_TYPE(Asset);
set(nullptr);
- Nv::Blast::TkAllocator::s_allocatorCallback = nullptr;
-}
-
-
-physx::PxErrorCallback& TkFrameworkImpl::getErrorCallback() const
-{
- return getErrorCallbackInternal();
-}
-
-
-physx::PxAllocatorCallback& TkFrameworkImpl::getAllocatorCallback() const
-{
- return getAllocatorCallbackInternal();
-}
-
-
-NvBlastLog TkFrameworkImpl::getLogFn() const
-{
- return TkFrameworkImpl::log;
-}
-
-
-TkSerializable* TkFrameworkImpl::deserialize(PxFileBuf& stream)
-{
- // Read framework ID
- if (stream.readDword() != ClassID)
- {
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::deserialize: stream does not contain a BlastTk object.");
- return nullptr;
- }
-
- // Read object class ID and get class type data
- const auto it = m_typeIDToIndex.find(stream.readDword());
- if (it == nullptr)
- {
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::deserialize: BlastTk object type unrecognized.");
- return nullptr;
- }
-
- const uint32_t index = (*it).second;
- NVBLAST_ASSERT(index < m_types.size());
-
- const TkTypeImpl* type = m_types[index];
-
- // Read object class version and ensure it's current
- if (stream.readDword() != type->getVersionInternal())
- {
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::deserialize: BlastTk object version does not equal the current version for the loaded type.");
- return nullptr;
- }
-
- // Object ID
- NvBlastID id;
- stream.read(&id, sizeof(NvBlastID));
-
- // Serializable user data
- const uint32_t lsq = stream.readDword();
- const uint32_t msq = stream.readDword();
-
- // All checks out, deserialize
- TkSerializable* object = type->getDeserializeFn()(stream, id);
-
- // Set serializable user data if deserialization was successful
- if (object != nullptr)
- {
- object->userIntData = static_cast<uint64_t>(msq) << 32 | static_cast<uint64_t>(lsq);
- }
-
- return object;
}
@@ -271,7 +156,7 @@ const TkType* TkFrameworkImpl::getType(TkTypeIndex::Enum typeIndex) const
{
if (typeIndex < 0 || typeIndex >= TkTypeIndex::TypeCount)
{
- NVBLASTTK_LOG_WARNING("TkFrameworkImpl::getType: invalid typeIndex.");
+ NVBLAST_LOG_WARNING("TkFrameworkImpl::getType: invalid typeIndex.");
return nullptr;
}
@@ -285,7 +170,7 @@ TkIdentifiable* TkFrameworkImpl::findObjectByID(const NvBlastID& id) const
if (object == nullptr)
{
- NVBLASTTK_LOG_WARNING("TkFrameworkImpl::findObjectByID: object not found.");
+ NVBLAST_LOG_WARNING("TkFrameworkImpl::findObjectByID: object not found.");
}
return object;
@@ -298,7 +183,7 @@ uint32_t TkFrameworkImpl::getObjectCount(const TkType& type) const
if (index >= m_objects.size())
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::getObjectCount: BlastTk object type unrecognized.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::getObjectCount: BlastTk object type unrecognized.");
return 0;
}
@@ -313,7 +198,7 @@ uint32_t TkFrameworkImpl::getObjects(TkIdentifiable** buffer, uint32_t bufferSiz
if (index >= m_objects.size())
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::getObjectCount: BlastTk object type unrecognized.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::getObjectCount: BlastTk object type unrecognized.");
return 0;
}
@@ -322,7 +207,7 @@ uint32_t TkFrameworkImpl::getObjects(TkIdentifiable** buffer, uint32_t bufferSiz
uint32_t objectCount = objectArray.size();
if (objectCount <= indexStart)
{
- NVBLASTTK_LOG_WARNING("TkFrameworkImpl::getObjects: indexStart beyond end of object list.");
+ NVBLAST_LOG_WARNING("TkFrameworkImpl::getObjects: indexStart beyond end of object list.");
return 0;
}
@@ -338,15 +223,15 @@ uint32_t TkFrameworkImpl::getObjects(TkIdentifiable** buffer, uint32_t bufferSiz
}
-bool TkFrameworkImpl::reorderAssetDescChunks(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, NvBlastBondDesc* bondDescs, uint32_t bondCount, uint32_t* chunkReorderMap /*= nullptr*/) const
+bool TkFrameworkImpl::reorderAssetDescChunks(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, NvBlastBondDesc* bondDescs, uint32_t bondCount, uint32_t* chunkReorderMap /*= nullptr*/, bool keepBondNormalChunkOrder /*= false*/) const
{
- uint32_t* map = chunkReorderMap != nullptr ? chunkReorderMap : static_cast<uint32_t*>(NVBLASTTK_ALLOC(chunkCount * sizeof(uint32_t), "reorderAssetDescChunks:chunkReorderMap"));
- void* scratch = NVBLASTTK_ALLOC(chunkCount * sizeof(NvBlastChunkDesc), "reorderAssetDescChunks:scratch");
- const bool result = NvBlastReorderAssetDescChunks(chunkDescs, chunkCount, bondDescs, bondCount, map, scratch, log);
- NVBLASTTK_FREE(scratch);
+ uint32_t* map = chunkReorderMap != nullptr ? chunkReorderMap : static_cast<uint32_t*>(NVBLAST_ALLOC_NAMED(chunkCount * sizeof(uint32_t), "reorderAssetDescChunks:chunkReorderMap"));
+ void* scratch = NVBLAST_ALLOC_NAMED(chunkCount * sizeof(NvBlastChunkDesc), "reorderAssetDescChunks:scratch");
+ const bool result = NvBlastReorderAssetDescChunks(chunkDescs, chunkCount, bondDescs, bondCount, map, keepBondNormalChunkOrder, scratch, logLL);
+ NVBLAST_FREE(scratch);
if (chunkReorderMap == nullptr)
{
- NVBLASTTK_FREE(map);
+ NVBLAST_FREE(map);
}
return result;
}
@@ -354,9 +239,9 @@ bool TkFrameworkImpl::reorderAssetDescChunks(NvBlastChunkDesc* chunkDescs, uint3
bool TkFrameworkImpl::ensureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount) const
{
- void* scratch = NVBLASTTK_ALLOC(chunkCount, "ensureAssetExactSupportCoverage:scratch");
- const bool result = NvBlastEnsureAssetExactSupportCoverage(chunkDescs, chunkCount, scratch, log);
- NVBLASTTK_FREE(scratch);
+ void* scratch = NVBLAST_ALLOC_NAMED(chunkCount, "ensureAssetExactSupportCoverage:scratch");
+ const bool result = NvBlastEnsureAssetExactSupportCoverage(chunkDescs, chunkCount, scratch, logLL);
+ NVBLAST_FREE(scratch);
return result;
}
@@ -366,7 +251,7 @@ TkAsset* TkFrameworkImpl::createAsset(const TkAssetDesc& desc)
TkAssetImpl* asset = TkAssetImpl::create(desc);
if (asset == nullptr)
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::createAsset: failed to create asset.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::createAsset: failed to create asset.");
}
return asset;
@@ -378,7 +263,7 @@ TkAsset* TkFrameworkImpl::createAsset(const NvBlastAsset* assetLL, Nv::Blast::Tk
TkAssetImpl* asset = TkAssetImpl::create(assetLL, jointDescs, jointDescCount, ownsAsset);
if (asset == nullptr)
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::createAsset: failed to create asset.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::createAsset: failed to create asset.");
}
return asset;
@@ -390,7 +275,7 @@ TkGroup* TkFrameworkImpl::createGroup(const TkGroupDesc& desc)
TkGroupImpl* group = TkGroupImpl::create(desc);
if (group == nullptr)
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::createGroup: failed to create group.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::createGroup: failed to create group.");
}
return group;
@@ -402,7 +287,7 @@ TkActor* TkFrameworkImpl::createActor(const TkActorDesc& desc)
TkActor* actor = TkActorImpl::create(desc);
if (actor == nullptr)
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::createActor: failed to create actor.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::createActor: failed to create actor.");
}
return actor;
@@ -417,35 +302,35 @@ TkJoint* TkFrameworkImpl::createJoint(const TkJointDesc& desc)
TkFamilyImpl* family0 = static_cast<TkFamilyImpl*>(desc.families[0]);
TkFamilyImpl* family1 = static_cast<TkFamilyImpl*>(desc.families[1]);
- NVBLASTTK_CHECK_ERROR(family0 != nullptr || family1 != nullptr, "TkFrameworkImpl::createJoint: at least one family in the TkJointDesc must be valid.", return nullptr);
+ NVBLAST_CHECK_ERROR(family0 != nullptr || family1 != nullptr, "TkFrameworkImpl::createJoint: at least one family in the TkJointDesc must be valid.", return nullptr);
- NVBLASTTK_CHECK_ERROR(family0 == nullptr || desc.chunkIndices[0] < family0->getAssetImpl()->getChunkCount(), "TkFrameworkImpl::createJoint: desc.chunkIndices[0] is invalid.", return nullptr);
- NVBLASTTK_CHECK_ERROR(family1 == nullptr || desc.chunkIndices[1] < family1->getAssetImpl()->getChunkCount(), "TkFrameworkImpl::createJoint: desc.chunkIndices[1] is invalid.", return nullptr);
+ NVBLAST_CHECK_ERROR(family0 == nullptr || desc.chunkIndices[0] < family0->getAssetImpl()->getChunkCount(), "TkFrameworkImpl::createJoint: desc.chunkIndices[0] is invalid.", return nullptr);
+ NVBLAST_CHECK_ERROR(family1 == nullptr || desc.chunkIndices[1] < family1->getAssetImpl()->getChunkCount(), "TkFrameworkImpl::createJoint: desc.chunkIndices[1] is invalid.", return nullptr);
const bool actorsAreTheSame = family0 == family1 && family0->getActorByChunk(desc.chunkIndices[0]) == family1->getActorByChunk(desc.chunkIndices[1]);
- NVBLASTTK_CHECK_ERROR(!actorsAreTheSame, "TkFrameworkImpl::createJoint: the chunks listed in the TkJointDesc must be in different actors.", return nullptr);
+ NVBLAST_CHECK_ERROR(!actorsAreTheSame, "TkFrameworkImpl::createJoint: the chunks listed in the TkJointDesc must be in different actors.", return nullptr);
if (family0 != nullptr)
{
- const bool isSupportChunk = !isInvalidIndex(NvBlastAssetGetChunkToGraphNodeMap(family0->getAssetImpl()->getAssetLLInternal(), log)[desc.chunkIndices[0]]);
- NVBLASTTK_CHECK_ERROR(isSupportChunk, "TkFrameworkImpl::createJoint: desc.chunkIndices[0] is not a support chunk in the asset for desc.families[0]. Joint not created.", return nullptr);
+ const bool isSupportChunk = !isInvalidIndex(NvBlastAssetGetChunkToGraphNodeMap(family0->getAssetImpl()->getAssetLLInternal(), logLL)[desc.chunkIndices[0]]);
+ NVBLAST_CHECK_ERROR(isSupportChunk, "TkFrameworkImpl::createJoint: desc.chunkIndices[0] is not a support chunk in the asset for desc.families[0]. Joint not created.", return nullptr);
handle0 = family0->createExternalJointHandle(getFamilyID(family1), desc.chunkIndices[0], desc.chunkIndices[1]);
- NVBLASTTK_CHECK_ERROR(handle0 != nullptr, "TkFrameworkImpl::createJoint: could not create joint handle in family[0]. Joint not created.", return nullptr);
+ NVBLAST_CHECK_ERROR(handle0 != nullptr, "TkFrameworkImpl::createJoint: could not create joint handle in family[0]. Joint not created.", return nullptr);
}
if (family1 != nullptr)
{
- const bool isSupportChunk = !isInvalidIndex(NvBlastAssetGetChunkToGraphNodeMap(family1->getAssetImpl()->getAssetLLInternal(), log)[desc.chunkIndices[1]]);
- NVBLASTTK_CHECK_ERROR(isSupportChunk, "TkFrameworkImpl::createJoint: desc.chunkIndices[1] is not a support chunk in the asset for desc.families[1]. Joint not created.", return nullptr);
+ const bool isSupportChunk = !isInvalidIndex(NvBlastAssetGetChunkToGraphNodeMap(family1->getAssetImpl()->getAssetLLInternal(), logLL)[desc.chunkIndices[1]]);
+ NVBLAST_CHECK_ERROR(isSupportChunk, "TkFrameworkImpl::createJoint: desc.chunkIndices[1] is not a support chunk in the asset for desc.families[1]. Joint not created.", return nullptr);
if (family1 != family0)
{
handle1 = family1->createExternalJointHandle(getFamilyID(family0), desc.chunkIndices[1], desc.chunkIndices[0]);
- NVBLASTTK_CHECK_ERROR(handle1 != nullptr, "TkFrameworkImpl::createJoint: could not create joint handle in family[1]. Joint not created.", return nullptr);
+ NVBLAST_CHECK_ERROR(handle1 != nullptr, "TkFrameworkImpl::createJoint: could not create joint handle in family[1]. Joint not created.", return nullptr);
}
}
- TkJointImpl* joint = NVBLASTTK_NEW(TkJointImpl)(desc, nullptr);
- NVBLASTTK_CHECK_ERROR(joint != nullptr, "TkFrameworkImpl::createJoint: failed to create joint.", return nullptr);
+ TkJointImpl* joint = NVBLAST_NEW(TkJointImpl)(desc, nullptr);
+ NVBLAST_CHECK_ERROR(joint != nullptr, "TkFrameworkImpl::createJoint: failed to create joint.", return nullptr);
const TkJointData& jointData = joint->getDataInternal();
@@ -468,28 +353,6 @@ TkJoint* TkFrameworkImpl::createJoint(const TkJointDesc& desc)
}
-bool TkFrameworkImpl::serializeHeader(const TkSerializable& object, PxFileBuf& stream)
-{
- const TkTypeImpl& type = static_cast<const TkTypeImpl&>(object.getType());
-
- // Tk framework identifier
- stream.storeDword(ClassID);
-
- // Object header
- stream.storeDword(type.getID());
- stream.storeDword(type.getVersionInternal());
-
- // Object ID
- stream.write(&object.getID(), sizeof(NvBlastID));
-
- // Serializable user data
- stream.storeDword(static_cast<uint32_t>(object.userIntData & 0xFFFFFFFF));
- stream.storeDword(static_cast<uint32_t>(object.userIntData >> 32));
-
- return true;
-}
-
-
void TkFrameworkImpl::onCreate(TkIdentifiable& object)
{
const TkTypeImpl& type = static_cast<const TkTypeImpl&>(object.getType());
@@ -500,7 +363,7 @@ void TkFrameworkImpl::onCreate(TkIdentifiable& object)
{
if (!isInvalidIndex(index))
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::addObject: object type unrecognized.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::addObject: object type unrecognized.");
}
return;
}
@@ -529,7 +392,7 @@ void TkFrameworkImpl::onDestroy(TkIdentifiable& object)
{
if (!isInvalidIndex(index))
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::removeObject: object type unrecognized.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::removeObject: object type unrecognized.");
}
return;
}
@@ -541,13 +404,13 @@ void TkFrameworkImpl::onDestroy(TkIdentifiable& object)
void TkFrameworkImpl::onCreate(TkJointImpl& joint)
{
- NVBLASTTK_CHECK_ERROR(m_joints.insert(&joint), "TkFrameworkImpl::onCreate: Joint already tracked.", return);
+ NVBLAST_CHECK_ERROR(m_joints.insert(&joint), "TkFrameworkImpl::onCreate: Joint already tracked.", return);
}
void TkFrameworkImpl::onDestroy(TkJointImpl& joint)
{
- NVBLASTTK_CHECK_ERROR(m_joints.erase(&joint), "TkFrameworkImpl::onDestroy: Joint not tracked.", return);
+ NVBLAST_CHECK_ERROR(m_joints.erase(&joint), "TkFrameworkImpl::onDestroy: Joint not tracked.", return);
}
@@ -557,7 +420,7 @@ void TkFrameworkImpl::onIDChange(TkIdentifiable& object, const NvBlastID& IDPrev
{
if (!m_IDToObject.erase(IDPrev))
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::reportIDChanged: object with previous ID doesn't exist.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::reportIDChanged: object with previous ID doesn't exist.");
}
}
@@ -566,7 +429,7 @@ void TkFrameworkImpl::onIDChange(TkIdentifiable& object, const NvBlastID& IDPrev
auto& value = m_IDToObject[IDCurr];
if (value != nullptr)
{
- NVBLASTTK_LOG_ERROR("TkFrameworkImpl::reportIDChanged: object with new ID already exists.");
+ NVBLAST_LOG_ERROR("TkFrameworkImpl::reportIDChanged: object with new ID already exists.");
return;
}
value = &object;
@@ -579,28 +442,15 @@ void TkFrameworkImpl::onIDChange(TkIdentifiable& object, const NvBlastID& IDPrev
//////// Global API implementation ////////
-Nv::Blast::TkFramework* NvBlastTkFrameworkCreate(const Nv::Blast::TkFrameworkDesc& desc)
+Nv::Blast::TkFramework* NvBlastTkFrameworkCreate()
{
- if (desc.errorCallback == nullptr)
- {
- return nullptr;
- }
-
- if (desc.allocatorCallback == nullptr)
- {
- desc.errorCallback->reportError(PxErrorCode::eINVALID_OPERATION, "TkFramework::create: NULL allocator given in descriptor.", __FILE__, __LINE__);
- return nullptr;
- }
-
if (Nv::Blast::TkFrameworkImpl::get() != nullptr)
{
- desc.errorCallback->reportError(PxErrorCode::eINVALID_OPERATION, "TkFramework::create: framework already created. Use TkFramework::get() to access.", __FILE__, __LINE__);
+ NVBLAST_LOG_ERROR("TkFramework::create: framework already created. Use TkFramework::get() to access.");
return nullptr;
}
- Nv::Blast::TkAllocator::s_allocatorCallback = desc.allocatorCallback;
-
- Nv::Blast::TkFrameworkImpl* framework = new (desc.allocatorCallback->allocate(sizeof(Nv::Blast::TkFrameworkImpl), "TkFrameworkImpl", __FILE__, __LINE__)) Nv::Blast::TkFrameworkImpl(desc);
+ Nv::Blast::TkFrameworkImpl* framework = NVBLAST_NEW(Nv::Blast::TkFrameworkImpl) ();
Nv::Blast::TkFrameworkImpl::set(framework);
return Nv::Blast::TkFrameworkImpl::get();