public static void DrawMMGrid(GraphicsInterface G, float PW, float width, float height, float minorGrid, float majorGrid) { if (minorGrid < 0) { return; } Pen P = new Pen(System.Drawing.ColorTranslator.FromHtml("#c4e5ff"), PW * 0.5f); for (float X = 0; X <= width; X += minorGrid) { G.DrawLine(P, X, 0, X, height); } for (float X = 0; X <= height; X += minorGrid) { G.DrawLine(P, 0.0f, X, width, X); } P = new Pen(System.Drawing.ColorTranslator.FromHtml("#bad7ed"), PW); for (float X = 0; X <= width; X += majorGrid) { G.DrawLine(P, X, 0, X, height); } for (float X = 0; X <= height; X += majorGrid) { G.DrawLine(P, 0.0f, X, width, X); } }
private void glControl1_Paint(object sender, PaintEventArgs e) { if (ShapeMarkedForUpdate && (AutoUpdate || ForceShapeUpdate)) { //Console.WriteLine("updating shape.."); ThePanel.UpdateShape(); // check if needed? ShapeMarkedForUpdate = false; } glControl1.MakeCurrent(); DrawingScale = Math.Min(glControl1.Width, glControl1.Height) / (float)(Math.Max(ThePanel.TheSet.Height, ThePanel.TheSet.Width) + 10); GraphicsInterface GI = (GraphicsInterface) new GLGraphicsInterface(0, 0, glControl1.Width, glControl1.Height); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(-glControl1.Width / 2, glControl1.Width / 2, glControl1.Height / 2, -glControl1.Height / 2, -100, 100); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); GL.Viewport(0, 0, glControl1.Width, glControl1.Height); GL.Clear(ClearBufferMask.ColorBufferBit); GI.ScaleTransform((float)Zoom, -(float)Zoom); GI.TranslateTransform(-(float)(CenterPoint.X), -(float)(CenterPoint.Y)); GL.Disable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); ThePanel.DrawBoardBitmap(1.0f, GI, glControl1.Width, glControl1.Height, SelectedInstance, HoverShape, SnapDistance()); glControl1.SwapBuffers(); }
public GLFrameBuffer(GraphicsInterface gi) { fColorBuffer = new GLColorBuffer(gi); fDepthBuffer = new GLDepthBuffer(gi); fStencilBuffer = new GLStencilBuffer(gi); fAccumBuffer = new GLAccumBuffer(gi); }
public void Draw(GraphicsInterface graphics) { graphics.DrawRectangle(contained > 0 ? Color.Red : Color.Yellow, (float)xstart, (float)ystart, (float)xend - (float)xstart, (float)yend - (float)ystart, (float)((xend - xstart) * 0.001)); foreach (var C in Children) { C.Draw(graphics); } }
public UnaryTextureProcessor(GraphicsInterface gi, int width, int height, string fragmentString) : base(gi) { fWidth = width; fHeight = height; FragmentShaderString = fragmentString; }
// Method for releasing disposable dependencies (if any) public void Release(GraphicsInterface graphicsInterface) { var disposable = graphicsInterface as IDisposable; if (disposable != null) { disposable.Dispose(); } }
protected override void RenderContent(GraphicsInterface gi) { gi.Color(fVertex1.fColor); gi.Vertex(fVertex1.fPosition); gi.Color(fVertex2.fColor); gi.Vertex(fVertex2.fPosition); gi.Color(fVertex3.fColor); gi.Vertex(fVertex3.fPosition); }
public void Render(GraphicsInterface G, Color FG, Color BG) { G.Clear(BG); Pen P = new Pen(FG, 1); foreach (var a in Lines) { G.DrawLine(P, a.Item1, a.Item2); } }
public GLClientFeatureList(GraphicsInterface gi) { fGI = gi; fColorArrayFeature = new GLFeatureColorArray(gi); fEdgeArrayFeature = new GLFeatureEdgeArray(gi); fIndexArrayFeature = new GLFeatureIndexArray(gi); fNormalArrayFeature = new GLFeatureNormalArray(gi); fTextureCoordArrayFeature = new GLFeatureTextureCoordArray(gi); fVertexArrayFeature = new GLFeatureVertexArray(gi); }
private float GetScaleAndBuildTransform(GraphicsInterface G2, PolyLineSet.Bounds Bounds) { Bitmap B = new Bitmap(1, 1); Graphics G = Graphics.FromImage(B); float S = GetScaleAndBuildTransform(G, Bounds); G2.Transform = G.Transform.Clone(); return(S); }
public void DrawArt(GraphicsInterface graphics, Color Col) { if (contained == 0) { graphics.FillRectangle(Col, (float)xstart, (float)ystart, (float)xend - (float)xstart - 1, (float)yend - (float)ystart - 1); } foreach (var C in Children) { C.DrawArt(graphics, Col); } }
public BinaryTextureProcessor(GraphicsInterface gi, int width, int height, string fragmentString) : base(gi) { fWidth = width; fHeight = height; fFragmentShaderString = fragmentString; fBaseTextureUnit = GLTextureUnit.GetTextureUnit(gi, TextureUnitID.Unit1); fBlendTextureUnit = GLTextureUnit.GetTextureUnit(gi, TextureUnitID.Unit0); }
public void drawEverything(GraphicsInterface gi, Transform transform, ref RenderCamera camTrs) { if (transform != Transform.Identity) { OpenTK.Graphics.OpenGL.GL.PushMatrix(); transform.GL_Load(); drawEverything(gi, ref camTrs); OpenTK.Graphics.OpenGL.GL.PopMatrix(); } else { drawEverything(gi, ref camTrs); } }
public void Draw(GraphicsInterface graphics, bool drawcontained = true) { if (contained > 0 && drawcontained == false) { } else { graphics.DrawRectangle(contained > 0 ? Color.Red : Color.Yellow, xstart, ystart, xend - xstart - 1, yend - ystart - 1); } foreach (var C in Children) { C.Draw(graphics); } }
protected override void RenderContent(GraphicsInterface gi) { int i; for (i = 5; i >= 0; i--) { gi.Begin((BeginMode)fStyle); gi.Normal(n[i]); //gl.glNormal3fv(n[i]); gi.Vertex3(v[faces[i][0]]); gi.Vertex3(v[faces[i][1]]); gi.Vertex3(v[faces[i][2]]); gi.Vertex3(v[faces[i][3]]); gi.End(); } }
// Use this for initialization void Start() { parentDamageSystem = GameObject.Find("DamageSystem"); if (!parentDamageSystem) { parentDamageSystem = new GameObject("DamageSystem"); parentDamageSystem.transform.position.Set(0f, 0f, 0f); } spawner = GameObject.FindObjectOfType <Spawner>(); graphicsInterface = GameObject.FindObjectOfType <GraphicsInterface>(); CurrentSpeed = normalSpeed; currentLife = life; anim = GetComponent <Animator>(); }
public void draw(GraphicsInterface gi, ref Transform transform, byte drawLayers, ref RenderCamera camTrs, DrawOptions options = 0) { GeoNode NodeIter; GeoModel ModelIter; GeoMesh MeshIter; uint NodeIterPos; uint ModelIterPos; uint MeshIterPos; var new_transform = Local * transform; GL.PushMatrix(); Local.GL_Load(); if (this.forceBillboard) { camTrs.MakeBillboardAndRotateGL(ref transform); } if (0 != (SelfDrawLayerMask & drawLayers)) { for (ModelIter = FirstModel, ModelIterPos = ModelCount; 0 != ModelIterPos; ModelIter = ModelIter.Next, --ModelIterPos) { if (0 != (ModelIter.DrawLayerMask & drawLayers)) { for (MeshIter = ModelIter.First, MeshIterPos = ModelIter.Count; 0 != MeshIterPos; MeshIter = MeshIter.Next, --MeshIterPos) { if (0 != (MeshIter.DrawLayerMask & drawLayers)) { gi.Draw(ref MeshIter.State, Options: options); } } } } } for (NodeIter = FirstChild, NodeIterPos = NumImmediate; 0 != NodeIterPos; NodeIter = NodeIter.Sibling, --NodeIterPos) { if (0 != (NodeIter.DrawLayerMask & drawLayers)) { NodeIter.draw(gi, ref new_transform, drawLayers, ref camTrs, options); } } GL.PopMatrix(); }
public GLFeatureList(GraphicsInterface gi) { fGI = gi; fAlphaTest = new GLFeatureAlphaTest(gi); fAutoNormal = new GLFeatureAutoNormal(gi); fBlend = new GLFeatureBlend(gi); fColorMaterial = new GLFeatureColorMaterial(gi); fColorSum = new GLFeatureColorSum(gi); fCullFace = new GLFeatureCullFace(gi); fDepthTest = new GLFeatureDepthTest(gi); fDither = new GLFeatureDither(gi); fFog = new GLFeatureFog(gi); fLighting = new GLFeatureLighting(gi); fLineSmooth = new GLFeatureLineSmooth(gi); fMap1Vertex3 = new GLFeatureMap1Vertex3(gi); fMap2Vertex3 = new GLFeatureMap2Vertex3(gi); fPointSmooth = new GLFeaturePointSmooth(gi); fPolygonSmooth = new GLFeaturePolygonSmooth(gi); fPointSprite = new GLFeaturePointSprite(gi); fTexturing2D = new Texturing2D(gi); }
//public int maxNumMonstersOfLevel; private void Start() { graphicsInterface = GameObject.FindObjectOfType <GraphicsInterface>(); fieldControl = GameObject.FindObjectOfType <FieldControl>(); player = GameObject.FindObjectOfType <Player>(); levelManager = GameObject.FindObjectOfType <LevelManager>(); parent = GameObject.Find("Attackers"); if (!parent) { parent = new GameObject("Attackers"); parent.transform.position.Set(0f, 0f, 0f); } spawnTime = 5f; //Depois que um novo level iniciar, após este tempo os monstros começarão a surgir countdownToNewLevelBegin = 8f; //Depois que um level acabar, após este tempo um novo level irá iniciar currentTime = 0f; monstersSpawned = 0; canSpawn = false; LoadNextLevelInfo(); NewLevelStarts(); }
public bool draw( GraphicsInterface gi, Transform transform, byte drawLayers, ref RenderCamera camTrs) { GeoNode NodeIter; uint NodeIterPos; for (NodeIterPos = NumImmediate, NodeIter = FirstChild; 0 != NodeIterPos; NodeIter = NodeIter.Sibling, --NodeIterPos) { if (0 == (NodeIter.DrawLayerMask & drawLayers)) { continue; } GL.PushMatrix(); transform.GL_Load(); do { NodeIter.draw(gi, ref transform, drawLayers, ref camTrs); while (0 != --NodeIterPos && 0 == ((NodeIter = NodeIter.Sibling).DrawLayerMask & drawLayers)) { continue; } } while (0 != NodeIterPos); GL.DisableClientState(ArrayCap.ColorArray); GL.DisableClientState(ArrayCap.NormalArray); GL.DisableClientState(ArrayCap.TextureCoordArray); GL.DisableClientState(ArrayCap.VertexArray); GL.PopMatrix(); return(true); } return(false); }
public GLStencilBuffer(GraphicsInterface gi) : base(gi, ClearBufferMask.StencilBufferBit) { }
public BracketPolygonDrawing(GraphicsInterface gi) : base(gi, BeginMode.Polygon) { fPolyAspects = new GLAspectPolygon(gi); }
//static bool old; public bool drawModel(GraphicsInterface gi, Transform transform, byte drawLayers, ref RenderCamera camTrs) { if (/*!old &&*/ null != (object)root) { return(root.draw(gi, transform, drawLayers, ref camTrs)); } bool started = false; for (int i = 0; i < meshes.Count; i++) { MeshData m = meshes[i]; if (0 == ((1 << (m.material.drawLayerBillboard & 7)) & drawLayers)) { continue; } //if (m.vertices == null || m.indices == null) return; if (!started) { started = true; GL.PushMatrix(); transform.GL_Load(); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.TextureCoordArray); GL.EnableClientState(ArrayCap.ColorArray); } if (m.texture != null) { GL.BindTexture(TextureTarget.Texture2D, m.texture.ID); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, m.texture.TextureParamS); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, m.texture.TextureParamT); } GL.BindBuffer(BufferTarget.ArrayBuffer, m.vbo); GL.VertexPointer(3, VertexPointerType.Float, 0, IntPtr.Zero); GL.BindBuffer(BufferTarget.ArrayBuffer, m.texBuf); GL.TexCoordPointer(2, TexCoordPointerType.Float, 0, IntPtr.Zero); GL.BindBuffer(BufferTarget.ArrayBuffer, m.colorBuf); GL.ColorPointer(4, ColorPointerType.Float, 0, IntPtr.Zero); GL.BindBuffer(BufferTarget.ArrayBuffer, m.normalBuf); GL.NormalPointer(NormalPointerType.Float, 0, IntPtr.Zero); GL.BindBuffer(BufferTarget.ElementArrayBuffer, m.ibo); if (Globals.doWireframe) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); } else { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); } GL.DrawElements(PrimitiveType.Triangles, m.indices.Length, DrawElementsType.UnsignedInt, IntPtr.Zero); if (Globals.doWireframe) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); } } if (started) { GL.DisableClientState(ArrayCap.VertexArray); GL.DisableClientState(ArrayCap.TextureCoordArray); GL.DisableClientState(ArrayCap.ColorArray); GL.PopMatrix(); } return(started); }
public void drawEverything(GraphicsInterface gi, ref RenderCamera camTrs) { Object3D obj; Model3D model; Transform transform; List <Object3D> list; int i, ilist; byte modelId; bool selected; if (Globals.renderCollisionMap) { collision.drawCollisionMap(false); } else { AreaModel.drawModel(gi, ref camTrs); } for (i = Objects.Count - 1; i >= 0; --i) { obj = Objects[i]; obj.LoadTransform(out transform, ref camTrs); // Need to slighting increase the model's size, just in-case of overlapping bounding boxes. if ((selected = isObjectSelected(0, i))) { transform.scale *= 1.001f; } if ((modelId = obj.ModelID) != 0) { if (!level.ModelIDs.TryGetValue(modelId, out model)) { continue; } if (Globals.drawObjectModels) { model.drawModel(gi, transform, ref camTrs); } BoundingBox.draw(transform, selected ? Globals.SelectedObjectColor : Globals.ObjectColor, model); } else { BoundingBox.draw(transform, selected ? Globals.SelectedObjectColor : Globals.ObjectColor); } } // macro objects, then special objects. for (selected = false, ilist = 1, list = MacroObjects; ilist != 3; list = SpecialObjects, ++ilist) { for (i = list.Count - 1; i >= 0; --i) { obj = list[i]; if ((modelId = obj.ModelID) != 0) { if (!level.ModelIDs.TryGetValue(modelId, out model)) { continue; } obj.LoadTransform(out transform, ref camTrs); if (Globals.drawObjectModels) { model.drawModel(gi, transform, ref camTrs); } BoundingBox.draw(transform, isObjectSelected(ilist, i) ? Globals.SelectedObjectColor : Globals.MacroObjectColor, model); } else { BoundingBox.draw(obj.transform, isObjectSelected(ilist, i) ? Globals.SelectedObjectColor : Globals.MacroObjectColor); } } } }
public Texturing2D(GraphicsInterface gi) : base(gi, GLOption.Texture2d) { fTextureGenS = new GLFeatureTextureGenS(gi); fTextureGenT = new GLFeatureTextureGenT(gi); }
private void Start() { graphicsInterface = GetComponent <GraphicsInterface>(); AddStars(40); }
//public GLBracketDrawing(BeginMode aMode, GraphicsInterface gi) //{ // fGI = gi; // fMode = aMode; //} public GLBracketDrawing(GraphicsInterface gi, BeginMode aMode) { fGI = gi; fMode = aMode; }
public void drawModel(GraphicsInterface gi, Transform transform, [In] ref RenderCamera camTrs) { drawModel(gi, transform, 255, ref camTrs); }
public BracketLineStripDrawing(GraphicsInterface gi) : base(gi, BeginMode.LineStrip) { }
public BracketQuadStripDrawing(GraphicsInterface gi) : base(gi, BeginMode.QuadStrip) { }
public HyperbolicInterpolation(GraphicsInterface gi) : base(gi, HintTarget.PerspectiveCorrectionHint, HintMode.Nicest) { }
public GLBlendFunc(GraphicsInterface gi, BlendingFactorSrc srcBlend, BlendingFactorDest dstBlend) :base(gi) { fSrcBlendFactor = srcBlend; fDstBlendFactor = dstBlend; }
public GIObject(GraphicsInterface gi) { fGI = gi; }
public BracketPointDrawing(GraphicsInterface gi) : base(gi, BeginMode.Points) { fPointsAspect = new GLAspectPoints(gi); }
public GLFeatureBlend(GraphicsInterface gi) : base (gi, GLOption.Blend) { }
public BracketLineDrawing(GraphicsInterface gi, BeginMode mode) : base(gi, mode) { fLineAspects = new GLAspectLines(gi); }
public GLDepthBuffer(GraphicsInterface gi) : base(gi, ClearBufferMask.DepthBufferBit) { }
public GLAspect(GraphicsInterface gi) { fGI = gi; }
public void drawModel(GraphicsInterface gi, [In] ref RenderCamera camTrs) { drawModel(gi, Transform.Identity, ref camTrs); }
public BracketTriangleFanDrawing(GraphicsInterface gi) : base(gi, BeginMode.TriangleFan) { }
public AttributeStackServer(GraphicsInterface gi) : base(gi) { }
protected override void BeginRender(GraphicsInterface gi) { gi.Drawing.Triangles.Begin(); }
public GLFeatureLineSmooth(GraphicsInterface gi) : base(gi, GLOption.LineSmooth, HintTarget.LineSmoothHint) { }
protected override void EndRender(GraphicsInterface gi) { gi.Drawing.Triangles.End(); }
public GLFeaturePolygonSmooth(GraphicsInterface gi) : base(gi, GLOption.PolygonSmooth, HintTarget.PolygonSmoothHint) { }
public GLHintedFeature(GraphicsInterface gi, GLOption aFeature, HintTarget aTarget) : base(gi, aFeature) { fHintMode = HintMode.DontCare; fHintTarget = aTarget; }
public BinaryTextureProcessor(GraphicsInterface gi, int width, int height) : this(gi, width, height, UnaryTextureProcessor.FixedFrag) { }
public GLAspectPoints(GraphicsInterface gi) :base(gi) { fState = new GLState(gi); fSmoothing = new GLFeaturePointSmooth(gi); }
public bool drawModel(GraphicsInterface gi, byte drawLayers, ref RenderCamera camTrs) { return(drawModel(gi, Transform.Identity, drawLayers, ref camTrs)); }