private void FormCube_Load(object sender, EventArgs e) { var position = new vec3(5, 3, 4) * 0.3f; var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspective, this.winGLCanvas1.Width, this.winGLCanvas1.Height); Texture texture = GetTexture(); this.cubeNode = CubeNode.Create(texture); var scene = new Scene(camera); scene.RootNode = cubeNode; this.scene = scene; var list = new ActionList(); var transformAction = new TransformAction(scene); list.Add(transformAction); var renderAction = new RenderAction(scene); list.Add(renderAction); this.actionList = list; //// uncomment these lines to enable manipualter of camera! //var manipulater = new FirstPerspectiveManipulater(); //manipulater.BindingMouseButtons = System.Windows.Forms.MouseButtons.Right; //manipulater.Bind(camera, this.winGLCanvas1); }
private void O(float distance, Texture texture, GroupNode groupNode, vec3 diff) { { cubeNode = CubeNode.Create(texture); cubeNode.WorldPosition = new vec3(distance * 0.5f, 0, 0) + diff; groupNode.Children.Add(cubeNode); } { cubeNode = CubeNode.Create(texture); cubeNode.WorldPosition = new vec3(-distance * 0.5f, 0, 0) + diff; groupNode.Children.Add(cubeNode); } { cubeNode = CubeNode.Create(texture); cubeNode.WorldPosition = new vec3(distance * 0.5f, distance, 0) + diff; groupNode.Children.Add(cubeNode); } { cubeNode = CubeNode.Create(texture); cubeNode.WorldPosition = new vec3(-distance * 0.5f, distance, 0) + diff; groupNode.Children.Add(cubeNode); } }