internal static void DrawRibbon(this RenderContext context, RibbonMesh mesh, D3DSimpleTextureEffect effect, D3DMaterial material, Matrix viewProjection, ShaderResourceView texture)
        {
            // World = I, so use viewProjection as World*viewProjection
            effect.WorldTransform = Matrix.Identity;
            effect.WorldTransformInversedTransposed = MathF.InverseTranspose(Matrix.Identity);
            effect.WorldViewProjectionTransform     = viewProjection;

            effect.Material = material;
            effect.Texture  = texture;

            var tech          = effect.SimpleTextureTechnique;
            var desc          = tech.Description;
            var deviceContext = context.Direct3DDevice.ImmediateContext;

            for (var i = 0; i < desc.PassCount; ++i)
            {
                tech.GetPassByIndex(i).Apply(deviceContext);
                mesh.Draw(deviceContext);
            }
        }
        public static void Draw(this BasicModelInstance instance, DeviceContext deviceContext, D3DSimpleTextureEffect effect, Matrix viewProjection)
        {
            var world = instance.World;
            var wit   = MathF.InverseTranspose(world);
            var wvp   = world * viewProjection;

            effect.WorldTransform = world;
            effect.WorldTransformInversedTransposed = wit;
            effect.WorldViewProjectionTransform     = wvp;

            effect.Material = instance.Model.Material;
            effect.Texture  = instance.Model.DiffuseMap;

            DrawTech(instance, deviceContext, effect.SimpleTextureTechnique);
        }
 public static void DrawModel(this RenderContext context, BasicModelInstance modelInstance, D3DSimpleTextureEffect effect, Matrix viewProjection)
 {
     modelInstance.Draw(context.Direct3DDevice.ImmediateContext, effect, viewProjection);
 }