save code
This commit is contained in:
@@ -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.
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user