Original Post
🔒 Locked
Stride
Advertisement
You, sir, make no sense. What on earth are you talking about?
Let me try to explain this better.
First
Then
Somehow this makes it so that the player models in the game glow the color you have specified in Light. I really don''t understand how if m_Stride equals 32 that it would select only the player models.
First
unsigned int m_Stride;
HRESULT f_IDirect3DDevice8::SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer8 *pStreamData, UINT Stride) {
if (StreamNumber == 0)
m_Stride = Stride;
return f_pDirect3DDevice->SetStreamSource(StreamNumber, pStreamData, Stride);
}
Then
HRESULT f_IDirect3DDevice8::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type, UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT PrimitiveCount) {
if (Lambert) {
if(m_Stride == 32) {
DWORD old_state;
f_pDirect3DDevice->CreateStateBlock(D3DSBT_ALL, &old_state);
f_pDirect3DDevice->CaptureStateBlock(old_state);
f_pDirect3DDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
f_pDirect3DDevice->SetLight( 0, &Light );
f_pDirect3DDevice->LightEnable( 0, true );
HRESULT hResult = f_pDirect3DDevice->DrawIndexedPrimitive(Type, MinIndex, NumVertices, StartIndex, PrimitiveCount);
f_pDirect3DDevice->ApplyStateBlock(old_state);
f_pDirect3DDevice->DeleteStateBlock(old_state);
return hResult;
}
}
return f_pDirect3DDevice->DrawIndexedPrimitive(Type, MinIndex, NumVertices, StartIndex, PrimitiveCount);
}
Somehow this makes it so that the player models in the game glow the color you have specified in Light. I really don''t understand how if m_Stride equals 32 that it would select only the player models.
I don''t know Jack about DirectX since I don''t use Windows, but it looks like Stride is actually the size of each individual vertex data element.
It looks like that SetStreamSource() function accepts a pointer to an array of vertex data. Stride is the size of each element in the array.
Say you have a vertex with the following members:
struct Vertex{
float x, y, z;
float r, g, b;
};
Where x,y,z is the vertex coordinates, and r,g,b is the diffuse color. The Stride of an array of these Vertex structures would be 6*sizeof(float), or sizeof(Vertex).
The function needs this Stride information in the case where vertex data can be of any format you wish to specify; Stride tells the function what to add to move to the next Vertex structure.
Or, so it looks to me.
Josh
vertexnormal AT linuxmail DOT org
Check out Golem at:
My cheapass website
It looks like that SetStreamSource() function accepts a pointer to an array of vertex data. Stride is the size of each element in the array.
Say you have a vertex with the following members:
struct Vertex{
float x, y, z;
float r, g, b;
};
Where x,y,z is the vertex coordinates, and r,g,b is the diffuse color. The Stride of an array of these Vertex structures would be 6*sizeof(float), or sizeof(Vertex).
The function needs this Stride information in the case where vertex data can be of any format you wish to specify; Stride tells the function what to add to move to the next Vertex structure.
Or, so it looks to me.
Josh
vertexnormal AT linuxmail DOT org
Check out Golem at:
My cheapass website
I would like to hear what you mean by "almost made".
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement