1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "javax_microedition_m3g_Object3D.h" |
|
19 |
|
20 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1animate |
|
21 (JNIEnv* aEnv, jclass, jint aHObject, jint aTime) |
|
22 { |
|
23 M3G_DO_LOCK |
|
24 jint anim = (jint)m3gAnimate((M3GObject)aHObject, aTime); |
|
25 M3G_DO_UNLOCK(aEnv) |
|
26 return anim; |
|
27 } |
|
28 |
|
29 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1getAnimationTrack |
|
30 (JNIEnv* aEnv, jclass, jint aHObject, jint aIndex) |
|
31 { |
|
32 M3G_DO_LOCK |
|
33 jint handle = (M3Guint)m3gGetAnimationTrack((M3GObject)aHObject, aIndex); |
|
34 M3G_DO_UNLOCK(aEnv) |
|
35 return handle; |
|
36 } |
|
37 |
|
38 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1find |
|
39 (JNIEnv* aEnv, jclass, jint aHObject, jint aUserID) |
|
40 { |
|
41 M3G_DO_LOCK |
|
42 jint target = (M3Guint)m3gFind((M3GObject)aHObject, aUserID); |
|
43 M3G_DO_UNLOCK(aEnv) |
|
44 return target; |
|
45 } |
|
46 |
|
47 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1getUserID |
|
48 (JNIEnv* aEnv, jclass, jint aHObject) |
|
49 { |
|
50 M3G_DO_LOCK |
|
51 jint id = (jint)m3gGetUserID((M3GObject)aHObject); |
|
52 M3G_DO_UNLOCK(aEnv) |
|
53 return id; |
|
54 } |
|
55 |
|
56 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1addAnimationTrack |
|
57 (JNIEnv* aEnv, jclass, jint aHObject, jint aHTrack) |
|
58 { |
|
59 M3G_DO_LOCK |
|
60 jint ret = (jint)m3gAddAnimationTrack((M3GObject)aHObject, (M3GAnimationTrack)aHTrack); |
|
61 M3G_DO_UNLOCK(aEnv) |
|
62 return ret; |
|
63 } |
|
64 |
|
65 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1getAnimationTrackCount |
|
66 (JNIEnv* aEnv, jclass, jint aHObject) |
|
67 { |
|
68 M3G_DO_LOCK |
|
69 jint count = (jint)m3gGetAnimationTrackCount((M3GObject)aHObject); |
|
70 M3G_DO_UNLOCK(aEnv) |
|
71 return count; |
|
72 } |
|
73 |
|
74 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Object3D__1removeAnimationTrack |
|
75 (JNIEnv* aEnv, jclass, jint aHObject, jint aHTrack) |
|
76 { |
|
77 M3G_DO_LOCK |
|
78 m3gRemoveAnimationTrack((M3GObject)aHObject, (M3GAnimationTrack)aHTrack); |
|
79 M3G_DO_UNLOCK(aEnv) |
|
80 } |
|
81 |
|
82 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Object3D__1setUserID |
|
83 (JNIEnv* aEnv, jclass, jint aHObject, jint aUserID) |
|
84 { |
|
85 M3G_DO_LOCK |
|
86 m3gSetUserID((M3GObject)aHObject, aUserID); |
|
87 M3G_DO_UNLOCK(aEnv) |
|
88 } |
|
89 |
|
90 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Object3D__1addRef |
|
91 (JNIEnv* aEnv, jclass, jint aObject) |
|
92 { |
|
93 M3G_DO_LOCK |
|
94 m3gAddRef((M3GObject) aObject); |
|
95 M3G_DO_UNLOCK(aEnv) |
|
96 } |
|
97 |
|
98 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1duplicate |
|
99 (JNIEnv* aEnv, jclass, jint aHObject, jintArray aHReferences) |
|
100 { |
|
101 jint* references = NULL; |
|
102 if (aHReferences) |
|
103 { |
|
104 references = aEnv->GetIntArrayElements(aHReferences, NULL); |
|
105 if (references == NULL) |
|
106 { |
|
107 M3G_RAISE_EXCEPTION(aEnv, "java/lang/OutOfMemoryError"); |
|
108 return 0; |
|
109 } |
|
110 } |
|
111 |
|
112 M3G_DO_LOCK |
|
113 M3Guint ret = (M3Guint)m3gDuplicate((M3GObject)aHObject, (M3GObject *)references); |
|
114 M3G_DO_UNLOCK(aEnv) |
|
115 |
|
116 if (references) |
|
117 { |
|
118 aEnv->ReleaseIntArrayElements(aHReferences, references, 0); |
|
119 } |
|
120 |
|
121 return ret; |
|
122 } |
|
123 |
|
124 JNIEXPORT jint JNICALL Java_javax_microedition_m3g_Object3D__1getReferences |
|
125 (JNIEnv* aEnv, jclass, jint aHObject, jintArray aHReferences) |
|
126 { |
|
127 jint* references = NULL; |
|
128 if (aHReferences) |
|
129 { |
|
130 references = aEnv->GetIntArrayElements(aHReferences, NULL); |
|
131 if (references == NULL) |
|
132 { |
|
133 M3G_RAISE_EXCEPTION(aEnv, "java/lang/OutOfMemoryError"); |
|
134 return 0; |
|
135 } |
|
136 } |
|
137 jint numReferences = aHReferences ? aEnv->GetArrayLength(aHReferences) : 0; |
|
138 |
|
139 M3G_DO_LOCK |
|
140 jint ret = m3gGetReferences((M3GObject)aHObject, (M3GObject *)references, numReferences); |
|
141 M3G_DO_UNLOCK(aEnv) |
|
142 |
|
143 if (references) |
|
144 { |
|
145 aEnv->ReleaseIntArrayElements(aHReferences, references, 0); |
|
146 } |
|
147 |
|
148 return ret; |
|
149 } |
|