diff --git a/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs b/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs index 4dd9fa8d..e5fa8f45 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs @@ -886,6 +886,26 @@ namespace LayoutBXLYT.Cafe } + public bool UseOneMaterialForAll + { + get { return Convert.ToBoolean(_flag & 1); } + } + + public bool UseVertexColorForAll + { + get { return Convert.ToBoolean((_flag >> 1) & 1); } + } + + public bool WindowKind + { + get { return Convert.ToBoolean((_flag >> 2) & 3); } + } + + public bool NotDrawnContent + { + get { return Convert.ToBoolean((_flag >> 4) & 1); } + } + public ushort StretchLeft; public ushort StretchRight; public ushort StretchTop; diff --git a/File_Format_Library/FileFormats/Layout/CAFE/BflytShader.cs b/File_Format_Library/FileFormats/Layout/CAFE/BflytShader.cs index d010dc98..e223c6a1 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/BflytShader.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/BflytShader.cs @@ -101,42 +101,8 @@ namespace LayoutBXLYT { get { - StringBuilder frag = new StringBuilder(); - frag.AppendLine("uniform vec4 blackColor;"); - frag.AppendLine("uniform vec4 whiteColor;"); - frag.AppendLine("uniform int hasTexture0;"); - frag.AppendLine("uniform int debugShading;"); - frag.AppendLine("uniform int numTextureMaps;"); - frag.AppendFormat("uniform sampler2D textures{0};\n", 0); - frag.AppendLine("uniform sampler2D uvTestPattern;"); - - frag.AppendLine("void main()"); - frag.AppendLine("{"); - - frag.AppendLine("vec4 textureMap0 = vec4(1);"); - frag.AppendLine("if (numTextureMaps > 0)"); - frag.AppendLine("{"); - frag.AppendLine("if (hasTexture0 == 1)"); - frag.AppendLine(" textureMap0 = texture2D(textures0, gl_TexCoord[0].st);"); - frag.AppendLine("}"); - frag.AppendLine("if (debugShading == 0)"); - frag.AppendLine("{"); - frag.AppendLine("vec4 colorFrag = gl_Color * textureMap0;"); - frag.AppendLine("vec4 colorBlend = colorFrag * whiteColor;"); - frag.AppendLine("gl_FragColor = colorBlend;"); - - frag.AppendLine("}"); - frag.AppendLine("else if (debugShading == 1)"); - frag.AppendLine(" gl_FragColor = vec4(textureMap0.rgb, 1);"); - frag.AppendLine("else if (debugShading == 2)"); - frag.AppendLine(" gl_FragColor = whiteColor;"); - frag.AppendLine("else if (debugShading == 3)"); - frag.AppendLine(" gl_FragColor = blackColor;"); - frag.AppendLine("else if (debugShading == 4)"); - frag.AppendLine(" gl_FragColor = texture2D(uvTestPattern, gl_TexCoord[0].st);"); - frag.AppendLine("}"); - - return frag.ToString(); + string path = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Layout", "Bflyt.frag"); + return System.IO.File.ReadAllText(path); } } diff --git a/Toolbox/Shader/Layout/Bflyt.frag b/Toolbox/Shader/Layout/Bflyt.frag new file mode 100644 index 00000000..47108754 --- /dev/null +++ b/Toolbox/Shader/Layout/Bflyt.frag @@ -0,0 +1,31 @@ +uniform vec4 blackColor; +uniform vec4 whiteColor; +uniform int hasTexture0; +uniform int debugShading; +uniform int numTextureMaps; +uniform sampler2D textures0; +uniform sampler2D uvTestPattern; + +void main() +{ + vec4 textureMap0 = vec4(1); + if (numTextureMaps > 0) + { + if (hasTexture0 == 1) + textureMap0 = texture2D(textures0, gl_TexCoord[0].st);; + } + if (debugShading == 0) + { + vec4 colorFrag = gl_Color * textureMap0; + vec4 colorBlend = colorFrag * whiteColor; + gl_FragColor = colorBlend; + } + if (debugShading == 1) + gl_FragColor = vec4(textureMap0.rgb, 1); + if (debugShading == 2) + gl_FragColor = whiteColor; + if (debugShading == 3) + gl_FragColor = blackColor; + if (debugShading == 4) + gl_FragColor = texture2D(uvTestPattern, gl_TexCoord[0].st); +} \ No newline at end of file diff --git a/Toolbox/Toolbox.csproj b/Toolbox/Toolbox.csproj index abf186f8..6b469015 100644 --- a/Toolbox/Toolbox.csproj +++ b/Toolbox/Toolbox.csproj @@ -245,6 +245,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest