Java 类android.renderscript.Matrix4f 实例源码

项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:intellij-ce-playground    文件:BallsRS.java   
void updateProjectionMatrices() {
    mVpConsts = new ScriptField_VpConsts(mRS, 1,
                                         Allocation.USAGE_SCRIPT |
                                         Allocation.USAGE_GRAPHICS_CONSTANTS);
    ScriptField_VpConsts.Item i = new ScriptField_VpConsts.Item();
    Matrix4f mvp = new Matrix4f();
    mvp.loadOrtho(0, mRS.getWidth(), mRS.getHeight(), 0, -1, 1);
    i.MVP = mvp;
    mVpConsts.set(i, 0, true);
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
@Override
public void onSurfaceChanged(GL10 gl10, int w, int h) {
    GLES20.glViewport(0, 0, w, h);

    Matrix4f perspective = new Matrix4f();
    perspective.loadPerspective(85.0f, (float)w / (float)h, 1.0f, -150.0f);

    if(cube != null) {
        cube.setProjection(perspective);
    }
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
public void updateWithDelta(long dt) {

        Matrix4f camera2 = new Matrix4f();
        camera2.translate(0.0f, 0.0f, -5.0f);
        cube.setCamera(camera2);
        cube.setRotationY((float)( cube.rotationY + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.setRotationZ((float)( cube.rotationZ + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.draw(dt);
    }
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
@Override
public void onSurfaceChanged(GL10 gl10, int w, int h) {
    GLES20.glViewport(0, 0, w, h);

    Matrix4f perspective = new Matrix4f();
    perspective.loadPerspective(85.0f, (float)w / (float)h, 1.0f, -150.0f);

    if(cube != null) {
        cube.setProjection(perspective);
    }
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
@Override
public void onSurfaceChanged(GL10 gl10, int w, int h) {
    GLES20.glViewport(0, 0, w, h);

    Matrix4f perspective = new Matrix4f();
    perspective.loadPerspective(85.0f, (float)w / (float)h, 1.0f, -150.0f);

    if(cube != null) {
        cube.setProjection(perspective);
    }
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
public void updateWithDelta(long dt) {

        final float secsPerMove = 2.0f * ONE_SEC;
        float movement = (float)(Math.sin(System.currentTimeMillis() * 2 * Math.PI / secsPerMove));

        // move camera
        Matrix4f camera = new Matrix4f();
        camera.translate(0.0f, -1.0f * movement, -15.0f);
        camera.rotate(360.0f * movement, 0.0f, 0.0f, 1.0f);
        camera.scale(movement, movement, movement);
        square.setCamera(camera);
        square.draw(dt);
    }
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
@Override
public void onSurfaceChanged(GL10 gl10, int w, int h) {
    GLES20.glViewport(0, 0, w, h);

    Matrix4f perspective = new Matrix4f();
    perspective.loadPerspective(85.0f, (float)w / (float)h, 1.0f, -150.0f);

    if(cube != null) {
        cube.setProjection(perspective);
    }
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
public void updateWithDelta(long dt) {

        Matrix4f camera2 = new Matrix4f();
        camera2.translate(0.0f, 0.0f, -5.0f);
        cube.setCamera(camera2);
        cube.setRotationY((float)( cube.rotationY + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.setRotationZ((float)( cube.rotationZ + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.draw(dt);
    }
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
@Override
public void onSurfaceChanged(GL10 gl10, int w, int h) {
    GLES20.glViewport(0, 0, w, h);

    if(square != null) {
        Matrix4f perspective = new Matrix4f();
        perspective.loadPerspective(85.0f, (float)w / (float)h, 1.0f, -150.0f);
        square.setProjection(perspective);
    }
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
public void updateWithDelta(long dt) {

        Matrix4f camera2 = new Matrix4f();
        camera2.translate(0.0f, 0.0f, -5.0f);
        cube.setCamera(camera2);
        cube.setRotationY((float)( cube.rotationY + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.setRotationZ((float)( cube.rotationZ + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.draw(dt);
    }
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
  Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
  mat.translate(position.x, position.y, position.z);
  mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
  mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
  mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
  mat.scale(scale, scale, scale);
  return mat;
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
public void updateWithDelta(long dt) {

        Matrix4f camera2 = new Matrix4f();
        camera2.translate(0.0f, 0.0f, -5.0f);
        cube.setCamera(camera2);
        cube.setRotationY((float)( cube.rotationY + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.setRotationZ((float)( cube.rotationZ + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.draw(dt);
    }
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
public void updateWithDelta(long dt) {

        final float secsPerMove = 2.0f * ONE_SEC;
        float movement = (float)(Math.sin(System.currentTimeMillis() * 2 * Math.PI / secsPerMove));

        Matrix4f camera = new Matrix4f();
        camera.translate(0.0f, -1.0f * movement, 0.0f);
        camera.rotate(360.0f * movement, 0.0f, 0.0f, 1.0f);
        camera.scale(movement, movement, movement);
        square.setCamera(camera);


        square.draw(dt);
    }
项目:LearningOpenGLES2-Android    文件:Model.java   
public Matrix4f modelMatrix() {
    Matrix4f mat = new Matrix4f(); // make a new identitiy 4x4 matrix
    mat.translate(position.x, position.y, position.z);
    mat.rotate(rotationX, 1.0f, 0.0f, 0.0f);
    mat.rotate(rotationY, 0.0f, 1.0f, 0.0f);
    mat.rotate(rotationZ, 0.0f, 0.0f, 1.0f);
    mat.scale(scale, scale, scale);
    return mat;
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
@Override
public void onSurfaceChanged(GL10 gl10, int w, int h) {
    GLES20.glViewport(0, 0, w, h);

    Matrix4f perspective = new Matrix4f();
    perspective.loadPerspective(85.0f, (float)w / (float)h, 1.0f, -150.0f);

    if(cube != null) {
        cube.setProjection(perspective);
    }
}
项目:LearningOpenGLES2-Android    文件:OGLRenderer.java   
public void updateWithDelta(long dt) {

        Matrix4f camera2 = new Matrix4f();
        camera2.translate(0.0f, 0.0f, -5.0f);
        cube.setCamera(camera2);
        cube.setRotationY((float)( cube.rotationY + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.setRotationZ((float)( cube.rotationZ + Math.PI * dt / (ONE_SEC * 0.1f) ));
        cube.draw(dt);
    }
项目:LearningOpenGLES2-Android    文件:Model.java   
public void setCamera(Matrix4f mat) {
    camera.load(mat);
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public void setProjection(Matrix4f mat) {
    projection.load(mat);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix) {
    setUniformMatrix(location, matrix, false);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix, boolean transpose) {
    if(location == -1) return;
    GLES20.glUniformMatrix4fv(location, 1, transpose, matrix.getArray(), 0);
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public void setCamera(Matrix4f mat) {
    camera.load(mat);
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public void setProjection(Matrix4f mat) {
    projection.load(mat);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix) {
    setUniformMatrix(location, matrix, false);
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public void setCamera(Matrix4f mat) {
    camera.load(mat);
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public void setCamera(Matrix4f mat) {
    camera.load(mat);
}
项目:LearningOpenGLES2-Android    文件:Model.java   
public void setProjection(Matrix4f mat) {
    projection.load(mat);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix) {
    setUniformMatrix(location, matrix, false);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix) {
    setUniformMatrix(location, matrix, false);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix) {
    setUniformMatrix(location, matrix, false);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix, boolean transpose) {
    if(location == -1) return;
    GLES20.glUniformMatrix4fv(location, 1, transpose, matrix.getArray(), 0);
}
项目:LearningOpenGLES2-Android    文件:ShaderProgram.java   
public void setUniformMatrix (int location, Matrix4f matrix) {
    setUniformMatrix(location, matrix, false);
}