本文整理了Java中android.opengl.Matrix.rotateM()
方法的一些代码示例,展示了Matrix.rotateM()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.rotateM()
方法的具体详情如下:
包路径:android.opengl.Matrix
类名称:Matrix
方法名:rotateM
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void testRotateMInPlace() {
float[] matrix = new float[]{
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16
};
float[] expected = new float[]{
0.95625275f, 1.9625025f, 2.968752f, 3.9750016f,
5.0910234f, 6.07802f, 7.0650167f, 8.052013f,
8.953606f, 9.960234f, 10.966862f, 11.973489f,
13, 14, 15, 16
};
Matrix.rotateM(matrix, 0, 2, 4, 6, 8);
assertThat(matrix).usingExactEquality().containsAllOf(expected);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testRotateM() {
float[] matrix = new float[]{
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16
};
float[] expected = new float[]{
0.95625275f, 1.9625025f, 2.968752f, 3.9750016f,
5.0910234f, 6.07802f, 7.0650167f, 8.052013f,
8.953606f, 9.960234f, 10.966862f, 11.973489f,
13, 14, 15, 16
};
float[] output = new float[16];
Matrix.rotateM(output, 0, matrix, 0, 2, 4, 6, 8);
assertThat(output).usingExactEquality().containsAllOf(expected);
}
代码示例来源:origin: google/ExoPlayer
Matrix.rotateM(phoneInWorldSpaceMatrix, 0, 90, 1, 0, 0);
renderer.setDeviceOrientation(phoneInWorldSpaceMatrix, roll);
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
public static float[] rotate(float[] m,float angle){
Matrix.rotateM(m,0,angle,0,0,1);
return m;
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
public static float[] rotate(float[] m,float angle){
Matrix.rotateM(m,0,angle,0,0,1);
return m;
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
public void rotate(float angle,float x,float y,float z){
Matrix.rotateM(mMatrixCurrent,0,angle,x,y,z);
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onDrawFrame(GL10 gl) {
Matrix.rotateM(mFilter.getMatrix(),0,0.3f,0,1,0);
mFilter.draw();
}
});
代码示例来源:origin: google/santa-tracker-android
private void drawQuad(float centerX, float centerY, float width, float height, float rotation) {
// compute final matrix
float[] modelViewM = mTmpMatA;
float[] finalM = mTmpMatB;
Matrix.setIdentityM(modelViewM, 0);
Matrix.translateM(modelViewM, 0, centerX, centerY, 0.0f);
Matrix.rotateM(modelViewM, 0, rotation, 0.0f, 0.0f, 1.0f);
Matrix.scaleM(modelViewM, 0, width, height, 1.0f);
Matrix.multiplyMM(finalM, 0, mProjMat, 0, modelViewM, 0);
// push matrix
GLES20.glUniformMatrix4fv(mLocMatrix, 1, false, finalM, 0);
// push positions
GLES20.glEnableVertexAttribArray(mLocPosition);
mQuadGeomBuf.position(QUAD_GEOM_POS_OFFSET);
GLES20.glVertexAttribPointer(
mLocPosition, 3, GLES20.GL_FLOAT, false, QUAD_GEOM_STRIDE, mQuadGeomBuf);
// push texture coordinates
GLES20.glEnableVertexAttribArray(mLocTexCoord);
mQuadGeomBuf.position(QUAD_GEOM_TEXCOORD_OFFSET);
GLES20.glVertexAttribPointer(
mLocTexCoord, 2, GLES20.GL_FLOAT, false, QUAD_GEOM_STRIDE, mQuadGeomBuf);
// draw
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, QUAD_GEOM_VERTEX_COUNT);
}
代码示例来源:origin: yangjie10930/OpenGL4Android
/**
* 旋转矩阵
*
* @param m 待旋转的4X4矩阵
* @param r 旋转角度
* @return
*/
public static float[] rotation(float[] m, float r) {
Matrix.rotateM(m, 0, r, 0.0f, 0.0f, 1.0f);
return m;
}
代码示例来源:origin: glumes/AndroidOpenGLTutorial
public static void rotate(float angle, float x, float y, float z)//设置绕xyz轴移动
{
Matrix.rotateM(currMatrix, 0, angle, x, y, z);
}
代码示例来源:origin: saki4510t/libcommon
/**
* 現在のモデルビュー変換行列をxy平面で指定した角度回転させる
* @param mvp
* @param degrees
*/
protected static void rotate(final float[] mvp, final int degrees) {
if ((degrees % 180) != 0) {
Matrix.rotateM(mvp, 0, degrees, 0.0f, 0.0f, 1.0f);
}
}
代码示例来源:origin: linglongxin24/ARDevelopDemo
private void animateBowl(float[] modelViewMatrix)
{
double time = System.currentTimeMillis(); // Get real time difference
float dt = (float) (time - prevTime) / 1000; // from frame to frame
rotateAngle += dt * 180.0f / 3.1415f; // Animate angle based on time
rotateAngle %= 360;
Log.d(LOGTAG, "Delta animation time: " + rotateAngle);
Matrix.rotateM(modelViewMatrix, 0, rotateAngle, 0.0f, 1.0f, 0.0f);
prevTime = time;
}
代码示例来源:origin: dbrant/ModelViewer3D
private void updateViewMatrix() {
Matrix.setLookAtM(viewMatrix, 0, 0, 0, translateZ, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.translateM(viewMatrix, 0, -translateX, -translateY, 0f);
Matrix.rotateM(viewMatrix, 0, rotateAngleX, 1f, 0f, 0f);
Matrix.rotateM(viewMatrix, 0, rotateAngleY, 0f, 1f, 0f);
}
代码示例来源:origin: dbrant/ModelViewer3D
protected void initModelMatrix(float boundSize, float rotateX, float rotateY, float rotateZ) {
Matrix.setIdentityM(modelMatrix, 0);
Matrix.rotateM(modelMatrix, 0, rotateX, 1.0f, 0.0f, 0.0f);
Matrix.rotateM(modelMatrix, 0, rotateY, 0.0f, 1.0f, 0.0f);
Matrix.rotateM(modelMatrix, 0, rotateZ, 0.0f, 0.0f, 1.0f);
scaleModelMatrixToBounds(boundSize);
Matrix.translateM(modelMatrix, 0, -centerMassX, -centerMassY, -centerMassZ);
}
代码示例来源:origin: dbrant/ModelViewer3D
private void updateViewMatrix() {
Matrix.setLookAtM(viewMatrix, 0, 0, 0, translateZ, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.translateM(viewMatrix, 0, -translateX, -translateY, 0f);
Matrix.rotateM(viewMatrix, 0, rotateAngleX, 1f, 0f, 0f);
Matrix.rotateM(viewMatrix, 0, rotateAngleY, 0f, 1f, 0f);
}
代码示例来源:origin: saki4510t/libcommon
/**
* モデルビュー変換行列にxy平面で指定した角度回転させた回転行列をセットする
* @param mvp
* @param degrees
*/
protected static void setRotation(final float[] mvp, final int degrees) {
Matrix.setIdentityM(mvp, 0);
if ((degrees % 180) != 0) {
Matrix.rotateM(mvp, 0, degrees, 0.0f, 0.0f, 1.0f);
}
}
}
代码示例来源:origin: doggycoder/AndroidOpenGLDemo
@Override
public void onDrawFrame(GL10 gl) {
Matrix.rotateM(matrix,0,2,-1,-1,1);
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT|GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glClearColor(0.5f,0.5f,0.5f,1.0f);
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
public void setRotation(int rotation) {
Matrix.setIdentityM(rotationMatrix, 0);
Matrix.rotateM(rotationMatrix, 0, rotation, 0f, 0f, -1f);
update();
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
public void setRotation(int rotation) {
Matrix.setIdentityM(rotationMatrix, 0);
Matrix.rotateM(rotationMatrix, 0, rotation, 0f, 0f, -1f);
update();
}
代码示例来源:origin: glumes/AndroidOpenGLTutorial
@Override
public void onDrawFrame(GL10 gl) {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
long time = SystemClock.uptimeMillis() % 10000L;
float angleInDegrees = (360.0f / 10000.0f) * ((int) time);
Matrix.setIdentityM(modelMatrix,0);
Matrix.rotateM(modelMatrix,0,angleInDegrees,1.0f,1.0f,0.0f);
glUniformMatrix4fv(uMatrixLocation, 1, false, modelMatrix, 0);
// glUniform4f(uColorLocation, 0.0f, 1.0f, 0.0f, 1.0f);
glDrawArrays(GL_TRIANGLE_STRIP, 0, length);
}
内容来源于网络,如有侵权,请联系作者删除!