Project

General

Profile

« Previous | Next » 

Revision 2afc6754

Added by Leszek Koltunski over 2 years ago

Move RubikControl to objectlib (as 'ObjectAutomator')
Hide ObjectPreRender inside objectlib and move its APi to ObjectControl.

View differences:

src/main/java/org/distorted/main/RubikRenderer.java
22 22
import android.opengl.GLES30;
23 23
import android.opengl.GLSurfaceView;
24 24

  
25
import org.distorted.control.RubikControl;
26 25
import org.distorted.objectlib.effects.BaseEffect;
27 26
import org.distorted.library.effect.EffectType;
28 27
import org.distorted.library.effect.VertexEffectQuaternion;
......
31 30
import org.distorted.library.main.DistortedScreen;
32 31
import org.distorted.library.mesh.MeshBase;
33 32
import org.distorted.network.RubikNetwork;
33
import org.distorted.objectlib.main.ObjectControl;
34 34

  
35 35
import javax.microedition.khronos.egl.EGLConfig;
36 36
import javax.microedition.khronos.opengles.GL10;
......
45 45

  
46 46
   private final RubikSurfaceView mView;
47 47
   private final DistortedScreen mScreen;
48
   private final ObjectControl mControl;
48 49
   private final Fps mFPS;
49 50
   private boolean mErrorShown;
50 51
   private boolean mDebugSent;
51
   private RubikControl mControl;
52 52

  
53 53
   private static class Fps
54 54
     {
......
94 94
     {
95 95
     mErrorShown = false;
96 96
     mView = v;
97
     mControl = v.getObjectControl();
97 98
     mFPS = new Fps();
98 99
     mScreen = new DistortedScreen();
99 100
     mScreen.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f);
100 101
     }
101 102

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

  
104
   public void setControlState(boolean on)
105
     {
106
     mControl = on ? RubikControl.getInstance() : null;
107
     }
108

  
109 103
///////////////////////////////////////////////////////////////////////////////////////////////////
110 104
// various things are done here delayed, 'after the next render' as not to be done mid-render and
111 105
// cause artifacts.
......
115 109
     {
116 110
     long time = System.currentTimeMillis();
117 111
     mFPS.onRender(time);
118
     mView.getPreRender().preRender();
112
     mControl.preRender();
119 113
     mScreen.render(time);
120

  
121
     if( mControl!=null ) mControl.postDrawFrame(time);
122 114
     }
123 115

  
124 116
///////////////////////////////////////////////////////////////////////////////////////////////////
......
128 120
      {
129 121
      mScreen.resize(width,height);
130 122
      mView.setScreenSize(width,height);
131
      mView.getPreRender().setScreenSize(width);
132 123
      }
133 124

  
134 125
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff