Example #1
0
        public void Render()
        {
            //MdxRender.Device.VertexFormat = CustomVertex.TransformedTextured.Format;
            MdxRender.Device.VertexFormat = CustomVertex.TransformedTextured.Format;
            int passCount = billboardShader.BeginApply();

            for (int i = 0; i < passCount; i++)
            {
                billboardShader.SetPass(i);
                MdxRender.Device.DrawUserPrimitives(PrimitiveType.TriangleList, 2, verts);
            }
            billboardShader.EndApply();
        }
Example #2
0
 /// <summary>
 /// Renders the whole model.
 /// </summary>
 public void Render()
 {
     if (bDrawMesh)
     {
         try
         {
             if (defaultShader == null)
             {
                 for (int i = 0; i < shaderCount; i++)
                 {
                     Render(i);
                 }
             }
             else
             {
                 defaultShader.Lightmap = this.DefaultLightmap;
                 int count = defaultShader.BeginApply();
                 if (count > 0)
                 {
                     //for (int i = 0; i < count - 1; i++)
                     //{
                     //    for (int j = 0; j < shaderCount; j++)
                     //        Render(i);
                     //    defaultShader.SetPass(i + 1);
                     //}
                     for (int i = 0; i < count; i++)
                     {
                         defaultShader.SetPass(i);
                         for (int j = 0; j < shaderCount; j++)
                         {
                             Render(j);
                         }
                     }
                     //for (int i = 0; i < shaderCount; i++)
                     //    Render(i);
                     defaultShader.EndApply();
                 }
             }
         }
         catch (Exception e)
         {
             Trace.WriteLine("Error rendering EnhancedMesh: " + e.Message);
         }
     }
 }