8package org.skia.jetski;
14 private long mNativeInstance;
20 mNativeInstance = nCreate(1, 0, 0, 0,
29 public Matrix(
float m0,
float m4,
float m8,
float m12,
30 float m1,
float m5,
float m9,
float m13,
31 float m2,
float m6,
float m10,
float m14,
32 float m3,
float m7,
float m11,
float m15) {
33 mNativeInstance = nCreate(m0, m4, m8, m12,
40 mNativeInstance = nativeInstance;
44 float coaX,
float coaY,
float coaZ,
45 float upX,
float upY,
float upZ) {
46 return new Matrix(nCreateLookAt(eyeX, eyeY, eyeZ,
52 return new Matrix(nCreatePerspective(near, far, angle));
56 long nativeMatrix = nInverse(
m.getNativeInstance());
57 if (nativeMatrix == 0){
59 throw new RuntimeException(
"Matrix m was not an invertible Matrix");
61 return new Matrix(nativeMatrix);
65 long nativeTranspose = nTranspose(
m.getNativeInstance());
66 return new Matrix(nativeTranspose);
75 long nativeA =
a.mNativeInstance;
76 long nativeB =
b.mNativeInstance;
77 long nativeC = nConcat(nativeA, nativeB);
78 return new Matrix(nativeC);
91 float[] vals = nGetRowMajor(this.mNativeInstance);
93 throw new RuntimeException(
"Cannot make native float array, out of memory");
95 return nGetRowMajor(this.mNativeInstance);
104 long nativeA = this.mNativeInstance;
105 long nativeB =
b.mNativeInstance;
106 nPreConcat(nativeA, nativeB);
116 nTranslate(this.mNativeInstance,
x,
y, z);
129 nScale(this.mNativeInstance,
x,
y, z);
142 nRotate(this.mNativeInstance, 1, 0, 0, rad);
152 nRotate(this.mNativeInstance, 0, 1, 0, rad);
162 nRotate(this.mNativeInstance, 0, 0, 1, rad);
172 nRotate(this.mNativeInstance,
x,
y, z, rad);
180 nRelease(mNativeInstance);
192 private static native
long nCreate(
float m0,
float m4,
float m8,
float m12,
193 float m1,
float m5,
float m9,
float m13,
194 float m2,
float m6,
float m10,
float m14,
195 float m3,
float m7,
float m11,
float m15);
196 private static native
long nCreateLookAt(
float eyeX,
float eyeY,
float eyeZ,
197 float coaX,
float coaY,
float coaZ,
198 float upX,
float upY,
float upZ);
199 private static native
long nCreatePerspective(
float near,
float far,
float angle);
200 private static native
void nRelease(
long nativeInstance);
201 private static native
float[] nGetRowMajor(
long mNativeInstance);
202 private static native
long nInverse(
long mNativeInstance);
203 private static native
long nTranspose(
long mNativeInstance);
204 private static native
void nPreConcat(
long mNativeInstanceA,
long mNativeInstanceB);
205 private static native
long nConcat(
long mNativeInstanceA,
long mNativeInstanceB);
206 private static native
void nTranslate(
long mNativeInstance,
float x,
float y,
float z);
207 private static native
void nScale(
long mNativeInstance,
float x,
float y,
float z);
208 private static native
void nRotate(
long mNativeInstance,
float x,
float y,
float z,
float rad);
Matrix(long nativeInstance)
static Matrix makePerspective(float near, float far, float angle)
Matrix(float m0, float m4, float m8, float m12, float m1, float m5, float m9, float m13, float m2, float m6, float m10, float m14, float m3, float m7, float m11, float m15)
Matrix translate(float x, float y, float z)
Matrix rotateZ(float rad)
Matrix translate(float x, float y)
static Matrix makeLookAt(float eyeX, float eyeY, float eyeZ, float coaX, float coaY, float coaZ, float upX, float upY, float upZ)
Matrix rotateY(float rad)
Matrix scale(float x, float y)
Matrix preConcat(Matrix b)
static Matrix makeInverse(Matrix m)
Matrix scale(float x, float y, float z)
static Matrix makeTranspose(Matrix m)
static Matrix makeConcat(Matrix a, Matrix b)
Matrix rotateX(float rad)
float getAtRowCol(int r, int c)
Matrix rotate(float x, float y, float z, float rad)