Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

MindCode

lib3ds

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using lib3ds to extract the triangle geometry from a 3ds file. For some reason it's crashing.
void Extract3dsNode(Lib3dsFile* p3ds, Lib3dsNode* pNode) {
	for(Lib3dsNode* i = pNode->childs; i != NULL; i = i->next) {
		Extract3dsNode(p3ds, i);
	}

	if(pNode->type == LIB3DS_OBJECT_NODE) {

		if(!strcmp(pNode->name, "$$$DUMMY")) {
			throw "Lib3ds: Invalid mesh name.";
		}

		Lib3dsMesh* pMesh;

		pMesh = lib3ds_file_mesh_by_name(p3ds, pNode->name);

		if(!pMesh) {
			throw "Lib3ds: Mesh name does not exist.";
		}

		for(int _i = 0; _i < pMesh->faces; ++_i) {

			Lib3dsFace* pFace;
			CTriangle Triangle;

			pFace = &pMesh->faceL[_i];

			for(int j = 0; j < 3; j++) {

				Triangle.m_vVector[j].x = pMesh->pointL[ pFace->points[j] ].pos[0];
				Triangle.m_vVector[j].y = pMesh->pointL[ pFace->points[j] ].pos[1];
				Triangle.m_vVector[j].z = pMesh->pointL[ pFace->points[j] ].pos[2];
			}

			Triangle.Gen(Vector3dv);
			m_vTriangles.push_back(Triangle);

		}
	}
}
 
From what I can tell, it crashes on the innermost loop, when it gets the vertex information. [edited by - MindCode on January 28, 2003 7:19:45 PM]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!