Project

General

Profile

« Previous | Next » 

Revision 7958d843

Added by Leszek Koltunski almost 3 years ago

MeshBase's 'MAX_NUM_COMPONENTS' is not a constant - rename!

View differences:

src/main/java/org/distorted/library/uniformblock/UniformBlockAssociation.java
22 22
import android.opengl.GLES30;
23 23

  
24 24
import org.distorted.library.main.InternalBuffer;
25

  
26
import static org.distorted.library.mesh.MeshBase.MAX_EFFECT_COMPONENTS;
25
import org.distorted.library.mesh.MeshBase;
27 26

  
28 27
///////////////////////////////////////////////////////////////////////////////////////////////////
29 28
/**
......
39 38
  private static final int LOC_EQU = 1;
40 39

  
41 40
  private final InternalBuffer mUBO;
41
  private final int mMax;
42 42
  private int[] mAssociations;
43 43
  private int mStride;
44 44

  
......
46 46

  
47 47
  public UniformBlockAssociation()
48 48
    {
49
    mMax = MeshBase.getMaxEffComponents();
49 50
    mStride = DEFAULT_STRIDE;
50
    mAssociations= new int[mStride*MAX_EFFECT_COMPONENTS];
51
    mAssociations= new int[mStride*mMax];
51 52

  
52
    for(int i=0; i<MAX_EFFECT_COMPONENTS; i++)
53
    for(int i=0; i<mMax; i++)
53 54
      {
54 55
      mAssociations[mStride*i+LOC_AND] = DEFAULT_ASSOCIATION;
55 56
      mAssociations[mStride*i+LOC_EQU] = i;
......
62 63

  
63 64
  public UniformBlockAssociation(UniformBlockAssociation original)
64 65
    {
66
    mMax = original.mMax;
65 67
    mStride = original.mStride;
66 68
    int size = original.mAssociations.length;
67 69
    mAssociations= new int[size];
......
77 79
    {
78 80
    if( mStride != stride && stride!=0 )
79 81
      {
80
      int[] tmp = new int[stride*MAX_EFFECT_COMPONENTS];
82
      int[] tmp = new int[stride*mMax];
81 83

  
82
      for(int i=0; i<MAX_EFFECT_COMPONENTS; i++)
84
      for(int i=0; i<mMax; i++)
83 85
        {
84 86
        tmp[stride*i+LOC_AND] = mAssociations[mStride*i+LOC_AND];
85 87
        tmp[stride*i+LOC_EQU] = mAssociations[mStride*i+LOC_EQU];
......
111 113

  
112 114
  public int getIndex()
113 115
    {
114
    return mUBO.createImmediatelyInt( 4*mStride*MAX_EFFECT_COMPONENTS, mAssociations);
116
    return mUBO.createImmediatelyInt( 4*mStride*mMax, mAssociations);
115 117
    }
116 118

  
117 119
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff