Beispiel #1
0
        internal override bool TryConstructBody(GraphicEntity entity, IPhysicsShapeConstructor constructor)
        {
            return(constructor.TryConstructShape(entity, this));
            //var sphere = new Sphere(box.Size().X);
            //var size = box.Size();
            //var fbox = new Box(size.X, size.Y, size.Z);
            //fbox.ComputeInertia(1, out var sphereInertia);

            //var t = simulation.Shapes.Add(fbox);
            //ShapeIndex = t.Index;

            //simulation.Bodies.Add(BodyDescription.CreateDynamic(
            //    box.GetCenter(),
            //    sphereInertia,
            //    new CollidableDescription(t, 0.1f),
            //    new BodyActivityDescription(0.01f)));

            //var position = new Vector3();
            //var orientation = BepuUtilities.Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 0);
            //var pose = new RigidPose(position, orientation);
            //var ringBoxShape = new Box(0.5f, 1, 3);
            //ringBoxShape.ComputeInertia(1, out var ringBoxInertia);
            //var boxDescription = BodyDescription.CreateDynamic(new Vector3(), ringBoxInertia,
            //    new CollidableDescription(simulation.Shapes.Add(ringBoxShape), 0.1f),
            //    new BodyActivityDescription(0.01f));

            //Data.Body = simulation.Bodies.Add(BodyDescription.CreateDynamic(pose, bodyInertia, new CollidableDescription(bodyShape, 0.1f), new BodyActivityDescription(0.01f)));
        }
Beispiel #2
0
        public override void LookAtSelf(IEntityManager manager)
        {
            var           combinedBox = new BoundingBox();
            GraphicEntity entity      = null;

            foreach (var tag in Tags)
            {
                entity = manager.GetEntity(tag);
                if (entity.GetComponents <IRenderableComponent>().Any(x => x.CanRender))
                {
                    var geos = entity.GetComponents <IGeometryComponent>();
                    if (geos.Any())
                    {
                        var geo = geos.First();
                        combinedBox = combinedBox.Merge(geo.Box);
                    }
                }
            }

            var com = new MoveCameraToTargetComponent {
                Target = entity.Tag, TargetPosition = combinedBox.GetCenter()
            };

            entity.AddComponent(com);
        }
Beispiel #3
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <VeldridCameraBuilder.VeldridCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }
            var com = find.First();

            var x     = box.SizeX();
            var y     = box.SizeY();
            var ratio = x / y;
            var max   = Math.Max(box.SizeX(), box.SizeY()) * 1.2f;

            com.Position      = box.GetCenter() + Vector3.UnitZ * max;
            com.RotatePoint   = box.GetCenter();
            com.Width         = max;
            com.LookDirection = new Vector3(0, 0, -3);
            com.UpDirection   = new Vector3(0, 1, 0);
            com.Scale         = 1;
            // com.LookDirection = -Vector3.UnitZ * max;

            //ccom.Width *= box.SizeX() / viewport.ActualWidth;
            //var oldTarget = pcam.Position + pcam.LookDirection;
            //var distance = pcam.LookDirection.Length;
            //var newTarget = centerRay.PlaneIntersection(oldTarget, w);
            //if (newTarget != null) {
            //    orthographicCamera.LookDirection = w * distance;
            //    orthographicCamera.Position = newTarget.Value - orthographicCamera.LookDirection;
            //}

            return(true);
        }
Beispiel #4
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <GeneralCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }
            var ccom  = find.First();
            var delta = InputState.Delta;

            var p2   = InputState.CurrentPosition;
            var data = new MovementData {
                End = p2
            };

            entity
            .GetOrCreateComponent(new CameraZoomingComponent {
                State = ccom.GetState()
            })
            .Do(x => {
                x.MovementData = data;
                x.Delta        = delta;
            });

            return(true);
        }
Beispiel #5
0
        public void Animate(GraphicEntity owner, TimeSpan frameRateTime)
        {
            // Increment the translation values to simulate the moving clouds.
            // implementation for comparing FPS, when not using VSync.
            translate1 += vectorSpeed1;
            translate2 += vectorSpeed2;

            // Keep the values in the zero to one range.
            if (translate1.X > 1.0f)
            {
                translate1.X -= 1.0f;
            }
            if (translate1.Y > 1.0f)
            {
                translate1.Y -= 1.0f;
            }
            if (translate2.X > 1.0f)
            {
                translate2.X -= 1.0f;
            }
            if (translate2.Y > 1.0f)
            {
                translate2.Y -= 1.0f;
            }

            IsModified = true;
        }
Beispiel #6
0
        public override void Follow(GraphicEntity follower, GraphicEntity target)
        {
            var cameraPostion = target.GetComponent <GeneralCameraComponent>().Position;

            var worldMatrix = Matrix4x4.CreateTranslation(cameraPostion.X, cameraPostion.Y, cameraPostion.Z);

            follower.UpdateComponent(TransformComponent.Create(worldMatrix));
        }
 public override bool IsAplicable(GraphicEntity entity)
 {
     return(entity.TryGetComponent <RenderableComponent>(out var ren) &&
            ren.IsRenderable &&
            ren.Technique == RenderTechniques.Lines &&
            entity.Contains(
                typeof(GeometryPoolComponent),
                typeof(TransformComponent)));
 }
Beispiel #8
0
        protected override bool Executing(GraphicEntity entity, GeneralCameraComponent comp)
        {
            var mcomp = new Systems.CollidingWithScreenRayComponent();

            mcomp.ScreenPosition = InputState.CurrentPosition;
            entity.AddComponent(mcomp);

            return(true);
        }
Beispiel #9
0
 public override bool IsAplicable(GraphicEntity entity)
 {
     return(entity.TryGetComponent <RenderableComponent>(out var ren) &&
            ren.IsRenderable &&
            ren.Technique == RenderTechniques.OneFrameFlatWhite &&
            entity.Contains(
                typeof(BlackAndWhiteRenderComponent),
                typeof(TransformComponent)));
 }
Beispiel #10
0
        protected override void OnExecuting(GraphicEntity entity, ref LightComponent light, ref ColorComponent color, ISceneSnapshot snapshot)
        {
            if (entity.Contains <FollowCameraDirectLightComponent>() && light.Direction != snapshot.Camera.LookDirection)
            {
                entity.UpdateComponent(light.ApplyDirection(snapshot.Camera.LookDirection));
            }

            base.OnExecuting(entity, ref light, ref color, snapshot);
        }
Beispiel #11
0
 public override bool IsAplicable(GraphicEntity entity)
 {
     return(entity.TryGetComponent <RenderableComponent>(out var ren) &&
            ren.IsRenderable &&
            ren.Technique == RenderTechniques.Background &&
            entity.Contains(
                typeof(BackgroundRenderComponent),
                typeof(MemoryTexturedMaterialComponent)));
 }
Beispiel #12
0
 public void Register(GraphicEntity entity)
 {
     foreach (var tech in allTechniques)
     {
         if (tech.IsAplicable(entity))
         {
             GetOrCreate(tech).RegisterEntity(entity);
         }
     }
 }
Beispiel #13
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <GeneralCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }
            var ccom = find.First();

            return(Executing(entity, ccom) && Executing(ccom));
        }
Beispiel #14
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <GeneralCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }

            entity.RemoveComponents <CameraMovementComponent>();

            return(true);
        }
Beispiel #15
0
        protected override void Executing(ISceneSnapshot ss)
        {
            var           snapshot  = (SceneSnapshot)ss;
            var           emanager  = ContextState.GetEntityManager();
            var           toProcess = new List <GraphicEntity>();
            GraphicEntity source    = null;

            foreach (var entity in emanager.GetEntities())
            {
                if (entity.Has <IStickOnHeightMapComponent>())
                {
                    toProcess.Add(entity);
                }
                var s = entity.GetComponents <IHeightMapSourceComponent>();
                if (s.Any())
                {
                    source = entity;
                }
            }

            if (source.IsNull())
            {
                return;
            }

            foreach (var en in toProcess)
            {
                var com = en.GetComponent <IStickOnHeightMapComponent>();
                var tr  = en.GetComponent <TransformComponent>();

                var rayLocal   = new Ray(com.AttachPointLocal, com.AxisUpLocal);
                var rayEnWorld = rayLocal.Transformed(tr.MatrixWorld);

                //

                var sourceTr = source.GetComponent <TransformComponent>();
                var map      = source.GetComponent <IHeightMapSourceComponent>();

                var rayMapLocal = rayEnWorld.Transformed(sourceTr.MatrixWorld.Inverted());
                var matrix      = map.GetTransfromToMap(ref rayMapLocal);

                if (!matrix.IsIdentity)
                {
                    en.UpdateComponent(TransformComponent.Create(tr.MatrixWorld * matrix));

                    snapshot.Notifier.NotifyChange(tr);
                }
            }
        }
Beispiel #16
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <VeldridCameraBuilder.VeldridCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }
            var ccom = find.First();

            var p11 = state.ButtonsStates[GeneralMouseButtons.Right].PointDown;
            var p2  = state.CurrentPosition;

            var moveV = p2 - p11;

            if (moveV == Vector2.Zero)
            {
                return(false);
            }
            var v2Up      = new Vector2(0, -1);
            var mouseMove = moveV;
            var angleLook = v2Up.AngleRad(mouseMove.Normalize());

            //Console.WriteLine($"Angle 2D: {v2Up.Angle(mouseMove.Normalize())}");

            var look = ccom.LookDirection.Normalize();
            var up   = ccom.UpDirection.Normalize();

            var rotatedUp = Vector3.TransformNormal(up, Matrix4x4.CreateFromAxisAngle(look, angleLook));
            var cross     = Vector3.Cross(look, rotatedUp);

            var angle = mouseMove.Length();

            var movetozero     = Matrix4x4.CreateTranslation(ccom.RotatePoint * -1f);
            var rotate         = Matrix4x4.CreateFromAxisAngle(cross, angle.ToRad());
            var returntocenter = Matrix4x4.CreateTranslation(ccom.RotatePoint);
            var matrixRotate   = movetozero * rotate * returntocenter;

            if (matrixRotate.IsIdentity)
            {
                return(false);
            }

            ccom.UpDirection   = Vector3.TransformNormal(ccom.UpDirection.Normalize(), matrixRotate).Normalize();
            ccom.LookDirection = Vector3.TransformNormal(ccom.LookDirection.Normalize(), matrixRotate).Normalize();
            ccom.Position      = Vector3.Transform(ccom.Position, matrixRotate);

            return(true);
        }
Beispiel #17
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <GeneralCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }
            var ccom = find.First();

            ccom.ResetToDefault();
            entity.RemoveComponents <CameraMovementComponent>();

            return(true);
        }
Beispiel #18
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <VeldridCameraBuilder.VeldridCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }
            var ccom  = find.First();
            var delta = state.Delta;

            var nscale = ccom.Scale + (delta * 0.001f);

            if (nscale > 0)
            {
                ccom.Scale = nscale;
            }

            return(true);
        }
Beispiel #19
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <GeneralCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }
            var ccom = find.First();

            var type = KeywordMovingComponent.MovingDirection.Undefined;

            switch (InputState.Keyword)
            {
            case GeneralKeywords.W:
                type = KeywordMovingComponent.MovingDirection.MoveForward;
                break;

            case GeneralKeywords.S:
                type = KeywordMovingComponent.MovingDirection.MoveBackward;
                break;

            case GeneralKeywords.A:
                type = KeywordMovingComponent.MovingDirection.TurnLeft;
                break;

            case GeneralKeywords.D:
                type = KeywordMovingComponent.MovingDirection.TurnRight;
                break;
            }

            entity
            .GetOrCreateComponent(new KeywordMovingComponent())
            .Do(x => {
                x.Direction     = type;
                x.IsKeywordDown = InputState.IsKeywordDown;
            });

            return(true);
        }
Beispiel #20
0
        public bool Execute(GraphicEntity entity)
        {
            var find = entity.GetComponents <GeneralCameraComponent>();

            if (!find.Any())
            {
                return(false);
            }

            var p11  = InputState.ButtonsStates[GeneralMouseButtons.Right].PointV2;
            var p2   = InputState.CurrentPosition;
            var data = new MovementData {
                Begin = p11, End = p2
            };

            var ccom = find.First();

            entity.GetOrCreateComponent(new CameraRotatingComponent {
                State = ccom.GetState()
            })
            .MovementData = data;

            return(true);
        }
Beispiel #21
0
 public void RegisterEntity(GraphicEntity entity)
 {
     entities.AddLast(entity);
 }
Beispiel #22
0
 public override bool IsAplicable(GraphicEntity entity)
 {
     throw new NotImplementedException();
 }
Beispiel #23
0
        public void RenderEach(GraphicsDevice graphics, TProperties props, GraphicEntity en)
        {
            var device  = graphics.D3DDevice;
            var context = graphics.ImmediateContext;

            if (!en.TryGetComponent <D3DRenderComponent>(out var render))
            {
                render = new D3DRenderComponent();
                en.AddComponent(render);
            }

            var renderable = en.GetComponent <RenderableComponent>();
            var color      = en.GetComponent <MaterialColorComponent>();


            var geo = ContextState.GetGeometryPool().GetGeometry <IGeometryData>(en);

            if (!render.DepthStencilState.HasValue)
            {
                render.DepthStencilState.Set(new DepthStencilState(graphics.D3DDevice,
                                                                   renderable.DepthStencilStateDefinition.Description));
            }

            if (!render.BlendingState.HasValue)
            {
                render.BlendingState.Set(new BlendState(graphics.D3DDevice, renderable.BlendStateDescription));
            }

            {
                graphics.ClearAllShader();
                context.VertexShader.Set(vertexShader.Get());
                context.GeometryShader.Set(null);
                context.PixelShader.Set(pixelShader.Get());

                if (en.Contains <FlatShadingGeometryComponent>())
                {
                    context.GeometryShader.Set(flatShadingGS.Get());
                }
                else if (en.Contains <WireframeGeometryComponent>())
                {
                    context.GeometryShader.Set(wireframeGS.Get());
                    context.PixelShader.Set(wireframePS.Get());
                }
            }

            var topology = renderable.PrimitiveTopology;

            if (geo.IsModified || (!render.VertexBuffer.HasValue && !render.IndexBuffer.HasValue))
            {
                Vertex[] vertex = null;
                switch (geo.Topology)
                {
                case GeometryPrimitiveTopologies.TriangleList:
                    topology = PrimitiveTopology.TriangleList;
                    vertex   = new Vertex[geo.Positions.Length];
                    for (var index = 0; index < vertex.Length; index++)
                    {
                        vertex[index] = new Vertex(geo.Positions[index], geo.Normals[index]);
                    }
                    break;
                }

                render.VertexBuffer.Set(graphics.CreateBuffer(BindFlags.VertexBuffer, vertex));
                render.IndexBuffer.Set(graphics.CreateBuffer(BindFlags.IndexBuffer, geo.Indices.ToArray()));

                geo.IsModified = false;
            }
            if (!render.VertexBuffer.HasValue && !render.IndexBuffer.HasValue)
            {
                throw RenderTechniqueException.NoVertexAndIndexBuffers;
            }

            if (color.IsValid)
            {
                var material = MaterialStructBuffer.From(color);

                if (render.MaterialBuffer.HasValue)
                {
                    var buff = render.MaterialBuffer.Get();
                    graphics.UpdateDynamicBuffer(ref material, buff);
                }
                else
                {
                    var buff = graphics.CreateDynamicBuffer(ref material, Unsafe.SizeOf <MaterialStructBuffer>());
                    render.MaterialBuffer.Set(buff);
                }
            }

            UpdateTransformWorld(graphics, render, en);

            if (!render.TransformWorldBuffer.HasValue)
            {
                throw RenderTechniqueException.NoWorldTransformBuffers;
            }

            {//Update constant buffers
                context.VertexShader.SetConstantBuffer(GameStructBuffer.RegisterResourceSlot, props.Game);
                context.VertexShader.SetConstantBuffer(TransforStructBuffer.RegisterResourceSlot, render.TransformWorldBuffer.Get());

                context.PixelShader.SetConstantBuffer(GameStructBuffer.RegisterResourceSlot, props.Game);
                context.PixelShader.SetConstantBuffer(LightStructBuffer.RegisterResourceSlot, props.Lights);
                if (render.MaterialBuffer.HasValue)
                {
                    context.PixelShader.SetConstantBuffer(MaterialStructBuffer.RegisterResourceSlot, render.MaterialBuffer.Get());
                }
            }
            {
                context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(render.VertexBuffer.Get(),
                                                                                   layconst.VertexSize, 0));
                context.InputAssembler.SetIndexBuffer(render.IndexBuffer.Get(), SharpDX.DXGI.Format.R32_UInt, 0);

                context.InputAssembler.InputLayout       = inputLayout.Get();
                context.InputAssembler.PrimitiveTopology = topology;

                context.OutputMerger.SetDepthStencilState(
                    render.DepthStencilState.Get(),
                    renderable.DepthStencilStateDefinition.StencilRef);

                context.OutputMerger.SetBlendState(render.BlendingState.Get(),
                                                   new SharpDX.Mathematics.Interop.RawColor4(0, 0, 0, 0), -1);
            }

            var rasterizerDesc = renderable.RasterizerStateDescription;

            using (var rasterizerState = graphics.CreateRasterizerState(rasterizerDesc)) {
                context.Rasterizer.State = rasterizerState;

                graphics.ImmediateContext.DrawIndexed(geo.Indices.Length, 0, 0);
            }
        }
Beispiel #24
0
 public override bool IsAplicable(GraphicEntity entity)
 {
     return(entity.Contains(typeof(BillboardTextComponent)));
 }
Beispiel #25
0
 public EntityRenderModeSwither(GraphicEntity entity)
 {
     this.entity = entity;
 }
 public override bool IsAplicable(GraphicEntity entity) =>
 entity.TryGetComponent <RenderableComponent>(out var ren) &&
Beispiel #27
0
 internal override bool TryConstructBody(GraphicEntity entity, IPhysicsShapeConstructor constructor)
 {
     return(constructor.TryConstructShape(entity, this));
 }
Beispiel #28
0
 public bool HasComponents(GraphicEntity entity)
 {
     return(entity.Has(types));
 }
Beispiel #29
0
        public void RenderEach(GraphicsDevice graphics, TProperties game, GraphicEntity en)
        {
            var device  = graphics.D3DDevice;
            var context = graphics.ImmediateContext;

            if (!en.TryGetComponent <D3DRenderComponent>(out var render))
            {
                render = new D3DRenderComponent();
                en.AddComponent(render);
            }

            var renderable = en.GetComponent <RenderableComponent>();
            var geo        = ContextState.GetGeometryPool().GetGeometry <IGeometryData>(en);
            //optional
            var hasColor   = en.TryGetComponent <MaterialColorComponent>(out var color);
            var hasTexture = en.TryGetComponent <D3DTexturedMaterialSamplerComponent>(out var texture);

            if (!render.DepthStencilState.HasValue)
            {
                render.DepthStencilState.Set(new DepthStencilState(graphics.D3DDevice,
                                                                   renderable.DepthStencilStateDefinition.Description));
            }

            if (!render.BlendingState.HasValue)
            {
                render.BlendingState.Set(new BlendState(graphics.D3DDevice, renderable.BlendStateDescription));
            }

            UpdateTransformWorld(graphics, render, en);

            if (geo.IsModified)
            {
                var vertex = new Vertex[geo.Positions.Length];
                for (var index = 0; index < vertex.Length; index++)
                {
                    vertex[index] = new Vertex(
                        geo.Positions[index], geo.Normals[index], geo.TexCoor[index]);
                }

                render.VertexBuffer.Set(graphics.CreateBuffer(BindFlags.VertexBuffer, vertex));
                render.IndexBuffer.Set(graphics.CreateBuffer(BindFlags.IndexBuffer, geo.Indices.ToArray()));

                geo.IsModified = false;
            }

            if (hasColor)
            {
                var material = MaterialStructBuffer.From(color);

                if (render.MaterialBuffer.HasValue)
                {
                    var buff = render.MaterialBuffer.Get();
                    graphics.UpdateDynamicBuffer(ref material, buff);
                }
                else
                {
                    var buff = graphics.CreateDynamicBuffer(ref material, Unsafe.SizeOf <MaterialStructBuffer>());
                    render.MaterialBuffer.Set(buff);
                }
            }

            if (hasTexture && texture.IsModified)
            {
                render.TextureResources.Set(ConvertToResources(texture, graphics.TexturedLoader));
                render.SampleState.Set(graphics.CreateSampler(texture.SampleDescription));
                texture.IsModified = false;
            }

            {
                graphics.ClearAllShader();
                context.VertexShader.Set(vertexShader.Get());
                if (en.Contains <FlatShadingGeometryComponent>())
                {
                    context.GeometryShader.Set(flatShadingGS.Get());
                }
                context.PixelShader.Set(pixelShader.Get());

                context.VertexShader.SetConstantBuffer(GameStructBuffer.RegisterResourceSlot, game.Game);
                context.VertexShader.SetConstantBuffer(TransforStructBuffer.RegisterResourceSlot,
                                                       render.TransformWorldBuffer.Get());

                context.PixelShader.SetConstantBuffer(GameStructBuffer.RegisterResourceSlot, game.Game);
                context.PixelShader.SetConstantBuffer(LightStructBuffer.RegisterResourceSlot, game.Lights);
                if (render.MaterialBuffer.HasValue)
                {
                    context.PixelShader.SetConstantBuffer(MaterialStructBuffer.RegisterResourceSlot,
                                                          render.MaterialBuffer.Get());
                }
                if (render.TextureResources.HasValue && render.SampleState.HasValue)
                {
                    context.PixelShader.SetShaderResources(0, render.TextureResources.Get());
                    context.PixelShader.SetSampler(0, render.SampleState.Get());
                }
            }

            context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(render.VertexBuffer.Get(),
                                                                               layconst.VertexSize, 0));
            context.InputAssembler.SetIndexBuffer(render.IndexBuffer.Get(), SharpDX.DXGI.Format.R32_UInt, 0);

            context.InputAssembler.InputLayout       = inputLayout.Get();
            context.InputAssembler.PrimitiveTopology = renderable.PrimitiveTopology;

            context.OutputMerger.SetDepthStencilState(render.DepthStencilState.Get(), 0);
            context.OutputMerger.SetBlendState(render.BlendingState.Get(),
                                               new SharpDX.Mathematics.Interop.RawColor4(0, 0, 0, 0), -1);

            using (var rasterizerState = graphics.CreateRasterizerState(renderable.RasterizerStateDescription)) {
                context.Rasterizer.State = rasterizerState;

                graphics.ImmediateContext.DrawIndexed(geo.Indices.Length, 0, 0);
            }
        }
Beispiel #30
0
        protected void UpdateTransformWorld(GraphicsDevice graphics, D3DRenderComponent render, GraphicEntity en)
        {
            var transform   = en.GetComponent <TransformComponent>();
            var matrixWorld = transform.MatrixWorld;

            //var isChanged = false;
            //if(en.TryGetComponent<MovingComponent>(out var moving)) {
            //    isChanged = true;
            //    matrixWorld *= moving.MovingMatrix;
            //    en.RemoveComponent(moving);
            //    en.UpdateComponent(TransformComponent.Create(matrixWorld));
            //}

            if (!render.TransformWorldBuffer.HasValue)
            {
                var tr = TransforStructBuffer.ToTranspose(matrixWorld);

                if (render.TransformWorldBuffer.HasValue)
                {
                    var buff = render.TransformWorldBuffer.Get();
                    graphics.UpdateDynamicBuffer(ref tr, buff);
                }
                else
                {
                    var buff = graphics.CreateDynamicBuffer(ref tr, Unsafe.SizeOf <TransforStructBuffer>());
                    render.TransformWorldBuffer.Set(buff);
                }
            }
        }