Skip to content

Commit

Permalink
fine release candidate for newton 4.00 2021
Browse files Browse the repository at this point in the history
make some collision system also parallel, lock and atomic free.

I now need to revisit the joint limits, since I broke something there, but is not really critical now.
  • Loading branch information
JulioJerez committed Dec 26, 2021
1 parent a53bf90 commit bee9bd9
Show file tree
Hide file tree
Showing 19 changed files with 263 additions and 250 deletions.
3 changes: 1 addition & 2 deletions newton-4.00/applications/ndSandbox/demos/ndBasicStacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ void ndBasicStacks (ndDemoEntityManager* const scene)
BuildSphereColumn(scene, 10.0f, origin, ndVector(0.5f, 0.5f, 0.5f, 0.0f), 20);

origin.m_z += 6.0f;
//BuildBoxColumn(scene, 10.0f, origin, ndVector(0.5f, 0.5f, 0.5f, 0.0f), 7);
BuildBoxColumn(scene, 10.0f, origin, ndVector(0.5f, 0.5f, 0.5f, 0.0f), 20);
BuildBoxColumn(scene, 10.0f, origin, ndVector(0.5f, 0.5f, 0.5f, 0.0f), 18);

origin.m_z += 6.0f;
BuildCylinderColumn(scene, 10.0f, origin, ndVector(0.75f, 0.6f, 1.0f, 0.0f), 20);
Expand Down
4 changes: 2 additions & 2 deletions newton-4.00/applications/ndSandbox/ndDemoEntityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//#define DEFAULT_SCENE 1 // gpu basic rigidbody
//#define DEFAULT_SCENE 2 // friction ramp
//#define DEFAULT_SCENE 3 // conservation of momentum
//#define DEFAULT_SCENE 4 // basic Stacks
#define DEFAULT_SCENE 4 // basic Stacks
//#define DEFAULT_SCENE 5 // basic Trigger
//#define DEFAULT_SCENE 6 // basic player
//#define DEFAULT_SCENE 7 // particle fluid
Expand All @@ -50,7 +50,7 @@
//#define DEFAULT_SCENE 12 // active rag doll
//#define DEFAULT_SCENE 13 // basic vehicle
//#define DEFAULT_SCENE 14 // heavy vehicle
#define DEFAULT_SCENE 15 // simple voronoi fracture
//#define DEFAULT_SCENE 15 // simple voronoi fracture
//#define DEFAULT_SCENE 16 // basic voronoi fracture
//#define DEFAULT_SCENE 17 // linked voronoi fracture
//#define DEFAULT_SCENE 18 // skin peel voronoi fracture
Expand Down
4 changes: 2 additions & 2 deletions newton-4.00/applications/ndSandbox/toolbox/ndDebugDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ static void DrawBox(const ndVector& p0, const ndVector& p1, glVector3 box[12][2]
void RenderBodiesAABB(ndDemoEntityManager* const scene)
{
ndWorld* const world = scene->GetWorld();
const ndBodyList& bodyList = world->GetBodyList();

GLuint shader = scene->GetShaderCache().m_wireFrame;

Expand All @@ -97,6 +96,7 @@ void RenderBodiesAABB(ndDemoEntityManager* const scene)
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof (glVector3), box);

const ndBodyList& bodyList = world->GetBodyList();
for (ndBodyList::ndNode* bodyNode = bodyList.GetFirst(); bodyNode; bodyNode = bodyNode->GetNext())
{
ndVector p0;
Expand Down Expand Up @@ -181,7 +181,7 @@ void RenderContactPoints(ndDemoEntityManager* const scene)
glVector3 pointBuffer[4];
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof (glVector3), pointBuffer);
const ndContactList& contactList = world->GetContactList();
const ndContactArray& contactList = world->GetContactList();
for (ndInt32 i = 0; i < contactList.GetCount(); ++i)
{
const ndContact* const contact = contactList[i];
Expand Down
6 changes: 6 additions & 0 deletions newton-4.00/sdk/dCollision/ndBodyKinematic.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class ndBodyKinematic: public ndBody
void SetAccel(const ndJacobian& accel);
virtual void SpecialUpdate(ndFloat32 timestep);
virtual void IntegrateGyroSubstep(const ndVector& timestep);
virtual void ApplyExternalForces(ndInt32 threadIndex, ndFloat32 timestep);
virtual ndJacobian IntegrateForceAndToque(const ndVector& force, const ndVector& torque, const ndVector& timestep) const;

void UpdateCollisionMatrix();
Expand Down Expand Up @@ -514,5 +515,10 @@ inline void ndBodyKinematic::SpecialUpdate(ndFloat32)
{
dAssert(0);
}

inline void ndBodyKinematic::ApplyExternalForces(ndInt32, ndFloat32)
{
}

#endif

2 changes: 1 addition & 1 deletion newton-4.00/sdk/dCollision/ndCollision.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <ndShapePoint.h>
#include <ndShapeSphere.h>
#include <ndShapeConvex.h>
#include <ndContactList.h>
#include <ndContactArray.h>
#include <ndShapeCapsule.h>
#include <ndShapeCylinder.h>
#include <ndBodyKinematic.h>
Expand Down
2 changes: 1 addition & 1 deletion newton-4.00/sdk/dCollision/ndContact.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class ndContact: public ndConstraint
static ndVector m_initialSeparatingVector;

friend class ndScene;
friend class ndContactList;
friend class ndContactArray;
friend class ndBodyKinematic;
friend class ndContactSolver;
friend class ndShapeInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#include "ndCoreStdafx.h"
#include "ndCollisionStdafx.h"
#include "ndContact.h"
#include "ndContactList.h"
#include "ndContactArray.h"
#include "ndBodyKinematic.h"

ndContact* ndContactList::CreateContact(ndBodyKinematic* const body0, ndBodyKinematic* const body1)
ndContact* ndContactArray::CreateContact(ndBodyKinematic* const body0, ndBodyKinematic* const body1)
{
ndContact* const contact = new ndContact;
contact->SetBodies(body0, body1);
Expand All @@ -35,16 +35,16 @@ ndContact* ndContactList::CreateContact(ndBodyKinematic* const body0, ndBodyKine
return contact;
}

void ndContactList::DeleteContact(ndContact* const contact)
void ndContactArray::DeleteContact(ndContact* const contact)
{
if (contact->m_isAttached)
{
contact->DetachFromBodies();
contact->DetachFromBodies();
}
contact->m_isDead = 1;
}

void ndContactList::DeleteAllContacts()
void ndContactArray::DeleteAllContacts()
{
for (ndInt32 i = GetCount() - 1; i >= 0; --i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,16 @@
#include "ndCollisionStdafx.h"
#include "ndContact.h"


class ndConstraintArray: public ndArray<ndConstraint*>
{
public:
ndConstraintArray()
:ndArray<ndConstraint*>(1024)
{
}
};

class ndContactList : public ndArray<ndContact*>
class ndContactArray : public ndArray<ndContact*>
{
public:
ndContactList()
ndContactArray()
:ndArray<ndContact*>(1024)
,m_lock()
{
}

~ndContactList()
~ndContactArray()
{
}

Expand Down
Loading

0 comments on commit bee9bd9

Please sign in to comment.