1 |
d333eb6b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2016 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
46b572b5
|
Leszek Koltunski
|
// This file is part of Distorted. //
|
5 |
d333eb6b
|
Leszek Koltunski
|
// //
|
6 |
46b572b5
|
Leszek Koltunski
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
d333eb6b
|
Leszek Koltunski
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
46b572b5
|
Leszek Koltunski
|
// Distorted is distributed in the hope that it will be useful, //
|
12 |
d333eb6b
|
Leszek Koltunski
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
46b572b5
|
Leszek Koltunski
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
d333eb6b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
6c00149d
|
Leszek Koltunski
|
package org.distorted.library.mesh;
|
21 |
6a06a912
|
Leszek Koltunski
|
|
22 |
b7074bc6
|
Leszek Koltunski
|
import android.opengl.GLES30;
|
23 |
e8925fcd
|
Leszek Koltunski
|
import android.opengl.Matrix;
|
24 |
f046b159
|
Leszek Koltunski
|
import android.util.Log;
|
25 |
6c00149d
|
Leszek Koltunski
|
|
26 |
e8925fcd
|
Leszek Koltunski
|
import org.distorted.library.effect.MatrixEffect;
|
27 |
f046b159
|
Leszek Koltunski
|
import org.distorted.library.effect.VertexEffect;
|
28 |
36d65d88
|
Leszek Koltunski
|
import org.distorted.library.effectqueue.EffectQueue;
|
29 |
7602a827
|
Leszek Koltunski
|
import org.distorted.library.main.InternalBuffer;
|
30 |
da681e7e
|
Leszek Koltunski
|
import org.distorted.library.program.DistortedProgram;
|
31 |
a3a05347
|
Leszek Koltunski
|
import org.distorted.library.type.Static4D;
|
32 |
6c00149d
|
Leszek Koltunski
|
|
33 |
10836924
|
Leszek Koltunski
|
import java.io.InputStream;
|
34 |
|
|
import java.io.OutputStream;
|
35 |
f046b159
|
Leszek Koltunski
|
import java.nio.ByteBuffer;
|
36 |
|
|
import java.nio.ByteOrder;
|
37 |
|
|
import java.nio.FloatBuffer;
|
38 |
c90aca24
|
Leszek Koltunski
|
import java.util.ArrayList;
|
39 |
6a06a912
|
Leszek Koltunski
|
|
40 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
41 |
e0b6c593
|
Leszek Koltunski
|
/**
|
42 |
e5ba319d
|
Leszek Koltunski
|
* Abstract class which represents a Mesh, ie an array of vertices (rendered as a TRIANGLE_STRIP).
|
43 |
e0b6c593
|
Leszek Koltunski
|
* <p>
|
44 |
da681e7e
|
Leszek Koltunski
|
* If you want to render to a particular shape, extend from here, construct a float array
|
45 |
7a5e538a
|
Leszek Koltunski
|
* containing per-vertex attributes, and call back setAttribs().
|
46 |
e0b6c593
|
Leszek Koltunski
|
*/
|
47 |
715e7726
|
Leszek Koltunski
|
public abstract class MeshBase
|
48 |
6a06a912
|
Leszek Koltunski
|
{
|
49 |
e8925fcd
|
Leszek Koltunski
|
private static final int MAX_EFFECT_COMPONENTS= 100;
|
50 |
07206c71
|
Leszek Koltunski
|
private static final int DEFAULT_ASSOCIATION = 0xffffffff;
|
51 |
bc208a9c
|
Leszek Koltunski
|
|
52 |
227b9bca
|
Leszek Koltunski
|
// sizes of attributes of an individual vertex.
|
53 |
|
|
private static final int POS_DATA_SIZE= 3; // vertex coordinates: x,y,z
|
54 |
|
|
private static final int NOR_DATA_SIZE= 3; // normal vector: x,y,z
|
55 |
|
|
private static final int INF_DATA_SIZE= 3; // 'inflate' vector: x,y,z
|
56 |
7a5e538a
|
Leszek Koltunski
|
private static final int TEX_DATA_SIZE= 2; // texture coordinates: s,t
|
57 |
36d65d88
|
Leszek Koltunski
|
private static final int COM_DATA_SIZE= 1; // component number, a single float
|
58 |
6f2d931d
|
Leszek Koltunski
|
|
59 |
|
|
static final int POS_ATTRIB = 0;
|
60 |
|
|
static final int NOR_ATTRIB = POS_DATA_SIZE;
|
61 |
|
|
static final int INF_ATTRIB = POS_DATA_SIZE + NOR_DATA_SIZE;
|
62 |
e54bfada
|
Leszek Koltunski
|
static final int TEX_ATTRIB = 0;
|
63 |
36d65d88
|
Leszek Koltunski
|
static final int COM_ATTRIB = TEX_DATA_SIZE;
|
64 |
bc208a9c
|
Leszek Koltunski
|
|
65 |
e54bfada
|
Leszek Koltunski
|
static final int VERT1_ATTRIBS= POS_DATA_SIZE + NOR_DATA_SIZE + INF_DATA_SIZE; // number of attributes of a vertex (the part changed by preapply)
|
66 |
36d65d88
|
Leszek Koltunski
|
static final int VERT2_ATTRIBS= TEX_DATA_SIZE + COM_DATA_SIZE; // number of attributes of a vertex (the 'preapply invariant' part)
|
67 |
e54bfada
|
Leszek Koltunski
|
static final int TRAN_ATTRIBS = POS_DATA_SIZE + NOR_DATA_SIZE + INF_DATA_SIZE; // number of attributes of a transform feedback vertex
|
68 |
6a06a912
|
Leszek Koltunski
|
|
69 |
da681e7e
|
Leszek Koltunski
|
private static final int BYTES_PER_FLOAT = 4;
|
70 |
3ef3364d
|
Leszek Koltunski
|
|
71 |
6f2d931d
|
Leszek Koltunski
|
private static final int OFFSET_POS = POS_ATTRIB*BYTES_PER_FLOAT;
|
72 |
|
|
private static final int OFFSET_NOR = NOR_ATTRIB*BYTES_PER_FLOAT;
|
73 |
|
|
private static final int OFFSET_INF = INF_ATTRIB*BYTES_PER_FLOAT;
|
74 |
|
|
private static final int OFFSET_TEX = TEX_ATTRIB*BYTES_PER_FLOAT;
|
75 |
36d65d88
|
Leszek Koltunski
|
private static final int OFFSET_COM = COM_ATTRIB*BYTES_PER_FLOAT;
|
76 |
bc208a9c
|
Leszek Koltunski
|
|
77 |
227b9bca
|
Leszek Koltunski
|
private static final int TRAN_SIZE = TRAN_ATTRIBS*BYTES_PER_FLOAT;
|
78 |
e54bfada
|
Leszek Koltunski
|
private static final int VERT1_SIZE = VERT1_ATTRIBS*BYTES_PER_FLOAT;
|
79 |
|
|
private static final int VERT2_SIZE = VERT2_ATTRIBS*BYTES_PER_FLOAT;
|
80 |
a51fe521
|
Leszek Koltunski
|
|
81 |
e54bfada
|
Leszek Koltunski
|
private boolean mShowNormals; // when rendering this mesh, draw normal vectors?
|
82 |
|
|
private InternalBuffer mVBO1, mVBO2, mTFO; // main vertex buffer and transform feedback buffer
|
83 |
da681e7e
|
Leszek Koltunski
|
private int mNumVertices;
|
84 |
e54bfada
|
Leszek Koltunski
|
private float[] mVertAttribs1; // packed: PosX,PosY,PosZ, NorX,NorY,NorZ, InfX,InfY,InfZ
|
85 |
36d65d88
|
Leszek Koltunski
|
private float[] mVertAttribs2; // packed: TexS,TexT, Component
|
86 |
7a5e538a
|
Leszek Koltunski
|
private float mInflate;
|
87 |
2aeb75aa
|
Leszek Koltunski
|
private int[] mEquAssociation;
|
88 |
|
|
private int[] mAndAssociation;
|
89 |
36d65d88
|
Leszek Koltunski
|
|
90 |
71d8aba1
|
Leszek Koltunski
|
DeferredJobs.JobNode[] mJobNode;
|
91 |
07206c71
|
Leszek Koltunski
|
|
92 |
2aeb75aa
|
Leszek Koltunski
|
private static int[] mEquAssociationH = new int[EffectQueue.MAIN_VARIANTS];
|
93 |
|
|
private static int[] mAndAssociationH = new int[EffectQueue.MAIN_VARIANTS];
|
94 |
3ef3364d
|
Leszek Koltunski
|
|
95 |
e8925fcd
|
Leszek Koltunski
|
private static class TexComponent
|
96 |
c90aca24
|
Leszek Koltunski
|
{
|
97 |
|
|
private int mEndIndex;
|
98 |
a3a05347
|
Leszek Koltunski
|
private Static4D mTextureMap;
|
99 |
c90aca24
|
Leszek Koltunski
|
|
100 |
e8925fcd
|
Leszek Koltunski
|
TexComponent(int end)
|
101 |
c90aca24
|
Leszek Koltunski
|
{
|
102 |
a3a05347
|
Leszek Koltunski
|
mEndIndex = end;
|
103 |
|
|
mTextureMap= new Static4D(0,0,1,1);
|
104 |
c90aca24
|
Leszek Koltunski
|
}
|
105 |
e8925fcd
|
Leszek Koltunski
|
TexComponent(TexComponent original)
|
106 |
c90aca24
|
Leszek Koltunski
|
{
|
107 |
|
|
mEndIndex = original.mEndIndex;
|
108 |
a3a05347
|
Leszek Koltunski
|
|
109 |
|
|
float x = original.mTextureMap.get0();
|
110 |
|
|
float y = original.mTextureMap.get1();
|
111 |
|
|
float z = original.mTextureMap.get2();
|
112 |
|
|
float w = original.mTextureMap.get3();
|
113 |
|
|
mTextureMap = new Static4D(x,y,z,w);
|
114 |
0d4aae88
|
Leszek Koltunski
|
}
|
115 |
|
|
|
116 |
a3a05347
|
Leszek Koltunski
|
void setMap(Static4D map)
|
117 |
0d4aae88
|
Leszek Koltunski
|
{
|
118 |
a3a05347
|
Leszek Koltunski
|
mTextureMap.set(map.get0(),map.get1(),map.get2(),map.get3());
|
119 |
c90aca24
|
Leszek Koltunski
|
}
|
120 |
|
|
}
|
121 |
|
|
|
122 |
e8925fcd
|
Leszek Koltunski
|
private ArrayList<TexComponent> mTexComponent;
|
123 |
|
|
private ArrayList<Integer> mEffComponent;
|
124 |
c90aca24
|
Leszek Koltunski
|
|
125 |
6a06a912
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
126 |
3ef3364d
|
Leszek Koltunski
|
|
127 |
0f10a0b6
|
Leszek Koltunski
|
MeshBase()
|
128 |
3ef3364d
|
Leszek Koltunski
|
{
|
129 |
e8925fcd
|
Leszek Koltunski
|
mShowNormals = false;
|
130 |
|
|
mInflate = 0.0f;
|
131 |
|
|
mTexComponent = new ArrayList<>();
|
132 |
|
|
mEffComponent = new ArrayList<>();
|
133 |
|
|
|
134 |
|
|
mEquAssociation= new int[MAX_EFFECT_COMPONENTS];
|
135 |
|
|
mAndAssociation= new int[MAX_EFFECT_COMPONENTS];
|
136 |
36d65d88
|
Leszek Koltunski
|
|
137 |
71d8aba1
|
Leszek Koltunski
|
mJobNode = new DeferredJobs.JobNode[1];
|
138 |
|
|
|
139 |
e8925fcd
|
Leszek Koltunski
|
for(int i=0; i<MAX_EFFECT_COMPONENTS; i++)
|
140 |
2aeb75aa
|
Leszek Koltunski
|
{
|
141 |
|
|
mAndAssociation[i] = DEFAULT_ASSOCIATION;
|
142 |
|
|
mEquAssociation[i] = i;
|
143 |
|
|
}
|
144 |
4f81e0c8
|
Leszek Koltunski
|
|
145 |
e54bfada
|
Leszek Koltunski
|
mVBO1= new InternalBuffer(GLES30.GL_ARRAY_BUFFER , GLES30.GL_STATIC_READ);
|
146 |
|
|
mVBO2= new InternalBuffer(GLES30.GL_ARRAY_BUFFER , GLES30.GL_STATIC_READ);
|
147 |
b7074bc6
|
Leszek Koltunski
|
mTFO = new InternalBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, GLES30.GL_STATIC_READ);
|
148 |
c90aca24
|
Leszek Koltunski
|
}
|
149 |
|
|
|
150 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
151 |
|
|
// copy constructor
|
152 |
|
|
|
153 |
4f81e0c8
|
Leszek Koltunski
|
MeshBase(MeshBase original, boolean deep)
|
154 |
c90aca24
|
Leszek Koltunski
|
{
|
155 |
1fad573e
|
Leszek Koltunski
|
mShowNormals= original.mShowNormals;
|
156 |
|
|
mInflate = original.mInflate;
|
157 |
|
|
mNumVertices= original.mNumVertices;
|
158 |
42571056
|
Leszek Koltunski
|
|
159 |
e8925fcd
|
Leszek Koltunski
|
mAndAssociation= new int[MAX_EFFECT_COMPONENTS];
|
160 |
|
|
System.arraycopy(original.mAndAssociation, 0, mAndAssociation, 0, MAX_EFFECT_COMPONENTS);
|
161 |
|
|
mEquAssociation= new int[MAX_EFFECT_COMPONENTS];
|
162 |
|
|
System.arraycopy(original.mEquAssociation, 0, mEquAssociation, 0, MAX_EFFECT_COMPONENTS);
|
163 |
36d65d88
|
Leszek Koltunski
|
|
164 |
4f81e0c8
|
Leszek Koltunski
|
if( deep )
|
165 |
|
|
{
|
166 |
71d8aba1
|
Leszek Koltunski
|
mJobNode = new DeferredJobs.JobNode[1];
|
167 |
1fad573e
|
Leszek Koltunski
|
if( original.mJobNode[0]==null ) copy(original);
|
168 |
|
|
else mJobNode[0] = DeferredJobs.copy(this,original);
|
169 |
4f81e0c8
|
Leszek Koltunski
|
}
|
170 |
|
|
else
|
171 |
|
|
{
|
172 |
71d8aba1
|
Leszek Koltunski
|
mJobNode = original.mJobNode;
|
173 |
|
|
mVBO1 = original.mVBO1;
|
174 |
|
|
mVertAttribs1 = original.mVertAttribs1;
|
175 |
1fad573e
|
Leszek Koltunski
|
shallowCopy(original);
|
176 |
4f81e0c8
|
Leszek Koltunski
|
}
|
177 |
cbd502ec
|
Leszek Koltunski
|
|
178 |
4f81e0c8
|
Leszek Koltunski
|
mTFO = new InternalBuffer(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, GLES30.GL_STATIC_READ);
|
179 |
cbd502ec
|
Leszek Koltunski
|
mTFO.invalidate();
|
180 |
42571056
|
Leszek Koltunski
|
}
|
181 |
|
|
|
182 |
36d65d88
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
183 |
|
|
|
184 |
1fad573e
|
Leszek Koltunski
|
void copy(MeshBase original)
|
185 |
36d65d88
|
Leszek Koltunski
|
{
|
186 |
1fad573e
|
Leszek Koltunski
|
shallowCopy(original);
|
187 |
|
|
|
188 |
|
|
mVBO1= new InternalBuffer(GLES30.GL_ARRAY_BUFFER, GLES30.GL_STATIC_READ);
|
189 |
|
|
mVertAttribs1= new float[mNumVertices*VERT1_ATTRIBS];
|
190 |
|
|
System.arraycopy(original.mVertAttribs1,0,mVertAttribs1,0,mNumVertices*VERT1_ATTRIBS);
|
191 |
|
|
mVBO1.invalidate();
|
192 |
36d65d88
|
Leszek Koltunski
|
}
|
193 |
|
|
|
194 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
195 |
|
|
|
196 |
1fad573e
|
Leszek Koltunski
|
private void shallowCopy(MeshBase original)
|
197 |
36d65d88
|
Leszek Koltunski
|
{
|
198 |
e8925fcd
|
Leszek Koltunski
|
int texComSize = original.mTexComponent.size();
|
199 |
|
|
mTexComponent = new ArrayList<>();
|
200 |
36d65d88
|
Leszek Koltunski
|
|
201 |
e8925fcd
|
Leszek Koltunski
|
for(int i=0; i<texComSize; i++)
|
202 |
1fad573e
|
Leszek Koltunski
|
{
|
203 |
e8925fcd
|
Leszek Koltunski
|
TexComponent comp = new TexComponent(original.mTexComponent.get(i));
|
204 |
|
|
mTexComponent.add(comp);
|
205 |
1fad573e
|
Leszek Koltunski
|
}
|
206 |
f4c5a46e
|
Leszek Koltunski
|
|
207 |
e8925fcd
|
Leszek Koltunski
|
mEffComponent = new ArrayList<>();
|
208 |
|
|
mEffComponent.addAll(original.mEffComponent);
|
209 |
|
|
|
210 |
1fad573e
|
Leszek Koltunski
|
mVBO2= new InternalBuffer(GLES30.GL_ARRAY_BUFFER, GLES30.GL_STATIC_READ);
|
211 |
|
|
mVertAttribs2= new float[mNumVertices*VERT2_ATTRIBS];
|
212 |
|
|
System.arraycopy(original.mVertAttribs2,0,mVertAttribs2,0,mNumVertices*VERT2_ATTRIBS);
|
213 |
|
|
mVBO2.invalidate();
|
214 |
f4c5a46e
|
Leszek Koltunski
|
}
|
215 |
|
|
|
216 |
a8dfedcc
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
217 |
|
|
|
218 |
e8925fcd
|
Leszek Koltunski
|
void mergeTexComponentsNow()
|
219 |
a8dfedcc
|
Leszek Koltunski
|
{
|
220 |
e8925fcd
|
Leszek Koltunski
|
int num = mTexComponent.size();
|
221 |
a8dfedcc
|
Leszek Koltunski
|
|
222 |
|
|
if( num>1 )
|
223 |
|
|
{
|
224 |
e8925fcd
|
Leszek Koltunski
|
mTexComponent.clear();
|
225 |
|
|
mTexComponent.add(new TexComponent(mNumVertices-1));
|
226 |
|
|
|
227 |
|
|
mVBO2.invalidate();
|
228 |
|
|
}
|
229 |
|
|
}
|
230 |
|
|
|
231 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
232 |
|
|
|
233 |
|
|
void mergeEffComponentsNow()
|
234 |
|
|
{
|
235 |
|
|
int num = mEffComponent.size();
|
236 |
|
|
|
237 |
|
|
if( num>1 )
|
238 |
|
|
{
|
239 |
|
|
mEffComponent.clear();
|
240 |
|
|
mEffComponent.add(mNumVertices-1);
|
241 |
a8dfedcc
|
Leszek Koltunski
|
|
242 |
|
|
for(int index=0; index<mNumVertices; index++)
|
243 |
|
|
{
|
244 |
|
|
mVertAttribs2[VERT2_ATTRIBS*index+COM_ATTRIB] = 0;
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
mVBO2.invalidate();
|
248 |
|
|
}
|
249 |
|
|
}
|
250 |
|
|
|
251 |
0d4aae88
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
252 |
|
|
|
253 |
e8925fcd
|
Leszek Koltunski
|
void applyMatrix(MatrixEffect effect, int andAssoc, int equAssoc)
|
254 |
|
|
{
|
255 |
|
|
float[] matrix = new float[16];
|
256 |
|
|
float[] uniforms = new float[7];
|
257 |
|
|
int start, end=-1, numComp = mEffComponent.size();
|
258 |
|
|
|
259 |
|
|
Matrix.setIdentityM(matrix,0);
|
260 |
|
|
effect.compute(uniforms,0,0,0);
|
261 |
|
|
effect.apply(matrix, uniforms, 0);
|
262 |
|
|
|
263 |
|
|
for(int i=0; i<numComp; i++)
|
264 |
|
|
{
|
265 |
f45e4279
|
Leszek Koltunski
|
start = end+1;
|
266 |
e8925fcd
|
Leszek Koltunski
|
end = mEffComponent.get(i);
|
267 |
|
|
|
268 |
|
|
if( (andAssoc & mAndAssociation[i]) != 0 || (equAssoc == mEquAssociation[i]) )
|
269 |
|
|
{
|
270 |
f45e4279
|
Leszek Koltunski
|
applyMatrixToComponent(matrix,start,end);
|
271 |
e8925fcd
|
Leszek Koltunski
|
}
|
272 |
|
|
}
|
273 |
|
|
|
274 |
|
|
mVBO1.invalidate();
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
278 |
|
|
|
279 |
|
|
private void applyMatrixToComponent(float[] matrix, int start, int end)
|
280 |
|
|
{
|
281 |
|
|
float x,y,z;
|
282 |
|
|
|
283 |
f45e4279
|
Leszek Koltunski
|
for(int index=start*VERT1_ATTRIBS; index<=end*VERT1_ATTRIBS; index+=VERT1_ATTRIBS )
|
284 |
e8925fcd
|
Leszek Koltunski
|
{
|
285 |
|
|
x = mVertAttribs1[index+POS_ATTRIB ];
|
286 |
|
|
y = mVertAttribs1[index+POS_ATTRIB+1];
|
287 |
|
|
z = mVertAttribs1[index+POS_ATTRIB+2];
|
288 |
|
|
|
289 |
|
|
mVertAttribs1[index+POS_ATTRIB ] = matrix[0]*x + matrix[4]*y + matrix[ 8]*z + matrix[12];
|
290 |
|
|
mVertAttribs1[index+POS_ATTRIB+1] = matrix[1]*x + matrix[5]*y + matrix[ 9]*z + matrix[13];
|
291 |
|
|
mVertAttribs1[index+POS_ATTRIB+2] = matrix[2]*x + matrix[6]*y + matrix[10]*z + matrix[14];
|
292 |
|
|
|
293 |
|
|
x = mVertAttribs1[index+NOR_ATTRIB ];
|
294 |
|
|
y = mVertAttribs1[index+NOR_ATTRIB+1];
|
295 |
|
|
z = mVertAttribs1[index+NOR_ATTRIB+2];
|
296 |
|
|
|
297 |
|
|
mVertAttribs1[index+NOR_ATTRIB ] = matrix[0]*x + matrix[4]*y + matrix[ 8]*z;
|
298 |
|
|
mVertAttribs1[index+NOR_ATTRIB+1] = matrix[1]*x + matrix[5]*y + matrix[ 9]*z;
|
299 |
|
|
mVertAttribs1[index+NOR_ATTRIB+2] = matrix[2]*x + matrix[6]*y + matrix[10]*z;
|
300 |
|
|
|
301 |
|
|
x = mVertAttribs1[index+INF_ATTRIB ];
|
302 |
|
|
y = mVertAttribs1[index+INF_ATTRIB+1];
|
303 |
|
|
z = mVertAttribs1[index+INF_ATTRIB+2];
|
304 |
|
|
|
305 |
|
|
mVertAttribs1[index+INF_ATTRIB ] = matrix[0]*x + matrix[4]*y + matrix[ 8]*z;
|
306 |
|
|
mVertAttribs1[index+INF_ATTRIB+1] = matrix[1]*x + matrix[5]*y + matrix[ 9]*z;
|
307 |
|
|
mVertAttribs1[index+INF_ATTRIB+2] = matrix[2]*x + matrix[6]*y + matrix[10]*z;
|
308 |
|
|
}
|
309 |
|
|
}
|
310 |
|
|
|
311 |
26671ef8
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
312 |
|
|
|
313 |
|
|
void setEffectAssociationNow(int component, int andAssociation, int equAssociation)
|
314 |
|
|
{
|
315 |
|
|
mAndAssociation[component] = andAssociation;
|
316 |
|
|
mEquAssociation[component] = equAssociation;
|
317 |
|
|
}
|
318 |
|
|
|
319 |
e8925fcd
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
320 |
|
|
|
321 |
|
|
int numTexComponents()
|
322 |
|
|
{
|
323 |
|
|
return mTexComponent.size();
|
324 |
|
|
}
|
325 |
|
|
|
326 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
327 |
|
|
|
328 |
|
|
int numEffComponents()
|
329 |
0d4aae88
|
Leszek Koltunski
|
{
|
330 |
e8925fcd
|
Leszek Koltunski
|
return mEffComponent.size();
|
331 |
0d4aae88
|
Leszek Koltunski
|
}
|
332 |
|
|
|
333 |
42571056
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
334 |
6c00149d
|
Leszek Koltunski
|
// when a derived class is done computing its mesh, it has to call this method.
|
335 |
42571056
|
Leszek Koltunski
|
|
336 |
e54bfada
|
Leszek Koltunski
|
void setAttribs(float[] vert1Attribs, float[] vert2Attribs)
|
337 |
42571056
|
Leszek Koltunski
|
{
|
338 |
e54bfada
|
Leszek Koltunski
|
mNumVertices = vert1Attribs.length/VERT1_ATTRIBS;
|
339 |
|
|
mVertAttribs1= vert1Attribs;
|
340 |
|
|
mVertAttribs2= vert2Attribs;
|
341 |
da681e7e
|
Leszek Koltunski
|
|
342 |
e8925fcd
|
Leszek Koltunski
|
mTexComponent.add(new TexComponent(mNumVertices-1));
|
343 |
|
|
mEffComponent.add(mNumVertices-1);
|
344 |
c90aca24
|
Leszek Koltunski
|
|
345 |
e54bfada
|
Leszek Koltunski
|
mVBO1.invalidate();
|
346 |
|
|
mVBO2.invalidate();
|
347 |
42571056
|
Leszek Koltunski
|
}
|
348 |
|
|
|
349 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
350 |
|
|
|
351 |
1fad573e
|
Leszek Koltunski
|
void joinAttribs(MeshBase[] meshes)
|
352 |
226144d0
|
leszek
|
{
|
353 |
0d4aae88
|
Leszek Koltunski
|
MeshBase mesh;
|
354 |
e8925fcd
|
Leszek Koltunski
|
TexComponent comp;
|
355 |
a8dfedcc
|
Leszek Koltunski
|
int numMeshes = meshes.length;
|
356 |
e8925fcd
|
Leszek Koltunski
|
int numVertices,origVertices = mNumVertices;
|
357 |
26671ef8
|
Leszek Koltunski
|
int origTexComponents,numTexComponents;
|
358 |
e8925fcd
|
Leszek Koltunski
|
int origEffComponents=0,numEffComponents;
|
359 |
044b5494
|
Leszek Koltunski
|
|
360 |
0d4aae88
|
Leszek Koltunski
|
if( origVertices>0 )
|
361 |
|
|
{
|
362 |
e8925fcd
|
Leszek Koltunski
|
origTexComponents = mTexComponent.size();
|
363 |
1fad573e
|
Leszek Koltunski
|
mNumVertices+= ( mNumVertices%2==1 ? 2:1 );
|
364 |
e8925fcd
|
Leszek Koltunski
|
mTexComponent.get(origTexComponents-1).mEndIndex = mNumVertices-1;
|
365 |
|
|
origEffComponents = mEffComponent.size();
|
366 |
|
|
mEffComponent.set(origEffComponents-1,mNumVertices-1);
|
367 |
0d4aae88
|
Leszek Koltunski
|
}
|
368 |
044b5494
|
Leszek Koltunski
|
|
369 |
e7f85322
|
Leszek Koltunski
|
for(int i=0; i<numMeshes; i++)
|
370 |
0d4aae88
|
Leszek Koltunski
|
{
|
371 |
|
|
mesh = meshes[i];
|
372 |
e8925fcd
|
Leszek Koltunski
|
numTexComponents = mesh.mTexComponent.size();
|
373 |
|
|
numEffComponents = mesh.mEffComponent.size();
|
374 |
36d65d88
|
Leszek Koltunski
|
numVertices = mesh.mNumVertices;
|
375 |
|
|
|
376 |
1fad573e
|
Leszek Koltunski
|
int extraVerticesBefore = mNumVertices==0 ? 0:1;
|
377 |
|
|
int extraVerticesAfter = (i==numMeshes-1) ? 0 : (numVertices%2==1 ? 2:1);
|
378 |
36d65d88
|
Leszek Koltunski
|
|
379 |
e8925fcd
|
Leszek Koltunski
|
for(int j=0; j<numTexComponents; j++)
|
380 |
0d4aae88
|
Leszek Koltunski
|
{
|
381 |
e8925fcd
|
Leszek Koltunski
|
comp = new TexComponent(mesh.mTexComponent.get(j));
|
382 |
e0343804
|
Leszek Koltunski
|
comp.mEndIndex += (extraVerticesBefore+mNumVertices);
|
383 |
|
|
if( j==numTexComponents-1) comp.mEndIndex += extraVerticesAfter;
|
384 |
e8925fcd
|
Leszek Koltunski
|
mTexComponent.add(comp);
|
385 |
|
|
}
|
386 |
23b733db
|
Leszek Koltunski
|
|
387 |
e8925fcd
|
Leszek Koltunski
|
for(int j=0; j<numEffComponents; j++)
|
388 |
|
|
{
|
389 |
|
|
int index = mesh.mEffComponent.get(j);
|
390 |
e0343804
|
Leszek Koltunski
|
index += (extraVerticesBefore+mNumVertices);
|
391 |
|
|
if( j==numEffComponents-1 ) index += extraVerticesAfter;
|
392 |
e8925fcd
|
Leszek Koltunski
|
mEffComponent.add(index);
|
393 |
|
|
|
394 |
|
|
if( origEffComponents<MAX_EFFECT_COMPONENTS )
|
395 |
36d65d88
|
Leszek Koltunski
|
{
|
396 |
e8925fcd
|
Leszek Koltunski
|
mAndAssociation[origEffComponents] = mesh.mAndAssociation[j];
|
397 |
|
|
mEquAssociation[origEffComponents] = mesh.mEquAssociation[j];
|
398 |
|
|
origEffComponents++;
|
399 |
36d65d88
|
Leszek Koltunski
|
}
|
400 |
e7f85322
|
Leszek Koltunski
|
}
|
401 |
a8dfedcc
|
Leszek Koltunski
|
|
402 |
1fad573e
|
Leszek Koltunski
|
mNumVertices += (extraVerticesBefore+numVertices+extraVerticesAfter);
|
403 |
|
|
}
|
404 |
a8dfedcc
|
Leszek Koltunski
|
|
405 |
1fad573e
|
Leszek Koltunski
|
float[] newAttribs1 = new float[VERT1_ATTRIBS*mNumVertices];
|
406 |
e54bfada
|
Leszek Koltunski
|
float[] newAttribs2 = new float[VERT2_ATTRIBS*mNumVertices];
|
407 |
1fad573e
|
Leszek Koltunski
|
numVertices = origVertices;
|
408 |
0d4aae88
|
Leszek Koltunski
|
|
409 |
|
|
if( origVertices>0 )
|
410 |
|
|
{
|
411 |
e8925fcd
|
Leszek Koltunski
|
System.arraycopy(mVertAttribs1, 0, newAttribs1, 0, VERT1_ATTRIBS*numVertices);
|
412 |
|
|
System.arraycopy(mVertAttribs1, VERT1_ATTRIBS*(origVertices-1), newAttribs1, VERT1_ATTRIBS*origVertices, VERT1_ATTRIBS );
|
413 |
|
|
System.arraycopy(mVertAttribs2, 0, newAttribs2, 0, VERT2_ATTRIBS*numVertices);
|
414 |
|
|
System.arraycopy(mVertAttribs2, VERT2_ATTRIBS*(origVertices-1), newAttribs2, VERT2_ATTRIBS*origVertices, VERT2_ATTRIBS );
|
415 |
0d4aae88
|
Leszek Koltunski
|
origVertices++;
|
416 |
|
|
|
417 |
e7f85322
|
Leszek Koltunski
|
if( numVertices%2==1 )
|
418 |
0d4aae88
|
Leszek Koltunski
|
{
|
419 |
1fad573e
|
Leszek Koltunski
|
System.arraycopy(mVertAttribs1, VERT1_ATTRIBS*(origVertices-1), newAttribs1, VERT1_ATTRIBS*origVertices, VERT1_ATTRIBS);
|
420 |
e54bfada
|
Leszek Koltunski
|
System.arraycopy(mVertAttribs2, VERT2_ATTRIBS*(origVertices-1), newAttribs2, VERT2_ATTRIBS*origVertices, VERT2_ATTRIBS);
|
421 |
0d4aae88
|
Leszek Koltunski
|
origVertices++;
|
422 |
|
|
}
|
423 |
|
|
}
|
424 |
|
|
|
425 |
e7f85322
|
Leszek Koltunski
|
for(int i=0; i<numMeshes; i++)
|
426 |
0d4aae88
|
Leszek Koltunski
|
{
|
427 |
|
|
mesh = meshes[i];
|
428 |
e7f85322
|
Leszek Koltunski
|
numVertices = mesh.mNumVertices;
|
429 |
0d4aae88
|
Leszek Koltunski
|
|
430 |
22e60fba
|
Leszek Koltunski
|
if( origVertices>0 )
|
431 |
|
|
{
|
432 |
e8925fcd
|
Leszek Koltunski
|
System.arraycopy(mesh.mVertAttribs1, 0, newAttribs1, VERT1_ATTRIBS*origVertices, VERT1_ATTRIBS);
|
433 |
|
|
System.arraycopy(mesh.mVertAttribs2, 0, newAttribs2, VERT2_ATTRIBS*origVertices, VERT2_ATTRIBS);
|
434 |
22e60fba
|
Leszek Koltunski
|
origVertices++;
|
435 |
|
|
}
|
436 |
1fad573e
|
Leszek Koltunski
|
System.arraycopy(mesh.mVertAttribs1, 0, newAttribs1, VERT1_ATTRIBS*origVertices, VERT1_ATTRIBS*numVertices);
|
437 |
e54bfada
|
Leszek Koltunski
|
System.arraycopy(mesh.mVertAttribs2, 0, newAttribs2, VERT2_ATTRIBS*origVertices, VERT2_ATTRIBS*numVertices);
|
438 |
e7f85322
|
Leszek Koltunski
|
origVertices+=numVertices;
|
439 |
0d4aae88
|
Leszek Koltunski
|
|
440 |
e7f85322
|
Leszek Koltunski
|
if( i<numMeshes-1 )
|
441 |
0d4aae88
|
Leszek Koltunski
|
{
|
442 |
1fad573e
|
Leszek Koltunski
|
System.arraycopy(mesh.mVertAttribs1, VERT1_ATTRIBS*(numVertices-1), newAttribs1, VERT1_ATTRIBS*origVertices, VERT1_ATTRIBS);
|
443 |
e54bfada
|
Leszek Koltunski
|
System.arraycopy(mesh.mVertAttribs2, VERT2_ATTRIBS*(numVertices-1), newAttribs2, VERT2_ATTRIBS*origVertices, VERT2_ATTRIBS);
|
444 |
0d4aae88
|
Leszek Koltunski
|
origVertices++;
|
445 |
|
|
|
446 |
e7f85322
|
Leszek Koltunski
|
if( numVertices%2==1 )
|
447 |
0d4aae88
|
Leszek Koltunski
|
{
|
448 |
1fad573e
|
Leszek Koltunski
|
System.arraycopy(mesh.mVertAttribs1, VERT1_ATTRIBS*(numVertices-1), newAttribs1, VERT1_ATTRIBS*origVertices, VERT1_ATTRIBS);
|
449 |
e54bfada
|
Leszek Koltunski
|
System.arraycopy(mesh.mVertAttribs2, VERT2_ATTRIBS*(numVertices-1), newAttribs2, VERT2_ATTRIBS*origVertices, VERT2_ATTRIBS);
|
450 |
0d4aae88
|
Leszek Koltunski
|
origVertices++;
|
451 |
|
|
}
|
452 |
|
|
}
|
453 |
|
|
}
|
454 |
|
|
|
455 |
|
|
if( origVertices!=mNumVertices )
|
456 |
|
|
{
|
457 |
|
|
android.util.Log.e("mesh", "join: origVertices: "+origVertices+" numVertices: "+mNumVertices);
|
458 |
|
|
}
|
459 |
|
|
|
460 |
e8925fcd
|
Leszek Koltunski
|
int endIndex, index=0, numEffComp = mEffComponent.size();
|
461 |
36d65d88
|
Leszek Koltunski
|
|
462 |
e8925fcd
|
Leszek Koltunski
|
for(int component=0; component<numEffComp; component++)
|
463 |
36d65d88
|
Leszek Koltunski
|
{
|
464 |
e8925fcd
|
Leszek Koltunski
|
endIndex = mEffComponent.get(component);
|
465 |
36d65d88
|
Leszek Koltunski
|
|
466 |
|
|
for( ; index<=endIndex; index++) newAttribs2[VERT2_ATTRIBS*index+COM_ATTRIB] = component;
|
467 |
|
|
}
|
468 |
|
|
|
469 |
1fad573e
|
Leszek Koltunski
|
mVertAttribs1 = newAttribs1;
|
470 |
e54bfada
|
Leszek Koltunski
|
mVertAttribs2 = newAttribs2;
|
471 |
1fad573e
|
Leszek Koltunski
|
mVBO1.invalidate();
|
472 |
e54bfada
|
Leszek Koltunski
|
mVBO2.invalidate();
|
473 |
23b733db
|
Leszek Koltunski
|
}
|
474 |
|
|
|
475 |
a8dfedcc
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
476 |
|
|
// called from MeshJoined
|
477 |
|
|
|
478 |
|
|
void join(MeshBase[] meshes)
|
479 |
|
|
{
|
480 |
1fad573e
|
Leszek Koltunski
|
boolean immediateJoin = true;
|
481 |
a8dfedcc
|
Leszek Koltunski
|
|
482 |
1fad573e
|
Leszek Koltunski
|
for (MeshBase mesh : meshes)
|
483 |
a8dfedcc
|
Leszek Koltunski
|
{
|
484 |
1fad573e
|
Leszek Koltunski
|
if (mesh.mJobNode[0] != null)
|
485 |
|
|
{
|
486 |
|
|
immediateJoin = false;
|
487 |
|
|
break;
|
488 |
|
|
}
|
489 |
a8dfedcc
|
Leszek Koltunski
|
}
|
490 |
|
|
|
491 |
1fad573e
|
Leszek Koltunski
|
if( immediateJoin ) joinAttribs(meshes);
|
492 |
|
|
else mJobNode[0] = DeferredJobs.join(this,meshes);
|
493 |
|
|
}
|
494 |
a8dfedcc
|
Leszek Koltunski
|
|
495 |
1fad573e
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
496 |
a8dfedcc
|
Leszek Koltunski
|
|
497 |
dbe3079d
|
Leszek Koltunski
|
void textureMap(Static4D[] maps, int startComponent)
|
498 |
1fad573e
|
Leszek Koltunski
|
{
|
499 |
e8925fcd
|
Leszek Koltunski
|
int num_comp = mTexComponent.size();
|
500 |
1fad573e
|
Leszek Koltunski
|
int num_maps = maps.length;
|
501 |
dbe3079d
|
Leszek Koltunski
|
int min = Math.min(num_comp-startComponent, num_maps);
|
502 |
96877ab4
|
Leszek Koltunski
|
int vertex = startComponent>0 ? mTexComponent.get(startComponent-1).mEndIndex+1 : 0;
|
503 |
1fad573e
|
Leszek Koltunski
|
Static4D newMap, oldMap;
|
504 |
e8925fcd
|
Leszek Koltunski
|
TexComponent comp;
|
505 |
1fad573e
|
Leszek Koltunski
|
float newW, newH, ratW, ratH, movX, movY;
|
506 |
a8dfedcc
|
Leszek Koltunski
|
|
507 |
1fad573e
|
Leszek Koltunski
|
for(int i=0; i<min; i++)
|
508 |
|
|
{
|
509 |
|
|
newMap = maps[i];
|
510 |
dbe3079d
|
Leszek Koltunski
|
comp = mTexComponent.get(i+startComponent);
|
511 |
1fad573e
|
Leszek Koltunski
|
|
512 |
|
|
if( newMap!=null )
|
513 |
a8dfedcc
|
Leszek Koltunski
|
{
|
514 |
1fad573e
|
Leszek Koltunski
|
newW = newMap.get2();
|
515 |
|
|
newH = newMap.get3();
|
516 |
a8dfedcc
|
Leszek Koltunski
|
|
517 |
1fad573e
|
Leszek Koltunski
|
if( newW!=0.0f && newH!=0.0f )
|
518 |
a8dfedcc
|
Leszek Koltunski
|
{
|
519 |
1fad573e
|
Leszek Koltunski
|
oldMap = comp.mTextureMap;
|
520 |
|
|
ratW = newW/oldMap.get2();
|
521 |
|
|
ratH = newH/oldMap.get3();
|
522 |
|
|
movX = newMap.get0() - ratW*oldMap.get0();
|
523 |
|
|
movY = newMap.get1() - ratH*oldMap.get1();
|
524 |
|
|
|
525 |
|
|
for( int index=vertex*VERT2_ATTRIBS+TEX_ATTRIB ; vertex<=comp.mEndIndex; vertex++, index+=VERT2_ATTRIBS)
|
526 |
|
|
{
|
527 |
|
|
mVertAttribs2[index ] = ratW*mVertAttribs2[index ] + movX;
|
528 |
|
|
mVertAttribs2[index+1] = ratH*mVertAttribs2[index+1] + movY;
|
529 |
|
|
}
|
530 |
|
|
comp.setMap(newMap);
|
531 |
a8dfedcc
|
Leszek Koltunski
|
}
|
532 |
|
|
}
|
533 |
|
|
|
534 |
1fad573e
|
Leszek Koltunski
|
vertex= comp.mEndIndex+1;
|
535 |
a8dfedcc
|
Leszek Koltunski
|
}
|
536 |
|
|
|
537 |
1fad573e
|
Leszek Koltunski
|
mVBO2.invalidate();
|
538 |
|
|
}
|
539 |
|
|
|
540 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
541 |
a8dfedcc
|
Leszek Koltunski
|
|
542 |
e8925fcd
|
Leszek Koltunski
|
public static int getMaxEffComponents()
|
543 |
1fad573e
|
Leszek Koltunski
|
{
|
544 |
e8925fcd
|
Leszek Koltunski
|
return MAX_EFFECT_COMPONENTS;
|
545 |
1fad573e
|
Leszek Koltunski
|
}
|
546 |
|
|
|
547 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
548 |
|
|
|
549 |
|
|
public static void getUniforms(int mProgramH, int variant)
|
550 |
|
|
{
|
551 |
2aeb75aa
|
Leszek Koltunski
|
mEquAssociationH[variant] = GLES30.glGetUniformLocation( mProgramH, "vComEquAssoc");
|
552 |
|
|
mAndAssociationH[variant] = GLES30.glGetUniformLocation( mProgramH, "vComAndAssoc");
|
553 |
a8dfedcc
|
Leszek Koltunski
|
}
|
554 |
|
|
|
555 |
f046b159
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
556 |
|
|
/**
|
557 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
558 |
|
|
*
|
559 |
|
|
* @y.exclude
|
560 |
|
|
*/
|
561 |
|
|
public void copyTransformToVertex()
|
562 |
|
|
{
|
563 |
e54bfada
|
Leszek Koltunski
|
ByteBuffer buffer = (ByteBuffer)GLES30.glMapBufferRange( GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0,
|
564 |
|
|
TRAN_SIZE*mNumVertices, GLES30.GL_MAP_READ_BIT);
|
565 |
f046b159
|
Leszek Koltunski
|
if( buffer!=null )
|
566 |
|
|
{
|
567 |
e54bfada
|
Leszek Koltunski
|
FloatBuffer feedback = buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();
|
568 |
|
|
feedback.get(mVertAttribs1,0,VERT1_ATTRIBS*mNumVertices);
|
569 |
|
|
mVBO1.update(mVertAttribs1);
|
570 |
f046b159
|
Leszek Koltunski
|
}
|
571 |
|
|
else
|
572 |
|
|
{
|
573 |
b5be333a
|
Leszek Koltunski
|
int error = GLES30.glGetError();
|
574 |
|
|
Log.e("mesh", "failed to map tf buffer, error="+error);
|
575 |
f046b159
|
Leszek Koltunski
|
}
|
576 |
|
|
|
577 |
b5be333a
|
Leszek Koltunski
|
GLES30.glUnmapBuffer(GLES30.GL_TRANSFORM_FEEDBACK);
|
578 |
f046b159
|
Leszek Koltunski
|
}
|
579 |
|
|
|
580 |
1fad573e
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
581 |
|
|
/**
|
582 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
583 |
|
|
*
|
584 |
|
|
* @y.exclude
|
585 |
|
|
*/
|
586 |
|
|
public void debug()
|
587 |
|
|
{
|
588 |
|
|
if( mJobNode[0]!=null )
|
589 |
|
|
{
|
590 |
|
|
mJobNode[0].print(0);
|
591 |
|
|
}
|
592 |
|
|
else
|
593 |
|
|
{
|
594 |
|
|
android.util.Log.e("mesh", "JobNode null");
|
595 |
|
|
}
|
596 |
|
|
}
|
597 |
|
|
|
598 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
599 |
|
|
/**
|
600 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
601 |
|
|
*
|
602 |
|
|
* @y.exclude
|
603 |
|
|
*/
|
604 |
e0343804
|
Leszek Koltunski
|
public void printPos()
|
605 |
1fad573e
|
Leszek Koltunski
|
{
|
606 |
26671ef8
|
Leszek Koltunski
|
StringBuilder sb = new StringBuilder();
|
607 |
1fad573e
|
Leszek Koltunski
|
|
608 |
|
|
for(int i=0; i<mNumVertices; i++)
|
609 |
|
|
{
|
610 |
|
|
sb.append('(');
|
611 |
|
|
sb.append(mVertAttribs1[VERT1_ATTRIBS*i+POS_ATTRIB ]);
|
612 |
|
|
sb.append(',');
|
613 |
|
|
sb.append(mVertAttribs1[VERT1_ATTRIBS*i+POS_ATTRIB+1]);
|
614 |
|
|
sb.append(',');
|
615 |
|
|
sb.append(mVertAttribs1[VERT1_ATTRIBS*i+POS_ATTRIB+2]);
|
616 |
|
|
sb.append(") ");
|
617 |
|
|
}
|
618 |
e0343804
|
Leszek Koltunski
|
Log.d("mesh", sb.toString());
|
619 |
|
|
}
|
620 |
1fad573e
|
Leszek Koltunski
|
|
621 |
e0343804
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
622 |
|
|
/**
|
623 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
624 |
|
|
*
|
625 |
|
|
* @y.exclude
|
626 |
|
|
*/
|
627 |
|
|
public void printCom()
|
628 |
|
|
{
|
629 |
|
|
StringBuilder sb = new StringBuilder();
|
630 |
1fad573e
|
Leszek Koltunski
|
|
631 |
|
|
for(int i=0; i<mNumVertices; i++)
|
632 |
|
|
{
|
633 |
e0343804
|
Leszek Koltunski
|
sb.append(mVertAttribs2[VERT2_ATTRIBS*i+COM_ATTRIB]);
|
634 |
|
|
sb.append(' ');
|
635 |
|
|
}
|
636 |
|
|
|
637 |
|
|
Log.d("mesh", sb.toString());
|
638 |
|
|
}
|
639 |
|
|
|
640 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
641 |
|
|
/**
|
642 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
643 |
|
|
*
|
644 |
|
|
* @y.exclude
|
645 |
|
|
*/
|
646 |
|
|
public void printTex()
|
647 |
|
|
{
|
648 |
|
|
int vert=0;
|
649 |
|
|
int num = numTexComponents();
|
650 |
|
|
StringBuilder sb = new StringBuilder();
|
651 |
|
|
sb.append("tex components: ").append(num);
|
652 |
|
|
|
653 |
|
|
for(int i=0; i<num; i++)
|
654 |
|
|
{
|
655 |
|
|
int end = mTexComponent.get(i).mEndIndex;
|
656 |
|
|
sb.append("\n");
|
657 |
|
|
|
658 |
|
|
for( ; vert<=end; vert++)
|
659 |
|
|
{
|
660 |
|
|
sb.append(' ');
|
661 |
|
|
sb.append('(');
|
662 |
|
|
sb.append(mVertAttribs2[VERT2_ATTRIBS*vert+TEX_ATTRIB]);
|
663 |
|
|
sb.append(',');
|
664 |
|
|
sb.append(mVertAttribs2[VERT2_ATTRIBS*vert+TEX_ATTRIB+1]);
|
665 |
|
|
sb.append(')');
|
666 |
|
|
}
|
667 |
1fad573e
|
Leszek Koltunski
|
}
|
668 |
|
|
|
669 |
e0343804
|
Leszek Koltunski
|
Log.d("mesh", sb.toString());
|
670 |
1fad573e
|
Leszek Koltunski
|
}
|
671 |
|
|
|
672 |
23b733db
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
673 |
|
|
/**
|
674 |
0d4aae88
|
Leszek Koltunski
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
675 |
|
|
*
|
676 |
|
|
* @y.exclude
|
677 |
23b733db
|
Leszek Koltunski
|
*/
|
678 |
0d4aae88
|
Leszek Koltunski
|
public int getTFO()
|
679 |
23b733db
|
Leszek Koltunski
|
{
|
680 |
b5be333a
|
Leszek Koltunski
|
return mTFO.createImmediately(mNumVertices*TRAN_SIZE, null);
|
681 |
23b733db
|
Leszek Koltunski
|
}
|
682 |
|
|
|
683 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
684 |
|
|
/**
|
685 |
0d4aae88
|
Leszek Koltunski
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
686 |
|
|
*
|
687 |
|
|
* @y.exclude
|
688 |
23b733db
|
Leszek Koltunski
|
*/
|
689 |
0d4aae88
|
Leszek Koltunski
|
public int getNumVertices()
|
690 |
23b733db
|
Leszek Koltunski
|
{
|
691 |
0d4aae88
|
Leszek Koltunski
|
return mNumVertices;
|
692 |
23b733db
|
Leszek Koltunski
|
}
|
693 |
|
|
|
694 |
36d65d88
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
695 |
|
|
/**
|
696 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
697 |
|
|
*
|
698 |
|
|
* @y.exclude
|
699 |
|
|
*/
|
700 |
|
|
public void send(int variant)
|
701 |
|
|
{
|
702 |
e8925fcd
|
Leszek Koltunski
|
GLES30.glUniform1iv( mEquAssociationH[variant], MAX_EFFECT_COMPONENTS, mEquAssociation, 0);
|
703 |
|
|
GLES30.glUniform1iv( mAndAssociationH[variant], MAX_EFFECT_COMPONENTS, mAndAssociation, 0);
|
704 |
36d65d88
|
Leszek Koltunski
|
}
|
705 |
|
|
|
706 |
044b5494
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
707 |
6c00149d
|
Leszek Koltunski
|
/**
|
708 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
709 |
|
|
*
|
710 |
|
|
* @y.exclude
|
711 |
|
|
*/
|
712 |
da681e7e
|
Leszek Koltunski
|
public void bindVertexAttribs(DistortedProgram program)
|
713 |
6c00149d
|
Leszek Koltunski
|
{
|
714 |
71d8aba1
|
Leszek Koltunski
|
if( mJobNode[0]!=null )
|
715 |
f046b159
|
Leszek Koltunski
|
{
|
716 |
71d8aba1
|
Leszek Koltunski
|
mJobNode[0].execute(); // this will set itself to null
|
717 |
f046b159
|
Leszek Koltunski
|
}
|
718 |
|
|
|
719 |
e54bfada
|
Leszek Koltunski
|
int index1 = mVBO1.createImmediately(mNumVertices*VERT1_SIZE, mVertAttribs1);
|
720 |
|
|
int index2 = mVBO2.createImmediately(mNumVertices*VERT2_SIZE, mVertAttribs2);
|
721 |
22e60fba
|
Leszek Koltunski
|
|
722 |
e54bfada
|
Leszek Koltunski
|
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index1 );
|
723 |
|
|
GLES30.glVertexAttribPointer(program.mAttribute[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_POS);
|
724 |
|
|
GLES30.glVertexAttribPointer(program.mAttribute[1], NOR_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_NOR);
|
725 |
|
|
GLES30.glVertexAttribPointer(program.mAttribute[2], INF_DATA_SIZE, GLES30.GL_FLOAT, false, VERT1_SIZE, OFFSET_INF);
|
726 |
|
|
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index2 );
|
727 |
|
|
GLES30.glVertexAttribPointer(program.mAttribute[3], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_TEX);
|
728 |
36d65d88
|
Leszek Koltunski
|
GLES30.glVertexAttribPointer(program.mAttribute[4], COM_DATA_SIZE, GLES30.GL_FLOAT, false, VERT2_SIZE, OFFSET_COM);
|
729 |
b7074bc6
|
Leszek Koltunski
|
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0);
|
730 |
da681e7e
|
Leszek Koltunski
|
}
|
731 |
|
|
|
732 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
733 |
|
|
/**
|
734 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
735 |
|
|
*
|
736 |
|
|
* @y.exclude
|
737 |
|
|
*/
|
738 |
|
|
public void bindTransformAttribs(DistortedProgram program)
|
739 |
|
|
{
|
740 |
7e53a35f
|
Leszek Koltunski
|
int index = mTFO.createImmediately(mNumVertices*TRAN_SIZE, null);
|
741 |
22e60fba
|
Leszek Koltunski
|
|
742 |
b7074bc6
|
Leszek Koltunski
|
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, index );
|
743 |
|
|
GLES30.glVertexAttribPointer(program.mAttribute[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, 0, 0);
|
744 |
|
|
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0);
|
745 |
6c00149d
|
Leszek Koltunski
|
}
|
746 |
|
|
|
747 |
7a5e538a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
748 |
|
|
/**
|
749 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
750 |
|
|
*
|
751 |
|
|
* @y.exclude
|
752 |
|
|
*/
|
753 |
|
|
public void setInflate(float inflate)
|
754 |
|
|
{
|
755 |
|
|
mInflate = inflate;
|
756 |
|
|
}
|
757 |
|
|
|
758 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
759 |
|
|
/**
|
760 |
|
|
* Not part of public API, do not document (public only because has to be used from the main package)
|
761 |
|
|
*
|
762 |
|
|
* @y.exclude
|
763 |
|
|
*/
|
764 |
|
|
public float getInflate()
|
765 |
|
|
{
|
766 |
|
|
return mInflate;
|
767 |
|
|
}
|
768 |
|
|
|
769 |
466450b5
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
770 |
|
|
// PUBLIC API
|
771 |
3fc9327a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
772 |
10836924
|
Leszek Koltunski
|
/**
|
773 |
|
|
* Write tthe Mesh to an OutputStream.
|
774 |
|
|
*/
|
775 |
|
|
public void write(OutputStream stream)
|
776 |
|
|
{
|
777 |
|
|
|
778 |
|
|
}
|
779 |
|
|
|
780 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
781 |
|
|
/**
|
782 |
|
|
* Read the mesh from an InputStream.
|
783 |
|
|
*/
|
784 |
|
|
public void read(InputStream stream)
|
785 |
|
|
{
|
786 |
|
|
|
787 |
|
|
}
|
788 |
|
|
|
789 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
790 |
|
|
|
791 |
3fc9327a
|
Leszek Koltunski
|
/**
|
792 |
|
|
* When rendering this Mesh, do we want to render the Normal vectors as well?
|
793 |
420836fc
|
leszek
|
* <p>
|
794 |
|
|
* Will work only on OpenGL ES >= 3.0 devices.
|
795 |
3fc9327a
|
Leszek Koltunski
|
*
|
796 |
|
|
* @param show Controls if we render the Normal vectors or not.
|
797 |
|
|
*/
|
798 |
|
|
public void setShowNormals(boolean show)
|
799 |
|
|
{
|
800 |
b7074bc6
|
Leszek Koltunski
|
mShowNormals = show;
|
801 |
3fc9327a
|
Leszek Koltunski
|
}
|
802 |
466450b5
|
Leszek Koltunski
|
|
803 |
6c00149d
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
804 |
|
|
/**
|
805 |
|
|
* When rendering this mesh, should we also draw the normal vectors?
|
806 |
|
|
*
|
807 |
|
|
* @return <i>true</i> if we do render normal vectors
|
808 |
|
|
*/
|
809 |
|
|
public boolean getShowNormals()
|
810 |
|
|
{
|
811 |
|
|
return mShowNormals;
|
812 |
|
|
}
|
813 |
|
|
|
814 |
a8dfedcc
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
815 |
|
|
/**
|
816 |
e8925fcd
|
Leszek Koltunski
|
* Merge all texture components of this Mesh into a single one.
|
817 |
a8dfedcc
|
Leszek Koltunski
|
*/
|
818 |
e8925fcd
|
Leszek Koltunski
|
public void mergeTexComponents()
|
819 |
a8dfedcc
|
Leszek Koltunski
|
{
|
820 |
1fad573e
|
Leszek Koltunski
|
if( mJobNode[0]==null )
|
821 |
a8dfedcc
|
Leszek Koltunski
|
{
|
822 |
e8925fcd
|
Leszek Koltunski
|
mergeTexComponentsNow();
|
823 |
a8dfedcc
|
Leszek Koltunski
|
}
|
824 |
|
|
else
|
825 |
|
|
{
|
826 |
e8925fcd
|
Leszek Koltunski
|
mJobNode[0] = DeferredJobs.mergeTex(this);
|
827 |
|
|
}
|
828 |
|
|
}
|
829 |
|
|
|
830 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
831 |
|
|
/**
|
832 |
|
|
* Merge all effect components of this Mesh into a single one.
|
833 |
|
|
*/
|
834 |
|
|
public void mergeEffComponents()
|
835 |
|
|
{
|
836 |
|
|
if( mJobNode[0]==null )
|
837 |
|
|
{
|
838 |
|
|
mergeEffComponentsNow();
|
839 |
|
|
}
|
840 |
|
|
else
|
841 |
|
|
{
|
842 |
|
|
mJobNode[0] = DeferredJobs.mergeEff(this);
|
843 |
a8dfedcc
|
Leszek Koltunski
|
}
|
844 |
|
|
}
|
845 |
|
|
|
846 |
466450b5
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
847 |
|
|
/**
|
848 |
|
|
* Release all internal resources.
|
849 |
|
|
*/
|
850 |
|
|
public void markForDeletion()
|
851 |
|
|
{
|
852 |
e54bfada
|
Leszek Koltunski
|
mVertAttribs1 = null;
|
853 |
|
|
mVertAttribs2 = null;
|
854 |
466450b5
|
Leszek Koltunski
|
|
855 |
e54bfada
|
Leszek Koltunski
|
mVBO1.markForDeletion();
|
856 |
|
|
mVBO2.markForDeletion();
|
857 |
466450b5
|
Leszek Koltunski
|
mTFO.markForDeletion();
|
858 |
|
|
}
|
859 |
fa8bc998
|
Leszek Koltunski
|
|
860 |
e8925fcd
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
861 |
|
|
/**
|
862 |
|
|
* Apply a Matrix Effect to the components which match the (addAssoc,equAssoc) association.
|
863 |
|
|
* <p>
|
864 |
|
|
* This is a static, permanent modification of the vertices contained in this Mesh. If the effect
|
865 |
|
|
* contains any Dynamics, they will be evaluated at 0.
|
866 |
|
|
*
|
867 |
|
|
* @param effect List of Matrix Effects to apply to the Mesh.
|
868 |
|
|
* @param andAssoc 'Logical AND' association which defines which components will be affected.
|
869 |
|
|
* @param equAssoc 'equality' association which defines which components will be affected.
|
870 |
|
|
*/
|
871 |
|
|
public void apply(MatrixEffect effect, int andAssoc, int equAssoc)
|
872 |
|
|
{
|
873 |
|
|
if( mJobNode[0]==null )
|
874 |
|
|
{
|
875 |
|
|
applyMatrix(effect,andAssoc,equAssoc);
|
876 |
|
|
}
|
877 |
|
|
else
|
878 |
|
|
{
|
879 |
|
|
mJobNode[0] = DeferredJobs.matrix(this,effect,andAssoc,equAssoc);
|
880 |
|
|
}
|
881 |
|
|
}
|
882 |
|
|
|
883 |
fa8bc998
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
884 |
|
|
/**
|
885 |
f046b159
|
Leszek Koltunski
|
* Apply a Vertex Effect to the vertex mesh.
|
886 |
fa8bc998
|
Leszek Koltunski
|
* <p>
|
887 |
c90aca24
|
Leszek Koltunski
|
* This is a static, permanent modification of the vertices contained in this Mesh. If the effects
|
888 |
f046b159
|
Leszek Koltunski
|
* contain any Dynamics, the Dynamics will be evaluated at 0.
|
889 |
fa8bc998
|
Leszek Koltunski
|
*
|
890 |
f046b159
|
Leszek Koltunski
|
* We would call this several times building up a list of Effects to do. This list of effects gets
|
891 |
|
|
* lazily executed only when the Mesh is used for rendering for the first time.
|
892 |
e172985c
|
Leszek Koltunski
|
*
|
893 |
f046b159
|
Leszek Koltunski
|
* @param effect Vertex Effect to apply to the Mesh.
|
894 |
fa8bc998
|
Leszek Koltunski
|
*/
|
895 |
f046b159
|
Leszek Koltunski
|
public void apply(VertexEffect effect)
|
896 |
fa8bc998
|
Leszek Koltunski
|
{
|
897 |
71d8aba1
|
Leszek Koltunski
|
mJobNode[0] = DeferredJobs.vertex(this,effect);
|
898 |
c90aca24
|
Leszek Koltunski
|
}
|
899 |
|
|
|
900 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
901 |
|
|
/**
|
902 |
a3a05347
|
Leszek Koltunski
|
* Sets texture maps for (some of) the components of this mesh.
|
903 |
c90aca24
|
Leszek Koltunski
|
* <p>
|
904 |
a3a05347
|
Leszek Koltunski
|
* Format: ( x of lower-left corner, y of lower-left corner, width, height ).
|
905 |
|
|
* For example maps[0] = new Static4D( 0.0, 0.5, 0.5, 0.5 ) sets the 0th component texture map to the
|
906 |
0d4aae88
|
Leszek Koltunski
|
* upper-left quadrant of the texture.
|
907 |
a3a05347
|
Leszek Koltunski
|
* <p>
|
908 |
|
|
* Probably the most common user case would be sending as many maps as there are components in this
|
909 |
|
|
* Mesh. One can also send less, or more (the extraneous ones will be ignored) and set some of them
|
910 |
|
|
* to null (those will be ignored as well). So if there are 5 components, and we want to set the map
|
911 |
|
|
* of the 2nd and 4rd one, call this with
|
912 |
|
|
* maps = new Static4D[4]
|
913 |
|
|
* maps[0] = null
|
914 |
|
|
* maps[1] = the map for the 2nd component
|
915 |
|
|
* maps[2] = null
|
916 |
|
|
* maps[3] = the map for the 4th component
|
917 |
|
|
*
|
918 |
|
|
* A map's width and height have to be non-zero (but can be negative!)
|
919 |
e172985c
|
Leszek Koltunski
|
*
|
920 |
dbe3079d
|
Leszek Koltunski
|
* @param maps List of texture maps to apply to the texture's components.
|
921 |
|
|
* @param startComponent the component the first of the maps refers to.
|
922 |
c90aca24
|
Leszek Koltunski
|
*/
|
923 |
dbe3079d
|
Leszek Koltunski
|
public void setTextureMap(Static4D[] maps, int startComponent)
|
924 |
c90aca24
|
Leszek Koltunski
|
{
|
925 |
1fad573e
|
Leszek Koltunski
|
if( mJobNode[0]==null )
|
926 |
ea88d502
|
Leszek Koltunski
|
{
|
927 |
dbe3079d
|
Leszek Koltunski
|
textureMap(maps,startComponent);
|
928 |
1fad573e
|
Leszek Koltunski
|
}
|
929 |
|
|
else
|
930 |
|
|
{
|
931 |
dbe3079d
|
Leszek Koltunski
|
mJobNode[0] = DeferredJobs.textureMap(this,maps,startComponent);
|
932 |
ea88d502
|
Leszek Koltunski
|
}
|
933 |
fa8bc998
|
Leszek Koltunski
|
}
|
934 |
9099e567
|
Leszek Koltunski
|
|
935 |
e172985c
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
936 |
|
|
/**
|
937 |
|
|
* Return the texture map of one of the components.
|
938 |
|
|
*
|
939 |
|
|
* @param component The component number whose texture map we want to retrieve.
|
940 |
|
|
*/
|
941 |
|
|
public Static4D getTextureMap(int component)
|
942 |
|
|
{
|
943 |
e8925fcd
|
Leszek Koltunski
|
return (component>=0 && component<mTexComponent.size()) ? mTexComponent.get(component).mTextureMap : null;
|
944 |
e172985c
|
Leszek Koltunski
|
}
|
945 |
cbd502ec
|
Leszek Koltunski
|
|
946 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
947 |
|
|
/**
|
948 |
1e672c1d
|
Leszek Koltunski
|
* Set Effect association.
|
949 |
bc208a9c
|
Leszek Koltunski
|
*
|
950 |
1e672c1d
|
Leszek Koltunski
|
* This creates an association between a Component of this Mesh and a Vertex Effect.
|
951 |
2aeb75aa
|
Leszek Koltunski
|
* One can set two types of associations - an 'logical and' and a 'equal' associations and the Effect
|
952 |
|
|
* will only be active on vertices of Components such that
|
953 |
36d65d88
|
Leszek Koltunski
|
*
|
954 |
2aeb75aa
|
Leszek Koltunski
|
* (effect andAssoc) & (component andAssoc) != 0 || (effect equAssoc) == (mesh equAssoc)
|
955 |
36d65d88
|
Leszek Koltunski
|
*
|
956 |
|
|
* (see main_vertex_shader)
|
957 |
bc208a9c
|
Leszek Koltunski
|
*
|
958 |
|
|
* The point: this way we can configure the system so that each Vertex Effect acts only on a certain
|
959 |
1e672c1d
|
Leszek Koltunski
|
* subset of a Mesh, thus potentially significantly reducing the number of render calls.
|
960 |
cbd502ec
|
Leszek Koltunski
|
*/
|
961 |
26671ef8
|
Leszek Koltunski
|
public void setEffectAssociation(int component, int andAssociation, int equAssociation)
|
962 |
|
|
{
|
963 |
|
|
if( component>=0 && component<MAX_EFFECT_COMPONENTS )
|
964 |
|
|
{
|
965 |
|
|
if( mJobNode[0]==null )
|
966 |
|
|
{
|
967 |
|
|
setEffectAssociationNow(component, andAssociation, equAssociation);
|
968 |
|
|
}
|
969 |
|
|
else
|
970 |
|
|
{
|
971 |
|
|
mJobNode[0] = DeferredJobs.effectAssoc(this,component,andAssociation,equAssociation);
|
972 |
|
|
}
|
973 |
|
|
}
|
974 |
|
|
}
|
975 |
bc208a9c
|
Leszek Koltunski
|
|
976 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
977 |
|
|
/**
|
978 |
4f81e0c8
|
Leszek Koltunski
|
* Copy the Mesh.
|
979 |
|
|
*
|
980 |
|
|
* @param deep If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
|
981 |
|
|
* normals and inflates (the rest, in particular the mVertAttribs2 containing texture
|
982 |
36d65d88
|
Leszek Koltunski
|
* coordinates and effect associations, is always deep copied)
|
983 |
bc208a9c
|
Leszek Koltunski
|
*/
|
984 |
4f81e0c8
|
Leszek Koltunski
|
public abstract MeshBase copy(boolean deep);
|
985 |
bc208a9c
|
Leszek Koltunski
|
}
|