Exemplo n.º 1
0
 public void UpdateWorldMatrix(DeferredMeshElement el)
 {
     foreach (var p in meshRenderParts[el])
     {
         p.UpdateWorldMatrix(game.Device.ImmediateContext, el.WorldMatrix);
     }
 }
Exemplo n.º 2
0
        public DeferredMeshElement AddMesh(IMesh mesh)
        {
            var el = new DeferredMeshElement(this, mesh);

            var parts = createParts(el);

            meshRenderParts[el] = parts;
            Elements.Add(el);

            return(el);
        }
Exemplo n.º 3
0
        public void DeleteMesh(DeferredMeshElement el)
        {
            if (el.IsDeleted)
            {
                throw new InvalidOperationException();
            }


            var parts = meshRenderParts[el];

            meshRenderParts.Remove(el);

            //TODO: dispose parts
            //TODO: dipose mesh data?

            Elements.Remove(el);
        }
Exemplo n.º 4
0
        private MeshElementPart[] createParts(DeferredMeshElement el)
        {
            var allParts = new MeshElementPart[el.Mesh.GetCoreData().Parts.Count];

            var i = 0;

            foreach (var p in el.Mesh.GetCoreData().Parts)
            {
                var mat  = createMaterial(p);
                var data = createRenderData(p.MeshPart);

                var part = new MeshElementPart(mat, data);
                part.CreateBuffers(game);
                part.perObject.UpdatePerObjectBuffer(ctx, p.ObjectMatrix.dx() * el.WorldMatrix);
                parts.Add(part);
                allParts[i] = part;
                i++;
            }
            return(allParts);
        }