Context for drawing a Model.
コード例 #1
0
ファイル: Model.cs プロジェクト: layshua/Alexandria
 /// <summary>
 /// Draw the <see cref="Model"/>.
 /// </summary>
 /// <param name="drawContext"></param>
 public void Draw(ModelDrawContext drawContext)
 {
     foreach (var mesh in meshes)
     {
         mesh.Draw(drawContext);
     }
 }
コード例 #2
0
ファイル: ModelMaterial.cs プロジェクト: layshua/Alexandria
 /// <summary>
 /// Bind the material to the program.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="program"></param>
 public void Bind(ModelDrawContext context, ModelProgram program)
 {
     foreach (ModelMaterialParameter parameter in Parameters)
     {
         parameter.Bind(context, program);
     }
 }
コード例 #3
0
        /// <summary>
        /// Render the model.
        /// </summary>
        protected override void Render()
        {
            base.Render();

            var context = new ModelDrawContext() {
                Projection = Projection,
                View = View,
                World =World,
                DisplayMode = Program.DisplayMode,
            };

            Model.Draw(context);
        }
コード例 #4
0
        /// <summary>
        /// Render the model.
        /// </summary>
        protected override void Render()
        {
            base.Render();

            var context = new ModelDrawContext()
            {
                Projection  = Projection,
                View        = View,
                World       = World,
                DisplayMode = Program.DisplayMode,
            };

            Model.Draw(context);
        }
コード例 #5
0
        /// <summary>
        /// Draw the <see cref="ModelMesh"/>.
        /// </summary>
        /// <param name="context"></param>
        public void Draw(ModelDrawContext context)
        {
            try {
                if (Program == null)
                {
                    Program = new ModelProgram();
                    VertexDeclaration.Bind(Program, this, VertexSize);
                    Material.Bind(context, Program);
                }

                Program.Projection  = context.Projection;
                Program.View        = context.View;
                Program.World       = context.World;
                Program.DisplayMode = context.DisplayMode;
                DetailLevels[0].Draw(context, Program);
            } catch (Exception exception) {
                throw exception;
            }
        }
コード例 #6
0
        /// <summary>
        /// Bind the material parameter to the program.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="program"></param>
        public void Bind(ModelDrawContext context, ModelProgram program)
        {
            Texture2D texture = TextureSource != null?TextureSource.GetResourceValue() : null;

            switch (Name)
            {
            case DiffuseMapName:
                program.DiffuseMap = texture;
                break;

            case SpecularMapName:
            case NormalMapName:
            case LightMapName:
            case DetailNormalMapName:
                break;

            default:
                break;
            }
        }
コード例 #7
0
 /// <summary>
 /// Draw the detail level.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="program"></param>
 public void Draw(ModelDrawContext context, ModelProgram program)
 {
     program.Draw(Primitive.TriangleStrip, IndexCount, Model.Buffer, ElementType.UInt16, BufferIndexOffset);
 }
コード例 #8
0
ファイル: ModelMesh.cs プロジェクト: Burton-Radons/Alexandria
        /// <summary>
        /// Draw the <see cref="ModelMesh"/>.
        /// </summary>
        /// <param name="context"></param>
        public void Draw(ModelDrawContext context)
        {
            try {
                if (Program == null) {
                    Program = new ModelProgram();
                    VertexDeclaration.Bind(Program, this, VertexSize);
                    Material.Bind(context, Program);
                }

                Program.Projection = context.Projection;
                Program.View = context.View;
                Program.World = context.World;
                Program.DisplayMode = context.DisplayMode;
                DetailLevels[0].Draw(context, Program);
            } catch (Exception exception) {
                throw exception;
            }
        }
コード例 #9
0
 /// <summary>
 /// Draw the detail level.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="program"></param>
 public void Draw(ModelDrawContext context, ModelProgram program)
 {
     program.Draw(Primitive.TriangleStrip, IndexCount, Model.Buffer, ElementType.UInt16, BufferIndexOffset);
 }
コード例 #10
0
        /// <summary>
        /// Bind the material parameter to the program.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="program"></param>
        public void Bind(ModelDrawContext context, ModelProgram program)
        {
            Texture2D texture = TextureSource != null ? TextureSource.GetResourceValue() : null;

            switch (Name) {
                case DiffuseMapName:
                    program.DiffuseMap = texture;
                    break;

                case SpecularMapName:
                case NormalMapName:
                case LightMapName:
                case DetailNormalMapName:
                    break;

                default:
                    break;
            }
        }
コード例 #11
0
ファイル: Model.cs プロジェクト: Burton-Radons/Alexandria
 /// <summary>
 /// Draw the <see cref="Model"/>.
 /// </summary>
 /// <param name="drawContext"></param>
 public void Draw(ModelDrawContext drawContext)
 {
     foreach (var mesh in meshes)
         mesh.Draw(drawContext);
 }