protected override void OnFileDrop(FileDropEventArgs e) { for (int i = 0; i < e.FileNames.Length; i++) { if (e.FileNames[i].EndsWith(".glb", StringComparison.OrdinalIgnoreCase) || e.FileNames[i].EndsWith(".gltf", StringComparison.OrdinalIgnoreCase)) { var model = GLTFAssetLoader.Load(e.FileNames[i]); GameLoop.Instantiate(model, null); } } }
protected override void OnLoad() { //Initialize opengl debug callback _debugProcCallbackHandle = GCHandle.Alloc(_debugProcCallback); GL.Enable(EnableCap.DebugOutput); GL.Enable(EnableCap.DebugOutputSynchronous); GL.DebugMessageCallback(_debugProcCallback, IntPtr.Zero); //Init game contexts Init(); //Load test assets //var sponza = GLTFAssetLoader.Load(@"D:\Blender\Models\sponza-gltf-pbr\sponza.gltf"); //var zelda = GLTFAssetLoader.Load(@"D:\Blender\Models\JourneyPBR\Export\untitled.glb", 0.01f); //var car = AssetLoader.LoadAssets(@"D:\Blender\Models\Audi R8\Models\Audi R8.fbx", 0.1f); //var Sphere = GLTFAssetLoader.Load(@"D:\Blender\Models\Sphere.fbx", 1f); var spire = GLTFAssetLoader.Load(@"D:\Blender\Models\Spire.glb"); var mc = GLTFAssetLoader.Load(@"D:\Blender\Models\beta map split.glb", 1f); mc.Root.Transform.Position -= Vector3.UnitY * 128; GameLoop.Instantiate(mc, null); //GameLoop.Instantiate(Sphere, null); //GameLoop.Instantiate(car, null); //GameLoop.Instantiate(zelda, null); //GameLoop.Instantiate(sponza, null); GameLoop.Instantiate(spire, null); //Add RigidBodys //var rb1 = new RigidBody(); //rb1.DetectionSettings = RigidBody.ContinuousDetectionSettings; //rb1.Shape = new BepuPhysics.Collidables.Sphere(Sphere.Root.Transform.Scale.X); //Sphere.Root.AddScript(rb1); //var rb2 = new RigidBody(); //rb2.RigidBodyType = RigidBodyType.Kinematic; //rb2.Shape = new BepuPhysics.Collidables.Box(1000, 0.1f, 1000); //sponza.Root.AddScript(rb2); //Add Game Camera var c = new Camera(new Viewport(ClientRectangle)); ICamera.MainCamera = c; GameObject CameraObj = new GameObject("Main Camera"); CameraObj.AddScript(c); gameCamController = new FlyCamController(); CameraObj.AddScript(gameCamController); var stack = new PostProcessStack(); stack.AddEffect(new BloomEffect()); stack.AddEffect(new ToneMapACES()); CameraObj.AddScript(stack); GameLoop.Add(CameraObj); var light = new SunLight(); light.Color = Color4.White.ToNumerics().ToOpenTK().Xyz; light.Strength = 2; CameraObj.AddScript(light); gameCamController.Enabled = false; //Spinny thingy //zelda.Root.AddScript(new TurnTable()); //var t = Sphere.Root.GetComponent<Transform>()!; //t.Position = new Vector3(0, 4, 0); //t.Scale = new Vector3(0.1f); Input.Keyboard = KeyboardState; Input.Mouse = MouseState; editorCamController = EditorManager.cam.GameObject.GetScript <FlyCamController>() !; EditMode = true; }