public string getTexUnitsOfTexId(uint texId) { KPTexture tex = getTextureById(texId); if (tex == null) { return(""); } string result = null; uint[] listTu = tex.TexType == KPTextureType.TEX_2D ? m_listTexUnits_2D : m_listTexUnits_CubeMap; for (int i = 0; i < listTu.Length; i++) { if (listTu[i] == texId) { if (result == null) { result = i.ToString(); } else { result += ", " + i.ToString(); } } } return(result); }
public void applyTex(KPTexture tex) { if (tex == null) { m_tex.clearData(); this.Visible = false; return; } m_tex.copyFrom(tex); this.Parent.Text = getTitle(); listBoxMipmaps.Items.Clear(); KPMipmapLevel[] mips = m_tex.Mipmaps; m_mipCount = 0; m_maxWidth = -1; m_maxHeight = -1; int firstLevel = -1; for (int i = 0; i < mips.Length; i++) { KPMipmapLevel mip = mips[i]; if (mip.HasData) { if (m_maxWidth == -1 || mip.Width > m_maxWidth) { m_maxWidth = mip.Width; } if (m_maxHeight == -1 || mip.Height > m_maxHeight) { m_maxHeight = mip.Height; } if (firstLevel == -1) { firstLevel = m_mipCount; } listBoxMipmaps.Items.Add("Level " + i); m_mipLevels[m_mipCount++] = i; } } if (m_maxWidth == -1 || m_maxHeight == -1) { this.Visible = false; return; } for (int i = 0; i < KPTexture.MAX_MIPMAP_LEVEL_NUMBER; i++) { m_bitmaps[i] = null; } listBoxMipmaps.SelectedIndex = firstLevel; }
public UCTexture() { InitializeComponent(); this.Dock = DockStyle.Fill; m_tex = new KPTexture(); m_mipLevels = new int[KPTexture.MAX_MIPMAP_LEVEL_NUMBER]; m_mipCount = 0; m_bitmaps = new Bitmap[KPTexture.MAX_MIPMAP_LEVEL_NUMBER]; }
public void copyFrom(KPTexture tex) { clearData(); m_id = tex.Id; m_texType = tex.TexType; KPMipmapLevel[] mips = tex.Mipmaps; for (int i = 0; i < MAX_MIPMAP_LEVEL_NUMBER; i++) { m_pMipmaps[i].copyFrom(mips[i]); } }
private void listViewTextures_ItemActivate(object sender, EventArgs e) { string texId = listViewTextures.FocusedItem.Text; //Utils.gc(); KPClient client = KPClient.getInstance(); FormObjectDetail form = new FormObjectDetail(); UCTexture ucTexture = new UCTexture(); form.Controls.Add(ucTexture); KPTexture tex = client.CurrentStateMachine.getTextureById(uint.Parse(texId)); form.Text = "Texture :: id = " + (tex == null ? "ZERO" : tex.Id.ToString()); ucTexture.applyTex(tex); form.Show(this); }