Project

General

Profile

« Previous | Next » 

Revision 9361b337

Added by Leszek Koltunski almost 8 years ago

Provide support to add any class derived from DistortedObject to DistortedNode.

View differences:

src/main/java/org/distorted/library/DistortedObject.java
27 27
    protected Bitmap[] mBmp= null; // 
28 28
    int[] mTextureDataH;           // have to be shared among all the cloned Objects
29 29
    boolean[] mBitmapSet;          // 
30
 
30

  
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

  
33
  /**
34
   * Default empty constructor so that derived classes can call it
35
   */
36
    public DistortedObject()
37
      {
38

  
39
      }
40

  
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42
  /**
43
   * Copy constructor used to create a DistortedObject based on various parts of another object.
44
   * <p>
45
   * Whatever we do not clone gets created just like in the default constructor.
46
   *
47
   * @param dc    Source object to create our object from
48
   * @param flags A bitmask of values specifying what to copy.
49
   *              For example, CLONE_BITMAP | CLONE_MATRIX.
50
   */
51
    public DistortedObject(DistortedObject dc, int flags)
52
      {
53
      initializeEffectLists(dc,flags);
54

  
55
      mID = DistortedObjectList.add(this);
56

  
57
      mSizeX = dc.mSizeX;
58
      mSizeY = dc.mSizeY;
59
      mSizeZ = dc.mSizeZ;
60
      mSize  = dc.mSize;
61
      mGrid  = dc.mGrid;
62

  
63
      if( (flags & Distorted.CLONE_BITMAP) != 0 )
64
        {
65
        mTextureDataH = dc.mTextureDataH;
66
        mBmp          = dc.mBmp;
67
        mBitmapSet    = dc.mBitmapSet;
68
        }
69
      else
70
        {
71
        mTextureDataH   = new int[1];
72
        mTextureDataH[0]= 0;
73
        mBitmapSet      = new boolean[1];
74
        mBitmapSet[0]   = false;
75
        mBmp            = new Bitmap[1];
76
        mBmp[0]         = null;
77

  
78
        if( Distorted.isInitialized() ) resetTexture();
79
        }
80
      }
81

  
31 82
///////////////////////////////////////////////////////////////////////////////////////////////////
32 83

  
33 84
    protected void initializeData(int size)

Also available in: Unified diff