needforhint

hello

this is my first post in theese forums, though I am not such a noob. I load a multimaterial mesh from X file and render it with DrawPrimitive() function like this


and with DrawSubset() method replacing DrawPrimitve I get correct result


I wonder what goes wrong. All I do on my mesh object is that I call Optimize InPlace() method like this

Mesh->m_pAdjency =new DWORD[3 * Mesh->m_pMesh->GetNumFaces() ];

Mesh->m_pMesh->GenerateAdjacency(0.00f,Mesh->m_pAdjency);

if (FAILED(hr =Mesh->m_pMesh->OptimizeInplace(D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_COMPACT | D3DXMESHOPT_VERTEXCACHE,
Mesh->m_pAdjency,
NULL,
NULL,
NULL)));

the rendering is done this way:

if(FAILED(hr = m_pDevice->SetStreamSource(i,pSourceBuff , m_pAttribTab->VertexStart,
sizeof(BUMPVERTEX))))
return hr;


m_pDevice->SetFVF(BUMPVERTEX::FVF);


m_pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, m_pAttribTab->VertexStart,m_pAttribTab->FaceCount);

the m_pAttribTab is a correct pointer to the attribute table of my multimaterial mesh. I have checked it whille debugging....

and also it makes no change when I call drawprimitive like this


m_pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, m_pAttribTab->VertexStart,m_pAttribTab->VertexCount);

with m_pAttribTab->VertexCount in place of m_pAttribTab->FaceCount

why is that happening why DrawSubset makes it alll right




Re: Game Technologies: Graphics missing triangles with stream render

needforhint

why the pictures I inserted in html do not show up

eeergh why do I even bother






Re: Game Technologies: Graphics missing triangles with stream render

Bad Habit

DrawSubset() uses DrawIndexedPrimitive() rather than DrawPrimitive(). After you¡¯ve optimised a mesh it's vertices may not be arranged the way you think they are. Do something like:

pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0,
pAttributes[ i ].VertexStart,
pAttributes[ i ].VertexCount,
pAttributes[ i ].FaceStart * 3,
pAttributes[ i ].FaceCount);





Re: Game Technologies: Graphics missing triangles with stream render

needforhint

THANKS bro, that was it