• Create Account

### #ActualIceBreaker23

Posted 30 December 2011 - 03:27 PM

Thank you!

Ok can you give me a little code snippet how i compute the distance to the camera?
Do i have to use the worldMatrix for each object?

like this:
D3DXVECTOR vObjPos = (D3DXVECTOR) *m_World.41;
D3DXVECTOR3 vDistance = vObjPos - camera.vEye;
float fDistance = length(vObjPos);


Isn´t this to inefficient for 100 leaves on a tree or 100 grass tufts?

EDIT: How can i do that with the LPD3DXMESH class?

### #2IceBreaker23

Posted 30 December 2011 - 03:27 PM

Ok can you give me a little code snippet how i compute the distance to the camera?
Do i have to use the worldMatrix for each object?

like this:
D3DXVECTOR vObjPos = (D3DXVECTOR) *m_World.41;
D3DXVECTOR3 vDistance = vObjPos - camera.vEye;
float fDistance = length(vObjPos);


Isn´t this to inefficient for 100 leaves on a tree or 100 grass tufts?

EDIT: How can i do that with the LPD3DXMESH class?

### #1IceBreaker23

Posted 30 December 2011 - 03:25 PM

Ok can you give me a little code snippet how i compute the distance to the camera?
Do i have to use the worldMatrix for each object?

like this:
D3DXVECTOR vObjPos = (D3DXVECTOR) *m_World.41;
D3DXVECTOR3 vDistance = vObjPos - camera.vEye;
float fDistance = length(vObjPos);


Isn´t this to inefficient for 100 leaves on a tree or 100 grass tufts?

PARTNERS