Skip to content

Commit

Permalink
plugin update (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulioJerez committed Oct 27, 2024
1 parent de02e52 commit 898c88e
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void ndBodySphFluid::SortBuckets(ndThreadPool* const threadPool)

#ifdef _DEBUG
const ndArray<ndVector>& point = GetPositions();
for (int i = 1; i < data.m_hashGridMap.GetCount(); ++i)
for (ndInt32 i = 1; i < data.m_hashGridMap.GetCount(); ++i)
{
ndGridHash cell0(data.m_hashGridMap[i - 1]);
ndGridHash cell1(data.m_hashGridMap[i + 0]);
Expand Down Expand Up @@ -426,7 +426,7 @@ void ndBodySphFluid::SortCellBuckects(ndThreadPool* const threadPool)
}

#ifdef _DEBUG
for (int i = 1; i < data.m_hashGridMap.GetCount(); ++i)
for (ndInt32 i = 1; i < data.m_hashGridMap.GetCount(); ++i)
{
ndGridHash cell0(data.m_hashGridMap[i - 1]);
ndGridHash cell1(data.m_hashGridMap[i + 0]);
Expand Down Expand Up @@ -1159,7 +1159,7 @@ bool ndBodySphFluid::TraceHashes() const
#if 0
ndWorkingBuffers& data = *m_workingBuffers;
ndGridHash* xxxx = &data.m_hashGridMap[0];
for (int i = 0; i < data.m_hashGridMap.GetCount(); i++)
for (ndInt32 i = 0; i < data.m_hashGridMap.GetCount(); i++)
{
ndTrace(("id(%d)\tx(%d)\tz(%d)\n", xxxx[i].m_particleIndex, xxxx[i].m_x, xxxx[i].m_z));
}
Expand Down Expand Up @@ -1488,7 +1488,7 @@ void ndBodySphFluid::SortBuckets(ndThreadPool* const threadPool)

#ifdef _DEBUG
const ndArray<ndVector>& point = GetPositions();
for (int i = 1; i < data.m_hashGridMap.GetCount(); ++i)
for (ndInt32 i = 1; i < data.m_hashGridMap.GetCount(); ++i)
{
ndGridHash cell0(data.m_hashGridMap[i - 1]);
ndGridHash cell1(data.m_hashGridMap[i + 0]);
Expand Down Expand Up @@ -1591,7 +1591,7 @@ void ndBodySphFluid::SortCellBuckects(ndThreadPool* const threadPool)
}

#ifdef _DEBUG
for (int i = 1; i < data.m_hashGridMap.GetCount(); ++i)
for (ndInt32 i = 1; i < data.m_hashGridMap.GetCount(); ++i)
{
ndGridHash cell0(data.m_hashGridMap[i - 1]);
ndGridHash cell1(data.m_hashGridMap[i + 0]);
Expand Down Expand Up @@ -2335,7 +2335,7 @@ bool ndBodySphFluid::TraceHashes() const
#if 0
ndWorkingBuffers& data = *m_workingBuffers;
ndGridHash* xxxx = &data.m_hashGridMap[0];
for (int i = 0; i < data.m_hashGridMap.GetCount(); i++)
for (ndInt32 i = 0; i < data.m_hashGridMap.GetCount(); i++)
{
ndTrace(("id(%d)\tx(%d)\tz(%d)\n", xxxx[i].m_particleIndex, xxxx[i].m_x, xxxx[i].m_z));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void ndBodySphFluid::SortGrids(ndThreadPool* const threadPool)
}

#ifdef _DEBUG
for (int i = 1; i < data.m_hashGridMap.GetCount(); ++i)
for (ndInt32 i = 1; i < data.m_hashGridMap.GetCount(); ++i)
{
ndGridHash cell0(data.m_hashGridMap[i - 1]);
ndGridHash cell1(data.m_hashGridMap[i + 0]);
Expand Down Expand Up @@ -732,7 +732,7 @@ bool ndBodySphFluid::TraceHashes() const
#if 0
ndWorkingBuffers& data = *m_workingBuffers;
ndGridHash* xxxx = &data.m_hashGridMap[0];
for (int i = 0; i < data.m_hashGridMap.GetCount(); i++)
for (ndInt32 i = 0; i < data.m_hashGridMap.GetCount(); i++)
{
ndTrace(("id(%d)\tx(%d)\tz(%d)\n", xxxx[i].m_particleIndex, xxxx[i].m_x, xxxx[i].m_z));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ void ndShapeCompound::ndTreeArray::AddNode(ndNodeBase* const node, ndInt32 index
{
ndTreeArray::ndNode* const myNode = Insert(node, index);
node->m_myNode = myNode;
//node->m_shapeInstance->m_parent____ = parent;
node->m_shapeInstance->m_subCollisionHandle = myNode;
}

Expand All @@ -260,7 +259,6 @@ ndShapeCompound::ndShapeCompound()
,m_boxMinRadius(ndFloat32(0.0f))
,m_boxMaxRadius(ndFloat32(0.0f))
,m_root(nullptr)
//,m_ownerInstance(nullptr)
,m_idIndex(0)
{
}
Expand All @@ -272,7 +270,6 @@ ndShapeCompound::ndShapeCompound(const ndShapeCompound& source)
,m_boxMinRadius(ndFloat32(0.0f))
,m_boxMaxRadius(ndFloat32(0.0f))
,m_root(nullptr)
//,m_ownerInstance(m_ownerInstance)
,m_idIndex(0)
{
ndTreeArray::Iterator iter(source.m_array);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,5 @@ ndInt32 ndConvexHull2d(ndVector* const vertexCloud2d, ndInt32 count)
{
vertexCloud2d[i] = hull[i];
}
//return k - 1;
return k;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* 3. This notice may not be removed or altered from any source distribution.
*/

#ifndef __NDG_CONVEXHULL_2D__
#define __NDG_CONVEXHULL_2D__
#ifndef __ND_CONVEXHULL_2D_H__
#define __ND_CONVEXHULL_2D_H__

#include "ndCoreStdafx.h"
#include "ndVector.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
#include "ndArray.h"
#include "ndVector.h"

D_CORE_API void ndTriangulatePolygon(ndVector* const vertexCloud2d, ndInt32 count, ndArray<ndInt32>& triangles);
D_CORE_API void ndTriangulatePolygon(ndVector* const points, ndInt32 count, ndArray<ndInt32>& triangles);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,7 @@ ndJointBilateralConstraint* ndUrdfFile::ImportJoint(const nd::TiXmlNode* const j
pivotMatrix = matrix * pivotMatrix;
}

ndAssert(0);
const nd::TiXmlElement* const newtonEx = (nd::TiXmlElement*)jointNode->FirstChild("newton");
if (newtonEx)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void ndDynamicsUpdate::SortBodyJointScan()
ndCountingSort<ndJointBodyPairIndex, ndEvaluateKey1, D_MAX_BODY_RADIX_BIT>(*scene, tempBuffer, &bodyJointPairs[0], ndInt32 (bodyJointPairs.GetCount()), nullptr, nullptr);

#ifdef _DEBUG
for (int i = 1; i < bodyJointPairs.GetCount(); ++i)
for (ndInt32 i = 1; i < bodyJointPairs.GetCount(); ++i)
{
ndInt32 key0 = bodyJointPairs[i - 1].m_body;
ndInt32 key1 = bodyJointPairs[i + 0].m_body;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ ndWorld::ndWorld()

ndWorld::~ndWorld()
{
DeleteDeferredObjects();
CleanUp();

delete m_scene;
Expand Down Expand Up @@ -428,15 +429,9 @@ ndInt32 ndWorld::CompareJointByInvMass(const ndJointBilateralConstraint* const j
return 0;
}

void ndWorld::ThreadFunction()
void ndWorld::DeleteDeferredObjects()
{
D_TRACKTIME();
ndUnsigned64 timeAcc = ndGetTimeInMicroseconds();

m_inUpdate = true;
m_scene->Begin();

// clean up all batched deletd objects, before update
// clean up all batched deleted objects, before update
while (m_deletedModels.GetCount())
{
D_TRACKTIME();
Expand Down Expand Up @@ -486,6 +481,16 @@ void ndWorld::ThreadFunction()
ndSharedPtr<ndBody> sharedBody(GetBody(body));
RemoveBody(sharedBody);
}
}

void ndWorld::ThreadFunction()
{
D_TRACKTIME();
ndUnsigned64 timeAcc = ndGetTimeInMicroseconds();

m_inUpdate = true;
m_scene->Begin();
DeleteDeferredObjects();

//m_inUpdate = true;
//m_scene->Begin();
Expand Down
Loading

0 comments on commit 898c88e

Please sign in to comment.