|
|
@ -67,10 +67,6 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { |
|
|
|
gl.glClear(GL10.GL_COLOR_BUFFER_BIT) |
|
|
|
gl.glClear(GL10.GL_COLOR_BUFFER_BIT) |
|
|
|
gl.glLoadIdentity() |
|
|
|
gl.glLoadIdentity() |
|
|
|
|
|
|
|
|
|
|
|
if (USE_PERSPECTIVE_PROJECTION) { |
|
|
|
|
|
|
|
gl.glTranslatef(0f, 0f, -6f) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i in mCurlMeshes.indices) { |
|
|
|
for (i in mCurlMeshes.indices) { |
|
|
|
mCurlMeshes[i].onDrawFrame(gl) |
|
|
|
mCurlMeshes[i].onDrawFrame(gl) |
|
|
|
} |
|
|
|
} |
|
|
@ -90,14 +86,10 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { |
|
|
|
|
|
|
|
|
|
|
|
gl.glMatrixMode(GL10.GL_PROJECTION) |
|
|
|
gl.glMatrixMode(GL10.GL_PROJECTION) |
|
|
|
gl.glLoadIdentity() |
|
|
|
gl.glLoadIdentity() |
|
|
|
if (USE_PERSPECTIVE_PROJECTION) { |
|
|
|
|
|
|
|
GLU.gluPerspective(gl, 20f, width.toFloat() / height, .1f, 100f) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
GLU.gluOrtho2D( |
|
|
|
GLU.gluOrtho2D( |
|
|
|
gl, mViewRect.left, mViewRect.right, |
|
|
|
gl, mViewRect.left, mViewRect.right, |
|
|
|
mViewRect.bottom, mViewRect.top |
|
|
|
mViewRect.bottom, mViewRect.top |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gl.glMatrixMode(GL10.GL_MODELVIEW) |
|
|
|
gl.glMatrixMode(GL10.GL_MODELVIEW) |
|
|
|
gl.glLoadIdentity() |
|
|
|
gl.glLoadIdentity() |
|
|
@ -124,29 +116,6 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { |
|
|
|
mCurlMeshes.remove(mesh) |
|
|
|
mCurlMeshes.remove(mesh) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Change background/clear color. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
fun setBackgroundColor(color: Int) { |
|
|
|
|
|
|
|
mBackgroundColor = color |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set margins or padding. Note: margins are proportional. Meaning a value |
|
|
|
|
|
|
|
* of .1f will produce a 10% margin. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Synchronized |
|
|
|
|
|
|
|
fun setMargins( |
|
|
|
|
|
|
|
left: Float, top: Float, right: Float, |
|
|
|
|
|
|
|
bottom: Float |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
mMargins.left = left |
|
|
|
|
|
|
|
mMargins.top = top |
|
|
|
|
|
|
|
mMargins.right = right |
|
|
|
|
|
|
|
mMargins.bottom = bottom |
|
|
|
|
|
|
|
updatePageRects() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets visible page count to one or two. Should be either SHOW_ONE_PAGE or |
|
|
|
* Sets visible page count to one or two. Should be either SHOW_ONE_PAGE or |
|
|
|
* SHOW_TWO_PAGES. |
|
|
|
* SHOW_TWO_PAGES. |
|
|
@ -242,7 +211,5 @@ class CurlRenderer(private val mObserver: Observer) : GLSurfaceView.Renderer { |
|
|
|
// Constants for changing view mode. |
|
|
|
// Constants for changing view mode. |
|
|
|
const val SHOW_ONE_PAGE = 1 |
|
|
|
const val SHOW_ONE_PAGE = 1 |
|
|
|
const val SHOW_TWO_PAGES = 2 |
|
|
|
const val SHOW_TWO_PAGES = 2 |
|
|
|
// Set to true for checking quickly how perspective projection looks. |
|
|
|
|
|
|
|
private const val USE_PERSPECTIVE_PROJECTION = false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|