public void setCircleCenter(Vector2 center) { mCircleCenter[0] = (float)center.getX(); mCircleCenter[1] = (float)center.getY(); }
private void startRotation(final float x, final float y) { mapToScreen(x, y, mPrevScreenCoord); mCurrScreenCoord.setAll(mPrevScreenCoord.getX(), mPrevScreenCoord.getY()); mIsRotating = true; }
private void applyRotation() { if (mIsRotating) { mapToSphere((float) mPrevScreenCoord.getX(), (float) mPrevScreenCoord.getY(), mPrevSphereCoord); mapToSphere((float) mCurrScreenCoord.getX(), (float) mCurrScreenCoord.getY(), mCurrSphereCoord); Vector3 rotationAxis = mPrevSphereCoord.clone(); rotationAxis.cross(mCurrSphereCoord); rotationAxis.normalize(); double rotationAngle = Math.acos(Math.min(1, mPrevSphereCoord.dot(mCurrSphereCoord))); mCurrentOrientation.fromAngleAxis(rotationAxis, MathUtil.radiansToDegrees(rotationAngle)); mCurrentOrientation.normalize(); Quaternion q = new Quaternion(mStartOrientation); q.multiply(mCurrentOrientation); mEmpty.setOrientation(q); } }
mesh.textureCoordinates[uvIndex] = (float) vert.textureCoordinate.getX(); mesh.textureCoordinates[uvIndex + 1] = (float) vert.textureCoordinate.getY();
GLES20.glUniform2fv(muScaleHandle, 1, new float[] { (float) scale.getX(), (float) scale.getY() }, 0); GLES20.glUniform3fv(muScreenPositionHandle, 1, new float[] { (float) screenPosition.x, (float) screenPosition.y, (float) screenPosition.z }, 0); GLES20.glUniform2fv(muScaleHandle, 1, new float[] { (float) scale.getX(), (float) scale.getY() }, 0); GLES20.glUniform1f(muRotationHandle, (float) sprite.getRotation());
private void startRotation(final float x, final float y) { mapToScreen(x, y, mPrevScreenCoord); mCurrScreenCoord.setAll(mPrevScreenCoord.getX(), mPrevScreenCoord.getY()); mIsRotating = true; }
private void applyRotation() { if (mIsRotating) { mapToSphere((float) mPrevScreenCoord.getX(), (float) mPrevScreenCoord.getY(), mPrevSphereCoord); mapToSphere((float) mCurrScreenCoord.getX(), (float) mCurrScreenCoord.getY(), mCurrSphereCoord); Vector3 rotationAxis = mPrevSphereCoord.clone(); rotationAxis.cross(mCurrSphereCoord); rotationAxis.normalize(); double rotationAngle = Math.acos(Math.min(1, mPrevSphereCoord.dot(mCurrSphereCoord))); mCurrentOrientation.fromAngleAxis(rotationAxis, MathUtil.radiansToDegrees(rotationAngle)); mCurrentOrientation.normalize(); Quaternion q = new Quaternion(mStartOrientation); q.multiply(mCurrentOrientation); mEmpty.setOrientation(q); } }
mesh.textureCoordinates[uvIndex] = (float) vert.textureCoordinate.getX(); mesh.textureCoordinates[uvIndex + 1] = (float) vert.textureCoordinate.getY();
GLES20.glUniform2fv(muScaleHandle, 1, new float[] { (float) scale.getX(), (float) scale.getY() }, 0); GLES20.glUniform3fv(muScreenPositionHandle, 1, new float[] { (float) screenPosition.x, (float) screenPosition.y, (float) screenPosition.z }, 0); GLES20.glUniform2fv(muScaleHandle, 1, new float[] { (float) scale.getX(), (float) scale.getY() }, 0); GLES20.glUniform1f(muRotationHandle, (float) sprite.getRotation());