From 5b55e210ed8e2da9042015bd701d7e2e226c1404 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Sat, 27 Jul 2019 12:29:38 -0400 Subject: [PATCH] Fix normals. Load vertex colors for some types --- .vs/Toolbox/v15/.suo | Bin 438272 -> 437248 bytes .../FileFormats/Archives/LM2/LM2_Model.cs | 39 ++++++++++++------ Toolbox/Shader/GenericShader.frag | 4 +- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.vs/Toolbox/v15/.suo b/.vs/Toolbox/v15/.suo index 2ecbfda40207e7797a2b925aab3967e12c78dd85..1edc777bb5ac8a5e9e599f7b7ca9bb66b9d66633 100644 GIT binary patch delta 5256 zcmd^D3sjX=7XHuUKimr!ywK%!AtXe=7jjV%6YUC=rfC-+r&cxW9G0}uldeGwl~O$(OCa{BJ5EG2HbFz~^G z;*Hsd$xfWBbjmVXMhTH;=w!Lq?hrGPyEQQvOit9S z{y1|nKM}`~xUh%khvNuDG@>1uS7YA~5sR=Pu0fa)hJ1W?Z^*TKpW}N;P;=t*^9^HD zaOz@X%P%&RbQ|htpAm|3R~U-Cs}TMO69yv*dt-}$?mi6raD-uk75gBBy?d;o>JUkI zRCT3I=5sDxIh+Xjj44VODozpa9@AJNoBT7p*7yeEwv>`KxztiY&dYBs6#?f^4M$)D zvQR|H-vrJUZ{n!bEYD5eZ|d1r=3F1IwqY^rbTxB@8PK@$cEe(zOE$ zV{_*=$Od~#kM>+Y;`WcQ8Zlanv+EEBEtC8=B^j0DMZAJ|6=76}LcE4}9q|UjC;a8i zXx@keX$go;YC_@z#D2tw2t(ok_8)cAhp<0}kkbQFV^%|WH^_xYucVqMdQfJR1fkq}Y9f9h70g$CpE{g*hLoQ+t*o%YH z2&0|DWK&!w5XP#W=7-}zc_1}h4v%OeGmuKGu1vDzBKsD^OoWlq>dJYwG1NWKB3pB; znBLDwU2Frh7)gjk7}|_PSSI7ZgfLp&wG)U@V;5$9RvKnsY^7x{GJ33ZCzOgnT#|ND zmL;4ckIJ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qsI= zahQKao3tx&#xt9PeEJJM(b2pe%^_(z^-imYzq|cj&2*UQfXgJSN!v3qC{E>{7#OlV_LO z5B5F4*TP*lqVPvvQv>MdO?4lI%yNFA9J5#5&l6(5>}52ekG61NDbJK?Z>S%zxGkXV zN7C~Td}6ahcnCbRS51`{y`%0Y5OZ;Dl_r7^9LzNc5)qRgr*H~*rk)Ryh5u4tA^LmI zxn+loyYa&-Pvk>>r@9ohuqZNGnP6w4U{#x_ghQLDA8Nwrt6!(;kXxvjK=jf%0XnF!q|y}V4FJp%VEEn0q29=$)6$-)ZSRFNjP*+ec2 zj}sK$Jx2_LhFe6AEI6u02;}C90$GqQA`C)HLk-u}eUrtVO!vNe zolL$~9I%E9glPV?2%4e8CPEN9U!>~x$9;0kjbgP)?^rlg?z~gH%bH4lCj`T9YJJMX z9@%!cs8mm1P$yO=L7817!@>$-mW$Vljb_-snNBx$Xgef#spWFZBVs;>XZN#QXxq 20) + vert.col = Read_8_8_8_8_Unorm(reader); + } break; } @@ -281,6 +279,21 @@ namespace FirstPlugin.LuigisMansion.DarkMoon } } + public static Vector4 Read_8_8_8_8_Snorm(FileReader reader) + { + return new Vector4(reader.ReadSByte() / 255f, reader.ReadSByte() / 255f, reader.ReadSByte() / 255f, reader.ReadSByte() / 255f); + } + + public static Vector4 Read_8_8_8_8_Unorm(FileReader reader) + { + return new Vector4(reader.ReadByte() / 255f, reader.ReadByte() / 255f, reader.ReadByte() / 255f, reader.ReadByte() / 255f); + } + + public static Vector3 Read_8_8_8_Unorm(FileReader reader) + { + return new Vector3(reader.ReadByte() / 255f, reader.ReadByte() / 255f, reader.ReadByte() / 255f ); + } + public static Vector2 NormalizeUvCoordsToFloat(ushort U, ushort V) { return new Vector2( U / 1024f, V / 1024f); diff --git a/Toolbox/Shader/GenericShader.frag b/Toolbox/Shader/GenericShader.frag index 8d5ca48f..9f44735e 100644 --- a/Toolbox/Shader/GenericShader.frag +++ b/Toolbox/Shader/GenericShader.frag @@ -183,9 +183,9 @@ void main() if (uvChannel == 1) displayTexCoord = f_texcoord0; if (uvChannel == 2) - displayTexCoord = f_texcoord2; + displayTexCoord = f_texcoord1; if (uvChannel == 3) - displayTexCoord = f_texcoord3; + displayTexCoord = f_texcoord2; vec3 displayNormal = (normal.xyz * 0.5) + 0.5; if (renderType == 1) // normals color