Jump to content
  • Advertisement
Sign in to follow this  

Access to BLENDINCIDES field of vertex buffer?

This topic is 2246 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 hava a question. There is such popular function (from Quake3 source of soce) like buildSkinnedMesh. I suppose that everyone hear about it.
In this function mesh which has format (POSITION(float3), NORMAL(float3), TEXCOORD(float2)) is changed with the aid of ConvertToIndexedBlendedMesh into skinned mesh which has format (POSITION(float3), BLENDWEIGHT (in my case float2), BLENDINDICES (UBYTE4), NORMAL(float3), TEXCOORD(float2)).And after that I am confused... because when I get vertex buffer of the skinned mesh I see that all the members related to BLENDINDICES has 0 in it!!!

HRESULT hr = mSkinInfo->ConvertToIndexedBlendedMesh(tempMesh, D3DXMESH_DYNAMIC,
MAX_NUM_BONES_SUPPORTED, 0, 0, 0, 0, &mMaxVertInfluences,
&numBoneComboEntries, &boneComboTable, &mSkinnedMesh);

d3d::CheckError(hr, "ConvertToIndexedBlendedMesh()");

//Get vertex declaration for debug purpose
D3DVERTEXELEMENT9 elements[64];
u32 numElements = 0;

//Get vertex buffer for debug purposes
IDirect3DVertexBuffer9 *pVB = NULL;

u32 numBytes = mSkinnedMesh->GetNumBytesPerVertex();
void* dataVB = NULL;
if(FAILED(pVB->Lock(0, numBytes, &dataVB, D3DLOCK_DISCARD))) return;

float* data = (float *) dataVB;
float position_x = (float) data[0];
float position_y = (float) data[1];
float position_z = (float) data[2];
float weight0 = (float) data[3];
float weight1 = (float) data[4];
u32 blendindices = (u32) data[5]; //zero!!!
float n0 = (float) data[6];
float n1 = (float) data[7];
float n2 = (float) data[8];
float tex0 = (float) data[9];
float tex1 = (float) data[10];

float position2_x = (float) data[11];
float position2_y = (float) data[12];
float position2_z = (float) data[13];
float weight20 = (float) data[14];
float weight21 = (float) data[15];
u32 blendindices2 = (u32) data[16]; //zero!!!

u32 posBLENDINDICES = 5;
u32 posWEIGHT = 3;
u32 size = numBytes/4;
vector<u32> blendIndices;
for(u32 i = 0; i< 1000; ++i)
blendIndices.push_back((u32)data[i*11+5]); //all zeros!!!

The most probably is that BLENDINDICES returns alway 0 (so it is only for read) because when I was trying to modify this field I was failed. I was also trying to change another field just to check if I get well access to the vertex buffer and I was succeed. So it seems that BLENDINDICES is READONLY field. Could anybody confirm that. In runtime the animation behaves in the way like BLENDINDICES values are properly set, that is why I have assumptions that are only for READ. Edited by anders211

Share this post

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

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!