aboutsummaryrefslogtreecommitdiff
path: root/sdk/toolkit/source/NvBlastTkFamilyImpl.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/NvBlastTkFamilyImpl.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/NvBlastTkFamilyImpl.cpp')
-rw-r--r--sdk/toolkit/source/NvBlastTkFamilyImpl.cpp385
1 files changed, 65 insertions, 320 deletions
diff --git a/sdk/toolkit/source/NvBlastTkFamilyImpl.cpp b/sdk/toolkit/source/NvBlastTkFamilyImpl.cpp
index 33baafe..4879535 100644
--- a/sdk/toolkit/source/NvBlastTkFamilyImpl.cpp
+++ b/sdk/toolkit/source/NvBlastTkFamilyImpl.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 "NvBlastTkFrameworkImpl.h"
#include "NvBlastTkFamilyImpl.h"
@@ -16,14 +34,10 @@
#include "NvBlastTkJointImpl.h"
#include "Px.h"
-#include "PxFileBuf.h"
-#include "PxAllocatorCallback.h"
#include "NvBlastIndexFns.h"
#include "NvBlastMemory.h"
-using namespace physx::general_PxIOStream2;
-
namespace Nv
{
@@ -32,7 +46,7 @@ namespace Blast
//////// Static data ////////
-NVBLASTTK_DEFINE_TYPE_SERIALIZABLE(Family);
+NVBLASTTK_DEFINE_TYPE_IDENTIFIABLE(Family);
//////// Member functions ////////
@@ -51,12 +65,12 @@ TkFamilyImpl::~TkFamilyImpl()
{
if (m_familyLL != nullptr)
{
- uint32_t familyActorCount = NvBlastFamilyGetActorCount(m_familyLL, TkFrameworkImpl::get()->log);
+ uint32_t familyActorCount = NvBlastFamilyGetActorCount(m_familyLL, logLL);
if (familyActorCount != 0)
{
- NVBLASTTK_LOG_WARNING("TkFamilyImpl::~TkFamilyImpl(): family actor count is not 0.");
+ NVBLAST_LOG_WARNING("TkFamilyImpl::~TkFamilyImpl(): family actor count is not 0.");
}
- TkFrameworkImpl::get()->free(m_familyLL);
+ NVBLAST_FREE(m_familyLL);
}
}
@@ -73,7 +87,7 @@ void TkFamilyImpl::release()
m_actors.clear();
- NVBLASTTK_DELETE(this, TkFamilyImpl);
+ NVBLAST_DELETE(this, TkFamilyImpl);
}
@@ -112,7 +126,7 @@ uint32_t TkFamilyImpl::getActors(TkActor** buffer, uint32_t bufferSize, uint32_t
uint32_t actorCount = getActorCount();
if (actorCount <= indexStart)
{
- NVBLASTTK_LOG_WARNING("TkFamilyImpl::getActors: indexStart beyond end of actor list.");
+ NVBLAST_LOG_WARNING("TkFamilyImpl::getActors: indexStart beyond end of actor list.");
return 0;
}
@@ -146,22 +160,22 @@ uint32_t TkFamilyImpl::getActors(TkActor** buffer, uint32_t bufferSize, uint32_t
}
-NV_INLINE bool areLLActorsEqual(const NvBlastActor* actor0, const NvBlastActor* actor1, TkArray<uint32_t>::type& scratch)
+NV_INLINE bool areLLActorsEqual(const NvBlastActor* actor0, const NvBlastActor* actor1, Array<uint32_t>::type& scratch)
{
- if (NvBlastActorGetGraphNodeCount(actor0, TkFrameworkImpl::get()->log) != NvBlastActorGetGraphNodeCount(actor1, TkFrameworkImpl::get()->log))
+ if (NvBlastActorGetGraphNodeCount(actor0, logLL) != NvBlastActorGetGraphNodeCount(actor1, logLL))
{
return false;
}
- const uint32_t chunkCount = NvBlastActorGetVisibleChunkCount(actor0, TkFrameworkImpl::get()->log);
- if (chunkCount != NvBlastActorGetVisibleChunkCount(actor1, TkFrameworkImpl::get()->log))
+ const uint32_t chunkCount = NvBlastActorGetVisibleChunkCount(actor0, logLL);
+ if (chunkCount != NvBlastActorGetVisibleChunkCount(actor1, logLL))
{
return false;
}
scratch.resize(chunkCount * 2);
- NvBlastActorGetVisibleChunkIndices(scratch.begin(), chunkCount, actor0, TkFrameworkImpl::get()->log);
- NvBlastActorGetVisibleChunkIndices(scratch.begin() + chunkCount, chunkCount, actor1, TkFrameworkImpl::get()->log);
+ NvBlastActorGetVisibleChunkIndices(scratch.begin(), chunkCount, actor0, logLL);
+ NvBlastActorGetVisibleChunkIndices(scratch.begin() + chunkCount, chunkCount, actor1, logLL);
return memcmp(scratch.begin(), scratch.begin() + chunkCount, chunkCount * sizeof(uint32_t)) == 0;
}
@@ -170,21 +184,21 @@ void TkFamilyImpl::reinitialize(const NvBlastFamily* newFamily, TkGroup* group)
{
NVBLAST_ASSERT(newFamily);
#if NV_ENABLE_ASSERTS
- NvBlastID id0 = NvBlastFamilyGetAssetID(m_familyLL, TkFrameworkImpl::get()->log);
- NvBlastID id1 = NvBlastFamilyGetAssetID(newFamily, TkFrameworkImpl::get()->log);
+ NvBlastID id0 = NvBlastFamilyGetAssetID(m_familyLL, logLL);
+ NvBlastID id1 = NvBlastFamilyGetAssetID(newFamily, logLL);
NVBLAST_ASSERT(TkGUIDsEqual(&id0, &id1));
#endif
- NVBLAST_ASSERT(NvBlastFamilyGetSize(m_familyLL, TkFrameworkImpl::get()->log) == NvBlastFamilyGetSize(newFamily, TkFrameworkImpl::get()->log));
+ NVBLAST_ASSERT(NvBlastFamilyGetSize(m_familyLL, logLL) == NvBlastFamilyGetSize(newFamily, logLL));
// alloc and init new family
- const uint32_t blockSize = NvBlastFamilyGetSize(newFamily, TkFrameworkImpl::get()->log);
- NvBlastFamily* newFamilyCopy = (NvBlastFamily*)TkFrameworkImpl::get()->alloc(blockSize);
+ const uint32_t blockSize = NvBlastFamilyGetSize(newFamily, logLL);
+ NvBlastFamily* newFamilyCopy = (NvBlastFamily*)NVBLAST_ALLOC_NAMED(blockSize, "TkFamilyImpl::reinitialize");
memcpy(newFamilyCopy, newFamily, blockSize);
- NvBlastFamilySetAsset(newFamilyCopy, m_asset->getAssetLL(), TkFrameworkImpl::get()->log);
+ NvBlastFamilySetAsset(newFamilyCopy, m_asset->getAssetLL(), logLL);
// get actors from new family
- TkArray<NvBlastActor*>::type newLLActors(NvBlastFamilyGetActorCount(newFamilyCopy, TkFrameworkImpl::get()->log));
- uint32_t actorCount = NvBlastFamilyGetActors(newLLActors.begin(), newLLActors.size(), newFamilyCopy, TkFrameworkImpl::get()->log);
+ Array<NvBlastActor*>::type newLLActors(NvBlastFamilyGetActorCount(newFamilyCopy, logLL));
+ uint32_t actorCount = NvBlastFamilyGetActors(newLLActors.begin(), newLLActors.size(), newFamilyCopy, logLL);
// reset actor families to nullptr (we use it as a flag later)
for (TkActorImpl& actor : m_actors)
@@ -197,17 +211,17 @@ void TkFamilyImpl::reinitialize(const NvBlastFamily* newFamily, TkGroup* group)
// prepare split event with new actors
auto newActorsSplitEvent = getQueue().allocData<TkSplitEvent>();
- TkArray<TkActor*>::type children(actorCount);
+ Array<TkActor*>::type children(actorCount);
children.resizeUninitialized(0);
newActorsSplitEvent->children = children.begin();
// scratch
- TkArray<uint32_t>::type scratch(m_asset->getChunkCount());
+ Array<uint32_t>::type scratch(m_asset->getChunkCount());
for (uint32_t i = 0; i < actorCount; ++i)
{
NvBlastActor* newLLActor = newLLActors[i];
- uint32_t actorIndex = NvBlastActorGetIndex(newLLActor, TkFrameworkImpl::get()->log);
+ uint32_t actorIndex = NvBlastActorGetIndex(newLLActor, logLL);
TkActorImpl& tkActor = *getActorByIndex(actorIndex);
tkActor.m_family = this;
@@ -281,7 +295,7 @@ void TkFamilyImpl::reinitialize(const NvBlastFamily* newFamily, TkGroup* group)
}
// replace family
- TkFrameworkImpl::get()->free(m_familyLL);
+ NVBLAST_FREE(m_familyLL);
m_familyLL = newFamilyCopy;
// update joints
@@ -299,13 +313,13 @@ void TkFamilyImpl::reinitialize(const NvBlastFamily* newFamily, TkGroup* group)
TkActorImpl* TkFamilyImpl::getActorByChunk(uint32_t chunk)
{
- if (chunk >= NvBlastAssetGetChunkCount(m_asset->getAssetLLInternal(), TkFrameworkImpl::get()->log))
+ if (chunk >= NvBlastAssetGetChunkCount(m_asset->getAssetLLInternal(), logLL))
{
- NVBLASTTK_LOG_WARNING("TkFamilyImpl::getActorByChunk: invalid chunk index. Returning NULL.");
+ NVBLAST_LOG_WARNING("TkFamilyImpl::getActorByChunk: invalid chunk index. Returning NULL.");
return nullptr;
}
- NvBlastActor* actorLL = NvBlastFamilyGetChunkActor(m_familyLL, chunk, TkFrameworkImpl::get()->log);
+ NvBlastActor* actorLL = NvBlastFamilyGetChunkActor(m_familyLL, chunk, logLL);
return actorLL ? getActorByActorLL(actorLL) : nullptr;
}
@@ -441,293 +455,24 @@ const TkAsset* TkFamilyImpl::getAsset() const
}
-bool TkFamilyImpl::serialize(PxFileBuf& stream) const
-{
- TkFrameworkImpl::get()->serializeHeader(*this, stream);
-
- if (m_material != nullptr)
- {
- NVBLASTTK_LOG_WARNING("TkFamilyImpl::serialize(): Material pointer is not nullptr, it will be lost during serialization.");
- }
-
- NVBLASTTK_CHECK_ERROR(m_asset != nullptr, "TkFamilyImpl::serialize(): TkFamily asset is nullptr, can't be serialized.", return false);
- NVBLASTTK_CHECK_ERROR(m_familyLL != nullptr, "TkFamilyImpl::serialize(): TkFamily family is nullptr, can't be serialized.", return false);
-
- // Asset ID
- const NvBlastID& assetID = m_asset->getID();
- NVBLASTTK_CHECK_ERROR(!TkGUIDIsZero(&assetID), "TkFamilyImpl::serialize(): Associated asset doesn't have an ID set.", return false);
- stream.write(&assetID, sizeof(NvBlastID));
-
- // Family
- const uint32_t familySize = NvBlastFamilyGetSize(m_familyLL, TkFrameworkImpl::get()->log);
- stream.storeDword(familySize);
- stream.write(m_familyLL, familySize);
-
- //// Joints ////
-
- // Internal joint data
- stream.storeDword(m_internalJointCount);
-
- // External joint family ID list
- stream.storeDword(m_jointSets.size());
- for (uint32_t i = 0; i < m_jointSets.size(); ++i)
- {
- const JointSet* jointSet = m_jointSets[i];
- stream.write(&jointSet->m_familyID, sizeof(NvBlastID));
- }
-
- // Actor joint lists
- TkJointImpl* internalJoints = getInternalJoints();
- for (uint32_t actorNum = 0; actorNum < m_actors.size(); ++actorNum)
- {
- const TkActorImpl& actor = m_actors[actorNum];
- if (!actor.isActive())
- {
- continue; // We may need a better way of iterating through active actors
- }
-
- stream.storeDword(actor.getJointCount());
-
- for (TkActorImpl::JointIt j(actor); (bool)j; ++j)
- {
- TkJointImpl* joint = *j;
-
- const TkJointData& jointData = joint->getDataInternal();
- NVBLAST_ASSERT(jointData.actors[0] == &actor || jointData.actors[1] == &actor);
-
- const uint32_t attachmentFlags = (uint32_t)(jointData.actors[0] == &actor) | (uint32_t)(jointData.actors[1] == &actor) << 1;
- stream.storeDword(attachmentFlags);
-
- const TkActorImpl* otherActor = static_cast<const TkActorImpl*>(jointData.actors[(attachmentFlags >> 1) ^ 1]);
-
- if (joint->m_owner == this)
- {
- // Internal joint - write internal joint index
- const uint32_t jointIndex = static_cast<uint32_t>(joint - internalJoints);
- stream.storeDword(jointIndex);
- if (otherActor != nullptr && otherActor->getIndexInternal() < actorNum) // No need to write the joint data, it has already been written
- {
- continue;
- }
- }
- else
- {
- // External joint - write external family index and joint information
- stream.storeDword(invalidIndex<uint32_t>()); // Denotes external joint
-
- const FamilyIDMap::Entry* e = m_familyIDMap.find(getFamilyID(otherActor));
- NVBLASTTK_CHECK_ERROR(e != nullptr, "TkFamilyImpl::deserialize(): Bad data - attached family's ID not recorded.", return false);
-
- stream.storeDword(e->second); // Write family ID index
- }
-
- // Write joint data
- for (int side = 0; side < 2; ++side)
- {
- stream.storeDword(jointData.chunkIndices[side]);
- const physx::PxVec3& attachPosition = jointData.attachPositions[side];
- stream.storeFloat(attachPosition.x); stream.storeFloat(attachPosition.y); stream.storeFloat(attachPosition.z);
- }
- }
- }
-
- return true;
-}
-
-
//////// Static functions ////////
-TkSerializable* TkFamilyImpl::deserialize(PxFileBuf& stream, const NvBlastID& id)
-{
- // Asset resolve
- NvBlastID assetID;
- stream.read(&assetID, sizeof(NvBlastID));
- TkIdentifiable* object = TkFrameworkImpl::get()->findObjectByIDInternal(assetID);
- NVBLASTTK_CHECK_ERROR(object && object->getType() == TkAssetImpl::s_type, "TkFamilyImpl::deserialize: can't find asset with corresponding ID.", return nullptr);
- TkAssetImpl* asset = static_cast<TkAssetImpl*>(object);
-
- // Allocate
- TkFamilyImpl* family = NVBLASTTK_NEW(TkFamilyImpl)(id);
- NVBLASTTK_CHECK_ERROR(family != nullptr, "TkFamilyImpl::deserialize: family allocation failed.", return nullptr);
-
- // associate with found asset
- family->m_asset = asset;
-
- // Family
- const uint32_t familySize = stream.readDword();
- family->m_familyLL = static_cast<NvBlastFamily*>(TkFrameworkImpl::get()->alloc(familySize));
- stream.read(family->m_familyLL, familySize);
-
- if (family->m_familyLL == nullptr)
- {
- NVBLASTTK_LOG_ERROR("TkFamilyImpl::deserialize: low-level family could not be created.");
- family->release();
- return nullptr;
- }
-
-#if NV_ENABLE_ASSERTS && 0
- NvBlastID id = NvBlastFamilyGetAssetID(family->m_familyLL, TkFrameworkImpl::get()->log);
- NVBLAST_ASSERT(TkGUIDsEqual(&id, &assetID));
-#endif
-
- // preallocate actors
- uint32_t maxActorCount = NvBlastFamilyGetMaxActorCount(family->m_familyLL, TkFrameworkImpl::get()->log);
- family->m_actors.resize(maxActorCount);
-
- // get actors from family
- TkArray<NvBlastActor*>::type newLLActors(NvBlastFamilyGetActorCount(family->m_familyLL, TkFrameworkImpl::get()->log));
- uint32_t actorCount = NvBlastFamilyGetActors(newLLActors.begin(), newLLActors.size(), family->m_familyLL, TkFrameworkImpl::get()->log);
-
- // fill actors
- for (uint32_t i = 0; i < actorCount; ++i)
- {
- NvBlastActor* newLLActor = newLLActors[i];
- uint32_t actorIndex = NvBlastActorGetIndex(newLLActor, TkFrameworkImpl::get()->log);
- TkActorImpl& tkActor = *family->getActorByIndex(actorIndex);
-
- tkActor.m_family = family;
- tkActor.m_actorLL = newLLActor;
- }
-
- //// Create joints ////
-
- // internal
- family->m_internalJointCount = stream.readDword();
- family->m_internalJointBuffer.resize(family->m_internalJointCount * sizeof(TkJointImpl), '\0');
- TkJointImpl* internalJoints = family->getInternalJoints();
-
- // external joint family ID list
- const uint32_t jointSetCount = stream.readDword();
- family->m_jointSets.resize(jointSetCount);
- for (uint32_t i = 0; i < jointSetCount; ++i)
- {
- family->m_jointSets[i] = NVBLASTTK_NEW(JointSet);
- stream.read(&family->m_jointSets[i]->m_familyID, sizeof(NvBlastID));
- family->m_familyIDMap[family->m_jointSets[i]->m_familyID] = i;
- }
-
- // fill actor joint lists
- for (uint32_t actorNum = 0; actorNum < family->m_actors.size(); ++actorNum)
- {
- TkActorImpl& actor = family->m_actors[actorNum];
- if (!actor.isActive())
- {
- continue; // We may need a better way of iterating through active actors
- }
-
- // Read joint information
- uint32_t jointCount = stream.readDword();
- while (jointCount--)
- {
- const uint32_t attachmentFlags = stream.readDword();
- const uint32_t jointIndex = stream.readDword();
- if (!isInvalidIndex(jointIndex))
- {
- // Internal joint
- TkJointImpl& joint = internalJoints[jointIndex];
- TkJointData& jointData = joint.getDataWritable();
-
- // Initialize joint if it has not been encountered yet
- NVBLAST_ASSERT((joint.m_links[0].m_joint == nullptr) == (joint.m_links[1].m_joint == nullptr));
- if (joint.m_links[0].m_joint == nullptr)
- {
- new (&joint) TkJointImpl;
- joint.m_owner = family;
- for (int side = 0; side < 2; ++side)
- {
- jointData.chunkIndices[side] = stream.readDword();
- physx::PxVec3& attachPosition = jointData.attachPositions[side];
- attachPosition.x = stream.readFloat(); attachPosition.y = stream.readFloat(); attachPosition.z = stream.readFloat();
- }
- }
-
- if (attachmentFlags & 1)
- {
- jointData.actors[0] = &actor;
- actor.addJoint(joint.m_links[0]);
- }
-
- if (attachmentFlags & 2)
- {
- jointData.actors[1] = &actor;
- if (jointData.actors[0] != jointData.actors[1])
- {
- actor.addJoint(joint.m_links[1]);
- }
- }
- }
- else
- {
- // External joint
- const uint32_t otherFamilyIndex = stream.readDword();
- NVBLASTTK_CHECK_ERROR(otherFamilyIndex < family->m_jointSets.size(), "TkFamilyImpl::deserialize: family allocation failed.", return nullptr);
- const NvBlastID& otherFamilyID = family->m_jointSets[otherFamilyIndex]->m_familyID;
- TkFamilyImpl* otherFamily = static_cast<TkFamilyImpl*>(TkFrameworkImpl::get()->findObjectByIDInternal(otherFamilyID));
-
- TkJointDesc jointDesc;
- for (int side = 0; side < 2; ++side)
- {
- jointDesc.chunkIndices[side] = stream.readDword();
- physx::PxVec3& attachPosition = jointDesc.attachPositions[side];
- attachPosition.x = stream.readFloat(); attachPosition.y = stream.readFloat(); attachPosition.z = stream.readFloat();
- }
-
- NVBLASTTK_CHECK_ERROR(attachmentFlags != 3, "TkFamilyImpl::deserialize: both attached actors are the same in an external joint.", return nullptr);
-
- const uint32_t attachmentIndex = attachmentFlags >> 1;
-
- TkJointImpl** jointHandle = family->createExternalJointHandle(otherFamilyID, jointDesc.chunkIndices[attachmentIndex], jointDesc.chunkIndices[attachmentIndex ^ 1]);
- NVBLASTTK_CHECK_ERROR(jointHandle != nullptr, "TkFamilyImpl::deserialize: joint handle could not be created.", return nullptr);
-
- if (otherFamily == nullptr)
- {
- // Other family does not exist yet, we'll create the joint
- jointDesc.families[attachmentIndex] = family;
- jointDesc.families[attachmentIndex ^ 1] = nullptr;
-
- TkJointImpl* joint = NVBLASTTK_NEW(TkJointImpl)(jointDesc, nullptr);
- NVBLASTTK_CHECK_ERROR(joint != nullptr, "TkFamilyImpl::deserialize: joint createion failed.", return nullptr);
-
- *jointHandle = joint;
-
- actor.addJoint(joint->m_links[attachmentIndex]);
- }
- else
- {
- // Other family exists, and should have created the joint
- TkJointImpl* joint = otherFamily->findExternalJoint(family, ExternalJointKey(jointDesc.chunkIndices[attachmentIndex ^ 1], jointDesc.chunkIndices[attachmentIndex]));
- NVBLASTTK_CHECK_ERROR(joint != nullptr, "TkFamilyImpl::deserialize: other family should have created joint, but did not.", return nullptr);
-
- *jointHandle = joint;
-
- // Add the joint to its actor(s)
- joint->getDataWritable().actors[attachmentIndex] = &actor;
- actor.addJoint(joint->m_links[attachmentIndex]);
- }
- }
- }
- }
-
- return family;
-}
-
-
TkFamilyImpl* TkFamilyImpl::create(const TkAssetImpl* asset)
{
- TkFamilyImpl* family = NVBLASTTK_NEW(TkFamilyImpl);
+ TkFamilyImpl* family = NVBLAST_NEW(TkFamilyImpl);
family->m_asset = asset;
- void* mem = TkFrameworkImpl::get()->alloc(NvBlastAssetGetFamilyMemorySize(asset->getAssetLL(), TkFrameworkImpl::get()->log));
- family->m_familyLL = NvBlastAssetCreateFamily(mem, asset->getAssetLL(), TkFrameworkImpl::get()->log);
+ void* mem = NVBLAST_ALLOC_NAMED(NvBlastAssetGetFamilyMemorySize(asset->getAssetLL(), logLL), "TkFamilyImpl::create");
+ family->m_familyLL = NvBlastAssetCreateFamily(mem, asset->getAssetLL(), logLL);
//family->addListener(*TkFrameworkImpl::get());
if (family->m_familyLL == nullptr)
{
- NVBLASTTK_LOG_ERROR("TkFamilyImpl::create: low-level family could not be created.");
+ NVBLAST_LOG_ERROR("TkFamilyImpl::create: low-level family could not be created.");
family->release();
return nullptr;
}
- uint32_t maxActorCount = NvBlastFamilyGetMaxActorCount(family->m_familyLL, TkFrameworkImpl::get()->log);
+ uint32_t maxActorCount = NvBlastFamilyGetMaxActorCount(family->m_familyLL, logLL);
family->m_actors.resize(maxActorCount);
family->m_internalJointBuffer.resize(asset->getJointDescCountInternal() * sizeof(TkJointImpl), 0);
@@ -749,8 +494,8 @@ TkJointImpl** TkFamilyImpl::createExternalJointHandle(const NvBlastID& otherFami
}
else
{
- jointSet = NVBLASTTK_NEW(JointSet);
- NVBLASTTK_CHECK_ERROR(jointSet != nullptr, "TkFamilyImpl::addExternalJoint: failed to create joint set for other family ID.", return nullptr);
+ jointSet = NVBLAST_NEW(JointSet);
+ NVBLAST_CHECK_ERROR(jointSet != nullptr, "TkFamilyImpl::addExternalJoint: failed to create joint set for other family ID.", return nullptr);
jointSet->m_familyID = otherFamilyID;
otherFamilyIndex = m_jointSets.size();
m_familyIDMap[otherFamilyID] = otherFamilyIndex;
@@ -759,7 +504,7 @@ TkJointImpl** TkFamilyImpl::createExternalJointHandle(const NvBlastID& otherFami
const ExternalJointKey key(chunkIndex0, chunkIndex1);
const bool jointExists = jointSet->m_joints.find(key) != nullptr;
- NVBLASTTK_CHECK_WARNING(!jointExists, "TkFamilyImpl::addExternalJoint: joint already added.", return nullptr);
+ NVBLAST_CHECK_WARNING(!jointExists, "TkFamilyImpl::addExternalJoint: joint already added.", return nullptr);
return &jointSet->m_joints[key];
}
@@ -771,13 +516,13 @@ bool TkFamilyImpl::deleteExternalJointHandle(TkJointImpl*& joint, const NvBlastI
if (jointSetIndexEntry != nullptr)
{
const uint32_t jointSetIndex = jointSetIndexEntry->second;
- TkHashMap<ExternalJointKey, TkJointImpl*>::type::Entry e;
+ HashMap<ExternalJointKey, TkJointImpl*>::type::Entry e;
if (m_jointSets[jointSetIndex]->m_joints.erase(ExternalJointKey(chunkIndex0, chunkIndex1), e))
{
// Delete the joint set if it is empty
if (m_jointSets[jointSetIndex]->m_joints.size() == 0)
{
- NVBLASTTK_DELETE(m_jointSets[jointSetIndex], JointSet);
+ NVBLAST_DELETE(m_jointSets[jointSetIndex], JointSet);
m_jointSets.replaceWithLast(jointSetIndex);
m_familyIDMap.erase(otherFamilyID);
if (jointSetIndex < m_jointSets.size())
@@ -801,7 +546,7 @@ TkJointImpl* TkFamilyImpl::findExternalJoint(const TkFamilyImpl* otherFamily, Ex
const FamilyIDMap::Entry* jointSetIndexEntry = m_familyIDMap.find(getFamilyID(otherFamily));
if (jointSetIndexEntry != nullptr)
{
- const TkHashMap<ExternalJointKey, TkJointImpl*>::type::Entry* e = m_jointSets[jointSetIndexEntry->second]->m_joints.find(key);
+ const HashMap<ExternalJointKey, TkJointImpl*>::type::Entry* e = m_jointSets[jointSetIndexEntry->second]->m_joints.find(key);
if (e != nullptr)
{
return e->second;