@Override public void resize(int width, int height) { super.resize(width, height); mWorldState.width = width; mWorldState.height = height; mWorldState.rotate = width > height ? 1 : 0; mScript.set_g_glWidth(mWorldState.width); mScript.set_g_glHeight(mWorldState.height); mScript.set_g_rotate(mWorldState.rotate); mScript.invoke_initLeaves(); Matrix4f proj = new Matrix4f(); proj.loadProjectionNormalized(mWidth, mHeight); mPvOrthoAlloc.setProjection(proj); }
@Override public void setOffset(float xOffset, float yOffset, int xPixels, int yPixels) { mWorldState.xOffset = xOffset; mScript.set_g_xOffset(mWorldState.xOffset); }
private void createState() { mWorldState = new WorldState(); mWorldState.width = mWidth; mWorldState.height = mHeight; mWorldState.meshWidth = mMeshWidth; mWorldState.meshHeight = mMeshHeight; mWorldState.rippleIndex = 0; mWorldState.glWidth = 2.0f; mWorldState.glHeight = mGlHeight; mWorldState.skySpeedX = random(-0.001f, 0.001f); mWorldState.skySpeedY = random(0.00008f, 0.0002f); mWorldState.rotate = mWidth > mHeight ? 1 : 0; mWorldState.isPreview = isPreview() ? 1 : 0; mScript.set_g_glWidth(mWorldState.glWidth); mScript.set_g_glHeight(mWorldState.glHeight); mScript.set_g_meshWidth(mWorldState.meshWidth); mScript.set_g_meshHeight(mWorldState.meshHeight); mScript.set_g_xOffset(0); mScript.set_g_rotate(mWorldState.rotate); }