Revision 5dfbbda7
Added by Leszek Koltunski over 5 years ago
| src/main/java/org/distorted/examples/deferredjob/DeferredJobRenderer.java | ||
|---|---|---|
| 192 | 192 |
meshes[i] = meshes[0].copy(true); |
| 193 | 193 |
} |
| 194 | 194 |
|
| 195 |
Static4D[] textureMaps = new Static4D[MESHES]; |
|
| 196 |
for(int i=0; i<MESHES; i++) textureMaps[i] = new Static4D(i*0.5f,0.0f,0.5f,1.0f); |
|
| 197 |
MeshBase result = new MeshJoined(meshes); |
|
| 198 |
result.setTextureMap(textureMaps); |
|
| 195 |
Static4D[] lTextureMaps = new Static4D[MESHES]; |
|
| 196 |
Static4D[] rTextureMaps = new Static4D[MESHES]; |
|
| 197 |
|
|
| 198 |
for(int i=0; i<MESHES; i++) |
|
| 199 |
{
|
|
| 200 |
lTextureMaps[i] = new Static4D(0.0f,0.0f,0.5f,1.0f); |
|
| 201 |
rTextureMaps[i] = new Static4D(0.5f,0.0f,0.5f,1.0f); |
|
| 202 |
} |
|
| 203 |
|
|
| 204 |
MeshBase[] tmp = new MeshBase[2]; |
|
| 205 |
|
|
| 206 |
tmp[0] = new MeshJoined(meshes); |
|
| 207 |
tmp[0].setTextureMap(lTextureMaps); |
|
| 199 | 208 |
|
| 200 | 209 |
VertexEffectMove effect0 = new VertexEffectMove ( new Static3D(0,0,0.5f) ); |
| 201 | 210 |
VertexEffectRotate effect1 = new VertexEffectRotate( new Static1D(180), new Static3D(1,0,0), new Static3D(0,0,0) ); |
| 202 | 211 |
|
| 203 | 212 |
effect1.setMeshAssociation(1,0); // apply only to mesh[1] |
| 204 | 213 |
|
| 205 |
result.apply(effect0);
|
|
| 206 |
result.apply(effect1);
|
|
| 214 |
tmp[0].apply(effect0);
|
|
| 215 |
tmp[0].apply(effect1);
|
|
| 207 | 216 |
|
| 208 |
return result; |
|
| 217 |
tmp[1] = tmp[0].copy(true); |
|
| 218 |
tmp[1].setTextureMap(rTextureMaps); |
|
| 219 |
|
|
| 220 |
tmp[0].mergeComponents(); |
|
| 221 |
tmp[1].mergeComponents(); |
|
| 222 |
|
|
| 223 |
MeshBase combined = new MeshJoined(tmp); |
|
| 224 |
|
|
| 225 |
VertexEffectMove moveL = new VertexEffectMove ( new Static3D(-1,0,0) ); |
|
| 226 |
VertexEffectMove moveR = new VertexEffectMove ( new Static3D(+1,0,0) ); |
|
| 227 |
|
|
| 228 |
moveL.setMeshAssociation(0,0); |
|
| 229 |
moveR.setMeshAssociation(1,0); |
|
| 230 |
|
|
| 231 |
return combined; |
|
| 209 | 232 |
} |
| 210 | 233 |
} |
Also available in: Unified diff
Progress with DeferredJobs app (proves with the library part does not work :)