Hello, I have a problem.
This is my source code.
float* punkty[] = { NULL };
int ilePunktow = 0;
int* indeksy[] = { NULL };
int ileIndeksow = 0;
void drawAnim8orObject(struct Anim8orObject *obj) {
// OpenGL 1.1
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// Analiza obiektu (każdy tzw. mesh):
int i;
for (i = 0; i < obj->nMeshes; i++) {
// Kolor każdego mesha jest (dla uproszczenia) kolorem
// pierwszego z materiałów dla niego zdefiniowanych:
glColor4fv(obj->meshes[i]->materials[0].diffuse);
// Tabela z punkami danego "mesha":
glVertexPointer(3, GL_FLOAT, 0, obj->meshes[i]->coordinates);
// Tabela z normalnymi:
glNormalPointer(GL_FLOAT, 0, obj->meshes[i]->normals);
// Tabela ze współrzędnymi tekstur:
glTexCoordPointer(2, GL_FLOAT, 0, obj->meshes[i]->texcoords);
// Narysowanie kształtu korzystając z tabeli indeksów:
glDrawElements(GL_TRIANGLES, obj->meshes[i]->nIndices, GL_UNSIGNED_INT, obj->meshes[i]->indices);
punkty[i] = obj->meshes[i]->coordinates;
ilePunktow = obj->meshes[i]->nVertices;
indeksy[i] = obj->meshes[i]->indices;
ileIndeksow = obj->meshes[i]->nIndices;
}
}
NxBodyDesc bodyDesc;
NxActorDesc actorDesc;
NxTriangleMeshDesc triMesh;
triMesh.numVertices = ilePunktow;
triMesh.pointStrideBytes = sizeof(float) * 3;
triMesh.points = punkty;
triMesh.numTriangles = ileIndeksow / 3;
triMesh.triangles = indeksy;
triMesh.triangleStrideBytes = sizeof(int) * 3;
NxInitCooking();
MemoryWriteBuffer buf;
bool res = NxCookTriangleMesh(triMesh, buf);
if (!res) {
printf("Unable to cook a triangle mesh.");
exit(1);
}
NxTriangleMesh* pMesh = gPhysicsSDK->createTriangleMesh(MemoryReadBuffer(buf.data));
NxCloseCooking();
NxTriangleMeshShapeDesc tmsd;
tmsd.meshData = pMesh;
tmsd.userData = &triMesh;
tmsd.localPose.t = NxVec3(0.0, 0.0, 0.0);
tmsd.meshPagingMode = NX_MESH_PAGING_AUTO;
actorDesc.shapes.pushBack(&tmsd);
actorDesc.body = NULL;
actorDesc.globalPose.t = NxVec3(0.0, 0.0, 0.0);*/
kabina = gScene->createActor(actorDesc);
I have this error. Why ? I would load object from blender to physX and move it.
What could be wrong ?
Error 3 error LNK1120: 2 unresolved externals C:\Users\Piotrek\Documents\Visual Studio 2013\Projects\Projekt inzynierski\Debug\Projekt inzynierski.exe 1 1 Projekt inzynierski
Error 1 error LNK2019: unresolved external symbol "public: __thiscall MemoryWriteBuffer::MemoryWriteBuffer(void)" (??0MemoryWriteBuffer@@QAE@XZ) referenced in function "public: void __thiscall Dzwig::create(class NxPhysicsSDK &,class NxScene &)" (?create@Dzwig@@QAEXAAVNxPhysicsSDK@@AAVNxScene@@@Z) C:\Users\Piotrek\Documents\Visual Studio 2013\Projects\Projekt inzynierski\Projekt inzynierski\main.obj Projekt inzynierski
Error 2 error LNK2019: unresolved external symbol "public: virtual __thiscall MemoryWriteBuffer::~MemoryWriteBuffer(void)" (??1MemoryWriteBuffer@@UAE@XZ) referenced in function "public: void __thiscall Dzwig::create(class NxPhysicsSDK &,class NxScene &)" (?create@Dzwig@@QAEXAAVNxPhysicsSDK@@AAVNxScene@@@Z) C:\Users\Piotrek\Documents\Visual Studio 2013\Projects\Projekt inzynierski\Projekt inzynierski\main.obj Projekt inzynierski
Vertex, indices etc. I’m getting from my structure
/////////////////////////////////////////////////////////
//
// Anim8orExport.h
//
// This file defines the format of Anim8or ".c" models
//
/////////////////////////////////////////////////////////
#if !defined(__ANIM8OR_EXPORT_H)
#define __ANIM8OR_EXPORT_H 1
//#pragma warning(disable:4244) // No warnings on precision truncation
//#pragma warning(disable:4305) // No warnings on precision truncation, MSVC 6.0
typedef float color[4];
typedef struct Anim8orMaterial {
color ambient;
color diffuse;
color specular;
color emissive;
float Ka, Kd, Ks, Ke;
float Roughness, Brilliance;
char *ambientTexture;
char *diffuseTexture;
char *specularTexture;
char *emissiveTexture;
char *transparencyTexture;
char *bumpmapTexture;
char *texture;
} Anim8orMaterial;
typedef struct Anim8orMesh {
const char *name;
int nVertices;
int nIndices;
int *indices;
unsigned char *matindices;
float *coordinates;
float *normals;
float *texcoords;
Anim8orMaterial *materials;
} Anim8orMesh;
typedef struct Anim8orObject {
const char *name;
int nMeshes;
Anim8orMesh *meshes[128];
} Anim8orObject;
I have something wrong with function MemoryWriteBuffer and MemoryReadBuffer and I don’t know what it.