private void FormMain_Load(object sender, EventArgs e) { var rootElement = GetTree(); var position = new vec3(5, 3, 4); var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height); this.scene = new Scene(camera) { RootNode = rootElement, ClearColor = Color.SkyBlue.ToVec4(), }; var list = new ActionList(); var transformAction = new TransformAction(scene); list.Add(transformAction); var billboardSortAction = new BillboardSortAction(scene.RootNode, scene.Camera); (new FormProperyGrid(billboardSortAction)).Show(); list.Add(billboardSortAction); var renderAction = new RenderAction(scene); list.Add(renderAction); var billboardRenderAction = new BillboardRenderAction(this.scene.Camera, billboardSortAction); list.Add(billboardRenderAction); this.actionList = list; Match(this.trvScene, scene.RootNode); this.trvScene.ExpandAll(); var manipulater = new FirstPerspectiveManipulater(); manipulater.StepLength = 0.1f; manipulater.Bind(camera, this.winGLCanvas1); BlendSrcFactor s; BlendDestFactor d; helper.GetNext(out s, out d); ss = s; dd = d; this.winGLCanvas1.KeyPress += winGLCanvas1_KeyPress; }
/// <summary> /// InitGame initialises all of the classes (pcam, scene, time, the game scene root). It must be called. /// </summary> private void InitGame() { try { var position = new vec3(5, 3, 4); var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); pcam = new Camera(position, center, up, CameraType.Perspective, this.winGLCanvas1.Width, this.winGLCanvas1.Height); // create the camera rootElement = new GroupNode(); // this will be the rootnode of the scene CreateGameTree(rootElement); scene = new Scene(pcam) // initialises the scene, use pcam as camera { RootNode = rootElement, ClearColor = Color.Black.ToVec4(), }; actionlist = new ActionList(); treeView1.ExpandAll(); time = new DateTime(); var list = new ActionList(); // iniitialise the actionlist var transformAction = new TransformAction(scene); // transform action list.Add(transformAction); var billboardSortAction = new BillboardSortAction(scene.RootNode, scene.Camera); // billboard sort list.Add(billboardSortAction); var renderAction = new RenderAction(scene); // render list.Add(renderAction); var billboardRenderAction = new BillboardRenderAction(scene.Camera, billboardSortAction); // billboard render list.Add(billboardRenderAction); actionlist = list; camManip = new FirstPerspectiveManipulater(); // allows moving the camera camManip.BindingMouseButtons = GLMouseButtons.Right; camManip.StepLength = 0.1f; camManip.Bind(pcam, winGLCanvas1); Match(treeView1, scene.RootNode); // update the treeview } catch (Exception e) { if (throwFatalInsteadOfMsg) { throw; } GameFatal gf = new GameFatal(e); gf.Show(); } }
private void FormMain_Load(object sender, EventArgs e) { var rootElement = GetTree(); var position = new vec3(5, 3, 4); var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height); this.scene = new Scene(camera) { RootElement = rootElement, ClearColor = Color.SkyBlue.ToVec4(), }; var list = new ActionList(); var transformAction = new TransformAction(scene); list.Add(transformAction); var billboardSortAction = new BillboardSortAction(scene); list.Add(billboardSortAction); var renderAction = new RenderAction(scene); list.Add(renderAction); var billboardRenderAction = new BillboardRenderAction(scene, billboardSortAction); list.Add(billboardRenderAction); this.actionList = list; Match(this.trvScene, scene.RootElement); this.trvScene.ExpandAll(); var manipulater = new FirstPerspectiveManipulater(); manipulater.StepLength = 0.1f; manipulater.Bind(camera, this.winGLCanvas1); }
public void gInit(Camera pcam, DateTime time, SceneNodeBase rootElement, Client client, Server server, FirstPerspectiveManipulater camManip, ActionList actionlist, Scene scene, WinGLCanvas canvas) { var position = new vec3(5, 3, 4); var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); pcam = new Camera(position, center, up, CameraType.Perspective, canvas.Width, canvas.Height); // create the camera rootElement = new GroupNode(); // this will be the rootnode of the scene //CreateGameTree(rootElement); scene = new Scene(pcam) // initialises the scene, use pcam as camera { RootNode = rootElement, ClearColor = Color.Black.ToVec4(), }; actionlist = new ActionList(); //treeView1.ExpandAll(); time = new DateTime(); var list = new ActionList(); // iniitialise the actionlist var transformAction = new TransformAction(scene); // transform action list.Add(transformAction); var billboardSortAction = new BillboardSortAction(scene.RootNode, scene.Camera); // billboard sort list.Add(billboardSortAction); var renderAction = new RenderAction(scene); // render list.Add(renderAction); var billboardRenderAction = new BillboardRenderAction(scene.Camera, billboardSortAction); // billboard render list.Add(billboardRenderAction); actionlist = list; camManip = new FirstPerspectiveManipulater(); // allows moving the camera camManip.BindingMouseButtons = GLMouseButtons.Right; camManip.StepLength = 0.1f; camManip.Bind(pcam, canvas); }