• Advertisement
Sign in to follow this  

Setting float3 vectors

This topic is 1744 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'm doing a shader for shadow mapping right now, and I've got a quick question: how do you set 3d vectors in the effect file? SetVector() only lets you do 4d ones, but my position vectors in the shader are defined as float3. Thanks!

Share this post


Link to post
Share on other sites
Advertisement

Store your 3 component vector to a 4 component vector and set the w-component to 0. In the shader side, access the float4 position with .xyz.

 

Cheers!

Share this post


Link to post
Share on other sites

Or use  SetValue

 

 
 
D3DXVECTOR2 SomeFloat2;
effect->SetValue( "SomeFloat2", SomeFloat2, sizeof(D3DXVECTOR2) );
 
D3DXVECTOR3 SomeFloat3;
effect->SetValue( "SomeFloat3", SomeFloat3, sizeof(D3DXVECTOR3) );
 
D3DXMATRIX SomeMatrix;
effect->SetValue( "SomeFloat4x4", SomeMaxtrix, sizeof(D3DXMATRIX) );
Edited by belfegor

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement