Beispiel #1
0
        private void drawLetter(Font F, byte b, String s, xyz Start, int iD, OpenGlDevice Device)
        {
            if (F.Compiled[b] == null)
            {
                CompileChar = b;
                CompileFont = F;
                MeshCreator.Push();
                bool SaveRegSnap = Selector.RegisterSnap;
                Selector.RegisterSnap = false;
                F.Compiled[b]         = MeshCreator.Compile(this, Compiledraw);
                Selector.RegisterSnap = SaveRegSnap;
                MeshCreator.Pop();
            }

            if (F.Compiled[b] == null)
            {
                throw new Exception("Compile error of " + (char)(b));
            }

            if (RenderKind == RenderKind.SnapBuffer)
            {
                Object Handle = null;
                if ((RenderKind == RenderKind.SnapBuffer))
                {
                    Handle = Selector.RegisterSnapItem(new TextSnappItem(F, s, iD, Start, ModelMatrix * new xyz(0, 0, 0)));
                    if (F.GlyphInfo[b].BlackBoxY < 0.1) // blank
                    {
                        drawBox(new xyz(0, 0, 0), new xyz(F.GlyphInfo[b].Deltax, 1, 1));
                    }
                    else
                    {
                        drawBox(new xyz(0, 0, 0), new xyz(F.GlyphInfo[b].Deltax, F.GlyphInfo[b].BlackBoxY, 1));
                    }
                    if ((RenderKind == RenderKind.SnapBuffer))
                    {
                        Selector.UnRegisterSnapItem(Handle);
                    }
                }

                return;
            }
            if (Entity.Compiling)
            {
                MeshContainer M = F.Compiled[b] as MeshContainer;
                for (int i = 0; i < M.Progs.Count; i++)
                {
                    Mesh E = (M.Progs[i] as Mesh).Clone() as Mesh;
                    E.Transform(ModelMatrix);
                    MeshCreator.MeshListCurrent.Progs.Add(E);
                }

                return;
            }

            F.Compiled[b].Paint(this);
        }
Beispiel #2
0
        /// <summary>
        /// compiles ato an entiy. The draw method describes outfit.
        /// </summary>
        /// <param name="Draw">Method, which drsws some thing.</param>
        /// <returns></returns>
        public Entity Compile(DrawAction Draw)
        {
            bool SaveCompiling = Entity.Compiling;

            Entity.Compiling = true;
            Entity Result = MeshCreator.Compile(this, Draw);

            Entity.Compiling = SaveCompiling;
            return(Result);
        }
Beispiel #3
0
        MeshContainer DoCompile(OpenGlDevice Device)
        {
            Device.PushMatrix();
            Device.ModelMatrix = Matrix.identity;
            if (Mesh != null)
            {
                Mesh.Dispose();
            }
            MeshContainer M = MeshCreator.Compile(Device, CompileDraw);

            Device.PopMatrix();
            return(M);
        }