Java Code Examples for android.opengl.Matrix#setRotateEulerM()
The following examples show how to use
android.opengl.Matrix#setRotateEulerM() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeadTracker.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 4 votes |
public void getLastHeadView(float[] headView, int offset) { if(offset + 16 > headView.length) { throw new IllegalArgumentException("Not enough space to write the result"); } else { float rotation = 0.0F; switch(this.display.getRotation()) { case 0: rotation = 0.0F; break; case 1: rotation = 90.0F; break; case 2: rotation = 180.0F; break; case 3: rotation = 270.0F; } if(rotation != this.displayRotation) { this.displayRotation = rotation; Matrix.setRotateEulerM(this.sensorToDisplay, 0, 0.0F, 0.0F, -rotation); Matrix.setRotateEulerM(this.ekfToHeadTracker, 0, -90.0F, 0.0F, rotation); } OrientationEKF var4 = this.tracker; synchronized(this.tracker) { if(!this.tracker.isReady()) { return; } double secondsSinceLastGyroEvent = (double) TimeUnit.NANOSECONDS.toSeconds(this.clock.nanoTime() - this.latestGyroEventClockTimeNs); double secondsToPredictForward = secondsSinceLastGyroEvent + 0.057999998331069946D; double[] mat = this.tracker.getPredictedGLMatrix(secondsToPredictForward); int i = 0; while(true) { if(i >= headView.length) { break; } this.tmpHeadView[i] = (float)mat[i]; ++i; } } Matrix.multiplyMM(this.tmpHeadView2, 0, this.sensorToDisplay, 0, this.tmpHeadView, 0); Matrix.multiplyMM(headView, offset, this.tmpHeadView2, 0, this.ekfToHeadTracker, 0); Matrix.setIdentityM(this.neckModelTranslation, 0); Matrix.translateM(this.neckModelTranslation, 0, 0.0F, -this.neckModelFactor * 0.075F, this.neckModelFactor * 0.08F); Matrix.multiplyMM(this.tmpHeadView, 0, this.neckModelTranslation, 0, headView, offset); Matrix.translateM(headView, offset, this.tmpHeadView, 0, 0.0F, this.neckModelFactor * 0.075F, 0.0F); } }
Example 2
Source File: HeadTracker.java From HoloKilo with GNU General Public License v3.0 | 4 votes |
public void getLastHeadView(float[] headView, int offset) { if(offset + 16 > headView.length) { throw new IllegalArgumentException("Not enough space to write the result"); } else { float rotation = 0.0F; switch(this.display.getRotation()) { case 0: rotation = 0.0F; break; case 1: rotation = 90.0F; break; case 2: rotation = 180.0F; break; case 3: rotation = 270.0F; } if(rotation != this.displayRotation) { this.displayRotation = rotation; Matrix.setRotateEulerM(this.sensorToDisplay, 0, 0.0F, 0.0F, -rotation); Matrix.setRotateEulerM(this.ekfToHeadTracker, 0, -90.0F, 0.0F, rotation); } OrientationEKF var4 = this.tracker; synchronized(this.tracker) { if(!this.tracker.isReady()) { return; } double secondsSinceLastGyroEvent = (double)TimeUnit.NANOSECONDS.toSeconds(this.clock.nanoTime() - this.latestGyroEventClockTimeNs); double secondsToPredictForward = secondsSinceLastGyroEvent + 0.057999998331069946D; double[] mat = this.tracker.getPredictedGLMatrix(secondsToPredictForward); for(int i = 0; i < headView.length; ++i) { this.tmpHeadView[i] = (float)mat[i]; } } Matrix.multiplyMM(this.tmpHeadView2, 0, this.sensorToDisplay, 0, this.tmpHeadView, 0); Matrix.multiplyMM(headView, offset, this.tmpHeadView2, 0, this.ekfToHeadTracker, 0); Matrix.setIdentityM(this.neckModelTranslation, 0); Matrix.translateM(this.neckModelTranslation, 0, 0.0F, -this.neckModelFactor * 0.075F, this.neckModelFactor * 0.08F); Matrix.multiplyMM(this.tmpHeadView, 0, this.neckModelTranslation, 0, headView, offset); Matrix.translateM(headView, offset, this.tmpHeadView, 0, 0.0F, this.neckModelFactor * 0.075F, 0.0F); } }
Example 3
Source File: HeadTracker.java From MD360Player4Android with Apache License 2.0 | 4 votes |
public void getLastHeadView(float[] headView, int offset) { if(offset + 16 > headView.length) { throw new IllegalArgumentException("Not enough space to write the result"); } else { float rotation = 0.0F; switch(this.display.getRotation()) { case 0: rotation = 0.0F; break; case 1: rotation = 90.0F; break; case 2: rotation = 180.0F; break; case 3: rotation = 270.0F; } if(rotation != this.displayRotation) { this.displayRotation = rotation; Matrix.setRotateEulerM(this.sensorToDisplay, 0, 0.0F, 0.0F, -rotation); Matrix.setRotateEulerM(this.ekfToHeadTracker, 0, -90.0F, 0.0F, rotation); } OrientationEKF var4 = this.tracker; synchronized(this.tracker) { if(!this.tracker.isReady()) { return; } double secondsSinceLastGyroEvent = (double)TimeUnit.NANOSECONDS.toSeconds(this.clock.nanoTime() - this.latestGyroEventClockTimeNs); double secondsToPredictForward = secondsSinceLastGyroEvent + 0.057999998331069946D; double[] mat = this.tracker.getPredictedGLMatrix(secondsToPredictForward); int i = 0; while(true) { if(i >= headView.length) { break; } this.tmpHeadView[i] = (float)mat[i]; ++i; } } Matrix.multiplyMM(this.tmpHeadView2, 0, this.sensorToDisplay, 0, this.tmpHeadView, 0); Matrix.multiplyMM(headView, offset, this.tmpHeadView2, 0, this.ekfToHeadTracker, 0); Matrix.setIdentityM(this.neckModelTranslation, 0); Matrix.translateM(this.neckModelTranslation, 0, 0.0F, -this.neckModelFactor * 0.075F, this.neckModelFactor * 0.08F); Matrix.multiplyMM(this.tmpHeadView, 0, this.neckModelTranslation, 0, headView, offset); Matrix.translateM(headView, offset, this.tmpHeadView, 0, 0.0F, this.neckModelFactor * 0.075F, 0.0F); } }
Example 4
Source File: HeadTracker.java From Cardboard with Apache License 2.0 | 4 votes |
public HeadTracker(Context context) { this.mContext = context; Matrix.setRotateEulerM(this.mEkfToHeadTracker, 0, -90.0F, 0.0F, 0.0F); }