void axisElement2_BeforeRendering(object sender, Objects.RenderEventArgs e) { AxisElement2 element = sender as AxisElement2; mat4 projectionMatrix = camera.GetProjectionMat4(); projectionMatrix = glm.translate(projectionMatrix, new vec3(translateX, translateY, translateZ));// mat4 viewMatrix = camera.GetViewMat4(); mat4 modelMatrix = mat4.identity(); ShaderProgram shaderProgram = element.shaderProgram; shaderProgram.Bind(); shaderProgram.SetUniformMatrix4(AxisElement2.strprojectionMatrix, projectionMatrix.to_array()); shaderProgram.SetUniformMatrix4(AxisElement2.strviewMatrix, viewMatrix.to_array()); shaderProgram.SetUniformMatrix4(AxisElement2.strmodelMatrix, modelMatrix.to_array()); }
public FormSimpleUIAxis() { InitializeComponent(); //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name)) //{ // this.camera = CameraDictionary.Instance[this.GetType().Name]; //} //else { this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height); //CameraDictionary.Instance.Add(this.GetType().Name, this.camera); } satelliteRoration = new SatelliteRotator(camera); Padding padding = new System.Windows.Forms.Padding(40, 40, 40, 40); Size size = new Size(100, 100); //Size size = new Size(5, 5); IUILayoutParam param; param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size); uiLeftBottomAxis = new SimpleUIAxis(param); param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size); uiLeftTopAxis = new SimpleUIAxis(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size); uiRightBottomAxis = new SimpleUIAxis(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size); uiRightTopAxis = new SimpleUIAxis(param); uiLeftBottomAxis.Initialize(); uiLeftTopAxis.Initialize(); uiRightBottomAxis.Initialize(); uiRightTopAxis.Initialize(); param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size); uiLeftBottomRect = new SimpleUIRect(param); param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size); uiLeftTopRect = new SimpleUIRect(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size); uiRightBottomRect = new SimpleUIRect(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size); uiRightTopRect = new SimpleUIRect(param); uiLeftBottomRect.Initialize(); uiLeftTopRect.Initialize(); uiRightBottomRect.Initialize(); uiRightTopRect.Initialize(); axisElement = new AxisElement(); axisElement.Initialize(); axisElement.BeforeRendering += axisElement_BeforeRendering; axisElement.AfterRendering += axisElement_AfterRendering; axisElement2 = new AxisElement2(); axisElement2.Initialize(); axisElement2.BeforeRendering += axisElement2_BeforeRendering; axisElement2.AfterRendering += axisElement2_AfterRendering; this.glCanvas1.MouseWheel += glCanvas1_MouseWheel; this.glCanvas1.KeyPress += glCanvas1_KeyPress; this.glCanvas1.MouseDown += glCanvas1_MouseDown; this.glCanvas1.MouseMove += glCanvas1_MouseMove; this.glCanvas1.MouseUp += glCanvas1_MouseUp; this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw; this.glCanvas1.Resize += glCanvas1_Resize; }
void axisElement2_AfterRendering(object sender, Objects.RenderEventArgs e) { AxisElement2 element = sender as AxisElement2; element.shaderProgram.Unbind(); }
public FormSimpleUIAxis() { InitializeComponent(); //if (CameraDictionary.Instance.ContainsKey(this.GetType().Name)) //{ // this.camera = CameraDictionary.Instance[this.GetType().Name]; //} //else { this.camera = new Camera(CameraType.Ortho, this.glCanvas1.Width, this.glCanvas1.Height); //CameraDictionary.Instance.Add(this.GetType().Name, this.camera); } satelliteRoration = new SatelliteRotator(camera); Padding padding = new System.Windows.Forms.Padding(40, 40, 40, 40); Size size = new Size(100, 100); //Size size = new Size(5, 5); IUILayoutParam param; param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size); uiLeftBottomAxis = new SimpleUIAxis(param); param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size); uiLeftTopAxis = new SimpleUIAxis(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size); uiRightBottomAxis = new SimpleUIAxis(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size); uiRightTopAxis = new SimpleUIAxis(param); uiLeftBottomAxis.Initialize(); uiLeftTopAxis.Initialize(); uiRightBottomAxis.Initialize(); uiRightTopAxis.Initialize(); param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Bottom, padding, size); uiLeftBottomRect = new SimpleUIRect(param); param = new IUILayoutParam(AnchorStyles.Left | AnchorStyles.Top, padding, size); uiLeftTopRect = new SimpleUIRect(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Bottom, padding, size); uiRightBottomRect = new SimpleUIRect(param); param = new IUILayoutParam(AnchorStyles.Right | AnchorStyles.Top, padding, size); uiRightTopRect = new SimpleUIRect(param); uiLeftBottomRect.Initialize(); uiLeftTopRect.Initialize(); uiRightBottomRect.Initialize(); uiRightTopRect.Initialize(); axisElement = new AxisElement(); axisElement.Initialize(); axisElement2 = new AxisElement2(); axisElement2.Initialize(); this.glCanvas1.MouseWheel += glCanvas1_MouseWheel; this.glCanvas1.KeyPress += glCanvas1_KeyPress; this.glCanvas1.MouseDown += glCanvas1_MouseDown; this.glCanvas1.MouseMove += glCanvas1_MouseMove; this.glCanvas1.MouseUp += glCanvas1_MouseUp; this.glCanvas1.OpenGLDraw += glCanvas1_OpenGLDraw; this.glCanvas1.Resize += glCanvas1_Resize; }