Hi I have a problem with creating cloth because when I try to compile it I have unresolved external symbol
public: virtual _thiscall PxTooklit::MemoryOutputStream::~MemoryOutputStream(void)
and the same with destructor and the
public: virtual _thiscall PxToolkit::MemoryInputData(unsigned char*, unsigned int)
Am I missing some sort of library ?
Here is some more code to clear what libs I use
#ifndef _LIBRARIES_H_
#define _LIBRARIES_H_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(lib, "PhysX3CHECKED_x86.lib")
#pragma comment(lib, "PhysX3CommonCHECKED_x86.lib")
#pragma comment(lib, "PhysX3ExtensionsCHECKED.lib")
#pragma comment(lib, "PhysX3CharacterKinematicCHECKED_x86.lib")
#pragma comment(lib, "PhysX3CookingCHECKED_x86.lib")
#pragma comment(lib, "PhysXProfileSDKCHECKED.lib")
#pragma comment(lib, "PxTaskCHECKED.lib")
#pragma comment(lib, "RepX3CHECKED.lib")
#endif
and it neing used in the function of the cloth
mMeshDesc.setToDefault();
PxToolkit::MemoryOutputStream wb = PxToolkit::MemoryOutputStream();
//-------------------------geometry values
int w = 8, h = 7;
float hw = w / 2.f;
float hh = h / 2.f;
float d = 0.2f;
//
//
int numX = (int)(w / d) +1;
int numY = (int)(h / d) +1;
mMeshDesc.points.count = (numX + 1) * (numY + 1);
mMeshDesc.triangles.count = numX * numY * 2;
mMeshDesc.points.stride = sizeof( PxVec3 );
mMeshDesc.triangles.stride = 3 * sizeof(PxU32);
mMeshDesc.points.data = (PxVec3*)malloc(sizeof(PxVec3)* mMeshDesc.points.count );
mMeshDesc.triangles.data = (physx::PxU32*)malloc( sizeof( physx::PxU32 ) * mMeshDesc.triangles.count * 3);
mMeshDesc.edgeFlags = 0;
//----------------------------------Geometry
int i,j;
physx::PxVec3* p = (physx::PxVec3*)mMeshDesc.points.data;
mPos.resize( mMeshDesc.points.count );
mNormal.resize( mMeshDesc.points.count );
mIndices.resize( mMeshDesc.triangles.count * 3 );
for( i = 0; i y = float(h);
p->z = d*i;
++p;
}
}
memcpy( &mPos[0].x, (mMeshDesc.points.data), sizeof(physx::PxVec3)* mMeshDesc.points.count );
//-------------------------------------Topology
physx::PxU32* id = (physx::PxU32*)mMeshDesc.triangles.data;
for( i = 0; i < numY; ++i )
{
for( j = 0; j < numX; ++j )
{
PxU32 i0 = i * (numX+1) + j;
PxU32 i1 = i0 + 1;
PxU32 i2 = i0 + (numX+1);
PxU32 i3 = i2 + 1;
if ((j+i)%2)
{
*id++ = i0;
*id++ = i2;
*id++ = i1;
*id++ = i1;
*id++ = i2;
*id++ = i3;
}
else
{
*id++ = i0;
*id++ = i2;
*id++ = i3;
*id++ = i0;
*id++ = i3;
*id++ = i1;
}
}
}
memcpy( &mIndices[0], mMeshDesc.triangles.data, sizeof(physx::PxU32)*mMeshDesc.triangles.count * 3);
//---------------------------check if the criteria are met
PX_ASSERT(mMeshDesc.isValid() );
if( !mCooking->cookClothFabric( mMeshDesc, mGravity, wb) )
printf("Error cooking the cloth fibic!");
PxToolkit::MemoryInputData rb( wb.getData(), wb.getSize() );
mFabric = mPhysX->createClothFabric( rb );
physx::PxTransform tr;
tr.p = physx::PxVec3(0,10,0);
tr.q = physx::PxQuat::createIdentity();
mPoints = (physx::PxClothParticle*)malloc( sizeof(physx::PxClothParticle)* mMeshDesc.points.count );
p = (physx::PxVec3*)mMeshDesc.points.data;
for( size_t i = 0; i < mMeshDesc.points.count; ++i )
{
mPoints[i].pos = *p;
//----------------------Top corner points
if( i == 0 || i == numX )
mPoints[i].invWeight = 0;
else
mPoints[i].invWeight = 1.f;
++p;
}
cd.setToDefault();
physx::PxClothCollisionSphere mCollider[2]= {
{PxVec3(-1.0f, 0.0f, 0.0f), 0.5f},
{PxVec3( 1.0f, 0.0f, 0.0f), 0.25f}};
physx::PxU32 capsulePairs[] = {0,1};
cd.spheres = mCollider;
cd.numSpheres = 2;
cd.pairIndexBuffer = capsulePairs;
cd.numPairs = 1;
mPlane.normal = physx::PxVec3(0.f,1.f,0.f);
mPlane.distance = 0.f;
physx::PxU32 convMask = 1;//-------------------------------Convex references to the first plane only
mCloth->addCollisionPlane( mPlane );
mCloth->addCollisionConvex( convMask );
mCloth->setClothFlag( physx::PxClothFlag::eSWEPT_CONTACT, true);
mCloth = mPhysX->createCloth( pose, *mFabric, mPoints, cd, physx::PxClothFlag::eSWEPT_CONTACT);
mCps.solverType = physx::PxClothPhaseSolverConfig::eFAST;
mCps.stiffness = 1;
mCps.stretchStiffness = 0.5f;
mCloth->setPhaseSolverConfig( physx::PxClothFabricPhaseType::eBENDING, mCps );
mCloth->setPhaseSolverConfig( physx::PxClothFabricPhaseType::eSTRETCHING, mCps );
mCloth->setPhaseSolverConfig( physx::PxClothFabricPhaseType::eSHEARING, mCps );
mCloth->setPhaseSolverConfig( physx::PxClothFabricPhaseType::eSTRETCHING_HORIZONTAL, mCps );
mCloth->setDampingCoefficient( 0.125f );
mScene->addActor( *mCloth );
return mCloth;
I’m trying to figure it out but I don’t know what I am doing wrong. ;(
Part of this code is from the guide in the SDK.
Thanks in advance.