Project

General

Profile

« Previous | Next » 

Revision 9ae05f6c

Added by Leszek Koltunski almost 8 years ago

beginnings of support for drawing the Region in Vertex3D app.

View differences:

src/main/java/org/distorted/examples/vertex3d/Vertex3DRenderer.java
105 105

  
106 106
    public void setRegion(float x, float y, float r)
107 107
      {
108
      float f = mFactorReg*r;
109
      mRegionScalePoint.set(f,f,f);
108
      mFactorReg = mFactorObj*r/mRegion.getWidth();
109
      mRegionScalePoint.set(mFactorReg,mFactorReg,mFactorReg);
110 110
      }
111 111

  
112 112
///////////////////////////////////////////////////////////////////////////////////////////////////
......
139 139
      int centerSize = mCenter.getWidth();
140 140
      int regionSize = mRegion.getWidth();
141 141

  
142
      mFactorReg = (0.5f*width)/regionSize;
143

  
144 142
      if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object
145 143
        {
146 144
        mFactorObj = (0.80f*height)/mObjHeight;
......
154 152

  
155 153
      Vertex3DActivity act = (Vertex3DActivity)mView.getContext();
156 154
      mMovePoint.set(mFactorObj*act.getCenterX(),mFactorObj*act.getCenterY(),0);
157
      float f = mFactorReg*act.getRegionR();
158
      mRegionScalePoint.set(f,f,f);
155

  
156
      mFactorReg = mFactorObj*act.getRegionR()/regionSize;
157
      mRegionScalePoint.set(mFactorReg,mFactorReg,mFactorReg);
159 158

  
160 159
      Static3D rotateObj = new Static3D(mObjWidth/2,mObjHeight/2, 0);
161 160

  
......
177 176
      mRegion.quaternion(mQuatInt1, rotateCen);
178 177
      mRegion.quaternion(mQuatInt2, rotateCen);
179 178

  
180
      mRegion.move( new Static3D( (width -mFactorReg*regionSize-mFactorObj*mObjWidth )/2 ,
181
                                  (height-mFactorReg*regionSize-mFactorObj*mObjHeight)/2 , 12) );
179
      mRegion.move( new Static3D( (width -mFactorObj*mObjWidth )/2 ,
180
                                  (height-mFactorObj*mObjHeight)/2 , 12) );
182 181
      mRegion.move(mMoveInter);
183 182
      mRegion.scale(mRegionScaleInter);
183
      mRegion.move( new Static3D( -regionSize/2 , -regionSize/2 , 0) );
184 184

  
185 185
      int backgroundSize = mBackground.getWidth();
186 186
      float factorBackX = ((float)width)/backgroundSize;

Also available in: Unified diff