static void Main(params string[] args) { GLWindow window = new GLWindow(); var scene = CoreEngine.MainScene; SceneNode cameraNode = new SceneNode(); cameraNode.Name = "Camera"; var camera = cameraNode.AddComponent <Camera>(); cameraNode.GetTransform.Position = new Vector3(0, 2f, 0); camera.Background = new BackgroundSkybox(); CoreEngine.Shared.ScriptHolder.AddComponent <FrameTimeScript>(); //character view mode if (args.Length != 0) { scene.AddNode2Root(cameraNode); cameraNode.AddComponent <DynamicFormScript>(); //Remote Image Streaming //var script = (DynamicFormStream)cameraNode.AddComponent<DynamicFormStream>(); //var ISS = (ImageStreamerScript)cameraNode.AddComponent<ImageStreamerScript>(); //ISS.SetDSS(script); SceneNode modelNode = ResourcesManager.LoadAsset <ModelPrefab>(args[0]).CreateNode(); //var md = modelNode.GetComponent<MeshDrawer>(); //for(int i = 0; i < md.Materials.Length; i++) // md.Materials[i] = if (modelNode) { //modelNode.AddComponent<TestScript>(); modelNode.Name = "model"; scene.AddNode2Root(modelNode); //cameraNode.AddComponent<CameraControllOrbitScript>(); cameraNode.AddComponent <Toys.VR.VRControllScript>(); } } //scene mode else { var testScene = CoreEngine.Shared.ScriptHolder.AddComponent <TestSceneLoader>(); } var task = new Task(() => { Application.Init(); Window wndw = new Window(scene, window.Engine); //ISS.wndw = wndw; Application.Run(); }); task.Start(); window.Title = "ModelViewer"; window.Run(); }
public Controller() { var config = JObject.Parse(File.ReadAllText(@"config.json")); _pathGifts = (string)config["gifts"]; _pathSolution = (string)config["solution"]; var window = new GLWindow(800, 450, "Santa Claus"); window.Loaded += (sender, args) => Load((GLWindow)sender); window.Run(); }
static void Main(params string[] args) { GLWindow window = new GLWindow(); Scene scene = CoreEngine.MainScene; if (args.Length != 0) { SceneNode modelNode = ResourcesManager.LoadAsset <ModelPrefab>(args[0]).CreateNode(); modelNode.Name = "model"; scene.AddNode2Root(modelNode); } var camera = new Camera(); SceneNode cameraNode = new SceneNode(); cameraNode.Name = "Camera"; cameraNode.AddComponent(camera); cameraNode.AddComponent <CameraControllOrbitScript>(); //cameraNode.AddComponent<FrameTimeScript>(); //cameraNode.GetTransform.Position = new Vector3(0, 1f, 3); scene.AddNode2Root(cameraNode); cameraNode.AddComponent <DynamicFormScript>(); var task = new Task(() => { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var form = new Form1(); form.scene = scene; form.FormClosed += (s, e) => window.Close(); form.cam = camera; Application.Run(form); }); task.Start(); window.Title = "ModelViewer"; window.Run(); }
static void Main(string[] args) { Font font = new Font(@".\GapSansBold.ttf") { FontSize = 51, }; controller = new GameController(0); GameKeybindHost host = new GameKeybindHost(new GameKeybindList() { { "g_test", context => Keyboard.IsAnyKeyPressed, context => context.ControllerState.Buttons[GamepadButtonFlags.A, true] } }); actor = GameKeybindActor.CreateControllerActor(controller); actor.ConnectHost(host); portal = STPProject.CreateFromZIP("portal.zip"); window = new GLWindow(1280, 720, "0ms", WindowFlags.Window, VSyncMode.Off); window.ApplySetup(new Window2DSetup()); window.SetRenderPipeline(new TestRenderPipeline()); window.SetScene(scene = new Scene() { ShowAxisHelper = true }); scene.Background.Color = Color4.DarkGray; scene.Camera = new Camera() { }; SimpleShader shader = new SimpleShader("basic", AssemblyUtility.ReadAssemblyFile("SM_TEST.Default Fragment Shader1.frag"), (a, b) => { a["Color"].SetColor(b.Material.Tint); a["Scale"].SetFloat(b.Material.ShaderArguments.Get("Scale", 1f)); }); DrawObject2D obj = new DrawObject2D() { Material = { CustomShader = shader, Tint = new Color4(1f, 0.151217f, 0.050313f, 1), ShaderArguments = { ["Scale"] = 50f } } };/* * DrawObject2D obj2 = new DrawObject2D() * { * Material = * { * Tint = Color4.Aqua, * CustomShader = shader, * ShaderArguments = * { * ["Scale"] = 1000f * } * } * }; * obj2.Transform.Position.Set(300);*/ scene.Objects.Add(obj); window.RenderFrame += Window_RenderFrame; window.Run(); Debug.WriteLine("Window Closed"); }