Jump to content
  • Advertisement
Sign in to follow this  

hkSetVertexShaderConstantF Hook question

This topic is 1423 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!