private static ReadPasses ( BinaryReader reader, Effect effect, Shader shaders ) : EffectPassCollection | ||
reader | BinaryReader | |
effect | Effect | |
shaders | Shader | |
Résultat | EffectPassCollection |
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]; }