mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-15 01:18:07 +00:00
d1f03b161f
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles Alot of things optimized. UI is very fast and snappy now Dae rigging fixed. Dae bones can be imported. Dae with textures can be imported and exported to a folder Custom sampler editor for sampler data. Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited User data editor Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements Skeleton can be viewed GFPAK with some fixes in saving NUTEXB has proper mip map viewing PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed Files can be associated with the program and opened with on clicking them ASTC textures can be viewed UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits Textures use a new editor. It includes channel viewing and some new editing options Fixed black textures on some wii u bfres Fixed saving sarcs in sarcs Shortcut keys have been added in. CTRL + S can save the active file in the currently used window Fix more issues with bfres crashing File - New includes BNTX for creating new bntx files from scatch Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these Sharc files can have source data previewed and shader programs in XML Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update Byaml uses it's own editor instead of a seperate window for easy saving within sarcs Archives have a hex viewer Dae exporting greatly improved and can export rigged meshes Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list) Memory usage is greatly improved Narc (Nitro Archives) can be viewed and extracted. Fixed importing TGA images Support importing ASTC textures for bntx Added in PBR lighting for bfres from my implimentaion in forge Added gradient background for viewport. This can be edited in the settings Added skybox background option for viewport. Can load cubemaps Added grid with customizable cells for viewport. DDS decompression no longer requires Direct X tex. Zlib decompression has been improved for opening files that use it Rigid bones are properly ordered on importing a mesh. May fix some exploding issues. Endianness for KCL can be toggled for saving. Will be set to what it was using orignally Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good Vertex buffers can be added and removed. Also re encoded Parameters now use drop down panels with values for easier editing Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically Fixed animation scaling for skeletal animations finally! Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport Fixed support for audio files to be big endian in BARS Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save. Animations are split into multiple sub sections for switch's material animation for easier access Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from) Every section can be added in as new for both wii u and switch. Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later) Added option to copy UV channel Bone weights can be previewed Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more! Fixed 3.3 Wii U bfres from not opening Wii U Sharcfb files can have shader program data previewed (XML) And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
189 lines
4.5 KiB
GLSL
189 lines
4.5 KiB
GLSL
#version 330
|
|
|
|
uniform mat4 mtxCam;
|
|
uniform mat4 mtxMdl;
|
|
uniform mat4 sphereMatrix;
|
|
|
|
in vec3 vPosition;
|
|
in vec3 vNormal;
|
|
in vec3 vTangent;
|
|
in vec3 vBitangent;
|
|
in vec2 vUV0;
|
|
in vec4 vColor;
|
|
in vec4 vBone;
|
|
in vec4 vWeight;
|
|
in vec2 vUV1;
|
|
in vec2 vUV2;
|
|
in vec3 vPosition2;
|
|
in vec3 vPosition3;
|
|
|
|
out vec2 f_texcoord0;
|
|
out vec2 f_texcoord1;
|
|
out vec2 f_texcoord2;
|
|
out vec2 f_texcoord3;
|
|
|
|
out vec3 objectPosition;
|
|
|
|
out vec3 normal;
|
|
out vec3 viewNormal;
|
|
out vec4 vertexColor;
|
|
out vec3 tangent;
|
|
out vec3 bitangent;
|
|
|
|
out vec3 boneWeightsColored;
|
|
|
|
uniform vec2 SRT_Scale;
|
|
uniform float SRT_Rotate;
|
|
uniform vec2 SRT_Translate;
|
|
|
|
|
|
// Bone Weight Display
|
|
uniform sampler2D weightRamp1;
|
|
uniform sampler2D weightRamp2;
|
|
uniform int selectedBoneIndex;
|
|
uniform int debugOption;
|
|
|
|
|
|
// Shader Options
|
|
uniform vec4 gsys_bake_st0;
|
|
uniform vec4 gsys_bake_st1;
|
|
|
|
uniform int boneIds[190];
|
|
|
|
// Skinning uniforms
|
|
uniform mat4 bones[190];
|
|
|
|
|
|
//Meshes have a bone index and will use their transform depending on skin influence amount
|
|
uniform int SingleBoneIndex;
|
|
uniform mat4 SingleBoneBindTransform;
|
|
uniform int NoSkinning;
|
|
uniform int RigidSkinning;
|
|
|
|
vec4 skin(vec3 pos, ivec4 index)
|
|
{
|
|
vec4 newPosition = vec4(pos.xyz, 1.0);
|
|
|
|
newPosition = bones[index.x] * vec4(pos, 1.0) * vWeight.x;
|
|
newPosition += bones[index.y] * vec4(pos, 1.0) * vWeight.y;
|
|
newPosition += bones[index.z] * vec4(pos, 1.0) * vWeight.z;
|
|
if (vWeight.w < 1) //Necessary. Bones may scale weirdly without
|
|
newPosition += bones[index.w] * vec4(pos, 1.0) * vWeight.w;
|
|
|
|
return newPosition;
|
|
}
|
|
|
|
vec3 skinNRM(vec3 nr, ivec4 index)
|
|
{
|
|
vec3 newNormal = vec3(0);
|
|
|
|
newNormal = mat3(bones[index.x]) * nr * vWeight.x;
|
|
newNormal += mat3(bones[index.y]) * nr * vWeight.y;
|
|
newNormal += mat3(bones[index.z]) * nr * vWeight.z;
|
|
newNormal += mat3(bones[index.w]) * nr * vWeight.w;
|
|
|
|
return newNormal;
|
|
}
|
|
|
|
vec3 BoneWeightColor(float weights)
|
|
{
|
|
float rampInputLuminance = weights;
|
|
rampInputLuminance = clamp((rampInputLuminance), 0.001, 0.999);
|
|
if (debugOption == 1) // Greyscale
|
|
return vec3(weights);
|
|
else if (debugOption == 2) // Color 1
|
|
return texture(weightRamp1, vec2(1 - rampInputLuminance, 0.50)).rgb;
|
|
else // Color 2
|
|
return texture(weightRamp2, vec2(1 - rampInputLuminance, 0.50)).rgb;
|
|
}
|
|
|
|
float BoneWeightDisplay(ivec4 index)
|
|
{
|
|
float weight = 0;
|
|
if (selectedBoneIndex == boneIds[index.x])
|
|
weight += vWeight.x;
|
|
if (selectedBoneIndex == boneIds[index.y])
|
|
weight += vWeight.y;
|
|
if (selectedBoneIndex == boneIds[index.z])
|
|
weight += vWeight.z;
|
|
if (selectedBoneIndex == boneIds[index.w])
|
|
weight += vWeight.w;
|
|
|
|
if (selectedBoneIndex == boneIds[index.x] && RigidSkinning == 1)
|
|
weight = 1;
|
|
if (selectedBoneIndex == SingleBoneIndex && NoSkinning == 1)
|
|
weight = 1;
|
|
|
|
return weight;
|
|
}
|
|
|
|
vec2 rotateUV(vec2 uv, float rotation)
|
|
{
|
|
float mid = 0.5;
|
|
return vec2(
|
|
cos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid,
|
|
cos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid
|
|
);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
ivec4 index = ivec4(vBone);
|
|
|
|
vec4 objPos = vec4(vPosition.xyz, 1.0);
|
|
objectPosition = vPosition.xyz;
|
|
if (vBone.x != -1.0)
|
|
objPos = skin(vPosition, index);
|
|
|
|
vec4 position = mtxCam * mtxMdl * vec4(objPos.xyz, 1.0);
|
|
|
|
normal = vNormal;
|
|
viewNormal = mat3(sphereMatrix) * normal.xyz;
|
|
|
|
if(vBone.x != -1.0)
|
|
normal = normalize((skinNRM(vNormal.xyz, index)).xyz);
|
|
|
|
|
|
if (RigidSkinning == 1)
|
|
{
|
|
position = mtxCam * mtxMdl * (bones[index.x] * vec4(vPosition, 1.0));
|
|
normal = mat3(bones[index.x]) * vNormal.xyz * 1;
|
|
}
|
|
if (NoSkinning == 1)
|
|
{
|
|
position = mtxCam * mtxMdl * (SingleBoneBindTransform * vec4(vPosition, 1.0));
|
|
normal = mat3(SingleBoneBindTransform) * vNormal.xyz * 1;
|
|
//normal = normalize(normal);
|
|
}
|
|
|
|
gl_Position = position;
|
|
|
|
f_texcoord0 = vUV0;
|
|
|
|
vec4 sampler2 = gsys_bake_st0;
|
|
vec4 sampler3 = gsys_bake_st1;
|
|
|
|
if (sampler2.x != 0 && sampler2.y != 0)
|
|
f_texcoord1 = vec2((vUV1 * sampler2.xy) + sampler2.zw);
|
|
else
|
|
f_texcoord1 = vec2((vUV1 * vec2(1)) + sampler2.zw);
|
|
|
|
if (sampler3.x != 0 && sampler3.y != 0)
|
|
f_texcoord2 = vec2((vUV1 * sampler3.xy) + sampler3.zw);
|
|
else
|
|
f_texcoord2 = vec2((vUV1 * vec2(1)) + sampler3.zw);
|
|
|
|
|
|
f_texcoord0 = vec2((vUV0 * SRT_Scale.xy) + SRT_Translate.xy);
|
|
|
|
|
|
f_texcoord3 = vUV2;
|
|
|
|
tangent = vTangent;
|
|
bitangent = vBitangent;
|
|
vertexColor = vColor;
|
|
|
|
// fragment shader attributes
|
|
float totalWeight = BoneWeightDisplay(index);
|
|
boneWeightsColored = BoneWeightColor(totalWeight).rgb;
|
|
}
|