Beispiel #1
0
 /// <summary>
 /// Renders the ModelPreview at the specified level of detail.
 /// </summary>
 /// <param name="view">The SceneRenderControl to render the preview into.</param>
 /// <param name="LOD">Which level of detail to render at. Level 0 is traditionally the most detailed.</param>
 /// <param name="transform">The model transformation to be applied to the vertices.</param>
 public void Render(SceneRenderControl view, int LOD, Matrix transform)
 {
     foreach (ModelPreviewSection section in LODs[LOD].Sections)
     {
         if (Materials.ContainsKey(section.MaterialName))
         {
             Materials[section.MaterialName].RenderSection(LODs[LOD], section, transform, view);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Renders the given <see cref="ModelPreviewSection"/> of a <see cref="ModelPreviewLOD"/>.
 /// </summary>
 /// <param name="lod">The LOD to render.</param>
 /// <param name="s">Which faces to render.</param>
 /// <param name="transform">The model transformation to be applied to the vertices.</param>
 /// <param name="view">The SceneRenderControl that the given LOD should be rendered into.</param>
 public override void RenderSection(ModelPreviewLOD lod, ModelPreviewSection s, Matrix transform, SceneRenderControl view)
 {
     view.DefaultEffect.PrepDraw(view.ImmediateContext);
     view.DefaultEffect.RenderObject(view.ImmediateContext, new SceneRenderControl.WorldConstants(Matrix.Transpose(view.Camera.ProjectionMatrix), Matrix.Transpose(view.Camera.ViewMatrix), Matrix.Transpose(transform)), lod.Mesh, (int)s.StartIndex, (int)s.TriangleCount * 3, Textures.ContainsKey(DiffuseTextureFullName) ? Textures[DiffuseTextureFullName]?.TextureView ?? view.DefaultTextureView : view.DefaultTextureView);
 }
Beispiel #3
0
 /// <summary>
 /// Renders the given <see cref="ModelPreviewSection"/> of a <see cref="ModelPreviewLOD"/>.
 /// </summary>
 /// <param name="lod">The LOD to render.</param>
 /// <param name="s">Which faces to render.</param>
 /// <param name="transform">The model transformation to be applied to the vertices.</param>
 /// <param name="view">The SceneRenderControl that the given LOD should be rendered into.</param>
 public abstract void RenderSection(ModelPreviewLOD lod, ModelPreviewSection s, Matrix transform, SceneRenderControl view);