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(); }
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(); }
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(); }
public void SetHBDF(HBDF Hbdf) { this.file = Hbdf; this.timer1.Stop(); this.menuItem2.MenuItems.Clear(); GlNitro2.glNitroBindTextures(this.file, 1); this.Render(); }
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(); }
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(); }
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(); }
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); }
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(); }
public void SetNSBTX(MKDS_Course_Modifier.G3D_Binary_File_Format.NSBTX Btx) { this.file.TexPlttSet = Btx.TexPlttSet; GlNitro2.glNitroBindTextures(this.file, 1); this.Render(); }