There appears to be no texture transform set for the env map.
I tried to write a plugin to do the fix it with the following code:
Dim mTxTransform As D3DMATRIX
' use x axis transform
'
mTxTransform.m13 = 0.5
mTxTransform.m22 = -0.5
mTxTransform.m31 = -0.5
mTxTransform.m41 = 0.5
mTxTransform.m42 = 0.5
(I'm not sure if you are using multi or single pass)
If TextureCombined Is Nothing Then
D3DDevice.SetTransform D3DTS_TEXTURE0, mTxTransform
ElseIf NormalMap Is Nothing Then
D3DDevice.SetTransform D3DTS_TEXTURE1, mTxTransform
Else
D3DDevice.SetTransform D3DTS_TEXTURE2, mTxTransform
End If
(then draw primitives etc... )
but it crashed with an error hex 80010108
I then tried to compile and run the RotateColors sample, but that failed with the same error code.
3D Canvas uses many texture stages (I think up to 5). You would need to check with Direct3D as to which one is used for what. What you need to do is a compare of the texture provided as "environment map" with those used by the device to find which stage uses the environment map. It's going to change depending on whether there is a bumpmap etc.
I'm surprised RotateColors doesn't work. It couldn't be simpler. It works almost exactly the same as the "set specular color" plug-in.
Material plug-ins definitely use late binding. I wonder if there is something that I need to supply to make it so you can correctly compile. I'll have to investigate.