Project

General

Profile

« Previous | Next » 

Revision af662543

Added by Leszek Koltunski about 7 years ago

Fixes for z-fighting.

View differences:

src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
45 45
   private DistortedEffects mEffects;
46 46
   private DistortedScreen mScreen;
47 47

  
48
   private float mF, mX, mY;
49
   private int mWidth, mHeight;
48
   private float mF, mNear;
50 49

  
51 50
///////////////////////////////////////////////////////////////////////////////////////////////////
52 51

  
......
59 58

  
60 59
///////////////////////////////////////////////////////////////////////////////////////////////////
61 60

  
62
   int setFOV(int f)
61
   float setFOV(int f)
63 62
      {
64 63
      mF = f;
65
      mScreen.setProjection(mF,mX,mY);
66
      return (int)mF;
64
      mScreen.setProjection(mF,mNear);
65
      return mF;
67 66
      }
68 67

  
69 68
///////////////////////////////////////////////////////////////////////////////////////////////////
70 69

  
71
   int setX(int x)
70
   float setNear(int near)
72 71
      {
73
      mX = (x-50)*0.02f*mWidth;
74
      mScreen.setProjection(mF,mX,mY);
75
      return (int)mX;
76
      }
77

  
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79

  
80
   int setY(int y)
81
      {
82
      mY = (y-50)*0.02f*mHeight;
83
      mScreen.setProjection(mF,mX,mY);
84
      return (int)mY;
72
      mNear = near/100.0f;
73
      mScreen.setProjection(mF,mNear);
74
      return mNear;
85 75
      }
86 76

  
87 77
///////////////////////////////////////////////////////////////////////////////////////////////////
......
96 86
    
97 87
   public void onSurfaceChanged(GL10 glUnused, int width, int height) 
98 88
      {
99
      mWidth = width;
100
      mHeight= height;
101

  
102
      mScreen.setProjection(mF,mX,mY);
89
      mScreen.setProjection(mF,mNear);
103 90
      mEffects.abortAllEffects();
104 91

  
105 92
      Paint paint = new Paint();

Also available in: Unified diff