Revision da231553
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/examples/rubik/RubikRenderer.java | ||
---|---|---|
27 | 27 |
import org.distorted.library.message.EffectListener; |
28 | 28 |
import org.distorted.library.message.EffectMessage; |
29 | 29 |
import org.distorted.library.type.Static3D; |
30 |
import org.distorted.library.type.Static4D; |
|
31 | 30 |
|
32 | 31 |
import javax.microedition.khronos.egl.EGLConfig; |
33 | 32 |
import javax.microedition.khronos.opengles.GL10; |
... | ... | |
85 | 84 |
} |
86 | 85 |
|
87 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
88 |
// EffectListener. The library sends a message to us when it's time to call 'removeRotation'
|
|
87 |
// EffectListener. The library sends a message to us when it's time to create a new cube.
|
|
89 | 88 |
|
90 | 89 |
public void effectMessage(final EffectMessage em, final long effectID, final long objectID) |
91 | 90 |
{ |
... | ... | |
100 | 99 |
|
101 | 100 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
102 | 101 |
|
103 |
public void onSurfaceChanged(GL10 glUnused, int width, int height)
|
|
104 |
{
|
|
105 |
float cameraDistance = CAMERA_DISTANCE*(width>height ? width:height);
|
|
106 |
float fovInDegrees = computeFOV(cameraDistance,height);
|
|
102 |
public void onSurfaceChanged(GL10 glUnused, int width, int height)
|
|
103 |
{ |
|
104 |
float cameraDistance = CAMERA_DISTANCE*(width>height ? width:height); |
|
105 |
float fovInDegrees = computeFOV(cameraDistance,height); |
|
107 | 106 |
|
108 |
mScreen.setProjection( fovInDegrees, 0.1f);
|
|
109 |
mScreen.resize(width, height);
|
|
107 |
mScreen.setProjection( fovInDegrees, 0.1f); |
|
108 |
mScreen.resize(width, height); |
|
110 | 109 |
|
111 |
recomputeScaleFactor(width,height);
|
|
110 |
recomputeScaleFactor(width,height); |
|
112 | 111 |
|
113 |
mScreenHeight = height;
|
|
114 |
mScreenWidth = width;
|
|
115 |
}
|
|
112 |
mScreenHeight = height; |
|
113 |
mScreenWidth = width; |
|
114 |
} |
|
116 | 115 |
|
117 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
118 | 117 |
|
119 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
|
|
120 |
{
|
|
121 |
createNextCube();
|
|
122 |
|
|
123 |
VertexEffectSink.enable();
|
|
124 |
|
|
125 |
try
|
|
126 |
{
|
|
127 |
Distorted.onCreate(mView.getContext());
|
|
128 |
}
|
|
129 |
catch(Exception ex)
|
|
130 |
{
|
|
131 |
android.util.Log.e("Rubik", ex.getMessage() );
|
|
132 |
}
|
|
133 |
}
|
|
118 |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
|
|
119 |
{ |
|
120 |
createNextCube(); |
|
121 |
|
|
122 |
VertexEffectSink.enable(); |
|
123 |
|
|
124 |
try |
|
125 |
{ |
|
126 |
Distorted.onCreate(mView.getContext()); |
|
127 |
} |
|
128 |
catch(Exception ex) |
|
129 |
{ |
|
130 |
android.util.Log.e("Rubik", ex.getMessage() ); |
|
131 |
} |
|
132 |
} |
|
134 | 133 |
|
135 | 134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
136 | 135 |
|
Also available in: Unified diff
minor.