TL10
TL10

Reputation: 1

accessing a transformed texture's pixel data

How do i access the TRANSFORMED pixel data for a texture, after it has been transformed (rotated and scaled) by D3DXMatrixTransformation2D() and texture->SetTransform()?

I'm trying to do 2D pixel perfect collision detection and it's impossible if you can only access the untransformed pixel data using texture->LockRect().

Anybody got any ideas?

Upvotes: 0

Views: 142

Answers (1)

Constantinius
Constantinius

Reputation: 35039

This will not achieve the results you wish. With the SetTransform method you set a transformation which is applied before the texture is drawn. So it wont morph your image that you can read out the pixel values.

What you could do is to project world coordinates to UV coordinates of your texture and then read out the according pixel value and compare it and do your collision resolution there. I guess you use the inverse matrix of the matrix you created by D3DXMatrixTransformation2D().

Upvotes: 1

Related Questions