Project

General

Profile

« Previous | Next » 

Revision e8925fcd

Added by Leszek Koltunski almost 4 years ago

Big change to MeshBase:
1) split the list of Components into two: 'texture map' components and 'effect' components.
Reason: imagine the Rubik Cube with a Solver. When setting up a initial position in the Solver, we need to be able to set texture maps of each individual face of each cubit.
Thus previously (when there was only one Component which kept info both about Effect associations and Texture Maps) a 5x5x5 Rubik Cube would have to have 98*6 = almost 600 components.
This alone would mean 1200 uniforms in the Vertex Shader --> more than the guaranteed 1024.
Splitting the Component into two parts lets us merge the 6 'Effect' components of each Rubik Cubit into one (thus leaving only 98 Effect Components in the Verteex Shader --> 196 uniforms) while still allowing for change of the texture map of each individual face.
2) (re-) add the 'apply a matrix effect' (this time with associations)

View differences:

src/main/java/org/distorted/library/main/DistortedLibrary.java
218 218
    String mainVertHeader= mGLSL_VERSION + ("#define NUM_VERTEX "   + ( numV>0 ? getMax(EffectType.VERTEX  ) : 0 ) + "\n");
219 219
    String mainFragHeader= mGLSL_VERSION + ("#define NUM_FRAGMENT " + ( numF>0 ? getMax(EffectType.FRAGMENT) : 0 ) + "\n");
220 220

  
221
    mainVertHeader += "#define MAX_COMPON " + MeshBase.getMaxComponents() + "\n";
221
    mainVertHeader += "#define MAX_COMPON " + MeshBase.getMaxEffComponents() + "\n";
222 222

  
223 223
    String enabledEffectV= VertexEffect.getGLSL();
224 224
    String enabledEffectF= FragmentEffect.getGLSL();
......
309 309
    String fullVertHeader= mGLSL_VERSION + ("#define NUM_VERTEX "   + ( numV>0 ? getMax(EffectType.VERTEX ) : 0 ) + "\n");
310 310
    String fullFragHeader= mGLSL_VERSION + ("#define NUM_FRAGMENT " +                                         0   + "\n");
311 311

  
312
    fullVertHeader += "#define MAX_COMPON " + MeshBase.getMaxComponents() + "\n";
312
    fullVertHeader += "#define MAX_COMPON " + MeshBase.getMaxEffComponents() + "\n";
313 313

  
314 314
    String enabledEffectV= VertexEffect.getAllGLSL();
315 315
    String enabledEffectF= "{}";
......
348 348
    String mainVertHeader= mGLSL_VERSION + ("#define NUM_VERTEX "   + ( numV>0 ? getMax(EffectType.VERTEX  ) : 0 ) + "\n") + ("#define OIT\n");
349 349
    String mainFragHeader= mGLSL_VERSION + ("#define NUM_FRAGMENT " + ( numF>0 ? getMax(EffectType.FRAGMENT) : 0 ) + "\n") + ("#define OIT\n");
350 350

  
351
    mainVertHeader += "#define MAX_COMPON " + MeshBase.getMaxComponents() + "\n";
351
    mainVertHeader += "#define MAX_COMPON " + MeshBase.getMaxEffComponents() + "\n";
352 352

  
353 353
    String enabledEffectV= VertexEffect.getGLSL();
354 354
    String enabledEffectF= FragmentEffect.getGLSL();

Also available in: Unified diff