public void Initialize(System.Windows.Forms.Form form) { if (isInitialized) { return; } idPool = new Stratum.IdPool(); sceneGraph = new Stratum.SceneGraph(); BootstrapSharpDX(form); renderer = new Stratum.Renderer(); var earth = CreateGameObject(); var planetComp = CreateComponent <PlanetComponent>(); var atmosphere = CreateComponent <Atmosphere>(); earth.AddComponent(planetComp); earth.AddComponent(atmosphere); SceneGraph.Insert(earth, null); Engine.GraphicsContext.CurrentCamera = new PlanetCamera(RenderWGS84.EarthRadius); //worldEngine = new World(); //Engine.Instance.AddService(worldEngine, typeof(IWorldEngine), typeof(World)); isInitialized = true; }
internal static void Delete(Component component) { IdPool.Free(component.Id); component.Delete(); Component o; components.TryRemove(component.Id, out o); }
public static T CreateComponent <T>() where T : Component { ulong id = IdPool.Get(); T component = Activator.CreateInstance <T>(); component.Id = id; // add component to Engine components[id] = component; return(component); }
public static GameObject CreateGameObject() { ulong id = IdPool.Get(); GameObject @object = new GameObject(); @object.Id = id; // add object to Engine objects[id] = @object; return(@object); }
internal static void Delete(SceneNode sceneNode) { IdPool.Free(sceneNode.Id); sceneNode.Delete(); GameObject o; objects.TryRemove(sceneNode.Id, out o); foreach (var child in sceneNode.Children) { Delete(child); } }