internal static void DrawRibbon([NotNull] this GraphicsDevice graphicsDevice, RibbonMesh mesh, [NotNull] RibbonEffect effect, Matrix viewProjection, Material material, [NotNull] Texture2D ribbonTexture) { // World = I, so use viewProjection as World*viewProjection effect.World = Matrix.Identity; effect.WorldInvTranspose = Matrix.Identity; effect.WorldViewProj = viewProjection; effect.MaterialAmbient = material.Ambient; effect.MaterialDiffuse = material.Diffuse; effect.MaterialSpecular = material.Specular; effect.MaterialReflect = material.Reflect; effect.Opacity = 1; effect.TextureTransform = Matrix.Identity; effect.RibbonTexture = ribbonTexture; var pass = effect.CurrentTechnique.Passes[0]; pass.Apply(); graphicsDevice.BlendState = BlendState.AlphaBlend; graphicsDevice.DepthStencilState = DepthStencilState.Default; graphicsDevice.RasterizerState = RasterizerState.CullNone; mesh.Draw(graphicsDevice); }
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); } }