Project

General

Profile

« Previous | Next » 

Revision 15aa7d94

Added by Leszek Koltunski almost 7 years ago

Progress with support for Effect classes.

View differences:

src/main/java/org/distorted/library/effect/VertexEffectSink.java
23 23
import org.distorted.library.type.Data3D;
24 24
import org.distorted.library.type.Data4D;
25 25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Dynamic3D;
27
import org.distorted.library.type.Dynamic4D;
26 28
import org.distorted.library.type.Static1D;
29
import org.distorted.library.type.Static3D;
30
import org.distorted.library.type.Static4D;
27 31

  
28 32
///////////////////////////////////////////////////////////////////////////////////////////////////
29 33

  
......
49 53
      mStatic0  = (Static1D)sink;
50 54
      }
51 55

  
52
    mCenter = center;
53
    mRegion = region;
56
    if( center instanceof Static3D)
57
      {
58
      mStaticCenter = (Static3D)center;
59
      }
60
    else if( center instanceof Dynamic3D)
61
      {
62
      mDynamicCenter = (Dynamic3D)center;
63
      }
64

  
65
    if( region instanceof Static4D)
66
      {
67
      mStaticRegion = (Static4D)region;
68
      }
69
    else if( region instanceof Dynamic4D)
70
      {
71
      mDynamicRegion = (Dynamic4D)region;
72
      }
54 73
    }
55 74

  
56 75
///////////////////////////////////////////////////////////////////////////////////////////////////
......
68 87
      mStatic0  = (Static1D)sink;
69 88
      }
70 89

  
71
    mCenter = center;
90
    if( center instanceof Static3D)
91
      {
92
      mStaticCenter = (Static3D)center;
93
      }
94
    else if( center instanceof Dynamic3D )
95
      {
96
      mDynamicCenter = (Dynamic3D)center;
97
      }
98

  
99
    mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
100
    }
101

  
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103

  
104
  public boolean compute(float[] uniforms, int index, long currentDuration, long step )
105
    {
106
    boolean ret = false;
107

  
108
    if( mDynamicCenter!=null )
109
      {
110
      mDynamicCenter.interpolateMain(uniforms,index+5,currentDuration,step);
111
      }
112
    else
113
      {
114
      uniforms[index+5] = mStaticCenter.getX();
115
      uniforms[index+6] = mStaticCenter.getY();
116
      uniforms[index+7] = mStaticCenter.getZ();
117
      }
118

  
119
    if( mDynamicRegion!=null )
120
      {
121
      mDynamicRegion.interpolateMain(uniforms,index+8,currentDuration,step);
122
      }
123
    else
124
      {
125
      uniforms[index+ 8] = mStaticRegion.getX();
126
      uniforms[index+ 9] = mStaticRegion.getY();
127
      uniforms[index+10] = mStaticRegion.getZ();
128
      uniforms[index+11] = mStaticRegion.getW();
129
      }
130

  
131
    if( mDynamic0!=null )
132
      {
133
      ret = mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
134
      }
135
    else
136
      {
137
      uniforms[index  ] = ((Static1D)mStatic0).getX();
138
      }
139

  
140
    return ret;
72 141
    }
73 142
  }

Also available in: Unified diff