Project

General

Profile

« Previous | Next » 

Revision 41d39cea

Added by Leszek Koltunski over 7 years ago

Flag app finished

View differences:

src/main/java/org/distorted/examples/flag/FlagRenderer.java
51 51
    private DistortedObject mObject;
52 52
    private int mObjWidth, mObjHeight;
53 53
    private DynamicQuat mQuatInt1, mQuatInt2;
54
    private Dynamic5D mWaveDyn;
55
    private Static5D mWaveSta1, mWaveSta2;
54 56

  
55 57
    Static4D mQuat1, mQuat2;
56 58

  
......
67 69
      mObjWidth = mObject.getWidth();
68 70
      mObjHeight= mObject.getHeight();
69 71

  
70
      Static2D mWaveCenter = new Static2D(mObjWidth, mObjHeight/2);  // middle of the right edge
71
      Static4D mWaveRegion = new Static4D(0,0,mObjWidth,mObjWidth);
72

  
73
      Dynamic5D mWaveDyn = new Dynamic5D(1000,0.0f);
74
      Static5D  mWaveSta1= new Static5D(50,100,-180,90,0);
75
      Static5D  mWaveSta2= new Static5D(50,100,+180,90,0);
72
      mWaveDyn = new Dynamic5D(1000,0.0f);
73
      mWaveSta1= new Static5D(0,0,-180,0,0);  // all other values besides the
74
      mWaveSta2= new Static5D(0,0,+180,0,0);  // fourth will be set from the UI
76 75

  
77 76
      mWaveDyn.add(mWaveSta1);
78 77
      mWaveDyn.add(mWaveSta2);
79 78
      mWaveDyn.setMode(Dynamic.MODE_JUMP);
80 79

  
81
      //mWaveDyn.setNoise( new Static5D(0.1f, 0.1f, 0.1f, 0.1f, 0.1f) );
82

  
83 80
      mQuat1 = new Static4D(           0,         0,           0,          1);  // unity quaternion
84 81
      mQuat2 = new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);  // something semi-random that looks good
85 82

  
......
89 86
      mQuatInt1.add(mQuat1);
90 87
      mQuatInt2.add(mQuat2);
91 88

  
92
      mObject.wave(mWaveDyn, mWaveCenter, mWaveRegion);
89
      Static2D waveCenter = new Static2D(mObjWidth, mObjHeight/2);  // middle of the right edge
90
      Static4D waveRegion = new Static4D(0,0,mObjWidth,mObjWidth);
91

  
92
      mObject.wave(mWaveDyn, waveCenter, waveRegion);
93 93
      }
94 94

  
95 95
///////////////////////////////////////////////////////////////////////////////////////////////////
96 96

  
97
    public static void setAmplitude(int a)
97
    void setAmplitude(int a)
98 98
      {
99

  
99
      mWaveSta1.set1(a);
100
      mWaveSta2.set1(a);
100 101
      }
101 102

  
102 103
///////////////////////////////////////////////////////////////////////////////////////////////////
103 104

  
104
    public static void setLength(int l)
105
    void setLength(int l)
105 106
      {
106

  
107
      mWaveSta1.set2(l);
108
      mWaveSta2.set2(l);
107 109
      }
108 110

  
109 111
///////////////////////////////////////////////////////////////////////////////////////////////////
110 112

  
111
    public static void setAngleA(int a)
113
    void setAngleA(int a)
112 114
      {
113

  
115
      mWaveSta1.set4(a);
116
      mWaveSta2.set4(a);
114 117
      }
115 118

  
116 119
///////////////////////////////////////////////////////////////////////////////////////////////////
117 120

  
118
    public static void setAngleB(int b)
121
    void setAngleB(int b)
119 122
      {
120

  
123
      mWaveSta1.set5(b);
124
      mWaveSta2.set5(b);
121 125
      }
122 126

  
123 127
///////////////////////////////////////////////////////////////////////////////////////////////////
124 128

  
125
    public static void setNoise(Static5D noise)
129
    void setNoise(Static5D noise)
126 130
      {
127

  
131
      mWaveDyn.setNoise(noise);
128 132
      }
129 133

  
130 134
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff