public FormSimplePointSprite(float fontSize, bool foreshortening, FragShaderType type) { 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(); pointSpriteElement = new DemoSimplePointSpriteElement(fontSize, foreshortening, type); pointSpriteElement.Initialize(); pointSpriteElement.BeforeRendering += pointSpriteElement_BeforeRendering; pointSpriteElement.AfterRendering += pointSpriteElement_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; }
/// <summary> /// 这是一个使用point sprite进行渲染的简单的例子。 /// </summary> /// <param name="pointSize"></param> /// <param name="foreshortening">是否启用近大远小</param> public DemoSimplePointSpriteElement(float pointSize = 64.0f, bool foreshortening = true, FragShaderType fragShaderType = FragShaderType.Simple) { this.PointSize = pointSize; this.Foreshortening = foreshortening; this.fragShaderType = fragShaderType; }