29 |
import java.util.ArrayList; |
import java.util.ArrayList; |
30 |
|
|
31 |
/** The interface to the paper library. |
/** The interface to the paper library. |
32 |
|
* This interface is relatively low-level, just to make it |
33 |
|
* map as easily as possible to the JNI code. |
34 |
|
* For all array-type things (X), there are the methods setNX, getNX |
35 |
|
* and also some (possibly different, for using derived |
36 |
|
* classes) putX methods. |
37 |
|
* <p> |
38 |
|
* For example, the paper contains the Passes array, |
39 |
|
* so there are the methods getNPasses() and setNPasses(int i). |
40 |
|
* The passes are all of the same type so they are automatically |
41 |
|
* added as empties - getPass gives the Pass object to use |
42 |
|
* to place stuff into the pass. |
43 |
*/ |
*/ |
44 |
public class Paper implements GLDeletable { |
public class Paper implements GLDeletable { |
45 |
public static boolean dbg = true; |
public static boolean dbg = true; |
65 |
depends.add(o); |
depends.add(o); |
66 |
} |
} |
67 |
|
|
68 |
|
/** A class representing a single rendering pass |
69 |
|
* of a paper. |
70 |
|
* A pass contains the two CallGL codes Setupcode and Teardowncode, |
71 |
|
* and the following arrays: |
72 |
|
* IndirectTextureBinds, TexGens, LightSetups. |
73 |
|
* |
74 |
|
*/ |
75 |
public class Pass { |
public class Pass { |
76 |
private int index; |
private int index; |
77 |
private Pass(int index) { this.index = index; } |
private Pass(int index) { this.index = index; } |
78 |
|
|
79 |
|
public void setNIndirectTextureBinds(int n) { impl_Pass_setNIndirectTextureBinds(c_id, index, n); } |
80 |
|
|
81 |
|
public int getNIndirectTextureBinds() { return impl_Pass_getNIndirectTextureBinds(c_id, index); } |
82 |
|
|
83 |
public int getNTexGens() { return impl_Pass_getNTexGens(c_id, index); } |
public int getNTexGens() { return impl_Pass_getNTexGens(c_id, index); } |
84 |
public void setNTexGens(int n) { impl_Pass_setNTexGens(c_id, index, n); } |
public void setNTexGens(int n) { impl_Pass_setNTexGens(c_id, index, n); } |
85 |
|
|
102 |
impl_Pass_putEmbossTexGen(c_id, index, ind, matrix, eps); |
impl_Pass_putEmbossTexGen(c_id, index, ind, matrix, eps); |
103 |
} |
} |
104 |
|
|
105 |
|
/** Put an instruction to bind an indirect texture |
106 |
|
* for this pass. |
107 |
|
* The GL.IndirectTexture object is automatically |
108 |
|
* added to the depends array. |
109 |
|
* @param ind The index of the indirect texture bind instruction to put |
110 |
|
* @param activeTexture The GL token string (without the GL_ prefix) |
111 |
|
* for which texture to call glActiveTextureARB |
112 |
|
* for. E.g. "TEXTURE1_ARB" |
113 |
|
* @param textureTarget The GL token string (w.o. GL_) for |
114 |
|
* which texture target to bind. |
115 |
|
* E.g. "TEXTURE_3D" |
116 |
|
* @param indirectTexture The indirect texture to bind. |
117 |
|
*/ |
118 |
|
public void putIndirectTextureBind(int ind, |
119 |
|
String activeTexture, String textureTarget, |
120 |
|
GL.IndirectTexture indirectTexture) { |
121 |
|
if(ind < 0 || ind >= getNIndirectTextureBinds()) |
122 |
|
throw new ArrayIndexOutOfBoundsException(ind); |
123 |
|
addDepend(indirectTexture); |
124 |
|
impl_Pass_putIndirectTextureBind(c_id, index, ind, |
125 |
|
activeTexture, textureTarget, |
126 |
|
indirectTexture.getIndirectTextureId()); |
127 |
|
} |
128 |
|
|
129 |
/** Add an object on whose C++ representation this paper |
/** Add an object on whose C++ representation this paper |
130 |
* depends. For instance, if one of the setup codes uses |
* depends. For instance, if one of the setup codes uses |
131 |
* a texture id of a given GL.Texture object, then that |
* a texture id of a given GL.Texture object, then that |
190 |
|
|
191 |
static private native void impl_Pass_putNormalTexGen(int pid, int pass, int ind, float[] matrix) ; |
static private native void impl_Pass_putNormalTexGen(int pid, int pass, int ind, float[] matrix) ; |
192 |
static private native void impl_Pass_putEmbossTexGen(int pid, int pass, int ind, float[] matrix, float eps) ; |
static private native void impl_Pass_putEmbossTexGen(int pid, int pass, int ind, float[] matrix, float eps) ; |
193 |
|
|
194 |
|
static private native void impl_Pass_setNIndirectTextureBinds(int pid, int pass, int n); |
195 |
|
static private native int impl_Pass_getNIndirectTextureBinds(int pid, int pass); |
196 |
|
static private native void impl_Pass_putIndirectTextureBind(int pid, int pass, int ind, String activeTexture, String textureTarget, int indirectTextureId); |
197 |
} |
} |