Revision 7a5e538a
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/library/mesh/MeshBase.java | ||
---|---|---|
34 | 34 |
* Abstract class which represents a Mesh, i.e. an array of vertices (rendered as a TRIANGLE_STRIP) |
35 | 35 |
* <p> |
36 | 36 |
* If you want to render to a particular shape, extend from here, construct a float array |
37 |
* containing per-vertex attributes, and call back setData().
|
|
37 |
* containing per-vertex attributes, and call back setAttribs().
|
|
38 | 38 |
*/ |
39 | 39 |
public abstract class MeshBase |
40 | 40 |
{ |
... | ... | |
42 | 42 |
private static final int POS_DATA_SIZE= 3; // vertex coordinates: x,y,z |
43 | 43 |
private static final int NOR_DATA_SIZE= 3; // normal vector: x,y,z |
44 | 44 |
private static final int INF_DATA_SIZE= 3; // 'inflate' vector: x,y,z |
45 |
private static final int TEX_DATA_SIZE= 2; // texture coordinates |
|
45 |
private static final int TEX_DATA_SIZE= 2; // texture coordinates: s,t
|
|
46 | 46 |
|
47 | 47 |
static final int POS_ATTRIB = 0; |
48 | 48 |
static final int NOR_ATTRIB = POS_DATA_SIZE; |
... | ... | |
66 | 66 |
// of the Mesh. Used in DistortedEffects. See DistortedTexture.getDepth(). |
67 | 67 |
private int mNumVertices; |
68 | 68 |
private FloatBuffer mVertAttribs; // packed: PosX,PosY,PosZ, NorX,NorY,NorZ, InfX,InfY,InfZ, TexS,TexT |
69 |
private float mInflate; |
|
69 | 70 |
|
70 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
71 | 72 |
|
... | ... | |
154 | 155 |
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, 0); |
155 | 156 |
} |
156 | 157 |
|
158 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
159 |
/** |
|
160 |
* Not part of public API, do not document (public only because has to be used from the main package) |
|
161 |
* |
|
162 |
* @y.exclude |
|
163 |
*/ |
|
164 |
public void setInflate(float inflate) |
|
165 |
{ |
|
166 |
mInflate = inflate; |
|
167 |
} |
|
168 |
|
|
169 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
170 |
/** |
|
171 |
* Not part of public API, do not document (public only because has to be used from the main package) |
|
172 |
* |
|
173 |
* @y.exclude |
|
174 |
*/ |
|
175 |
public float getInflate() |
|
176 |
{ |
|
177 |
return mInflate; |
|
178 |
} |
|
179 |
|
|
157 | 180 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
158 | 181 |
// PUBLIC API |
159 | 182 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with Inflate (building block of postprocessing effects: the proper way of marking a halo around a Mesh)
'Inflate' app testing the machanism. MeshFlat appears to be working, now we only need to fill up the per-vertex Inflate vector in the MeshCubes.