Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public GLFrameBuffer(GraphicsInterface gi)
 {
     fColorBuffer = new GLColorBuffer(gi);
     fDepthBuffer = new GLDepthBuffer(gi);
     fStencilBuffer = new GLStencilBuffer(gi);
     fAccumBuffer = new GLAccumBuffer(gi);
 }
Esempio n. 4
0
 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;
        }
Esempio n. 6
0
    // Method for releasing disposable dependencies (if any)
    public void Release(GraphicsInterface graphicsInterface)
    {
        var disposable = graphicsInterface as IDisposable;

        if (disposable != null)
        {
            disposable.Dispose();
        }
    }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
        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);
            }
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 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);
     }
 }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
 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);
     }
 }
Esempio n. 14
0
 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);
     }
 }
Esempio n. 15
0
        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();
            }
        }
Esempio n. 16
0
    // 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>();
    }
Esempio n. 17
0
        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();
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
    //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();
    }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
 public GLStencilBuffer(GraphicsInterface gi)
     : base(gi, ClearBufferMask.StencilBufferBit)
 {
 }
Esempio n. 22
0
 public BracketPolygonDrawing(GraphicsInterface gi)
     : base(gi, BeginMode.Polygon)
 {
     fPolyAspects = new GLAspectPolygon(gi);
 }
Esempio n. 23
0
        //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);
        }
Esempio n. 24
0
        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);
                    }
                }
            }
        }
Esempio n. 25
0
 public Texturing2D(GraphicsInterface gi)
     : base(gi, GLOption.Texture2d)
 {
     fTextureGenS = new GLFeatureTextureGenS(gi);
     fTextureGenT = new GLFeatureTextureGenT(gi);
 }
Esempio n. 26
0
    private void Start()
    {
        graphicsInterface = GetComponent <GraphicsInterface>();

        AddStars(40);
    }
Esempio n. 27
0
        //public GLBracketDrawing(BeginMode aMode, GraphicsInterface gi)
        //{
        //    fGI = gi;
        //    fMode = aMode;
        //}

        public GLBracketDrawing(GraphicsInterface gi, BeginMode aMode)
        {
            fGI = gi;
            fMode = aMode;
        }
Esempio n. 28
0
 public void drawModel(GraphicsInterface gi, Transform transform, [In] ref RenderCamera camTrs)
 {
     drawModel(gi, transform, 255, ref camTrs);
 }
Esempio n. 29
0
 public BracketLineStripDrawing(GraphicsInterface gi)
     : base(gi, BeginMode.LineStrip)
 {
 }
Esempio n. 30
0
 public BracketQuadStripDrawing(GraphicsInterface gi)
     : base(gi, BeginMode.QuadStrip)
 {
 }
 public HyperbolicInterpolation(GraphicsInterface gi)
     : base(gi, HintTarget.PerspectiveCorrectionHint, HintMode.Nicest)
 {
 }
Esempio n. 32
0
 public GLBlendFunc(GraphicsInterface gi, BlendingFactorSrc srcBlend, BlendingFactorDest dstBlend)
     :base(gi)
 {
     fSrcBlendFactor = srcBlend;
     fDstBlendFactor = dstBlend;
 }
Esempio n. 33
0
 public GIObject(GraphicsInterface gi)
 {
     fGI = gi;
 }
Esempio n. 34
0
 public BracketPointDrawing(GraphicsInterface gi)
     : base(gi, BeginMode.Points)
 {
     fPointsAspect = new GLAspectPoints(gi);
 }
Esempio n. 35
0
 public GLFeatureBlend(GraphicsInterface gi)
     : base (gi, GLOption.Blend)
 {
 }
Esempio n. 36
0
 public BracketLineDrawing(GraphicsInterface gi, BeginMode mode)
     : base(gi, mode)
 {
     fLineAspects = new GLAspectLines(gi);
 }
Esempio n. 37
0
 public GLDepthBuffer(GraphicsInterface gi)
     : base(gi, ClearBufferMask.DepthBufferBit)
 {
 }
Esempio n. 38
0
 public GLAspect(GraphicsInterface gi)
 {
     fGI = gi;
 }
Esempio n. 39
0
 public void drawModel(GraphicsInterface gi, [In] ref RenderCamera camTrs)
 {
     drawModel(gi, Transform.Identity, ref camTrs);
 }
Esempio n. 40
0
 public BracketTriangleFanDrawing(GraphicsInterface gi)
     : base(gi, BeginMode.TriangleFan)
 {
 }
Esempio n. 41
0
 public AttributeStackServer(GraphicsInterface gi)
     : base(gi)
 {
 }
Esempio n. 42
0
 protected override void BeginRender(GraphicsInterface gi)
 {
     gi.Drawing.Triangles.Begin();
 }
Esempio n. 43
0
 public GLFeatureLineSmooth(GraphicsInterface gi)
     : base(gi, GLOption.LineSmooth, HintTarget.LineSmoothHint)
 {
 }
Esempio n. 44
0
 protected override void EndRender(GraphicsInterface gi)
 {
     gi.Drawing.Triangles.End();
 }
Esempio n. 45
0
 public GLFeaturePolygonSmooth(GraphicsInterface gi)
     : base(gi, GLOption.PolygonSmooth, HintTarget.PolygonSmoothHint)
 {
 }
Esempio n. 46
0
 public GLHintedFeature(GraphicsInterface gi, GLOption aFeature, HintTarget aTarget)
     : base(gi, aFeature)
 {
     fHintMode = HintMode.DontCare;
     fHintTarget = aTarget;
 }
Esempio n. 47
0
 public BinaryTextureProcessor(GraphicsInterface gi, int width, int height)
     : this(gi, width, height, UnaryTextureProcessor.FixedFrag)
 {
 }
Esempio n. 48
0
 public GLAspectPoints(GraphicsInterface gi)
     :base(gi)
 {
     fState = new GLState(gi);
     fSmoothing = new GLFeaturePointSmooth(gi);
 }
Esempio n. 49
0
 public bool drawModel(GraphicsInterface gi, byte drawLayers, ref RenderCamera camTrs)
 {
     return(drawModel(gi, Transform.Identity, drawLayers, ref camTrs));
 }