1
0
mirror of synced 2024-11-28 09:20:57 +01:00

Display emblem on karts properly

This commit is contained in:
KillzXGaming 2019-06-04 20:17:19 -04:00
parent 04a84695b9
commit 13b346ddde
12 changed files with 39 additions and 29 deletions

Binary file not shown.

View File

@ -705,12 +705,14 @@ namespace FirstPlugin
{
if (useSampler == "_a0")
{
if (AlbedoCount == 0)
{
m.HasDiffuseMap = true;
AlbedoCount++;
texture.Type = MatTexture.TextureType.Diffuse;
}
m.HasDiffuseMap = true;
AlbedoCount++;
texture.Type = MatTexture.TextureType.Diffuse;
}
if (useSampler == "_a1")
{
m.HasDiffuseLayer = true;
texture.Type = MatTexture.TextureType.DiffuseLayer2;
}
if (useSampler == "_n0")
{
@ -847,13 +849,6 @@ namespace FirstPlugin
AlbedoCount++;
texture.Type = MatTexture.TextureType.Diffuse;
}
if (AlbedoCount == 1)
{
// poly.material.HasDiffuseLayer = true;
// texture.hash = 19;
// texture.Type = MatTexture.TextureType.DiffuseLayer2;
}
}
else if (TextureName.Contains("Nrm") || TextureName.Contains("Norm") || TextureName.Contains("norm") || TextureName.Contains("nrm"))

View File

@ -491,12 +491,14 @@ namespace FirstPlugin
{
if (useSampler == "_a0")
{
if (AlbedoCount == 0)
{
m.HasDiffuseMap = true;
AlbedoCount++;
texture.Type = MatTexture.TextureType.Diffuse;
}
m.HasDiffuseMap = true;
AlbedoCount++;
texture.Type = MatTexture.TextureType.Diffuse;
}
else if (useSampler == "_a1")
{
m.HasDiffuseLayer = true;
texture.Type = MatTexture.TextureType.DiffuseLayer2;
}
else if (useSampler == "_n0")
{

View File

@ -947,7 +947,9 @@ namespace FirstPlugin
shader.SetBoolToInt("UseSpecularColor",
(mat.GetOptionValue("specular_mask_is_color") == 1) ||
mat.GetOptionValue("enable_specular_color") == 1);
shader.SetBoolToInt("UseMultiTexture", mat.GetOptionValue("enable_multi_texture") == 1);
//Colors
shader.SetVector4("const_color0", new Vector4(1, 1, 1, 1));
shader.SetVector4("base_color_mul_color", new Vector4(1, 1, 1, 1));

View File

@ -105,6 +105,7 @@ namespace Switch_Toolbox.Library
mat4.M31, mat4.M32, mat4.M33, mat4.M34,
mat4.M41, mat4.M42, mat4.M43, mat4.M44);
outMat.Transpose();
return outMat;
}

View File

@ -136,8 +136,7 @@ namespace Switch_Toolbox.Library
//Create a new assimp bone
Bone bone = new Bone();
bone.Name = STbone.Text;
bone.OffsetMatrix = transform;
bone.OffsetMatrix = STbone.invert.ToMatrix4x4();
mesh.Bones.Add(bone);
BoneNames.Add(bone.Name);

View File

@ -80,6 +80,7 @@ uniform float cSpecularType;
uniform float cIsEnableNormalMap;
uniform int UseSpecularColor;
uniform int UseMultiTexture;
// Texture Map Toggles
uniform int HasDiffuse;
@ -196,8 +197,6 @@ void main()
if (HasNormalMap == 1 && useNormalMap == 1)
N = CalcBumpedNormal(normal, NormalMap, vert, NormalMapUVIndex);
// Light Map
vec4 LightMapColor = texture(BakeLightMap, f_texcoord2);
@ -206,9 +205,14 @@ void main()
// Diffuse lighting.
float halfLambert = dot(difLightDirection, N) * 0.5 + 0.5;
vec4 diffuseMapColor = vec4(texture(DiffuseMap, f_texcoord0).rgba);
//Texture Overlay (Like an emblem in mk8)
if (HasDiffuseLayer == 1)
fragColor += vec4(texture(DiffuseLayer, f_texcoord3).rgb, 1) * vec4(1);
if (UseMultiTexture == 1 && HasDiffuseLayer == 1)
{
vec4 AlbLayer = vec4(texture(DiffuseLayer, f_texcoord3).rgba);
diffuseMapColor.rgb = mix(diffuseMapColor.rgb, AlbLayer.rgb, AlbLayer.a);
}
// Default Shader
vec4 alpha = texture2D(DiffuseMap, f_texcoord0).aaaa;
@ -220,7 +224,6 @@ void main()
alpha *= 0.5;
}
vec4 diffuseMapColor = vec4(texture(DiffuseMap, f_texcoord0).rgb, 1);
//vec4 diffuseMapColor = vec4(1);
diffuseMapColor *= halfLambert;

View File

@ -106,6 +106,13 @@ float AmbientOcclusionBlend(sampler2D BakeShadowMap, VertexAttributes vert, floa
return mix(aoMap, 1, ao_density);
}
vec3 CalculateTangent()
{
vec3 tangent = vec3(0);
return tangent;
}
vec3 CalcBumpedNormal(vec3 inputNormal, sampler2D normalMap, VertexAttributes vert, float texCoordIndex)
{
float normalIntensity = 1;
@ -126,11 +133,12 @@ vec3 CalcBumpedNormal(vec3 inputNormal, sampler2D normalMap, VertexAttributes ve
// TBN Matrix.
vec3 T = vert.tangent;
vec3 B = vert. bitangent;
vec3 B = vert.bitangent;
if (Luminance(B) < 0.01)
B = normalize(cross(T, vert.normal));
mat3 tbnMatrix = mat3(T, B, vert.normal);
vec3 newNormal = tbnMatrix * normalMapNormal;
return normalize(newNormal);
}
}