daily update on 20240828 by nitload youmu, autotexture added

This commit is contained in:
Nitload
2024-08-28 10:58:31 +08:00
parent d082071f2d
commit 1ee4e4a42f
586 changed files with 60910 additions and 123106 deletions
+92 -3
View File
@@ -1,4 +1,34 @@
using StgSharp;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="InternalData.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp;
using System;
using System.Collections.Generic;
@@ -8,7 +38,66 @@ namespace StgSharp
{
internal partial class InternalIO
{
internal const string CollisionTextureVertexShader ="#version 430 core\r\n\r\nlayout(location = 0) in vec2 localCollisionCoord;\r\nlayout(location = 1) in vec2 spaceCoord;\r\nlayout(location = 2) in float rotation;\r\nlayout(location = 3) in float scaling;\r\n\r\nuniform vec2 target;\r\nuniform mat2 projection;\r\n\r\nvoid main()\r\n{\r\n mat2 scaling = mat2(\r\n scaling,0,\r\n 0,scaling\r\n );\r\n mat2 rotation = mat2(\r\n cos(rotation),-sin(rotation),\r\n sin(rotation),cos(rotation) \r\n );\r\n vec2 realCoord = (rotation * scaling * localCollisionCoord) + spaceCoord - target;\r\n realCoord = projection * realCoord;\r\n\r\n float dist = distance(realCoord, vec2(0,0));\r\n float angle = atan(realCoord.y, realCoord.x);\r\n \r\n gl_Position = vec4(angle, realCoord.y, dist, 1);\r\n}";
internal const string CollisionTextureFragmentShader = "#version 430 core\r\n\r\nout vec4 Color;\r\n\r\nuniform float range;\r\n\r\nvoid main()\r\n{\r\n float dist = gl_FragCoord.z;\r\n\r\n if(dist > range)\r\n {\r\n discard;\r\n }\r\n dist /= range;\r\n gl_FragDepth = min(dist, gl_FragDepth);\r\n\r\n Color = vec4(dist,0,0,1);\r\n}";
#region ControllingItemRender
internal const string ControlItemRenderVertexShader = """
""";
#endregion
#region CollisionTexture
internal const string CollisionTextureVertexShader = """
#version 430 core
layout(location = 0) in vec2 localCollisionCoord;
layout(location = 1) in vec2 spaceCoord;
layout(location = 2) in float rotation;
layout(location = 3) in float scaling;
uniform vec2 target;
uniform mat2 projection;
void main()
{
mat2 scaling = mat2(
scaling,0,
0,scaling );
mat2 rotation = mat2(
cos(rotation),-sin(rotation),
sin(rotation),cos(rotation) );
vec2 realCoord = (rotation * scaling * localCollisionCoord) + spaceCoord - target;
realCoord = projection * realCoord;
float dist = distance(realCoord, vec2(0,0));
float angle = atan(realCoord.y, realCoord.x);
gl_Position = vec4(angle, realCoord.y, dist, 1);
}
""";
internal const string CollisionTextureFragmentShader = """
#version 430 core
out vec4 Color;
uniform float range;
void main()
{
float dist = gl_FragCoord.z;
if(dist > range)
{
discard;
}
dist /= range;
gl_FragDepth = min(dist, gl_FragDepth);
Color = vec4(dist,0,0,1);
}
""";
#endregion
}
}