Example #1
0
        public static VisualSphereObject Create(IContextState context, ElementTag elet, Data data)
        {
            var geo = GeometryBuilder.BuildSphere(data.Center, data.Radius);

            var geoId = context.GetGeometryPool()
                        .AddGeometry(geo);

            var tag = context.GetEntityManager()
                      .CreateEntity(elet)
                      .AddComponent(SpherePointComponent.Create(data.Center, data.Radius))
                      .AddComponent(MaterialColorComponent.Create(data.Color))
                      .AddComponent(GeometryBoundsComponent.Create(AxisAlignedBox.FromSphere(data.Center, data.Radius)))
                      .AddComponent(RenderableComponent.AsPoints())
                      .AddComponent(TransformComponent.Identity())
                      .Tag;

            return(new VisualSphereObject(tag));
        }