Пример #1
0
        public void Read(BinaryReader br)
        {
            if (br.ReadUInt32() != magic)
            {
                return;
            }

            byte fragmentCount = br.ReadByte();

            if (fragmentCount > 0)
            {
                VSFragments = new Fragment[fragmentCount];
                for (int i = 0; i < fragmentCount; i++)
                {
                    Fragment csf = new Fragment(br);
                    VSFragments[i] = csf;
                }
            }

            fragmentCount = br.ReadByte();
            if (fragmentCount > 0)
            {
                PSFragments = new Fragment[fragmentCount];
                for (int i = 0; i < fragmentCount; i++)
                {
                    Fragment csf = new Fragment(br);
                    PSFragments[i] = csf;
                }
            }

            byte shaderParameterCount = br.ReadByte();

            if (shaderParameterCount > 0)
            {
                ShaderParameters1 = new ShaderParameter[shaderParameterCount];
                for (int i = 0; i < shaderParameterCount; i++)
                {
                    ShaderParameter param = new ShaderParameter();
                    param.Read(br);
                    ShaderParameters1[i] = param;
                }
            }

            shaderParameterCount = br.ReadByte();
            if (shaderParameterCount > 0)
            {
                ShaderParameters2 = new ShaderParameter[shaderParameterCount];
                for (int i = 0; i < shaderParameterCount; i++)
                {
                    ShaderParameter param = new ShaderParameter();
                    param.Read(br);
                    ShaderParameters2[i] = param;
                }
            }

            byte techniqueCount = br.ReadByte();

            if (techniqueCount > 0)
            {
                Techniques = new Technique[techniqueCount];
                for (int i = 0; i < techniqueCount; i++)
                {
                    Technique tech = new Technique(br, this);
                    Techniques[i] = tech;
                }
            }
        }
 public void SetShaderParameter(ShaderParameter p, int i)
 {
     ShaderParameter          = p;
     ShaderParameterListIndex = i;
 }