internal EffectPassCollection(Effect effect, EffectPassCollection cloneSource) { foreach (var pass in cloneSource) { Add(new EffectPass(effect, pass)); } }
private static EffectPassCollection ReadPasses(BinaryReader reader, Effect effect, List <Shader> shaders) { Shader vertexShader = (Shader)null; Shader pixelShader = (Shader)null; EffectPassCollection effectPassCollection = new EffectPassCollection(); int num = (int)reader.ReadByte(); for (int index1 = 0; index1 < num; ++index1) { string name = reader.ReadString(); EffectAnnotationCollection annotations = Effect.ReadAnnotations(reader); int index2 = (int)reader.ReadByte(); if (index2 != (int)byte.MaxValue) { vertexShader = shaders[index2]; } int index3 = (int)reader.ReadByte(); if (index3 != (int)byte.MaxValue) { pixelShader = shaders[index3]; } EffectPass pass = new EffectPass(effect, name, vertexShader, pixelShader, (BlendState)null, (DepthStencilState)null, (RasterizerState)null, annotations); effectPassCollection.Add(pass); } return(effectPassCollection); }
internal EffectPassCollection(Effect effect, EffectPassCollection cloneSource) { foreach (EffectPass cloneSource1 in cloneSource) { this.Add(new EffectPass(effect, cloneSource1)); } }
/// <summary> /// Creates a new instance of <see cref="XNAEffectPassCollection"/>. /// </summary> /// <param name="coll">The underlying XNA effect pass collection.</param> internal XNAEffectPassCollection(XFG.EffectPassCollection coll) { _passes = new List <XNAEffectPass>(coll.Count); for (int i = 0; i < coll.Count; i++) { _passes.Add(new XNAEffectPass(coll[i])); } }
internal EffectTechnique(Effect effect, EffectTechnique cloneSource) { // Share all the immutable types. Name = cloneSource.Name; Annotations = cloneSource.Annotations; // Clone the mutable types. Passes = new EffectPassCollection(effect, cloneSource.Passes); }
internal EffectTechnique( string name, IntPtr pointer, EffectPassCollection passes, EffectAnnotationCollection annotations ) { Name = name; Passes = passes; Annotations = annotations; TechniquePointer = pointer; }
private void ReadEffect(BinaryReader reader) { if (new string(reader.ReadChars("MGFX".Length)) != "MGFX") { throw new Exception("The MGFX file is corrupt!"); } this.version = (int)reader.ReadByte(); if (this.version < 4) { throw new Exception("Unsupported MGFX file version!"); } if ((int)reader.ReadByte() != 0) { throw new Exception("The MGFX effect is the wrong profile for this platform!"); } int length = (int)reader.ReadByte(); this.ConstantBuffers = new ConstantBuffer[length]; for (int index1 = 0; index1 < length; ++index1) { string name = reader.ReadString(); int sizeInBytes = (int)reader.ReadInt16(); int[] parameterIndexes = new int[(int)reader.ReadByte()]; int[] parameterOffsets = new int[parameterIndexes.Length]; for (int index2 = 0; index2 < parameterIndexes.Length; ++index2) { parameterIndexes[index2] = (int)reader.ReadByte(); parameterOffsets[index2] = (int)reader.ReadUInt16(); } ConstantBuffer constantBuffer = new ConstantBuffer(this.GraphicsDevice, sizeInBytes, parameterIndexes, parameterOffsets, name); this.ConstantBuffers[index1] = constantBuffer; } this._shaderList = new List <Shader>(); int num1 = (int)reader.ReadByte(); for (int index = 0; index < num1; ++index) { this._shaderList.Add(new Shader(this.GraphicsDevice, reader)); } this.Parameters = this.ReadParameters(reader); this.Techniques = new EffectTechniqueCollection(); int num2 = (int)reader.ReadByte(); for (int index = 0; index < num2; ++index) { string name = reader.ReadString(); EffectAnnotationCollection annotations = Effect.ReadAnnotations(reader); EffectPassCollection passes = Effect.ReadPasses(reader, this, this._shaderList); this.Techniques.Add(new EffectTechnique(this, name, passes, annotations)); } this.CurrentTechnique = this.Techniques[0]; }
internal void ReadEffect(BinaryReader reader) { var effectPass = new EffectPass(this, "Pass", null, null, null, DepthStencilState.Default, RasterizerState.CullNone, EffectAnnotationCollection.Empty); effectPass._shaderProgram = new ShaderProgram(reader.ReadBytes((int)reader.BaseStream.Length)); var shaderProgram = effectPass._shaderProgram; EffectParameter[] parametersArray = new EffectParameter[shaderProgram.UniformCount + 4]; for (int i = 0; i < shaderProgram.UniformCount; i++) { parametersArray[i] = EffectParameterForUniform(shaderProgram, i); } #warning Hacks for BasicEffect as we don't have these parameters yet parametersArray[shaderProgram.UniformCount] = new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "SpecularColor", 3, 1, "float3", EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, new float[3]); parametersArray[shaderProgram.UniformCount + 1] = new EffectParameter( EffectParameterClass.Scalar, EffectParameterType.Single, "SpecularPower", 1, 1, "float", EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, 0.0f); parametersArray[shaderProgram.UniformCount + 2] = new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "FogVector", 4, 1, "float4", EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, new float[4]); parametersArray[shaderProgram.UniformCount + 3] = new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "DiffuseColor", 4, 1, "float4", EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, new float[4]); Parameters = new EffectParameterCollection(parametersArray); EffectPass [] effectsPassArray = new EffectPass[1]; effectsPassArray[0] = effectPass; var effectPassCollection = new EffectPassCollection(effectsPassArray); EffectTechnique [] effectTechniqueArray = new EffectTechnique[1]; effectTechniqueArray[0] = new EffectTechnique(this, "Name", effectPassCollection, EffectAnnotationCollection.Empty); Techniques = new EffectTechniqueCollection(effectTechniqueArray); ConstantBuffers = new ConstantBuffer[0]; CurrentTechnique = Techniques[0]; }
private static EffectPassCollection ReadPasses(BinaryReader reader, Effect effect, List <Shader> shaders) { Shader vertexShader = null; Shader pixelShader = null; var collection = new EffectPassCollection(); var count = (int)reader.ReadByte(); for (var i = 0; i < count; i++) { var name = reader.ReadString(); var annotations = ReadAnnotations(reader); // Assign these to the default shaders at this point? or do that in the effect pass. // Get the vertex shader. var shaderIndex = (int)reader.ReadByte(); if (shaderIndex != 255) { vertexShader = shaders[shaderIndex]; } // Get the pixel shader. shaderIndex = (int)reader.ReadByte(); if (shaderIndex != 255) { pixelShader = shaders[shaderIndex]; } // TODO: Add the state objects to the format! var pass = new EffectPass(effect, name, vertexShader, pixelShader, null, null, null, annotations); collection.Add(pass); // need to fix up the } return(collection); }
internal void ReadEffect(BinaryReader reader) { var effectPass = new EffectPass(this, "Pass", null, null, BlendState.AlphaBlend, DepthStencilState.Default, RasterizerState.CullNone, new EffectAnnotationCollection()); effectPass._shaderProgram = new ShaderProgram(reader.ReadBytes((int)reader.BaseStream.Length)); var shaderProgram = effectPass._shaderProgram; Parameters = new EffectParameterCollection(); for (int i = 0; i < shaderProgram.UniformCount; i++) { Parameters.Add(EffectParameterForUniform(shaderProgram, i)); } #warning Hacks for BasicEffect as we don't have these parameters yet Parameters.Add(new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "SpecularColor", 3, 1, "float3", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), new float[3])); Parameters.Add(new EffectParameter( EffectParameterClass.Scalar, EffectParameterType.Single, "SpecularPower", 1, 1, "float", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), 0.0f)); Parameters.Add(new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "FogVector", 4, 1, "float4", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), new float[4])); Parameters.Add(new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "DiffuseColor", 4, 1, "float4", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), new float[4])); Techniques = new EffectTechniqueCollection(); var effectPassCollection = new EffectPassCollection(); effectPassCollection.Add(effectPass); Techniques.Add(new EffectTechnique(this, "Name", effectPassCollection, new EffectAnnotationCollection())); ConstantBuffers = new ConstantBuffer[0]; CurrentTechnique = Techniques[0]; }
private static EffectPassCollection ReadPasses(BinaryReader reader, Effect effect, List<Shader> shaders) { Shader vertexShader = null; Shader pixelShader = null; var collection = new EffectPassCollection(); var count = (int)reader.ReadByte(); for (var i = 0; i < count; i++) { var name = reader.ReadString(); var annotations = ReadAnnotations(reader); // Assign these to the default shaders at this point? or do that in the effect pass. // Get the vertex shader. var shaderIndex = (int)reader.ReadByte(); if (shaderIndex != 255) { vertexShader = shaders[shaderIndex]; } // Get the pixel shader. shaderIndex = (int)reader.ReadByte(); if (shaderIndex != 255) { pixelShader = shaders[shaderIndex]; } BlendState blend = null; DepthStencilState depth = null; RasterizerState raster = null; if (reader.ReadBoolean()) { blend = new BlendState { AlphaBlendFunction = (BlendFunction)reader.ReadByte(), AlphaDestinationBlend = (Blend)reader.ReadByte(), AlphaSourceBlend = (Blend)reader.ReadByte(), BlendFactor = new Color(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()), ColorBlendFunction = (BlendFunction)reader.ReadByte(), ColorDestinationBlend = (Blend)reader.ReadByte(), ColorSourceBlend = (Blend)reader.ReadByte(), ColorWriteChannels = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels1 = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels2 = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels3 = (ColorWriteChannels)reader.ReadByte(), MultiSampleMask = reader.ReadInt32(), }; } if (reader.ReadBoolean()) { depth = new DepthStencilState { CounterClockwiseStencilDepthBufferFail = (StencilOperation)reader.ReadByte(), CounterClockwiseStencilFail = (StencilOperation)reader.ReadByte(), CounterClockwiseStencilFunction = (CompareFunction)reader.ReadByte(), CounterClockwiseStencilPass = (StencilOperation)reader.ReadByte(), DepthBufferEnable = reader.ReadBoolean(), DepthBufferFunction = (CompareFunction)reader.ReadByte(), DepthBufferWriteEnable = reader.ReadBoolean(), ReferenceStencil = reader.ReadInt32(), StencilDepthBufferFail = (StencilOperation)reader.ReadByte(), StencilEnable = reader.ReadBoolean(), StencilFail = (StencilOperation)reader.ReadByte(), StencilFunction = (CompareFunction)reader.ReadByte(), StencilMask = reader.ReadInt32(), StencilPass = (StencilOperation)reader.ReadByte(), StencilWriteMask = reader.ReadInt32(), TwoSidedStencilMode = reader.ReadBoolean(), }; } if (reader.ReadBoolean()) { raster = new RasterizerState { CullMode = (CullMode)reader.ReadByte(), DepthBias = reader.ReadSingle(), FillMode = (FillMode)reader.ReadByte(), MultiSampleAntiAlias = reader.ReadBoolean(), ScissorTestEnable = reader.ReadBoolean(), SlopeScaleDepthBias = reader.ReadSingle(), }; } var pass = new EffectPass(effect, name, vertexShader, pixelShader, blend, depth, raster, annotations); collection.Add(pass); } return collection; }
private static EffectPassCollection ReadPasses(BinaryReader reader, Effect effect, List <Shader> shaders) { Shader vertexShader = (Shader)null; Shader pixelShader = (Shader)null; EffectPassCollection effectPassCollection = new EffectPassCollection(); int num = (int)reader.ReadByte(); for (int index1 = 0; index1 < num; ++index1) { string name = reader.ReadString(); EffectAnnotationCollection annotations = Effect.ReadAnnotations(reader); int index2 = (int)reader.ReadByte(); if (index2 != (int)byte.MaxValue) { vertexShader = shaders[index2]; } int index3 = (int)reader.ReadByte(); if (index3 != (int)byte.MaxValue) { pixelShader = shaders[index3]; } BlendState blendState = (BlendState)null; DepthStencilState depthStencilState = (DepthStencilState)null; RasterizerState rasterizerState = (RasterizerState)null; if (reader.ReadBoolean()) { blendState = new BlendState() { AlphaBlendFunction = (BlendFunction)reader.ReadByte(), AlphaDestinationBlend = (Blend)reader.ReadByte(), AlphaSourceBlend = (Blend)reader.ReadByte(), BlendFactor = new Color((int)reader.ReadByte(), (int)reader.ReadByte(), (int)reader.ReadByte(), (int)reader.ReadByte()), ColorBlendFunction = (BlendFunction)reader.ReadByte(), ColorDestinationBlend = (Blend)reader.ReadByte(), ColorSourceBlend = (Blend)reader.ReadByte(), ColorWriteChannels = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels1 = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels2 = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels3 = (ColorWriteChannels)reader.ReadByte(), MultiSampleMask = reader.ReadInt32() } } ; if (reader.ReadBoolean()) { depthStencilState = new DepthStencilState() { CounterClockwiseStencilDepthBufferFail = (StencilOperation)reader.ReadByte(), CounterClockwiseStencilFail = (StencilOperation)reader.ReadByte(), CounterClockwiseStencilFunction = (CompareFunction)reader.ReadByte(), CounterClockwiseStencilPass = (StencilOperation)reader.ReadByte(), DepthBufferEnable = reader.ReadBoolean(), DepthBufferFunction = (CompareFunction)reader.ReadByte(), DepthBufferWriteEnable = reader.ReadBoolean(), ReferenceStencil = reader.ReadInt32(), StencilDepthBufferFail = (StencilOperation)reader.ReadByte(), StencilEnable = reader.ReadBoolean(), StencilFail = (StencilOperation)reader.ReadByte(), StencilFunction = (CompareFunction)reader.ReadByte(), StencilMask = reader.ReadInt32(), StencilPass = (StencilOperation)reader.ReadByte(), StencilWriteMask = reader.ReadInt32(), TwoSidedStencilMode = reader.ReadBoolean() } } ; if (reader.ReadBoolean()) { rasterizerState = new RasterizerState() { CullMode = (CullMode)reader.ReadByte(), DepthBias = reader.ReadSingle(), FillMode = (FillMode)reader.ReadByte(), MultiSampleAntiAlias = reader.ReadBoolean(), ScissorTestEnable = reader.ReadBoolean(), SlopeScaleDepthBias = reader.ReadSingle() } } ; EffectPass pass = new EffectPass(effect, name, vertexShader, pixelShader, blendState, depthStencilState, rasterizerState, annotations); effectPassCollection.Add(pass); } return(effectPassCollection); }
public EffectTechnique(string name, IntPtr pointer, EffectPassCollection passes, EffectAnnotationCollection annotations) { }
private static EffectPassCollection ReadPasses(BinaryReader reader, Effect effect, List <Shader> shaders) { Shader vertexShader = null; Shader pixelShader = null; var collection = new EffectPassCollection(); var count = (int)reader.ReadByte(); for (var i = 0; i < count; i++) { var name = reader.ReadString(); var annotations = ReadAnnotations(reader); // Assign these to the default shaders at this point? or do that in the effect pass. // Get the vertex shader. var shaderIndex = (int)reader.ReadByte(); if (shaderIndex != 255) { vertexShader = shaders[shaderIndex]; } // Get the pixel shader. shaderIndex = (int)reader.ReadByte(); if (shaderIndex != 255) { pixelShader = shaders[shaderIndex]; } BlendState blend = null; DepthStencilState depth = null; RasterizerState raster = null; if (reader.ReadBoolean()) { blend = new BlendState { AlphaBlendFunction = (BlendFunction)reader.ReadByte(), AlphaDestinationBlend = (Blend)reader.ReadByte(), AlphaSourceBlend = (Blend)reader.ReadByte(), BlendFactor = new Color(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()), ColorBlendFunction = (BlendFunction)reader.ReadByte(), ColorDestinationBlend = (Blend)reader.ReadByte(), ColorSourceBlend = (Blend)reader.ReadByte(), ColorWriteChannels = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels1 = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels2 = (ColorWriteChannels)reader.ReadByte(), ColorWriteChannels3 = (ColorWriteChannels)reader.ReadByte(), MultiSampleMask = reader.ReadInt32(), }; } if (reader.ReadBoolean()) { depth = new DepthStencilState { CounterClockwiseStencilDepthBufferFail = (StencilOperation)reader.ReadByte(), CounterClockwiseStencilFail = (StencilOperation)reader.ReadByte(), CounterClockwiseStencilFunction = (CompareFunction)reader.ReadByte(), CounterClockwiseStencilPass = (StencilOperation)reader.ReadByte(), DepthBufferEnable = reader.ReadBoolean(), DepthBufferFunction = (CompareFunction)reader.ReadByte(), DepthBufferWriteEnable = reader.ReadBoolean(), ReferenceStencil = reader.ReadInt32(), StencilDepthBufferFail = (StencilOperation)reader.ReadByte(), StencilEnable = reader.ReadBoolean(), StencilFail = (StencilOperation)reader.ReadByte(), StencilFunction = (CompareFunction)reader.ReadByte(), StencilMask = reader.ReadInt32(), StencilPass = (StencilOperation)reader.ReadByte(), StencilWriteMask = reader.ReadInt32(), TwoSidedStencilMode = reader.ReadBoolean(), }; } if (reader.ReadBoolean()) { raster = new RasterizerState { CullMode = (CullMode)reader.ReadByte(), DepthBias = reader.ReadSingle(), FillMode = (FillMode)reader.ReadByte(), MultiSampleAntiAlias = reader.ReadBoolean(), ScissorTestEnable = reader.ReadBoolean(), SlopeScaleDepthBias = reader.ReadSingle(), }; } var pass = new EffectPass(effect, name, vertexShader, pixelShader, blend, depth, raster, annotations); collection.Add(pass); } return(collection); }
internal EffectTechnique(Effect effect, string name, EffectPassCollection passes, EffectAnnotationCollection annotations) { Name = name; Passes = passes; Annotations = annotations; }
public EffectTechnique(Effect effect) { Passes = new EffectPassCollection(this); _effect = effect; }
internal void ReadEffect(BinaryReader reader) { var effectPass = new EffectPass(this, "Pass", null, null, BlendState.AlphaBlend, DepthStencilState.Default, RasterizerState.CullNone, new EffectAnnotationCollection()); effectPass._shaderProgram = new ShaderProgram(reader.ReadBytes((int)reader.BaseStream.Length)); var shaderProgram = effectPass._shaderProgram; Parameters = new EffectParameterCollection(); for (int i = 0; i < shaderProgram.UniformCount; i++) { Parameters.Add(EffectParameterForUniform(shaderProgram, i)); } #warning Hacks for BasicEffect as we don't have these parameters yet Parameters.Add (new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "SpecularColor", 3, 1, "float3", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), new float[3])); Parameters.Add (new EffectParameter( EffectParameterClass.Scalar, EffectParameterType.Single, "SpecularPower", 1, 1, "float", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), 0.0f)); Parameters.Add (new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "FogVector", 4, 1, "float4", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), new float[4])); Parameters.Add (new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "DiffuseColor", 4, 1, "float4", new EffectAnnotationCollection(), new EffectParameterCollection(), new EffectParameterCollection(), new float[4])); Techniques = new EffectTechniqueCollection(); var effectPassCollection = new EffectPassCollection(); effectPassCollection.Add(effectPass); Techniques.Add(new EffectTechnique(this, "Name", effectPassCollection, new EffectAnnotationCollection())); ConstantBuffers = new ConstantBuffer[0]; CurrentTechnique = Techniques[0]; }
internal void ReadEffect(BinaryReader reader) { var effectPass = new EffectPass(this, "Pass", null, null, null, DepthStencilState.Default, RasterizerState.CullNone, EffectAnnotationCollection.Empty); effectPass._shaderProgram = new ShaderProgram(reader.ReadBytes((int)reader.BaseStream.Length)); var shaderProgram = effectPass._shaderProgram; EffectParameter[] parametersArray = new EffectParameter[shaderProgram.UniformCount+4]; for (int i = 0; i < shaderProgram.UniformCount; i++) { parametersArray[i]= EffectParameterForUniform(shaderProgram, i); } #warning Hacks for BasicEffect as we don't have these parameters yet parametersArray[shaderProgram.UniformCount] = new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "SpecularColor", 3, 1, "float3",EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, new float[3]); parametersArray[shaderProgram.UniformCount+1] = new EffectParameter( EffectParameterClass.Scalar, EffectParameterType.Single, "SpecularPower", 1, 1, "float",EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, 0.0f); parametersArray[shaderProgram.UniformCount+2] = new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "FogVector", 4, 1, "float4",EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, new float[4]); parametersArray[shaderProgram.UniformCount+3] = new EffectParameter( EffectParameterClass.Vector, EffectParameterType.Single, "DiffuseColor", 4, 1, "float4",EffectAnnotationCollection.Empty, EffectParameterCollection.Empty, EffectParameterCollection.Empty, new float[4]); Parameters = new EffectParameterCollection(parametersArray); EffectPass []effectsPassArray = new EffectPass[1]; effectsPassArray[0] = effectPass; var effectPassCollection = new EffectPassCollection(effectsPassArray); EffectTechnique []effectTechniqueArray = new EffectTechnique[1]; effectTechniqueArray[0] = new EffectTechnique(this, "Name", effectPassCollection, EffectAnnotationCollection.Empty); Techniques = new EffectTechniqueCollection(effectTechniqueArray); ConstantBuffers = new ConstantBuffer[0]; CurrentTechnique = Techniques[0]; }
private static EffectPassCollection ReadPasses(BinaryReader reader, Effect effect, List<Shader> shaders) { Shader vertexShader = (Shader) null; Shader pixelShader = (Shader) null; EffectPassCollection effectPassCollection = new EffectPassCollection(); int num = (int) reader.ReadByte(); for (int index1 = 0; index1 < num; ++index1) { string name = reader.ReadString(); EffectAnnotationCollection annotations = Effect.ReadAnnotations(reader); int index2 = (int) reader.ReadByte(); if (index2 != (int) byte.MaxValue) vertexShader = shaders[index2]; int index3 = (int) reader.ReadByte(); if (index3 != (int) byte.MaxValue) pixelShader = shaders[index3]; BlendState blendState = (BlendState) null; DepthStencilState depthStencilState = (DepthStencilState) null; RasterizerState rasterizerState = (RasterizerState) null; if (reader.ReadBoolean()) blendState = new BlendState() { AlphaBlendFunction = (BlendFunction) reader.ReadByte(), AlphaDestinationBlend = (Blend) reader.ReadByte(), AlphaSourceBlend = (Blend) reader.ReadByte(), BlendFactor = new Color((int) reader.ReadByte(), (int) reader.ReadByte(), (int) reader.ReadByte(), (int) reader.ReadByte()), ColorBlendFunction = (BlendFunction) reader.ReadByte(), ColorDestinationBlend = (Blend) reader.ReadByte(), ColorSourceBlend = (Blend) reader.ReadByte(), ColorWriteChannels = (ColorWriteChannels) reader.ReadByte(), ColorWriteChannels1 = (ColorWriteChannels) reader.ReadByte(), ColorWriteChannels2 = (ColorWriteChannels) reader.ReadByte(), ColorWriteChannels3 = (ColorWriteChannels) reader.ReadByte(), MultiSampleMask = reader.ReadInt32() }; if (reader.ReadBoolean()) depthStencilState = new DepthStencilState() { CounterClockwiseStencilDepthBufferFail = (StencilOperation) reader.ReadByte(), CounterClockwiseStencilFail = (StencilOperation) reader.ReadByte(), CounterClockwiseStencilFunction = (CompareFunction) reader.ReadByte(), CounterClockwiseStencilPass = (StencilOperation) reader.ReadByte(), DepthBufferEnable = reader.ReadBoolean(), DepthBufferFunction = (CompareFunction) reader.ReadByte(), DepthBufferWriteEnable = reader.ReadBoolean(), ReferenceStencil = reader.ReadInt32(), StencilDepthBufferFail = (StencilOperation) reader.ReadByte(), StencilEnable = reader.ReadBoolean(), StencilFail = (StencilOperation) reader.ReadByte(), StencilFunction = (CompareFunction) reader.ReadByte(), StencilMask = reader.ReadInt32(), StencilPass = (StencilOperation) reader.ReadByte(), StencilWriteMask = reader.ReadInt32(), TwoSidedStencilMode = reader.ReadBoolean() }; if (reader.ReadBoolean()) rasterizerState = new RasterizerState() { CullMode = (CullMode) reader.ReadByte(), DepthBias = reader.ReadSingle(), FillMode = (FillMode) reader.ReadByte(), MultiSampleAntiAlias = reader.ReadBoolean(), ScissorTestEnable = reader.ReadBoolean(), SlopeScaleDepthBias = reader.ReadSingle() }; EffectPass pass = new EffectPass(effect, name, vertexShader, pixelShader, blendState, depthStencilState, rasterizerState, annotations); effectPassCollection.Add(pass); } return effectPassCollection; }