Sign in to follow this  
Anddos

hkSetVertexShaderConstantF Hook question

Recommended Posts

I found some code which lets you hook the directx device functions

What is happening here?

 

float* pMyData = (float*)pConstantData;
 
coords[0] = *(pMyData + 0); //4th element is the X
coords[1] = *(pMyData + 1); //8th element is the Y
coords[2] = *(pMyData + 2); //12th element is the Z
coords[3] = *(pMyData + 3); //4th element is the X
coords[4] = *(pMyData + 4); //8th element is the Y
coords[5] = *(pMyData + 5); //12th element is the Z
coords[6] = *(pMyData + 6); //4th element is the X
coords[7] = *(pMyData + 7); //8th element is the Y
coords[8] = *(pMyData + 8); //12th element is the Z
coords[9] = *(pMyData + 9); //8th element is the Y
coords[10] = *(pMyData + 10); //12th element is the Z
coords[11] = *(pMyData + 11); //4th element is the X
coords[12] = *(pMyData + 12); //8th element is the Y
coords[13] = *(pMyData + 13); //12th element is the Z
coords[14] = *(pMyData + 14); //4th element is the X
coords[15] = *(pMyData + 15); //8th element is the Y

Share this post


Link to post
Share on other sites

That code is copying 16 floats from an array of floats to another array.

 

16 floats could be a 4x4 matrix or anything else.

 

You could write the same thing like this:

coords[0] = pMyData[0];
...
Edited by TiagoCosta

Share this post


Link to post
Share on other sites

so the matrix passed to the shader could be accessed like this?

 

etc you could access the translation values from a matrix that is like world*view*projection?

Edited by Anddos

Share this post


Link to post
Share on other sites
Hi.
It looks like someone is over riding the texture coords.

Why hook other progams.
Make your own.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this