// Used for Injection Selection box /// <summary> /// The convert to bump map tool strip menu item_ click. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> /// <remarks></remarks> private void convertToBumpMapToolStripMenuItem_Click(object sender, EventArgs e) { if (saveBitmapDialog1.ShowDialog() == DialogResult.Cancel) { return; } Panel p = new Panel(); Renderer r = new Renderer(); r.CreateDevice(p); map.OpenMap(MapTypes.Internal); ParsedBitmap pm = new ParsedBitmap(ref map.SelectedMeta, map); Bitmap b = pm.FindChunkAndDecode(0, 0, 0, ref map.SelectedMeta, map, 0, 0); ShaderInfo s = new ShaderInfo(); s.BumpMapBitmap = b; map.CloseMap(); s.MakeTextures(ref r.device); TextureLoader.Save(saveBitmapDialog1.FileName, ImageFileFormat.Dds, s.NormalMap); }
/// <summary> /// Initializes a new instance of the <see cref="ShaderContainer"/> class. /// </summary> /// <param name="meta">The meta.</param> /// <remarks></remarks> public ShaderContainer(ref Meta meta) { BinaryReader BR = new BinaryReader(meta.MS); BR.BaseStream.Position = 96; int tempc = BR.ReadInt32(); int tempr = BR.ReadInt32() - meta.magic - meta.offset; Shader = new ShaderInfo[tempc]; count = tempc; for (int x = 0; x < tempc; x++) { BR.BaseStream.Position = tempr + (x * 32) + 12; int tempint = meta.Map.Functions.ForMeta.FindMetaByID(BR.ReadInt32()); Shader[x] = new ShaderInfo(tempint, meta.Map); } }
/// <summary> /// The set alpha blending. /// </summary> /// <param name="alphatype">The alphatype.</param> /// <param name="device">The device.</param> /// <remarks></remarks> public static void SetAlphaBlending(ShaderInfo.AlphaType alphatype, ref Device device) { if (alphatype == ShaderInfo.AlphaType.AlphaBlend) { device.RenderState.AlphaBlendEnable = true; device.RenderState.AlphaTestEnable = false; } else if (alphatype == ShaderInfo.AlphaType.AlphaTest) { device.RenderState.AlphaBlendEnable = false; device.RenderState.AlphaTestEnable = true; } else { device.RenderState.AlphaBlendEnable = false; device.RenderState.AlphaTestEnable = false; } }