public AlphaBlendLegacy(PPDDevice device) { effect = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("AlphaBlend")); alphas = new SharpDX.Direct3D9.Texture[256]; paAlphas = new SharpDX.Direct3D9.Texture[256]; for (var i = 0; i < alphas.Length; i++) { alphas[i] = ((Texture.DX9.Texture)device.GetModule <ColorTextureAllcator>().CreateTexture(new Color4(1, 1, 1, i / 255f)))._Texture; paAlphas[i] = ((Texture.DX9.Texture)device.GetModule <ColorTextureAllcator>().CreateTexture(new Color4(i / 255f)))._Texture; } }
/// <summary> /// コンストラクタ。 /// </summary> /// <param name="device"></param> public GaussianFilter(PPDDevice device) { effect = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("GaussianFilter")); widthHeightHandle = effect.GetParameter("WidthHeight"); projectionHandle = effect.GetParameter("Projection"); weightsHandle = effect.GetParameter("Weights"); textureHandle = effect.GetParameter("Texture"); effect.Technique = "Gaussian"; effect.SetValue(projectionHandle, device.Projection); effect.SetValue(widthHeightHandle, new Vector2(device.Width, device.Height)); }
/// <summary> /// コンストラクタです。 /// </summary> /// <param name="device"></param> public GlassFilter(PPDDevice device) { effect = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("Glass")); widthHeightHandle = effect.GetParameter("WidthHeight"); filterTextureHandle = effect.GetParameter("FilterTexture"); lastRenderTargetFilterTextureHandle = effect.GetParameter("LastRenderTargetTexture"); projectionHandle = effect.GetParameter("Projection"); effect.Technique = "Glass"; effect.SetValue(projectionHandle, device.Projection); effect.SetValue(widthHeightHandle, new Vector2(device.Width, device.Height)); }
public AlphaBlendShading(PPDDevice device) { this.device = device; effect = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("AlphaBlend")); textureHandle = effect.GetParameter("Texture"); lastRenderTargetTextureHandle = effect.GetParameter("LastRenderTargetTexture"); maskTextureHandle = effect.GetParameter("MaskTexture"); drawInfoHandle = effect.GetParameter("DrawInfo"); widthHeightHandle = effect.GetParameter("WidthHeight"); projectionHandle = effect.GetParameter("Projection"); filterInfoHandle = effect.GetParameter("FilterInfo"); effect.SetValue(widthHeightHandle, new Vector2(device.Width, device.Height)); effect.SetValue(projectionHandle, device.Projection); techniqueNames = new Dictionary <Tuple <BlendMode, bool, bool, ColorFilterType>, string>(); foreach (var blendMode in (BlendMode[])Enum.GetValues(typeof(BlendMode))) { foreach (var isPA in new bool[] { true, false }) { foreach (var isMasking in new bool[] { true, false }) { foreach (var filterType in (ColorFilterType[])Enum.GetValues(typeof(ColorFilterType))) { techniqueNames[new Tuple <BlendMode, bool, bool, ColorFilterType>(blendMode, isPA, isMasking, filterType)] = String.Format("{0}Blend{1}{2}{3}Filter", blendMode, isPA ? "PAEnabled" : "PADisabled", isMasking ? "MaskEnabled" : "MaskDisabled", filterType); } } } } maskTechniqueNames = new Dictionary <Tuple <MaskType, bool>, string>(); foreach (var maskType in (MaskType[])Enum.GetValues(typeof(MaskType))) { foreach (var isMasking in new bool[] { true, false }) { maskTechniqueNames[new Tuple <MaskType, bool>(maskType, isMasking)] = String.Format("{0}Mask{1}", maskType, isMasking ? "MaskEnabled" : "MaskDisabled"); } } }
public SpriteBatch(PPDDevice device) { this.device = device; effect = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("BasicEffect")); textureHandle = effect.GetParameter("Texture"); overlayColorHandle = effect.GetParameter("OverlayColor"); projectionHandle = effect.GetParameter("Projection"); effect.SetValue(projectionHandle, device.Projection); vertices = Vertex.VertexBufferFactoryManager.Factory.Create(device, _vertices.Length * ColoredTexturedVertex.Size); indices = Vertex.IndexBufferFactoryManager.Factory.Create(device, _indices.Length * sizeof(int)); spriteInfos = new List <SpriteInfo>(); scissorRectStates = new List <ScissorRectState>(); techniques = new Dictionary <bool, string> { { false, "BasicEffectPADisabled" }, { true, "BasicEffectPAEnabled" } }; }
/// <summary> /// コンストラクタです。 /// </summary> /// <param name="device"></param> public BorderFilter(PPDDevice device) { effect = EffectFactoryManager.Factory.FromMemory(device, device.GetShaderBytecode("Border")); widthHeightHandle = effect.GetParameter("WidthHeight"); filterTextureHandle = effect.GetParameter("FilterTexture"); lastRenderTargetTextureHandle = effect.GetParameter("LastRenderTargetTexture"); projectionHandle = effect.GetParameter("Projection"); colorHandle = effect.GetParameter("Color"); thicknessHandle = effect.GetParameter("Thickness"); thickness2Handle = effect.GetParameter("Thickness2"); actualThicknessHandle = effect.GetParameter("ActualThickness"); effect.SetValue(projectionHandle, device.Projection); effect.SetValue(widthHeightHandle, new Vector2(device.Width, device.Height)); }