save code

This commit is contained in:
xsl
2026-01-13 08:12:46 +08:00
parent 496d56f9c6
commit 52c9da08ed
10 changed files with 25 additions and 4 deletions
+4
View File
@@ -45,6 +45,8 @@ layout(push_constant) uniform PushConstants {
float radius;
float ux;
float uy;
float offset_x;
float offset_y;
} pushConstants;
@@ -55,6 +57,8 @@ void main() {
// 获取顶点位置
vec2 position = positions[gl_VertexIndex];
position = position * pushConstants.zoom;
position.x = position.x + (pushConstants.offset_x/480);
position.y = position.y + (pushConstants.offset_y/480);
// 设置输出位置(Vulkan使用不同的坐标系)
gl_Position = vec4(position, 0.0, 1.0);
Binary file not shown.
+4
View File
@@ -24,6 +24,8 @@ layout(push_constant) uniform PushConstants {
float radius;
float ux;
float uy;
float offset_x;
float offset_y;
} pushConstants;
out gl_PerVertex
@@ -37,6 +39,8 @@ void main()
vec2 position = vec2(inPos.xy*2 -1);
position = position * pushConstants.zoom;
position.x = position.x + (pushConstants.offset_x/480);
position.y = position.y + (pushConstants.offset_y/480);
gl_Position = vec4(position, 0.5, 1.0);
vec4 pos = ubo.model * vec4(inPos, 1.0);
Binary file not shown.
@@ -8,7 +8,8 @@ public class InitArg {
public float g;
public float b;
public float radius;
public float offset_x;
public float offset_y;
public String toJson() {
try {
JSONObject jsonObject = new JSONObject();
@@ -18,6 +19,8 @@ public class InitArg {
jsonObject.put("g", g);
jsonObject.put("b", b);
jsonObject.put("radius", radius);
jsonObject.put("offset_x", offset_x);
jsonObject.put("offset_y", offset_y);
return jsonObject.toString();
} catch (Exception e) {
e.printStackTrace();