1126 |
return 1; |
return 1; |
1127 |
} |
} |
1128 |
|
|
1129 |
|
JNIEXPORT jboolean JNICALL Java_gzz_gfx_gl_GL_transform2 |
1130 |
|
(JNIEnv *env, jclass, jint ninds, jintArray j_inds, jfloatArray j_pts, |
1131 |
|
jintArray j_interpinds, jintArray j_inds2, jfloatArray j_pts2, |
1132 |
|
jfloat fract, jboolean show1, |
1133 |
|
jint coordsys, jboolean inverse, jfloatArray j_points, jfloatArray j_into) { |
1134 |
|
|
1135 |
|
jint *inds = env->GetIntArrayElements(j_inds, 0); |
1136 |
|
jfloat *pts = env->GetFloatArrayElements(j_pts, 0); |
1137 |
|
|
1138 |
|
jint *interpinds = env->GetIntArrayElements(j_interpinds, 0); |
1139 |
|
|
1140 |
|
jint *inds2 = env->GetIntArrayElements(j_inds2, 0); |
1141 |
|
jfloat *pts2 = env->GetFloatArrayElements(j_pts2, 0); |
1142 |
|
|
1143 |
|
Coords::CoordSet coordset; |
1144 |
|
coordset.clean(); |
1145 |
|
coordset.setPoints((int)ninds, (int*)inds, |
1146 |
|
(float*)pts, (int*)interpinds, |
1147 |
|
(int*)inds2, (float*)pts2, |
1148 |
|
(float)fract, (bool)show1); |
1149 |
|
|
1150 |
|
int arrayLength = env->GetArrayLength(j_points); |
1151 |
|
jfloat *points = env->GetFloatArrayElements(j_points, 0); |
1152 |
|
jfloat *into = env->GetFloatArrayElements(j_into, 0); |
1153 |
|
|
1154 |
|
Coords::CoordSys *cs = coordset.get(coordsys); |
1155 |
|
if(cs != 0) { |
1156 |
|
if(inverse) cs = cs->getInverse(); |
1157 |
|
for(int i=0; i<arrayLength; i+=3) { |
1158 |
|
ZPt pt(points[i], points[i+1], points[i+2]); |
1159 |
|
ZPt pt2 = cs->transform(pt); |
1160 |
|
into[i] = pt2.x; |
1161 |
|
into[i+1] = pt2.y; |
1162 |
|
into[i+2] = pt2.z; |
1163 |
|
} |
1164 |
|
} |
1165 |
|
|
1166 |
|
env->ReleaseFloatArrayElements(j_points, points, JNI_ABORT); |
1167 |
|
env->ReleaseFloatArrayElements(j_into, into, 0); // These were changed, commit. |
1168 |
|
|
1169 |
|
env->ReleaseIntArrayElements(j_inds, inds, JNI_ABORT); |
1170 |
|
env->ReleaseFloatArrayElements(j_pts, pts, JNI_ABORT); |
1171 |
|
|
1172 |
|
env->ReleaseIntArrayElements(j_interpinds, interpinds, JNI_ABORT); |
1173 |
|
|
1174 |
|
env->ReleaseIntArrayElements(j_inds2, inds2, JNI_ABORT); |
1175 |
|
env->ReleaseFloatArrayElements(j_pts2, pts2, JNI_ABORT); |
1176 |
|
|
1177 |
|
return (cs != 0); |
1178 |
|
} |
1179 |
|
|
1180 |
|
|
1181 |
|
|
1182 |
using namespace Renderables; |
using namespace Renderables; |
1183 |
|
|