Esempio n. 1
0
 public void Render(GraphicsDevice device, CommandList commandList, RenderingContext context)
 {
     if (_meshGeometry != null)
     {
         //var copy = new RenderingContext()
         //{
         //    Renderer = context.Renderer,
         //    RenderWireframes = true
         //};
         MaterialInstance.Bind(device, commandList, context);
         commandList.UpdateBuffer(context.Renderer.WorldBuffer, 0, GameObject.Transform.WorldMatrix);
         _meshGeometry.Render(device, commandList);
     }
 }
Esempio n. 2
0
        public QuadRenderable(Rectangle source, bool transparent, MaterialInstance materialInstance) : base(materialInstance)
        {
            Transparent = transparent;
            var imageSize = new Vector2(MaterialInstance.ImageWidth, MaterialInstance.ImageHeight);
            var indices   = new ushort[] { 0, 1, 3, 1, 2, 3 };
            var vertices  = new VertexPositionTextureNormal[]
            {
                new VertexPositionTextureNormal(new Vector3(0, 0, 0), (new Vector2(source.Left, source.Bottom)) / imageSize, Vector3.UnitZ),
                new VertexPositionTextureNormal(new Vector3(0, 1, 0), (new Vector2(source.Left, source.Top)) / imageSize, Vector3.UnitZ),
                new VertexPositionTextureNormal(new Vector3(1, 1, 0), (new Vector2(source.Right, source.Top)) / imageSize, Vector3.UnitZ),
                new VertexPositionTextureNormal(new Vector3(1, 0, 0), (new Vector2(source.Right, source.Bottom)) / imageSize, Vector3.UnitZ)
            };

            UpdateMesh(vertices, indices);
        }
Esempio n. 3
0
 public MeshRenderable(MaterialInstance materialInstance)
 {
     MaterialInstance = materialInstance;
     _meshGeometry    = new MeshGeometry();
 }