protected override void OnLoad(EventArgs e) { if (Site != null && Site.DesignMode) { return; } MakeCurrent(); Context.LoadAll(); GL.ClearColor(0.2f, 0.3f, 0.3f, 1.0f); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.ProvokingVertex(ProvokingVertexMode.FirstVertexConvention); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest); coloredQuad = new ColoredQuad("d495f8", "ca7ff5", "bf67f2", "b54fef"); floor = new Obj3DFloor(20); gcodeDim = new GCodeDimensions(); millHead = new MillHead3D(); overlay = new Overlay(); overlay.Init(512, 512); overlay.UpdateVerts(Width, Height); //gcodepath = new Wire3D(); //gcodepath.Init(new float[] { 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 20 }); GL.Viewport(0, 0, Width, Height); screenAspect = (float)Width / (float)Height; camera = new Camera(screenAspect); LoadGcodeFile(null); base.OnLoad(e); loaded = true; }
public void OnEnable() { _quad = (ColoredQuad)target; _renderer = _quad.GetComponent<MeshRenderer>(); _meshFilter = _quad.GetComponent<MeshFilter>(); Type internalEditorUtilityType = typeof(InternalEditorUtility); PropertyInfo sortingLayersProperty = internalEditorUtilityType.GetProperty("sortingLayerNames", BindingFlags.Static | BindingFlags.NonPublic); _sortingLayers = (string[])sortingLayersProperty.GetValue(null, new object[0]); }