protected override void SetClipPlanesImpl(Math.Collections.PlaneList planes)
{
for (var i = 0; i < planes.Count; i++)
{
var p = planes[ i ];
var plane = new DX.Plane(p.Normal.x, p.Normal.y, p.Normal.z, p.D);
if (vertexProgramBound)
{
// programmable clips in clip space (ugh)
// must transform worldspace planes by view/proj
throw new NotImplementedException();
}
ActiveD3D9Device.SetClipPlane(i, plane);
}
var bits = ( 1ul << ( planes.Count + 1 ) ) - 1;
SetRenderState(RenderState.ClipPlaneEnable, (int)bits);
}