mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-25 14:00:21 +00:00
Fix preview scale
This commit is contained in:
parent
fbbbbd51bf
commit
ab44950984
12 changed files with 12 additions and 8 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -554,8 +554,8 @@ namespace FirstPlugin
|
|||
SetRenderSettings(defaultShaderProgram);
|
||||
|
||||
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
|
||||
|
||||
Matrix4 camMat = previewScale * control.mtxCam * control.mtxProj;
|
||||
defaultShaderProgram.SetMatrix4x4("previewScale", ref previewScale);
|
||||
|
||||
GL.Disable(EnableCap.CullFace);
|
||||
|
||||
|
|
|
@ -292,6 +292,8 @@ namespace FirstPlugin
|
|||
control.UpdateModelMatrix(ModelTransform);
|
||||
|
||||
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
|
||||
shader.SetMatrix4x4("previewScale", ref previewScale);
|
||||
|
||||
Matrix4 camMat = previewScale * control.mtxCam * control.mtxProj;
|
||||
|
||||
Matrix4 sphereMatrix = camMat;
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -59,7 +59,7 @@ namespace Switch_Toolbox.Library
|
|||
else
|
||||
position = bone * rotation * vec4((point.xyz - vec3(0, 1, 0)) * scale, 1);
|
||||
}
|
||||
gl_Position = mtxCam * mtxMdl * vec4(position.xyz, 1);
|
||||
gl_Position = mtxCam * mtxMdl * previewScale * vec4(position.xyz, 1);
|
||||
|
||||
}");
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace Switch_Toolbox.Library.Rendering
|
|||
control.CurrentShader = solidColorShaderProgram;
|
||||
|
||||
Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale);
|
||||
Matrix4 camMat = previewScale * control.mtxCam * control.mtxProj;
|
||||
Matrix4 camMat = control.mtxCam * control.mtxProj;
|
||||
Matrix4 invertedCamera = camMat.Inverted();
|
||||
Vector3 lightDirection = new Vector3(0f, 0f, -1f);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
uniform mat4 mtxCam;
|
||||
uniform mat4 mtxMdl;
|
||||
uniform mat4 sphereMatrix;
|
||||
uniform mat4 previewScale;
|
||||
|
||||
in vec3 vPosition;
|
||||
in vec3 vNormal;
|
||||
|
@ -135,7 +136,7 @@ void main()
|
|||
if (vBone.x != -1.0)
|
||||
objPos = skin(vPosition, index);
|
||||
|
||||
vec4 position = mtxCam * mtxMdl * vec4(objPos.xyz, 1.0);
|
||||
vec4 position = mtxCam * mtxMdl * previewScale * vec4(objPos.xyz, 1.0);
|
||||
|
||||
normal = vNormal;
|
||||
viewNormal = mat3(sphereMatrix) * normal.xyz;
|
||||
|
@ -146,17 +147,17 @@ void main()
|
|||
|
||||
if (RigidSkinning == 1)
|
||||
{
|
||||
position = mtxCam * mtxMdl * (bones[index.x] * vec4(vPosition, 1.0));
|
||||
position = mtxCam * mtxMdl * previewScale * (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));
|
||||
position = mtxCam * mtxMdl * previewScale * (SingleBoneBindTransform * vec4(vPosition, 1.0));
|
||||
normal = mat3(SingleBoneBindTransform) * vNormal.xyz * 1;
|
||||
//normal = normalize(normal);
|
||||
}
|
||||
|
||||
gl_Position = position;
|
||||
gl_Position =position;
|
||||
|
||||
f_texcoord0 = vUV0;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ out vec3 position;
|
|||
|
||||
uniform mat4 mtxCam;
|
||||
uniform mat4 mtxMdl;
|
||||
uniform mat4 previewScale;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -19,7 +20,7 @@ void main()
|
|||
color = vColor;
|
||||
position = vPosition;
|
||||
|
||||
gl_Position = mtxCam * mtxMdl * vec4(vPosition.xyz, 1.0);
|
||||
gl_Position = mtxCam * mtxMdl * previewScale * vec4(vPosition.xyz, 1.0);
|
||||
|
||||
vec3 distance = (vPosition.xyz + vec3(5, 5, 5))/2;
|
||||
|
||||
|
|
Loading…
Reference in a new issue