I am porting an "old" DirectX application and am having trouble trying to some direct replacements in managed DX.
The first one is dealing with assigning color to a light!
/* old code */
D3DLIGHT myLight
D3DCOLORVALUE Diffuse = { 1.0f, 1.0f, 1.0f, 1.0f };
myLight.Diffuse = Diffuse;
/* new code */
Light myLight
myLight.Diffuse = System.Drawing.Color.fromRGBA(1.0f, 1.0f, 1.0f, 1.0f);
myLight.Ambient = System.Drawing.Color.fromRGBA(1.0f, 1.0f, 1.0f, 1.0f);
myLight.Specular = System.Drawing.Color.fromRGBA(1.0f, 1.0f, 1.0f, 1.0f);
// arghhhh.... System.Drawing.Color.fromRGBA takes ints not floats!
All the examples i have seen for setting a MDX color use the System.Drawing.Color, the closest of which i can use is Color.FromRGBA(). Unfortunately this does not take values as floats.
The second one, and by far the most confusing to me, is using SetTextureStage(). In MDX the 3rd argument is a float value? What on earth do i use? I just cannot seem to figure what these constants would be!
/* old code */
myDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
myDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
myDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
myDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
myDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
/* new code */
device.SetTextureStageState(0, TextureStageStates.ColorArgument1, TextureArgument.TextureColor);
device.SetTextureStageState(0, TextureStageStates.ColorOperation, TextureOperation.Modulate);
device.SetTextureStageState(0, TextureStageStates.ColorArgument2, TextureArgument.Diffuse);
device.SetTextureStageState(0, TextureStageStates.AlphaArgument1, TextureOperation.TextureColor);
device.SetTextureStageState(0, TextureStageStates.AlphaOperation, TextureOperation.SelectArg1);
// arghhhh.... SetTextureStageState takes a float value not these MDX constants!
Any help whatsoever is most appreciated..