示例#1
0
 public void RenderObject(
     ushort id,
     MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD tmp,
     bool translate,
     NSBTP btp  = null,
     int btpidx = 0,
     bool last  = true)
 {
     if (!this.objectstex.Contains(id))
     {
         GlNitro2.glNitroBindTextures(tmp, (int)id * (int)byte.MaxValue + 1 + this.texoffset * (int)ushort.MaxValue);
         if (last)
         {
             this.objectstex.Add(id);
         }
     }
     Gl.glPushMatrix();
     Gl.glScalef(16.12903f * tmp.modelSet.models[0].info.posScale, 16.12903f * tmp.modelSet.models[0].info.posScale, 16.12903f * tmp.modelSet.models[0].info.posScale);
     if (translate)
     {
         Gl.glTranslatef(0.0f, tmp.modelSet.models[0].info.boxH / 2f - tmp.modelSet.models[0].info.boxY, 0.0f);
     }
     tmp.modelSet.models[0].ProcessSbc(tmp.TexPlttSet, (NSBCA)null, 0, 0, (MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTA)null, 0, 0, btp, 0, btpidx, (NSBMA)null, 0, 0, (NSBVA)null, 0, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, this.picking, (int)id * (int)byte.MaxValue + 1 + this.texoffset * (int)ushort.MaxValue);
     ++this.texoffset;
     Gl.glPopMatrix();
 }
示例#2
0
 private void CGFX_Load(object sender, EventArgs e)
 {
     this.simpleOpenGlControl1.InitializeContexts();
     Gl.ReloadFunctions();
     Gl.glEnable(32826);
     Gl.glEnable(2903);
     Gl.glEnable(2929);
     Gl.glEnable(2977);
     Gl.glDisable(2884);
     Gl.glFrontFace(2305);
     Gl.glEnable(3553);
     Gl.glClearDepth(1.0);
     Gl.glEnable(3008);
     Gl.glAlphaFunc(516, 0.0f);
     Gl.glEnable(3042);
     Gl.glBlendFunc(770, 771);
     Gl.glShadeModel(7425);
     Gl.glDepthFunc(515);
     Gl.glClearColor(0.2f, 0.2f, 0.2f, 0.0f);
     if (this.cgfx.Data.Textures != null)
     {
         int Nr = 1;
         foreach (MKDS_Course_Modifier._3DS.CGFX.DATA.TXOB texture in this.cgfx.Data.Textures)
         {
             int WrapModeS = 10497;
             int WrapModeT = 10497;
             GlNitro2.glNitroTexImage2D(texture.GetBitmap(0), Nr, WrapModeS, WrapModeT, 9729, 9729);
             ++Nr;
         }
     }
     this.Shaders = new CGFXShader[this.cgfx.Data.Models[0].Materials.Length];
     this.Render();
 }
示例#3
0
 private void OBJ_Load(object sender, EventArgs e)
 {
     this.simpleOpenGlControl1.InitializeContexts();
     Gl.ReloadFunctions();
     Gl.glEnable(32826);
     Gl.glEnable(2903);
     Gl.glEnable(2929);
     Gl.glEnable(2977);
     Gl.glDisable(2884);
     Gl.glFrontFace(2305);
     Gl.glEnable(3553);
     Gl.glClearDepth(1.0);
     Gl.glEnable(3008);
     Gl.glAlphaFunc(516, 0.0f);
     Gl.glEnable(3042);
     Gl.glBlendFunc(770, 771);
     Gl.glShadeModel(7425);
     Gl.glClearColor(0.2f, 0.2f, 0.2f, 1f);
     if (this.Mlt != null)
     {
         int Nr = 1;
         foreach (MLT.Material material in this.Mlt.Materials)
         {
             if (material.DiffuseMap != null)
             {
                 GlNitro2.glNitroTexImage2D(material.DiffuseMap, Nr, 10497, 9728);
             }
             ++Nr;
         }
     }
     this.Render();
 }
示例#4
0
 public void SetNSBMD(MKDS_Course_Modifier.G3D_Binary_File_Format.NSBMD Bmd)
 {
     this.file = Bmd;
     this.timer1.Stop();
     this.Btp        = (NSBTP)null;
     this.Bta        = (MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTA)null;
     this.Bca        = (NSBCA)null;
     this.Bma        = (NSBMA)null;
     this.Bva        = (NSBVA)null;
     this.SelBcaAnim = 0;
     this.SelBmaAnim = 0;
     this.SelBtaAnim = 0;
     this.SelBtpAnim = 0;
     this.SelBvaAnim = 0;
     this.SelMdl     = 0;
     this.menuItem3.MenuItems.Clear();
     for (int index = 0; index < (int)this.file.modelSet.dict.numEntry; ++index)
     {
         this.menuItem3.MenuItems.Add(this.file.modelSet.dict[index].Key, new EventHandler(this.menuItem3_Click));
         this.menuItem3.MenuItems[index].RadioCheck = true;
     }
     this.menuItem3.MenuItems[0].Checked = true;
     this.menuItem2.MenuItems.Clear();
     this.menuItem5.MenuItems.Clear();
     GlNitro2.glNitroBindTextures(this.file, 1);
     this.Render();
 }
示例#5
0
 private void NSBMD_Load(object sender, EventArgs e)
 {
     for (int index = 0; index < (int)this.file.modelSet.dict.numEntry; ++index)
     {
         this.menuItem3.MenuItems.Add(this.file.modelSet.dict[index].Key, new EventHandler(this.menuItem3_Click));
         this.menuItem3.MenuItems[index].RadioCheck = true;
     }
     this.menuItem3.MenuItems[0].Checked = true;
     this.simpleOpenGlControl1.InitializeContexts();
     Gl.ReloadFunctions();
     Gl.glEnable(32826);
     Gl.glEnable(2903);
     Gl.glEnable(2929);
     Gl.glEnable(2977);
     Gl.glDisable(2884);
     Gl.glFrontFace(2305);
     Gl.glEnable(3553);
     Gl.glClearDepth(1.0);
     Gl.glEnable(3008);
     Gl.glAlphaFunc(516, 0.0f);
     Gl.glEnable(3042);
     Gl.glBlendFunc(770, 771);
     Gl.glShadeModel(7425);
     Gl.glClearColor(0.2f, 0.2f, 0.2f, 0.0f);
     GlNitro2.glNitroBindTextures(this.file, 1);
     this.Render();
 }
示例#6
0
 private void UploadCells()
 {
     for (int Index = 0; Index < (int)this.Cell.CellBankBlock.CellDataBank.numCells; ++Index)
     {
         GlNitro2.glNitroTexImage2D(this.Cell.CellBankBlock.CellDataBank.GetBitmap(Index, this.Graphic, this.Palette), Index + 1, 9728);
     }
     this.Render(false, new Point());
 }
示例#7
0
 public void SetHBDF(HBDF Hbdf)
 {
     this.file = Hbdf;
     this.timer1.Stop();
     this.menuItem2.MenuItems.Clear();
     GlNitro2.glNitroBindTextures(this.file, 1);
     this.Render();
 }
示例#8
0
 public void SetBMD(MKDS_Course_Modifier.SM64DS.BMD Bmd)
 {
     this.file = Bmd;
     this.timer1.Stop();
     this.Bca        = (BCA)null;
     this.SelBcaAnim = 0;
     this.menuItem2.MenuItems.Clear();
     GlNitro2.glNitroBindTextures(this.file, 1);
     this.Render();
 }
示例#9
0
 private void menuItem16_Click(object sender, EventArgs e)
 {
     this.Render();
     System.Drawing.Bitmap bitmap = GlNitro2.ScreenShot(this.simpleOpenGlControl1);
     if (this.saveFileDialog3.ShowDialog() == DialogResult.OK && this.saveFileDialog3.FileName.Length > 0)
     {
         bitmap.Save(this.saveFileDialog3.FileName, ImageFormat.Png);
     }
     bitmap.Dispose();
 }
示例#10
0
        private void MPDSEditor_Load(object sender, EventArgs e)
        {
            byte[] numArray1 = Compression.LZ77Decompress(this.BoardData.Files[1].Data);
            byte[] numArray2 = Compression.LZ77Decompress(this.BoardData.Files[2].Data);
            byte[] numArray3 = Compression.LZ77Decompress(this.BoardData.Files[0].Data);
            byte[] array1    = ((IEnumerable <byte>)numArray1).ToList <byte>().GetRange(4, numArray1.Length - 4).ToArray();
            byte[] array2    = ((IEnumerable <byte>)numArray2).ToList <byte>().GetRange(4, numArray2.Length - 4).ToArray();
            byte[] array3    = ((IEnumerable <byte>)numArray3).ToList <byte>().GetRange(4, numArray3.Length - 4).ToArray();
            this.pictureBox1.Image = (Image)Graphic.ConvertData(array2, 0, 0, array1, array3, 256, 256, Graphic.GXTexFmt.GX_TEXFMT_PLTT16, Graphic.NNSG2dCharacterFmt.NNS_G2D_CHARACTER_FMT_CHAR);
            this.Layout            = new BoardLayout(Compression.LZ77Decompress(this.BoardData.Files[3].Data));
            int index1 = -1;
            int num    = 0;

            for (int index2 = 4; (long)index2 < (long)this.BoardData.NrFiles; ++index2)
            {
                int length = this.BoardData.Files[index2].Data.Length;
                if (length > num)
                {
                    num    = length;
                    index1 = index2;
                }
            }
            this.Model      = new HBDF(Compression.LZ77Decompress(this.BoardData.Files[index1].Data));
            this.Spaces     = new HBDF.TEXSBlock(Compression.LZ77Decompress(this.SystemData.Files[69].Data));
            this.Objects[0] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[32].Data));
            this.Objects[1] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[31].Data));
            this.Objects[2] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[33].Data));
            Gl.ReloadFunctions();
            Gl.glEnable(2896);
            Gl.glEnable(32826);
            Gl.glEnable(2903);
            Gl.glEnable(2929);
            Gl.glEnable(2977);
            Gl.glDisable(2884);
            Gl.glFrontFace(2305);
            Gl.glEnable(3553);
            Gl.glClearDepth(1.0);
            Gl.glEnable(3008);
            Gl.glEnable(3042);
            Gl.glBlendFunc(770, 771);
            Gl.glShadeModel(7425);
            Gl.glAlphaFunc(516, 0.0f);
            Gl.glClearColor(0.2f, 0.2f, 0.2f, 1f);
            GlNitro2.glNitroBindTextures(this.Model, 1);
            GlNitro2.glNitroBindTextures(this.Spaces, (int)this.Model.MDLFBlocks[0].NrTextures + 1);
            GlNitro2.glNitroBindTextures(this.Objects[0], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length);
            GlNitro2.glNitroBindTextures(this.Objects[1], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length + (int)this.Objects[0].MDLFBlocks[0].NrTextures);
            GlNitro2.glNitroBindTextures(this.Objects[2], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length + (int)this.Objects[0].MDLFBlocks[0].NrTextures + (int)this.Objects[1].MDLFBlocks[0].NrTextures);
            this.Render();
        }
示例#11
0
 public void menuItem7_Click(object sender, EventArgs e)
 {
     ((MenuItem)sender).Checked = true;
     this.SelBtpAnim            = ((MenuItem)sender).Index - 2;
     GlNitro2.glNitroBindTextures(this.file, 1);
     if (this.SelBtpAnim >= 0)
     {
         this.BtpNumFrames = (int)this.Btp.texPatAnmSet.texPatAnm[this.SelBtpAnim].numFrame;
     }
     this.SetZeroFrame();
     foreach (MenuItem menuItem in this.menuItem7.MenuItems)
     {
         if (menuItem != (MenuItem)sender)
         {
             menuItem.Checked = false;
         }
     }
     this.Render();
 }
示例#12
0
 private void NKM_Load(object sender, EventArgs e)
 {
     this.simpleOpenGlControl1.InitializeContexts();
     Gl.ReloadFunctions();
     Gl.glEnable(32826);
     Gl.glEnable(2903);
     Gl.glEnable(2929);
     Gl.glEnable(2977);
     Gl.glDisable(2884);
     Gl.glFrontFace(2305);
     Gl.glEnable(3553);
     Gl.glClearDepth(1.0);
     Gl.glEnable(3008);
     Gl.glAlphaFunc(516, 0.0f);
     Gl.glEnable(3042);
     Gl.glBlendFunc(770, 771);
     Gl.glShadeModel(7425);
     Gl.glClearColor(0.2f, 0.2f, 0.2f, 0.0f);
     GlNitro2.glNitroBindTextures(this.nsbmd, 1);
     this.Render(false, 0, 0);
 }
示例#13
0
 private void NSBTA_Load(object sender, EventArgs e)
 {
     for (int index1 = 0; index1 < (int)this.file.texSRTAnmSet.dict.numEntry; ++index1)
     {
         TreeNode treeNode = this.treeView1.Nodes.Add(this.file.texSRTAnmSet.dict[index1].Key);
         for (int index2 = 0; index2 < (int)this.file.texSRTAnmSet.texSRTAnm[index1].dict.numEntry; ++index2)
         {
             treeNode.Nodes.Add(this.file.texSRTAnmSet.texSRTAnm[index1].dict[index2].Key);
         }
     }
     Gl.glEnable(2903);
     Gl.glEnable(2929);
     Gl.glDepthFunc(519);
     Gl.glDisable(2884);
     Gl.glEnable(3553);
     Gl.glBlendFunc(770, 771);
     Gl.glEnable(3553);
     GlNitro2.glNitroTexImage2D(Resources.preview_background, 0, 10497);
     GlNitro2.glNitroTexImage2D(Resources.example, 1, 10497);
     this.Render((float[])null);
 }
示例#14
0
        public void Render(bool pick = false, int X1 = 0, int Y1 = 0)
        {
            float num1 = (float)this.simpleOpenGlControl1.Width / (float)this.simpleOpenGlControl1.Height;

            Gl.glMatrixMode(5889);
            Gl.glLoadIdentity();
            Gl.glViewport(0, 0, this.simpleOpenGlControl1.Width, this.simpleOpenGlControl1.Height);
            Glu.gluPerspective(30.0, (double)num1, 0.100000001490116, 32768.0);
            Gl.glMatrixMode(5888);
            Gl.glLoadIdentity();
            Gl.glBindTexture(3553, 0);
            Gl.glColor3f(1f, 1f, 1f);
            Gl.glClear(16640);
            Gl.glTranslatef(MKDSEditor.X, MKDSEditor.Y, -MKDSEditor.dist);
            Gl.glRotatef(MKDSEditor.elev, 1f, 0.0f, 0.0f);
            Gl.glRotatef(MKDSEditor.ang, 0.0f, 1f, 0.0f);
            Gl.glPushMatrix();
            Gl.glPushMatrix();
            if (this.Root1.GetFileByPath("\\course_model_V.nsbmd") != null)
            {
                if (this.first)
                {
                    GlNitro2.glNitroBindTextures(this.nsbmd2, 16711426);
                }
                Gl.glScalef(this.nsbmd2.modelSet.models[0].info.posScale / this.nsbmd.modelSet.models[0].info.posScale, this.nsbmd2.modelSet.models[0].info.posScale / this.nsbmd.modelSet.models[0].info.posScale, this.nsbmd2.modelSet.models[0].info.posScale / this.nsbmd.modelSet.models[0].info.posScale);
                Gl.glDisable(2884);
                this.nsbmd2.modelSet.models[0].ProcessSbc(MKDSEditor.X, MKDSEditor.Y, MKDSEditor.dist, MKDSEditor.elev, MKDSEditor.ang, this.picking, 16711426);
            }
            Gl.glPopMatrix();
            this.nsbmd.modelSet.models[0].ProcessSbc(MKDSEditor.X, MKDSEditor.Y, MKDSEditor.dist, MKDSEditor.elev, MKDSEditor.ang, false, 1);
            Gl.glPopMatrix();
            Gl.glPushMatrix();
            Gl.glScalef(0.062f * this.nsbmd.modelSet.models[0].info.invPosScale, 0.062f * this.nsbmd.modelSet.models[0].info.invPosScale, 0.062f * this.nsbmd.modelSet.models[0].info.invPosScale);
            Gl.glPushMatrix();
            this.texoffset = (int)this.nsbmd.modelSet.models[0].materials.dict.numEntry + 1;
            this.picking   = false;
            int num2 = -1;

            for (int index = 0; (long)index < (long)this.nkm.OBJI.NrEntries; ++index)
            {
                Gl.glBindTexture(3553, 0);
                Gl.glColor4f(1f, 1f, 1f, 1f);
                Gl.glPushMatrix();
                Gl.glTranslatef(this.nkm.OBJI[index].Position.X, this.nkm.OBJI[index].Position.Y + 16f, this.nkm.OBJI[index].Position.Z);
                Gl.glRotatef(this.nkm.OBJI[index].Rotation.X, 1f, 0.0f, 0.0f);
                Gl.glRotatef(this.nkm.OBJI[index].Rotation.Y, 0.0f, 1f, 0.0f);
                Gl.glRotatef(this.nkm.OBJI[index].Rotation.Z, 0.0f, 0.0f, 1f);
                Gl.glScalef(this.nkm.OBJI[index].Scale.X, this.nkm.OBJI[index].Scale.Y, this.nkm.OBJI[index].Scale.Z);
                if (this.selected == this.nkm.OBJI[index])
                {
                    num2 = index;
                }
                this.RenderObject(this.nkm.OBJI[index]);
                Gl.glPopMatrix();
            }
            Gl.glPopMatrix();
            if (num2 != -1)
            {
                int index = num2;
                Gl.glBindTexture(3553, 0);
                Gl.glColor4f(1f, 1f, 1f, 1f);
                Gl.glPushMatrix();
                Gl.glTranslatef(this.nkm.OBJI[index].Position.X, this.nkm.OBJI[index].Position.Y, this.nkm.OBJI[index].Position.Z);
                Gl.glRotatef(this.nkm.OBJI[index].Rotation.X, 1f, 0.0f, 0.0f);
                Gl.glRotatef(this.nkm.OBJI[index].Rotation.Y, 0.0f, 1f, 0.0f);
                Gl.glRotatef(this.nkm.OBJI[index].Rotation.Z, 0.0f, 0.0f, 1f);
                Gl.glScalef(this.nkm.OBJI[index].Scale.X, this.nkm.OBJI[index].Scale.Y, this.nkm.OBJI[index].Scale.Z);
                Gl.glColorMask(0, 0, 0, 0);
                Gl.glEnable(2960);
                Gl.glStencilMask(3);
                Gl.glStencilFunc(519, 1, 3);
                Gl.glStencilOp(7681, 7681, 7681);
                this.picking = true;
                Gl.glDisable(2884);
                this.RenderObject(this.nkm.OBJI[index]);
                this.picking = false;
                Gl.glColorMask(1, 1, 1, 1);
                Gl.glPolygonMode(1032, 6914);
                Gl.glEnable(32823);
                Gl.glStencilFunc(514, 1, 3);
                Gl.glStencilOp(7680, 7680, 7682);
                Gl.glPolygonOffset(-1f, -1f);
                Gl.glColor4f(1f, 1f, 0.5f, 0.1960784f);
                this.picking = true;
                Gl.glDisable(2884);
                this.RenderObject(this.nkm.OBJI[index]);
                Gl.glDisable(32823);
                Gl.glPolygonMode(1032, 6913);
                Gl.glLineWidth(2f);
                Gl.glStencilFunc(514, 0, 3);
                Gl.glStencilOp(7680, 7680, 7681);
                Gl.glDepthFunc(519);
                Gl.glColor4f(1f, 1f, 0.5f, 1f);
                Gl.glDisable(2884);
                this.RenderObject(this.nkm.OBJI[index]);
                this.picking = false;
                Gl.glPolygonMode(1032, 6914);
                Gl.glDepthFunc(515);
                Gl.glColor4f(1f, 1f, 1f, 1f);
                this.picking = false;
                Gl.glPopMatrix();
            }
            Gl.glPopMatrix();
            this.simpleOpenGlControl1.Refresh();
        }
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            Gl.glMatrixMode(5889);
            Gl.glLoadIdentity();
            Gl.glViewport(0, 0, this.simpleOpenGlControl1.Width, this.simpleOpenGlControl1.Height);
            float   num1 = float.MaxValue;
            float   num2 = float.MaxValue;
            float   num3 = float.MinValue;
            float   num4 = float.MinValue;
            Vector3 PositionA;
            Vector3 PositionB;
            Vector3 PositionC;

            for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx)
            {
                if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 8 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19)
                {
                    KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC);
                    if ((double)PositionA.X < (double)num1 && (double)PositionA.X > (double)short.MinValue)
                    {
                        num1 = PositionA.X;
                    }
                    if ((double)PositionA.X > (double)num3 && (double)PositionA.X < (double)short.MaxValue)
                    {
                        num3 = PositionA.X;
                    }
                    if ((double)PositionB.X < (double)num1 && (double)PositionB.X > (double)short.MinValue)
                    {
                        num1 = PositionB.X;
                    }
                    if ((double)PositionB.X > (double)num3 && (double)PositionB.X < (double)short.MaxValue)
                    {
                        num3 = PositionB.X;
                    }
                    if ((double)PositionC.X < (double)num1 && (double)PositionC.X > (double)short.MinValue)
                    {
                        num1 = PositionC.X;
                    }
                    if ((double)PositionC.X > (double)num3 && (double)PositionC.X < (double)short.MaxValue)
                    {
                        num3 = PositionC.X;
                    }
                    if ((double)PositionA.Z < (double)num2 && (double)PositionA.Z > (double)short.MinValue)
                    {
                        num2 = PositionA.Z;
                    }
                    if ((double)PositionA.Z > (double)num4 && (double)PositionA.Z < (double)short.MaxValue)
                    {
                        num4 = PositionA.Z;
                    }
                    if ((double)PositionB.Z < (double)num2 && (double)PositionB.Z > (double)short.MinValue)
                    {
                        num2 = PositionB.Z;
                    }
                    if ((double)PositionB.Z > (double)num4 && (double)PositionB.Z < (double)short.MaxValue)
                    {
                        num4 = PositionB.Z;
                    }
                    if ((double)PositionC.Z < (double)num2 && (double)PositionC.Z > (double)short.MinValue)
                    {
                        num2 = PositionC.Z;
                    }
                    if ((double)PositionC.Z > (double)num4 && (double)PositionC.Z < (double)short.MaxValue)
                    {
                        num4 = PositionC.Z;
                    }
                }
            }
            float num5   = (float)(int)num1;
            float num6   = (float)(int)num2;
            float num7   = (float)(int)num3;
            float num8   = (float)(int)num4;
            float val1_1 = num5 - 512f;
            float val2_1 = num6 - 512f;
            float val1_2 = num7 + 512f;
            float val2_2 = num8 + 512f;

            this.textBox1.Text = ((int)((double)Math.Min(val1_1, val2_1) * 1.33333337306976)).ToString();
            this.textBox3.Text = ((int)((double)Math.Max(val1_2, val2_2) * 1.33333337306976)).ToString();
            TextBox textBox2 = this.textBox2;
            float   num9     = Math.Min(val1_1, val2_1);
            string  str1     = num9.ToString();

            textBox2.Text = str1;
            TextBox textBox4 = this.textBox4;

            num9 = Math.Max(val1_2, val2_2);
            string str2 = num9.ToString();

            textBox4.Text = str2;
            Gl.glOrtho((double)Math.Min(val1_1, val2_1) * 1.33333337306976, (double)Math.Max(val1_2, val2_2) * 1.33333337306976, (double)Math.Max(val1_2, val2_2), (double)Math.Min(val1_1, val2_1), -8192.0, 8192.0);
            Gl.glMatrixMode(5888);
            Gl.glLoadIdentity();
            Gl.glClearColor(0.0f, 0.0627451f, 0.3764706f, 1f);
            Gl.glClear(16640);
            Gl.glColor4f(1f, 1f, 1f, 1f);
            Gl.glEnable(3553);
            Gl.glBindTexture(3553, 0);
            Gl.glColor4f(1f, 1f, 1f, 1f);
            Gl.glDisable(2884);
            Gl.glEnable(3008);
            Gl.glEnable(3042);
            Gl.glBlendFunc(770, 771);
            Gl.glAlphaFunc(519, 0.0f);
            Gl.glDepthFunc(515);
            Gl.glPolygonMode(1032, 6913);
            Gl.glLineWidth(2f);
            Gl.glColor4f(1f, 1f, 1f, 1f);
            for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx)
            {
                if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19)
                {
                    KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC);
                    Gl.glBegin(4);
                    Gl.glVertex3f(PositionA.X, PositionA.Z, PositionA.Y - 100f);
                    Gl.glVertex3f(PositionB.X, PositionB.Z, PositionB.Y - 100f);
                    Gl.glVertex3f(PositionC.X, PositionC.Z, PositionC.Y - 100f);
                    Gl.glEnd();
                }
            }
            Gl.glDisable(10754);
            Gl.glPolygonMode(1032, 6914);
            Gl.glColor3f(0.4705882f, 0.4705882f, 0.4705882f);
            for (int PlaneIdx = 0; PlaneIdx < this.k.Planes.Length; ++PlaneIdx)
            {
                if (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 0 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 1 || (((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 3 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 7) || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 18 || ((int)this.k.Planes[PlaneIdx].Type >> 8 & 31) == 19)
                {
                    KCL.GetTriangle(this.k, PlaneIdx, out PositionA, out PositionB, out PositionC);
                    Gl.glBegin(4);
                    Gl.glVertex3f(PositionA.X, PositionA.Z, PositionA.Y);
                    Gl.glVertex3f(PositionB.X, PositionB.Z, PositionB.Y);
                    Gl.glVertex3f(PositionC.X, PositionC.Z, PositionC.Y);
                    Gl.glEnd();
                }
            }
            this.img = (byte[])null;
            this.map = (byte[])null;
            System.Drawing.Bitmap b = GlNitro2.ScreenShot(this.simpleOpenGlControl1);
            b.MakeTransparent(Color.FromArgb(0, 16, 96));
            Graphic.ConvertBitmap(b, this.pal, out this.img, out this.map, Graphic.GXTexFmt.GX_TEXFMT_PLTT16, true);
            b.Dispose();
            this.simpleOpenGlControl1.Refresh();
        }
示例#16
0
 public void SetNSBTX(MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTX Btx)
 {
     this.file.TexPlttSet = Btx.TexPlttSet;
     GlNitro2.glNitroBindTextures(this.file, 1);
     this.Render();
 }