public void InitFiles() { #if PWindow if (EngineNS.IO.FileManager.UseCooked != null) { return; } var files = CEngine.Instance.FileManager.GetFiles(RName.GetRName("Shaders", RName.enRNameType.Engine).Address, "*.*", SearchOption.AllDirectories); if (files == null) { return; } foreach (var f in files) { bool error = false; var i = CEngine.Instance.FileManager.NormalizePath(f, out error); if (error) { continue; } if (i.EndsWith(".shaderinc") || i.EndsWith(".cginc") || i.EndsWith(".shadingenv") || i.EndsWith(".compute")) { var desc = new HLSLFileDesc(); desc.Directory = CEngine.Instance.FileManager.GetPathFromFullName(i); desc.FileName = CEngine.Instance.FileManager.GetPureFileFromFullName(i); desc.HLSLCode = System.IO.File.ReadAllText(i); Hash64.CalcHash64(ref desc.HashCode, desc.HLSLCode); FileDescDict.Add(desc.Directory + desc.FileName, desc); } } foreach (var i in FileDescDict) { GetDepends(i.Value); } foreach (var i in FileDescDict) { if (i.Key.EndsWith(".shadingenv") || i.Key.EndsWith(".compute")) { var allDepends = new List <HLSLFileDesc>(); CollectDependTree(i.Value, allDepends); allDepends.Sort((left, right) => { return(left.FullName.CompareTo(right.FullName)); }); string AllCode = i.Value.HLSLCode; foreach (var j in allDepends) { AllCode += j.HLSLCode; } Hash64.CalcHash64(ref i.Value.HashWithDepends, AllCode); } } #endif }
private void UpdateHash64() { if (Modifiers.Count == 0) { mHash64 = Hash64.Empty; return; } string mdfStr = ""; for (int i = 0; i < Modifiers.Count; i++) { mdfStr += Modifiers[i].Name; } Hash64.CalcHash64(ref mHash64, mdfStr); }
public Hash64 GetFolderHash() { var cname = RttiHelper.GetTypeSaveString(MetaType); cname = cname.Replace('+', '.'); cname = cname.ToLower(); var idx = cname.IndexOf('|'); if (idx >= 0) { cname = cname.Substring(idx + 1); } Hash64 hash = new Hash64(); Hash64.CalcHash64(ref hash, cname); return(hash); }
internal void UpdateHash64(bool UpdateMacro) { if (UpdateMacro) { UpdateMacroArray(); } String = ""; if (MtlShaderPatch != null) { String += MtlShaderPatch.ToString(); } if (MdfQueueShaderPatch != null) { String += MdfQueueShaderPatch.ToString(); } if (ShaderMacros != null) { String += ShaderMacros.ToString(); } String += EnvShaderPatch.ToString(); Hash64.CalcHash64(ref NameHash, String); }