private static Color[] ConvertXBGR1555(byte[] Data) { Color[] data = new Color[Data.Length / 2]; for (int i = 0; i < Data.Length; i += 2) { data[i / 2] = Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(IOUtil.ReadU16LE(Data, i))); } return(data); }
public void MaterialColor1(uint cmd) { ushort spec = (ushort)(cmd & 0x7FFF); bool shine = (cmd & 0x8000) != 0; ushort emiss = (ushort)((cmd >> 16) & 0x7FFF); UsesSpecularReflectionTable = shine; SpecularColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(spec)); EmissionColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(emiss)); }
public void MaterialColor0(uint cmd) { ushort diff = (ushort)(cmd & 0x7FFF); bool vtx = (cmd & 0x8000) != 0; ushort amb = (ushort)((cmd >> 16) & 0x7FFF); DiffuseColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(diff)); AmbientColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(amb)); if (vtx) { Color(DiffuseColor); } }
private void MDL0MaterialEditor_Load(object sender, EventArgs e) { checkBox3.Checked = (Material.polyAttr & 1) != 0; checkBox4.Checked = (Material.polyAttr & 2) != 0; checkBox5.Checked = (Material.polyAttr & 4) != 0; checkBox6.Checked = (Material.polyAttr & 8) != 0; comboBox1.SelectedIndex = (int)((Material.polyAttr >> 4) & 0x3); comboBox2.SelectedIndex = (int)((Material.polyAttr >> 6) & 0x3); checkBox7.Checked = ((Material.polyAttr >> 11) & 0x1) == 1; checkBox8.Checked = ((Material.polyAttr >> 12) & 0x1) == 1; checkBox9.Checked = ((Material.polyAttr >> 13) & 0x1) == 1; comboBox3.SelectedIndex = (int)((Material.polyAttr >> 14) & 0x1); checkBox10.Checked = ((Material.polyAttr >> 15) & 0x1) == 1; trackBar1.Value = (int)((Material.polyAttr >> 16) & 31); trackBar2.Value = (int)((Material.polyAttr >> 24) & 63); checkBox1.Checked = (Material.diffAmb & 0x8000) != 0; button1.BackColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb((ushort)(Material.diffAmb & 0x7FFF))); button2.BackColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb((ushort)((Material.diffAmb >> 16) & 0x7FFF))); checkBox2.Checked = (Material.specEmi & 0x8000) != 0; button3.BackColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb((ushort)(Material.specEmi & 0x7FFF))); button4.BackColor = System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb((ushort)((Material.specEmi >> 16) & 0x7FFF))); uint wrapS = (Material.texImageParam >> 16) & 1; if (wrapS != 0) { wrapS += (Material.texImageParam >> 18) & 1; } comboBox4.SelectedIndex = (int)wrapS; uint wrapT = (Material.texImageParam >> 17) & 1; if (wrapT != 0) { wrapT += (Material.texImageParam >> 19) & 1; } comboBox5.SelectedIndex = (int)wrapT; }
public STAG(EndianBinaryReader er) { Signature = er.ReadString(Encoding.ASCII, 4); if (Signature != "STAG") { throw new SignatureNotCorrectException(Signature, "STAG", er.BaseStream.Position - 4); } Unknown1 = er.ReadUInt16(); NrLaps = er.ReadInt16(); Unknown2 = er.ReadByte(); FogEnabled = er.ReadByte() == 1; FogTableGenMode = er.ReadByte(); FogSlope = er.ReadByte(); UnknownData1 = er.ReadBytes(0x8); FogDensity = er.ReadFx32(); FogColor = Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(er.ReadUInt16())); FogAlpha = er.ReadUInt16(); KclColor1 = Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(er.ReadUInt16())); KclColor2 = Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(er.ReadUInt16())); KclColor3 = Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(er.ReadUInt16())); KclColor4 = Color.FromArgb((int)GFXUtil.XBGR1555ToArgb(er.ReadUInt16())); UnknownData2 = er.ReadBytes(0x8); }
public void Color(uint color) { Color(System.Drawing.Color.FromArgb((int)GFXUtil.XBGR1555ToArgb((ushort)color))); }