• Advertisement
Sign in to follow this  

NVMeshMender - problems with using

This topic is 3384 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 trying to use mesh mender to generate tangent-basis and the application crashes when using Mend function (says that vector is out of range). My code is very simple (note that I dont use any index buffer so every successive three indices point to every successive three vertices):
		std::vector<unsigned int> indices;
		std::vector<unsigned int> remap;
		std::vector<MeshMender::Vertex> verts;

		for (int t = 0; t < 3*facesNum; ++t)
		{
			indices.push_back(3*t + 0);
			indices.push_back(3*t + 1);
			indices.push_back(3*t + 2);
		}

		MeshMender::Vertex inv;

		for (int t = 0; t < 3*facesNum; ++t)
		{
			inv.pos = D3DXVECTOR3(vertices[t].position.x, vertices[t].position.y, vertices[t].position.z);
			inv.s = vertices[t].texCoord0.x;
			inv.t = vertices[t].texCoord0.y;
			verts.push_back( inv );
		}

		const float minNormalCreaseCos = 0.2f;
		const float minTangentCreaseCos = 0.2f;
		const float minBinormalCreaseCos = 0.2f;
		const float weightNormalsByArea = 0.5f;

		MeshMender mender;

		mender.Mend(verts,
		indices,
		remap,
		minNormalCreaseCos,
		minTangentCreaseCos,
		minBinormalCreaseCos,
		weightNormalsByArea,
		MeshMender::CALCULATE_NORMALS,
		MeshMender::DONT_RESPECT_SPLITS,
		MeshMender::FIX_CYLINDRICAL);

Share this post


Link to post
Share on other sites
Advertisement
Ok, never mind. I decided to use D3DXComputeTangentFrame, save data to my own file format and I can use it with both, D3D and OGL renderers :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement