public void Read(FileReader reader) { var pos = reader.Position; uint SectionSize = reader.ReadUInt32(); uint NameLength = reader.ReadUInt32(); Type = reader.ReadEnum <ShaderType>(false); uint index = reader.ReadUInt32(); Text = reader.ReadString((int)NameLength); variationMacroData = new VariationMacroData(); variationSymbolData = new VariationSymbolData(); UniformVariables = new ShaderSymbolData(); UniformBlocks = new ShaderSymbolData(); SamplerVariables = new ShaderSymbolData(); AttributeVariables = new ShaderSymbolData(); variationMacroData.Read(reader); variationSymbolData.Read(reader); UniformVariables.Read(reader); UniformBlocks.Read(reader); SamplerVariables.Read(reader); AttributeVariables.Read(reader); reader.Seek(SectionSize + pos, System.IO.SeekOrigin.Begin); }
private static void WriteMarcos(XmlDocument doc, VariationMacroData var, string Name, XmlNode node) { XmlNode rootNode = doc.CreateElement(Name); foreach (var macro in var.macros) { XmlNode childNode = doc.CreateElement("macro"); AddAttribute(doc, "name", macro.Name.Replace("\x00", ""), childNode); AddAttribute(doc, "value", macro.Value.Replace("\x00", ""), childNode); // AddAttribute(doc, "Values", macro.Values, ParamNode); rootNode.AppendChild(childNode); } node.AppendChild(rootNode); }
public void Read(FileReader reader, SHARC.Header header) { var pos = reader.Position; uint SectionSize = reader.ReadUInt32(); uint NameLength = reader.ReadUInt32(); if (header.Version >= 13) { VertexShaderIndex = reader.ReadInt32(); FragmentShaderIndex = reader.ReadInt32(); GeoemetryShaderIndex = reader.ReadInt32(); ushort computeUnk1 = reader.ReadUInt16(); ushort vertexUnk2 = reader.ReadUInt16(); ushort fragmentUnk2 = reader.ReadUInt16(); ushort geometryUnk2 = reader.ReadUInt16(); ushort computeUnk2 = reader.ReadUInt16(); } else { VertexShaderIndex = reader.ReadInt32(); FragmentShaderIndex = reader.ReadInt32(); GeoemetryShaderIndex = reader.ReadInt32(); VertexShaderIndex = 0; FragmentShaderIndex = 1; GeoemetryShaderIndex = -1; } Text = reader.ReadString((int)NameLength, true); variationVertexMacroData = new VariationMacroData(); variationFragmenMacroData = new VariationMacroData(); variationGeometryMacroData = new VariationMacroData(); variationComputeMacroData = new VariationMacroData(); variationSymbolData = new VariationSymbolData(); variationSymbolDataFull = new VariationSymbolData(); UniformVariables = new ShaderSymbolData(); UniformBlocks = new ShaderSymbolData(); SamplerVariables = new ShaderSymbolData(); AttributeVariables = new ShaderSymbolData(); variationVertexMacroData.Read(reader, header.Version); variationFragmenMacroData.Read(reader, header.Version); variationGeometryMacroData.Read(reader, header.Version); if (header.Version >= 13) { variationComputeMacroData.Read(reader, header.Version); } variationSymbolData.Read(reader); variationSymbolDataFull.Read(reader); UniformVariables.Read(reader, header.Version, true); if (header.Version <= 12) { if (header.Version >= 11) { UniformBlocks.Read(reader, header.Version, true); } SamplerVariables.Read(reader, header.Version); AttributeVariables.Read(reader, header.Version); } reader.Seek(SectionSize + pos, System.IO.SeekOrigin.Begin); }