aboutsummaryrefslogtreecommitdiff
path: root/sdk
diff options
context:
space:
mode:
authorAnton Novoselov <[email protected]>2017-08-14 16:41:28 +0300
committerAnton Novoselov <[email protected]>2017-08-14 16:41:28 +0300
commit9a1c1d814f3fa0b54b49d90b43130c02bc280f44 (patch)
treeeae6ead883173c66619c30b6a1ed085f3cb70f4d /sdk
parentUpdated to CL 22627414: (diff)
downloadblast-9a1c1d814f3fa0b54b49d90b43130c02bc280f44.tar.xz
blast-9a1c1d814f3fa0b54b49d90b43130c02bc280f44.zip
Updated to CL 22661993:
* docs updates * authoring fixes * asset view in sample fix * latest blast_tools_and_samples-windows.zip
Diffstat (limited to 'sdk')
-rw-r--r--sdk/compiler/cmake/windows/NvBlastTk.cmake5
-rw-r--r--sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h2
-rw-r--r--sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.cpp371
-rw-r--r--sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.h3
-rw-r--r--sdk/extensions/physx/include/NvBlastExtCustomProfiler.h20
-rw-r--r--sdk/extensions/physx/include/NvBlastExtPxTask.h17
-rw-r--r--sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.cpp8
-rw-r--r--sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.h11
-rw-r--r--sdk/extensions/stress/include/NvBlastExtStressSolver.h2
-rw-r--r--sdk/toolkit/include/NvBlastTkActor.h12
-rw-r--r--sdk/toolkit/include/NvBlastTkFamily.h2
-rw-r--r--sdk/toolkit/include/NvBlastTkFramework.h4
-rw-r--r--sdk/toolkit/include/NvBlastTkGroup.h2
-rw-r--r--sdk/toolkit/source/NvBlastTkGroupImpl.h2
-rw-r--r--sdk/toolkit/source/NvBlastTkTaskImpl.cpp34
15 files changed, 422 insertions, 73 deletions
diff --git a/sdk/compiler/cmake/windows/NvBlastTk.cmake b/sdk/compiler/cmake/windows/NvBlastTk.cmake
index d12f78f..03854b9 100644
--- a/sdk/compiler/cmake/windows/NvBlastTk.cmake
+++ b/sdk/compiler/cmake/windows/NvBlastTk.cmake
@@ -2,14 +2,11 @@
# Build NvBlastTk Windows
#
-FIND_PACKAGE(nvToolsExt $ENV{PM_nvToolsExt_VERSION} REQUIRED)
-
SET(BLASTTK_PLATFORM_COMMON_FILES
${COMMON_SOURCE_DIR}/NvBlastIncludeWindows.h
)
SET(BLASTTK_PLATFORM_INCLUDES
- PRIVATE $<$<OR:$<CONFIG:debug>,$<CONFIG:checked>,$<CONFIG:profile>>:${NVTOOLSEXT_INCLUDE_DIRS}>
)
SET(BLASTTK_COMPILE_DEFS
@@ -24,4 +21,4 @@ SET(BLASTTK_COMPILE_DEFS
SET(BLASTTK_LIBTYPE "SHARED")
-SET(BLASTTK_PLATFORM_LINKED_LIBS Rpcrt4 $<$<OR:$<CONFIG:debug>,$<CONFIG:checked>,$<CONFIG:profile>>:${NVTOOLSEXT_LIB}>)
+SET(BLASTTK_PLATFORM_LINKED_LIBS Rpcrt4)
diff --git a/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h b/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h
index 0986cf4..3c0675c 100644
--- a/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h
+++ b/sdk/extensions/authoring/include/NvBlastExtAuthoringTypes.h
@@ -86,7 +86,7 @@ struct Triangle
int32_t userData;
int32_t materialId;
int32_t smoothingGroup;
- physx::PxVec3 getNormal()
+ physx::PxVec3 getNormal() const
{
return ((b.p - a.p).cross(c.p - a.p));
}
diff --git a/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.cpp b/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.cpp
index 161ec5f..eda8f7c 100644
--- a/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.cpp
+++ b/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.cpp
@@ -30,6 +30,9 @@
#include <iostream>
#include <sstream>
#include <iomanip>
+#include <map>
+#include <algorithm>
+#include <set>
#include "NvBlastTypes.h"
#include "NvBlastGlobals.h"
#include "NvBlastTkFramework.h"
@@ -212,13 +215,11 @@ bool FbxFileWriter::appendMesh(const AuthoringResult& aResult, const char* asset
if (!smElement)
{
//If no smoothing groups, generate them
- FbxGeometryConverter fbxConv(mesh->GetFbxManager());
- if (fbxConv.ComputeEdgeSmoothingFromNormals(mesh))
- {
- fbxConv.ComputePolygonSmoothingFromEdgeSmoothing(mesh, 0);
- }
+ generateSmoothingGroups(mesh, skin);
}
+ removeDuplicateControlPoints(mesh, skin);
+
if (aResult.collisionHull != nullptr)
{
return appendCollisionMesh(chunkCount, aResult.collisionHullOffset, aResult.collisionHull, assetName);
@@ -544,13 +545,11 @@ void FbxFileWriter::createChunkRecursiveNonSkinned(const std::string& meshName,
if (!mesh->GetElementSmoothing())
{
//If no smoothing groups, generate them
- FbxGeometryConverter fbxConv(mesh->GetFbxManager());
- if (fbxConv.ComputeEdgeSmoothingFromNormals(mesh))
- {
- fbxConv.ComputePolygonSmoothingFromEdgeSmoothing(mesh, 0);
- }
+ generateSmoothingGroups(mesh, nullptr);
}
+ removeDuplicateControlPoints(mesh, nullptr);
+
for (uint32_t i = chunk->firstChildIndex; i < chunk->childIndexStop; i++)
{
createChunkRecursiveNonSkinned(meshName, i, meshNode, materials, meshData);
@@ -673,13 +672,12 @@ void FbxFileWriter::createChunkRecursiveNonSkinned(const std::string& meshName,
if (!smElement)
{
//If no smoothing groups, generate them
- FbxGeometryConverter fbxConv(mesh->GetFbxManager());
- if (fbxConv.ComputeEdgeSmoothingFromNormals(mesh))
- {
- fbxConv.ComputePolygonSmoothingFromEdgeSmoothing(mesh, 0);
- }
+ generateSmoothingGroups(mesh, nullptr);
+
}
+ removeDuplicateControlPoints(mesh, nullptr);
+
for (uint32_t i = chunk->firstChildIndex; i < chunk->childIndexStop; i++)
{
createChunkRecursiveNonSkinned(meshName, i, meshNode, materials, aResult);
@@ -1079,13 +1077,11 @@ bool FbxFileWriter::appendMesh(const ExporterMeshData& meshData, const char* ass
if (!mesh->GetElementSmoothing())
{
//If no smoothing groups, generate them
- FbxGeometryConverter fbxConv(mesh->GetFbxManager());
- if (fbxConv.ComputeEdgeSmoothingFromNormals(mesh))
- {
- fbxConv.ComputePolygonSmoothingFromEdgeSmoothing(mesh, 0);
- }
+ generateSmoothingGroups(mesh, skin);
}
+ removeDuplicateControlPoints(mesh, skin);
+
if (meshData.hulls != nullptr)
{
return appendCollisionMesh(chunkCount, meshData.hullsOffsets, meshData.hulls, assetName);
@@ -1093,3 +1089,338 @@ bool FbxFileWriter::appendMesh(const ExporterMeshData& meshData, const char* ass
return true;
}
+void FbxFileWriter::generateSmoothingGroups(fbxsdk::FbxMesh* mesh, FbxSkin* skin)
+{
+ if (mesh->GetElementSmoothing(0) || !mesh->IsTriangleMesh())
+ {
+ //they already exist or we can't make it
+ return;
+ }
+
+ const FbxGeometryElementNormal* geNormal = mesh->GetElementNormal();
+ if (!geNormal || geNormal->GetMappingMode() != FbxGeometryElement::eByPolygonVertex || geNormal->GetReferenceMode() != FbxGeometryElement::eDirect)
+ {
+ //We just set this up, but just incase
+ return;
+ }
+
+ int clusterCount = 0;
+ std::vector<std::vector<int>> cpsPerCluster;
+ if (skin)
+ {
+ clusterCount = skin->GetClusterCount();
+ cpsPerCluster.resize(clusterCount);
+ for (int c = 0; c < clusterCount; c++)
+ {
+ FbxCluster* cluster = skin->GetCluster(c);
+ int* clusterCPList = cluster->GetControlPointIndices();
+ const int clusterCPListLength = cluster->GetControlPointIndicesCount();
+
+ cpsPerCluster[c].resize(clusterCPListLength);
+ memcpy(cpsPerCluster[c].data(), clusterCPList, sizeof(int) * clusterCPListLength);
+ std::sort(cpsPerCluster[c].begin(), cpsPerCluster[c].end());
+ }
+ }
+
+ auto smElement = mesh->CreateElementSmoothing();
+ smElement->SetMappingMode(FbxGeometryElement::eByPolygon);
+ smElement->SetReferenceMode(FbxGeometryElement::eDirect);
+
+ FbxVector4* cpList = mesh->GetControlPoints();
+ const int cpCount = mesh->GetControlPointsCount();
+
+ const int triangleCount = mesh->GetPolygonCount();
+ const int cornerCount = triangleCount * 3;
+
+ int* polygonCPList = mesh->GetPolygonVertices();
+ const auto& normalByCornerList = geNormal->GetDirectArray();
+
+ std::multimap<int, int> overlappingCorners;
+ //sort them by z for faster overlap checking
+ std::vector<std::pair<double, int>> cornerIndexesByZ(cornerCount);
+ for (int c = 0; c < cornerCount; c++)
+ {
+ cornerIndexesByZ[c] = std::pair<double, int>(cpList[polygonCPList[c]][2], c);
+ }
+ std::sort(cornerIndexesByZ.begin(), cornerIndexesByZ.end());
+
+ for (int i = 0; i < cornerCount; i++)
+ {
+ const int cornerA = cornerIndexesByZ[i].second;
+ const int cpiA = polygonCPList[cornerA];
+ FbxVector4 cpA = cpList[cpiA];
+ cpA[3] = 0;
+
+ int clusterIndexA = -1;
+ for (int c = 0; c < clusterCount; c++)
+ {
+ if (std::binary_search(cpsPerCluster[c].begin(), cpsPerCluster[c].end(), cpiA))
+ {
+ clusterIndexA = c;
+ break;
+ }
+ }
+
+ for (int j = i + 1; j < cornerCount; j++)
+ {
+ if (std::abs(cornerIndexesByZ[j].first - cornerIndexesByZ[i].first) > FBXSDK_TOLERANCE)
+ {
+ break; // if the z's don't match other values don't matter
+ }
+ const int cornerB = cornerIndexesByZ[j].second;
+ const int cpiB = polygonCPList[cornerB];
+ FbxVector4 cpB = cpList[cpiB];
+
+ cpB[3] = 0;
+
+ //uses FBXSDK_TOLERANCE
+ if (cpA == cpB)
+ {
+ int clusterIndexB = -1;
+ for (int c = 0; c < clusterCount; c++)
+ {
+ if (std::binary_search(cpsPerCluster[c].begin(), cpsPerCluster[c].end(), cpiB))
+ {
+ clusterIndexB = c;
+ break;
+ }
+ }
+
+ if (clusterIndexA == clusterIndexB)
+ {
+ overlappingCorners.emplace(cornerA, cornerB);
+ overlappingCorners.emplace(cornerB, cornerA);
+ }
+ }
+ }
+ }
+
+ auto& smoothingGroupByTri = smElement->GetDirectArray();
+ for (int i = 0; i < triangleCount; i++)
+ {
+ smoothingGroupByTri.Add(0);
+ }
+ //first one
+ smoothingGroupByTri.SetAt(0, 1);
+
+ for (int i = 1; i < triangleCount; i++)
+ {
+ int sharedMask = 0, unsharedMask = 0;
+ for (int c = 0; c < 3; c++)
+ {
+ int myCorner = i * 3 + c;
+ FbxVector4 myNormal = normalByCornerList.GetAt(myCorner);
+ myNormal.Normalize();
+ myNormal[3] = 0;
+
+ auto otherCornersRangeBegin = overlappingCorners.lower_bound(myCorner);
+ auto otherCornersRangeEnd = overlappingCorners.upper_bound(myCorner);
+ for (auto it = otherCornersRangeBegin; it != otherCornersRangeEnd; it++)
+ {
+ int otherCorner = it->second;
+ FbxVector4 otherNormal = normalByCornerList.GetAt(otherCorner);
+ otherNormal.Normalize();
+ otherNormal[3] = 0;
+ if (otherNormal == myNormal)
+ {
+ sharedMask |= smoothingGroupByTri[otherCorner / 3];
+ }
+ else
+ {
+ unsharedMask |= smoothingGroupByTri[otherCorner / 3];
+ }
+ }
+ }
+
+ //Easy case, no overlap
+ if ((sharedMask & unsharedMask) == 0 && sharedMask != 0)
+ {
+ smoothingGroupByTri.SetAt(i, sharedMask);
+ }
+ else
+ {
+ for (int sm = 0; sm < 32; sm++)
+ {
+ int val = 1 << sm;
+ if (((val & sharedMask) == sharedMask) && !(val & unsharedMask))
+ {
+ smoothingGroupByTri.SetAt(i, val);
+ break;
+ }
+ }
+ }
+ }
+
+}
+
+namespace
+{
+ //These methods have different names for some reason
+ inline double* getControlPointBlendWeights(FbxSkin* skin)
+ {
+ return skin->GetControlPointBlendWeights();
+ }
+
+ inline double* getControlPointBlendWeights(FbxCluster* cluster)
+ {
+ return cluster->GetControlPointWeights();
+ }
+
+ template <typename T>
+ void remapCPsAndRemoveDuplicates(const int newCPCount, const std::vector<int>& oldToNewCPMapping, T* skinOrCluster)
+ {
+ //Need to avoid duplicate entires since UE doesn't seem to normalize this correctly
+ std::vector<bool> addedCP(newCPCount, false);
+ std::vector<std::pair<int, double>> newCPsAndWeights;
+ newCPsAndWeights.reserve(newCPCount);
+
+ int* skinCPList = skinOrCluster->GetControlPointIndices();
+ double* skinCPWeights = getControlPointBlendWeights(skinOrCluster);
+ const int skinCPListLength = skinOrCluster->GetControlPointIndicesCount();
+
+ for (int bw = 0; bw < skinCPListLength; bw++)
+ {
+ int newCPIdx = oldToNewCPMapping[skinCPList[bw]];
+ if (!addedCP[newCPIdx])
+ {
+ addedCP[newCPIdx] = true;
+ newCPsAndWeights.emplace_back(newCPIdx, skinCPWeights[bw]);
+ }
+ }
+ skinOrCluster->SetControlPointIWCount(newCPsAndWeights.size());
+ skinCPList = skinOrCluster->GetControlPointIndices();
+ skinCPWeights = getControlPointBlendWeights(skinOrCluster);
+ for (size_t bw = 0; bw < newCPsAndWeights.size(); bw++)
+ {
+ skinCPList[bw] = newCPsAndWeights[bw].first;
+ skinCPWeights[bw] = newCPsAndWeights[bw].second;
+ }
+ }
+}
+
+//Do this otherwise Maya shows the mesh as faceted due to not being welded
+void FbxFileWriter::removeDuplicateControlPoints(fbxsdk::FbxMesh* mesh, FbxSkin* skin)
+{
+ FbxVector4* cpList = mesh->GetControlPoints();
+ const int cpCount = mesh->GetControlPointsCount();
+
+ std::vector<int> oldToNewCPMapping(cpCount, -1);
+ //sort them by z for faster overlap checking
+ std::vector<std::pair<double, int>> cpIndexesByZ(cpCount);
+ for (int cp = 0; cp < cpCount; cp++)
+ {
+ cpIndexesByZ[cp] = std::pair<double, int>(cpList[cp][2], cp);
+ }
+ std::sort(cpIndexesByZ.begin(), cpIndexesByZ.end());
+
+ int clusterCount = 0;
+ std::vector<std::vector<int>> cpsPerCluster;
+ if (skin)
+ {
+ clusterCount = skin->GetClusterCount();
+ cpsPerCluster.resize(clusterCount);
+ for (int c = 0; c < clusterCount; c++)
+ {
+ FbxCluster* cluster = skin->GetCluster(c);
+ int* clusterCPList = cluster->GetControlPointIndices();
+ const int clusterCPListLength = cluster->GetControlPointIndicesCount();
+
+ cpsPerCluster[c].resize(clusterCPListLength);
+ memcpy(cpsPerCluster[c].data(), clusterCPList, sizeof(int) * clusterCPListLength);
+ std::sort(cpsPerCluster[c].begin(), cpsPerCluster[c].end());
+ }
+ }
+
+ std::vector<FbxVector4> uniqueCPs;
+ uniqueCPs.reserve(cpCount);
+
+ for (int i = 0; i < cpCount; i++)
+ {
+ const int cpiA = cpIndexesByZ[i].second;
+ FbxVector4 cpA = cpList[cpiA];
+ if (!(oldToNewCPMapping[cpiA] < 0))
+ {
+ //already culled this one
+ continue;
+ }
+ const int newIdx = int(uniqueCPs.size());
+ oldToNewCPMapping[cpiA] = newIdx;
+ uniqueCPs.push_back(cpA);
+
+ int clusterIndexA = -1;
+ for (int c = 0; c < clusterCount; c++)
+ {
+ if (std::binary_search(cpsPerCluster[c].begin(), cpsPerCluster[c].end(), cpiA))
+ {
+ clusterIndexA = c;
+ break;
+ }
+ }
+
+ for (int j = i + 1; j < cpCount; j++)
+ {
+ if (std::abs(cpIndexesByZ[j].first - cpIndexesByZ[i].first) > FBXSDK_TOLERANCE)
+ {
+ break; // if the z's don't match other values don't matter
+ }
+
+ const int cpiB = cpIndexesByZ[j].second;
+ FbxVector4 cpB = cpList[cpiB];
+
+ //uses FBXSDK_TOLERANCE
+ if (cpA == cpB)
+ {
+ int clusterIndexB = -1;
+ for (int c = 0; c < clusterCount; c++)
+ {
+ if (std::binary_search(cpsPerCluster[c].begin(), cpsPerCluster[c].end(), cpiB))
+ {
+ clusterIndexB = c;
+ break;
+ }
+ }
+
+ //don't merge unless they share the same clusters
+ if (clusterIndexA == clusterIndexB)
+ {
+ oldToNewCPMapping[cpiB] = newIdx;
+ }
+ }
+ }
+ }
+
+ const int originalCPCount = cpCount;
+ const int newCPCount = int(uniqueCPs.size());
+
+ if (newCPCount == cpCount)
+ {
+ //don't bother, it will just scramble it for no reason
+ return;
+ }
+
+ mesh->InitControlPoints(newCPCount);
+ cpList = mesh->GetControlPoints();
+
+ for (int cp = 0; cp < newCPCount; cp++)
+ {
+ cpList[cp] = uniqueCPs[cp];
+ }
+
+ int* polygonCPList = mesh->GetPolygonVertices();
+ const int polygonCPListLength = mesh->GetPolygonVertexCount();
+ for (int pv = 0; pv < polygonCPListLength; pv++)
+ {
+ polygonCPList[pv] = oldToNewCPMapping[polygonCPList[pv]];
+ }
+
+ if (skin)
+ {
+ remapCPsAndRemoveDuplicates(newCPCount, oldToNewCPMapping, skin);
+ for (int c = 0; c < skin->GetClusterCount(); c++)
+ {
+ FbxCluster* cluster = skin->GetCluster(c);
+ remapCPsAndRemoveDuplicates(newCPCount, oldToNewCPMapping, cluster);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.h b/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.h
index 985b32c..f8490cb 100644
--- a/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.h
+++ b/sdk/extensions/exporter/source/NvBlastExtExporterFbxWriter.h
@@ -126,6 +126,9 @@ private:
void addControlPoints(fbxsdk::FbxMesh* mesh, const ExporterMeshData& meshData);
void addBindPose();
+
+ void generateSmoothingGroups(fbxsdk::FbxMesh* mesh, FbxSkin* skin);
+ void removeDuplicateControlPoints(fbxsdk::FbxMesh* mesh, FbxSkin* skin);
};
}
diff --git a/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h b/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h
index 4130964..e879d03 100644
--- a/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h
+++ b/sdk/extensions/physx/include/NvBlastExtCustomProfiler.h
@@ -68,11 +68,22 @@ static thread_local ExtProfileData th_ProfileData[PROFILER_MAX_NESTED_DEPTH];
static thread_local int32_t th_depth = 0;
#endif
+
+/**
+Implements Nv::Blast::ProfilerCallback to serve the physx::PxProfilerCallback set in PxFoundation
+for PhysX Visual Debugger support and platform specific profilers like NVIDIA(R) NSight(TM).
+*/
class ExtCustomProfiler : public ProfilerCallback
{
public:
+ /**
+ Construct an ExtCustomProfiler with platform specific profiler signals disabled.
+ */
ExtCustomProfiler() : m_platformEnabled(false) {}
+
+ ////// ProfilerCallback interface //////
+
virtual void zoneStart(const char* name) override
{
@@ -127,6 +138,13 @@ public:
}
+ ////// local interface //////
+
+ /**
+ Enable or disable platform specific profiler signals. Disabled by default.
+
+ \param[in] enabled true enables, false disables platform profiler calls.
+ */
void setPlatformEnabled(bool enabled)
{
m_platformEnabled = enabled;
@@ -140,4 +158,4 @@ private:
} // namespace Nv
-#endif
+#endif // NVBLASTDEFAULTPROFILER_H
diff --git a/sdk/extensions/physx/include/NvBlastExtPxTask.h b/sdk/extensions/physx/include/NvBlastExtPxTask.h
index b692ce8..739828c 100644
--- a/sdk/extensions/physx/include/NvBlastExtPxTask.h
+++ b/sdk/extensions/physx/include/NvBlastExtPxTask.h
@@ -58,11 +58,13 @@ protected:
virtual ~ExtGroupTaskManager() {}
public:
- static ExtGroupTaskManager* create(physx::PxTaskManager&);
- static ExtGroupTaskManager* create(physx::PxTaskManager&, TkGroup&);
+ /**
+ Construct using existing physx::PxTaskManager and TkGroup. The TkGroup can be set later with setGroup().
+ */
+ static ExtGroupTaskManager* create(physx::PxTaskManager&, TkGroup* = nullptr);
/**
- Change the group to process. Cannot be changed while the group being processed.
+ Set the group to process. Cannot be changed while a group being processed.
*/
virtual void setGroup(TkGroup*) = 0;
@@ -75,12 +77,19 @@ public:
\param[in] workerCount The number of worker tasks to start,
0 uses the dispatcher's worker thread count.
+
\return The number of worker tasks started.
+ If 0, processing did not start and wait() will never return true.
*/
virtual uint32_t process(uint32_t workerCount = 0) = 0;
/**
- Wait for the group to end processing.
+ Wait for the group to end processing. When processing has finished, TkGroup::endProcess is executed.
+
+ \param[in] block true: does not return until the group has been processed.
+ false: return immediately if workers are still processing the group.
+
+ \return true if group processing was completed (and the group was actually processing)
*/
virtual bool wait(bool block = true) = 0;
diff --git a/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.cpp b/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.cpp
index 55a6eae..0b1c6e6 100644
--- a/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.cpp
+++ b/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.cpp
@@ -106,13 +106,7 @@ void ExtGroupTaskManagerImpl::setGroup(TkGroup* group)
}
-ExtGroupTaskManager* ExtGroupTaskManager::create(physx::PxTaskManager& taskManager)
-{
- return NVBLAST_NEW(ExtGroupTaskManagerImpl) (taskManager);
-}
-
-
-ExtGroupTaskManager* ExtGroupTaskManager::create(physx::PxTaskManager& taskManager, TkGroup& group)
+ExtGroupTaskManager* ExtGroupTaskManager::create(physx::PxTaskManager& taskManager, TkGroup* group)
{
return NVBLAST_NEW(ExtGroupTaskManagerImpl) (taskManager, group);
}
diff --git a/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.h b/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.h
index f705e71..de4676e 100644
--- a/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.h
+++ b/sdk/extensions/physx/source/physics/NvBlastExtPxTaskImpl.h
@@ -185,13 +185,10 @@ Implements ExtGroupTaskManager
class ExtGroupTaskManagerImpl : public ExtGroupTaskManager
{
public:
- ExtGroupTaskManagerImpl(physx::PxTaskManager& taskManager)
- : m_taskManager(taskManager), m_sync(0), m_group(nullptr) {}
+ ExtGroupTaskManagerImpl(physx::PxTaskManager& taskManager, TkGroup* group)
+ : m_taskManager(taskManager), m_sync(0), m_group(group) {}
- ExtGroupTaskManagerImpl(physx::PxTaskManager& taskManager, TkGroup& group)
- : m_taskManager(taskManager), m_sync(0), m_group(&group) {}
-
- // public API
+ // ExtGroupTaskManager API
virtual void setGroup(TkGroup*) override;
virtual uint32_t process(uint32_t) override;
virtual void release() override;
@@ -209,4 +206,4 @@ private:
} // namespace Blast
} // namespace Nv
-#endif // NVBLASTEXTPXTASKIMPL_H \ No newline at end of file
+#endif // NVBLASTEXTPXTASKIMPL_H
diff --git a/sdk/extensions/stress/include/NvBlastExtStressSolver.h b/sdk/extensions/stress/include/NvBlastExtStressSolver.h
index 471c35e..674a6d9 100644
--- a/sdk/extensions/stress/include/NvBlastExtStressSolver.h
+++ b/sdk/extensions/stress/include/NvBlastExtStressSolver.h
@@ -256,7 +256,7 @@ public:
virtual void generateFractureCommands(const NvBlastActor& actor, NvBlastFractureBuffers& commands) = 0;
/**
- Generate fracture commands for whole family. A bit faster way to get all fractured bonds then calling generateFractureCommands() for every actor.
+ Generate fracture commands for whole family. A bit faster way to get all fractured bonds than calling generateFractureCommands() for every actor.
Calling this function if getOverstressedBondCount() == 0 or actor has no bond doesn't make sense, bondFractureCount will be '0'.
diff --git a/sdk/toolkit/include/NvBlastTkActor.h b/sdk/toolkit/include/NvBlastTkActor.h
index 453e4c4..73e83cd 100644
--- a/sdk/toolkit/include/NvBlastTkActor.h
+++ b/sdk/toolkit/include/NvBlastTkActor.h
@@ -167,9 +167,9 @@ public:
/**
Apply damage to this actor.
- Actual damage processing is deferred till the group process() call. Sets actor in 'pending' state.
+ Actual damage processing is deferred till the group worker process() call. Sets actor in 'pending' state.
- It's the user's responsibility to keep programParams pointer alive until the group sync() call.
+ It's the user's responsibility to keep programParams pointer alive until the group endProcess() call.
\param[in] program A NvBlastDamageProgram containing damage shaders.
\param[in] programParams Parameters for the NvBlastDamageProgram.
@@ -179,7 +179,7 @@ public:
/**
Apply damage to this actor.
- Actual damage processing is deferred till the group process() call. Sets actor in 'pending' state.
+ Actual damage processing is deferred till the group worker process() call. Sets actor in 'pending' state.
Damage Desc will be stacked into NvBlastProgramParams. NvBlastProgramParams will be passed into shader.
@@ -194,16 +194,16 @@ public:
/**
Apply damage to this actor.
- Actual damage processing is deferred till the group process() call. Sets actor in 'pending' state.
+ Actual damage processing is deferred till the group worker process() call. Sets actor in 'pending' state.
Damage Desc will be stacked into NvBlastDamageProgram. NvBlastDamageProgram will be passed into shader.
- This function overload explicitly sets a material to be passed into NvBlastProgramParams, it must be valid until the group sync() call.
+ This function overload explicitly sets a material to be passed into NvBlastProgramParams, it must be valid until the group endProcess() call.
\param[in] program A NvBlastDamageProgram containing damage shaders.
\param[in] damageDesc Parameters to be put in NvBlastDamageProgram, have to be POD type (will be copied).
\param[in] descSize Size of damageDesc in bytes. Required to copy and store Damage Desc.
- \param[in] material Material to be passed into NvBlastProgramParams. Must be valid until the group sync() call.
+ \param[in] material Material to be passed into NvBlastProgramParams. Must be valid until the group endProcess() call.
*/
virtual void damage(const NvBlastDamageProgram& program, const void* damageDesc, uint32_t descSize, const void* material) = 0;
diff --git a/sdk/toolkit/include/NvBlastTkFamily.h b/sdk/toolkit/include/NvBlastTkFamily.h
index 119d308..02b91cb 100644
--- a/sdk/toolkit/include/NvBlastTkFamily.h
+++ b/sdk/toolkit/include/NvBlastTkFamily.h
@@ -128,7 +128,7 @@ public:
virtual const void* getMaterial() const = 0;
/**
- Set the default material to be passed into NvBlastDamageProgram when a TkActor in this family is damaged. Must be valid till group sync() call.
+ Set the default material to be passed into NvBlastDamageProgram when a TkActor in this family is damaged. Must be valid till group endProcess() call.
\param[in] material The material to be the new default.
*/
diff --git a/sdk/toolkit/include/NvBlastTkFramework.h b/sdk/toolkit/include/NvBlastTkFramework.h
index 51ee743..e9601ff 100644
--- a/sdk/toolkit/include/NvBlastTkFramework.h
+++ b/sdk/toolkit/include/NvBlastTkFramework.h
@@ -129,9 +129,9 @@ Descriptor for joint creation.
*/
struct TkJointDesc
{
- TkFamily* families[2]; //!< The TkFamily objects containint the chunks joined by the joint
+ TkFamily* families[2]; //!< The TkFamily objects containing the chunks joined by the joint
uint32_t chunkIndices[2]; //!< The chunk indices within the corresponding TkFamily objects joined by the joint. The indexed chunks will be support chunks.
- physx::PxVec3 attachPositions[2]; //!< The position of the joint relative to each TkActor which ownes the chunks jointed by this joint
+ physx::PxVec3 attachPositions[2]; //!< The position of the joint relative to each TkActor which owns the chunks jointed by this joint
};
diff --git a/sdk/toolkit/include/NvBlastTkGroup.h b/sdk/toolkit/include/NvBlastTkGroup.h
index 2e5ee3e..c799485 100644
--- a/sdk/toolkit/include/NvBlastTkGroup.h
+++ b/sdk/toolkit/include/NvBlastTkGroup.h
@@ -176,7 +176,7 @@ public:
/**
Helper function to process the group synchronously on a single thread.
*/
- virtual void process();
+ void process();
/**
For profile builds only, request stats of the last successful processing. Inactive in other builds.
diff --git a/sdk/toolkit/source/NvBlastTkGroupImpl.h b/sdk/toolkit/source/NvBlastTkGroupImpl.h
index ea5b926..061802d 100644
--- a/sdk/toolkit/source/NvBlastTkGroupImpl.h
+++ b/sdk/toolkit/source/NvBlastTkGroupImpl.h
@@ -93,7 +93,7 @@ public:
/**
Atomically check if this group is processing actors. @see setProcessing()
- \return true between process() and sync() calls, false otherwise
+ \return true between startProcess() and endProcess() calls, false otherwise
*/
bool isProcessing() const;
diff --git a/sdk/toolkit/source/NvBlastTkTaskImpl.cpp b/sdk/toolkit/source/NvBlastTkTaskImpl.cpp
index e08986a..bc825a7 100644
--- a/sdk/toolkit/source/NvBlastTkTaskImpl.cpp
+++ b/sdk/toolkit/source/NvBlastTkTaskImpl.cpp
@@ -154,7 +154,7 @@ void TkWorker::process(TkWorkerJob& j)
{
NvBlastTimers* timers = nullptr;
- BLAST_PROFILE_SCOPE_M("TkActor");
+ BLAST_PROFILE_SCOPE_M("TkActor");
TkActorImpl* tkActor = j.m_tkActor;
const uint32_t tkActorIndex = tkActor->getIndex();
@@ -179,25 +179,25 @@ void TkWorker::process(TkWorkerJob& j)
{
NvBlastFractureBuffers commandBuffer = m_tempBuffer;
- BLAST_PROFILE_ZONE_BEGIN("Material");
+ BLAST_PROFILE_ZONE_BEGIN("Material");
damage.generateFracture(&commandBuffer, actorLL, timers);
- BLAST_PROFILE_ZONE_END("Material");
+ BLAST_PROFILE_ZONE_END("Material");
if (commandBuffer.chunkFractureCount > 0 || commandBuffer.bondFractureCount > 0)
{
- BLAST_PROFILE_SCOPE_M("Fill Command Events");
+ BLAST_PROFILE_SCOPE_M("Fill Command Events");
reportFractureCommands(commandBuffer, m_bondBuffer, m_chunkBuffer, events, tkActor);
}
NvBlastFractureBuffers eventBuffer = m_tempBuffer;
- BLAST_PROFILE_ZONE_BEGIN("Fracture");
+ BLAST_PROFILE_ZONE_BEGIN("Fracture");
NvBlastActorApplyFracture(&eventBuffer, actorLL, &commandBuffer, logLL, timers);
- BLAST_PROFILE_ZONE_END("Fracture");
+ BLAST_PROFILE_ZONE_END("Fracture");
if (eventBuffer.chunkFractureCount > 0 || eventBuffer.bondFractureCount > 0)
{
- BLAST_PROFILE_SCOPE_M("Fill Fracture Events");
+ BLAST_PROFILE_SCOPE_M("Fill Fracture Events");
tkActor->m_flags |= (TkActorFlag::DAMAGED);
reportFractureEvents(eventBuffer, m_bondBuffer, m_chunkBuffer, events, tkActor);
}
@@ -210,13 +210,13 @@ void TkWorker::process(TkWorkerJob& j)
NvBlastActorSplitEvent splitEvent = { nullptr, nullptr };
if (tkActor->isDamaged())
{
- BLAST_PROFILE_ZONE_BEGIN("Split Memory");
+ BLAST_PROFILE_ZONE_BEGIN("Split Memory");
uint32_t maxActorCount = NvBlastActorGetMaxActorCountForSplit(actorLL, logLL);
splitEvent.newActors = mem->reserveNewActors(maxActorCount);
- BLAST_PROFILE_ZONE_END("Split Memory");
- BLAST_PROFILE_ZONE_BEGIN("Split");
+ BLAST_PROFILE_ZONE_END("Split Memory");
+ BLAST_PROFILE_ZONE_BEGIN("Split");
j.m_newActorsCount = NvBlastActorSplit(&splitEvent, actorLL, maxActorCount, m_splitScratch, logLL, timers);
- BLAST_PROFILE_ZONE_END("Split");
+ BLAST_PROFILE_ZONE_END("Split");
tkActor->m_flags.clear(TkActorFlag::DAMAGED);
}
@@ -231,7 +231,7 @@ void TkWorker::process(TkWorkerJob& j)
{
NVBLAST_ASSERT(splitEvent.deletedActor == tkActor->getActorLL());
- BLAST_PROFILE_ZONE_BEGIN("memory new actors");
+ BLAST_PROFILE_ZONE_BEGIN("memory new actors");
auto tkSplitEvent = events.allocData<TkSplitEvent>();
@@ -243,21 +243,21 @@ void TkWorker::process(TkWorkerJob& j)
tkSplitEvent->parentData.index = tkActorIndex;
family.removeActor(tkActor);
- BLAST_PROFILE_ZONE_END("memory new actors");
+ BLAST_PROFILE_ZONE_END("memory new actors");
- BLAST_PROFILE_ZONE_BEGIN("create new actors");
+ BLAST_PROFILE_ZONE_BEGIN("create new actors");
for (uint32_t i = 0; i < j.m_newActorsCount; ++i)
{
TkActorImpl* newActor = family.addActor(splitEvent.newActors[i]);
tkSplitEvent->children[i] = newActor;
}
j.m_newActors = reinterpret_cast<TkActorImpl**>(tkSplitEvent->children);
- BLAST_PROFILE_ZONE_END("create new actors");
+ BLAST_PROFILE_ZONE_END("create new actors");
- BLAST_PROFILE_ZONE_BEGIN("split event");
+ BLAST_PROFILE_ZONE_BEGIN("split event");
events.addEvent(tkSplitEvent);
- BLAST_PROFILE_ZONE_END("split event");
+ BLAST_PROFILE_ZONE_END("split event");
}
j.m_tkActor->m_flags.clear(TkActorFlag::PENDING);