Repository navigation
Expand file tree
/
Copy pathShaderRenderer.java
More file actions
88 lines (67 loc) · 2.1 KB
/
Copy pathShaderRenderer.java
File metadata and controls
88 lines (67 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import processing.opengl.PGraphicsOpenGL;
import processing.opengl.PShader;
public class ShaderRenderer {
String filename;
/*
y+=h+hMargin;
addControlFloatParameter(this,"edgeX",0,1, x, y, incrementalTab,null);
y+=h+hMargin;
addControlFloatParameter(this,"edgeY",0,1, x, y, incrementalTab,null);
y+=h+hMargin;
addControlFloatParameter(this,"edgeRatio",0,1, x, y, incrementalTab,null);
y+=h+hMargin;
y+=hMargin+3*(h+hMargin);
*/
//public FloatParameter edgeX = new FloatParameter(this,0,0,1,"edgeX");
//public FloatParameter edgeY = new FloatParameter(this,0,0,1,"edgeY");
//public FloatParameter edgeRatio = new FloatParameter(this,1,0,1,"edgeRatio");
ShaderRenderer(Application app,PGraphicsOpenGL pgl,String filename){
this.app=app;
this.pgl=pgl;
this.filename=filename;
try{
/*if(new File(filename).exists()){
filename = "file://"+new File(filename).getCanonicalPath();
}else if(new File("Contents/Resources/Java/"+filename).exists()){
filename = "file://"+new File("Contents/Resources/Java/"+filename).getPath();
}else{
filename= "file://"+filename;
}*/
shader = pgl.loadShader(filename);
/*String content = "";
BufferedReader in = new BufferedReader(new FileReader(new File(filename)));
String str;
while ((str = in.readLine()) != null) {
content += str + "\n";
}
in.close();
shader.vertexShaderSource = content;
*/
//pgl.setShader(shader, shaderType);
}catch(Exception e){
e.printStackTrace();
}
}
PShader shader;
Application app;
PGraphicsOpenGL pgl;
public void update(){
//if(app.frameCount%100==0)shader = pgl.loadShader(filename, shaderType);
//float x=0;
//float y=0;
//float ratio=0;
//Layer layer = app.layers[0];
/*if(layer instanceof LayerNineBlockPattern){
ShaderRenderer p = ((ShaderRenderer)layer);
if(p!=null){
ratio=p.edgeRatio.v();
x=p.edgeX.v();
y=p.edgeY.v();
}
shader.set("x",x);
shader.set("y", y);
shader.set("ratio", ratio);
pgl.shader(shader);
}*/
}
}