Skip to content

Commit dd530d8

Browse files
Ueda.A.TakashiUeda.A.Takashi
authored andcommitted
Desktop-M3G側のインターフェースの変更に伴うアップデート
1 parent b295e77 commit dd530d8

File tree

7 files changed

+73
-50
lines changed

7 files changed

+73
-50
lines changed

CHANGES

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
4+
5+
2011/xx/xx
6+
- remove dependecy for libpng and libjpeg.
7+
- you don't need these library any more!
8+
9+
10+
2011/05/17 ver 0.3.3
11+
- first release

README

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,32 @@ Brief description
44
-------------------------------------------
55

66
= What is the Java-M3G? =
7-
Java-M3G is a java bindings for Desktop-M3G (Which implements M3G 1.1(JSR184) API).
7+
Java-M3G is a java binding for Desktop-M3G (Which implements M3G 1.1(JSR184) API).
88
It is distributed under MIT license.
99

1010
= Requirement =
1111
- OpenGL 1.5 or higher (for Linux)
1212
- OpenGL ES 1.1 or higher (for Android)
13-
- libz
14-
- Desktop-M3G (libm3g.so)
13+
- libz (*1)
14+
- Desktop-M3G (*2)
15+
16+
(*1) You need only libz.
17+
Current version of Java-M3G(and Desktop-M3G) doesn't need libpng an libjpeg yet.
18+
(*2) Desktop-M3G is another project.
19+
But binary package of Java-M3G also contains this.
20+
So, you can use Java-M3G very easy and quick.
1521

1622
= Java-M3G =
1723
Java-M3G consits of 3 components.
18-
- java-m3g.jar := Java bindings for Desktop-M3G
19-
- libjava-m3g.so := jni(C++) library which inteconnects Java side and C++ side.
20-
- libm3g.so := Desktop-M3G which implements M3G-1.1(JSR 184) API.
21-
24+
- java-m3g.jar := Java binding for Desktop-M3G
25+
- libjava-m3g.so := jni(C++) library which inteconnects Java side and C++ side
26+
- libm3g.so := Desktop-M3G which implements M3G-1.1(JSR 184) API
2227

2328
-------------------------------------------
2429
Make & Install
2530
-------------------------------------------
2631

27-
- see README.linux for Linux
32+
- see README.linux for Linux
2833
- see README.android for Android
2934

3035

README.linux

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,21 @@ Make & Install
3333
Compile C++ native libary first.
3434
1. cd ${Java-M3G}/jni/build/linux/Debug
3535
2. cmake -DCMAKE_BUILD_TYPE=Debug ../../..
36-
- will generate libjava-m3g.so
36+
- will generate Makefile
3737
3. make
38+
- will generate libjava-m3g.so
3839
4. make install
3940
- will install Java-M3G to ${Java-M3G}/bin.
4041

4142
= java-m3g.jar =
4243
You need Eclipse for compiling java-m3g.jar.
4344
1. import all projects from ${Java-M3G}/build/linux
44-
- 「import」-->「Existing Projects into Workspace」-->「Select root directory」
45-
- You can find Java-M3G, Sample-00-JOGL, Smaple-01-Simple, etc., ...
45+
- 「Import」-->「General」-->「Existing Projects into Workspace」-->「Select root directory」
46+
Select ${Java-M3G}/build/linux as root directory.
47+
You can find Java-M3G project and other sample projects (Sample-00-JOGL, Smaple-01-Simple, etc., ...).
48+
Import all of them.
4649
2. open (or double click) java-m3g.jardesc at java-M3G project
47-
- will export java-m3g.jar
50+
- will export java-m3g.jar
4851

4952

5053
-------------------------------------------
@@ -54,36 +57,39 @@ How to use Java-M3G
5457
= Copy Java-M3G =
5558
You need to copy 3 components (java-m3g.jar, libjava-m3g.so and libm3g.so) to your project.
5659
You can find them here.
57-
- ${Java-M3G}/Java-M3G/bin/java-m3g.jar
60+
- ${Java-M3G}/build/linux/Java-M3G/bin/java-m3g.jar
5861
- ${Java-M3G}/jni/bin/lib/linux/libjava-m3g.so
5962
- ${Java-M3G}/jni/bin/lib/linux/libm3g.so
60-
Copy to your ${YourFavorite} directory.
63+
Copy them to your ${YourFavorite} directory.
6164

6265
= Setup JOGL =
6366
Open your project in Eclipse.
6467
- [Properties] --> [Java Build Path] --> [Libraries] --> [Add External JARs...]
65-
set jar files and native location.
68+
set jar files,
6669
- /usr/share/java/jogl.jar (on my Ubuntu 11.10)
6770
- /usr/share/java/glugen-rt.jar (on my Ubuntu 11.10)
71+
and native library location.
6872
- /usr/lib/jni (on my Ubuntu 11.10)
6973
Don't forget to set native library location.
70-
They need native libraries (libjogl.so, libgugen-rt.so).
74+
Actually they need their proper native libraries (libjogl.so, libgugen-rt.so).
7175

7276
= Setup Java-M3G =
7377
Open your project in Eclipse.
7478
- [Properties] --> [Java Build Path] --> [Libraries] --> [Add External JARs...]
75-
set jar files and native library location.
76-
- ${YourFavorite}/java-m3g.jar
77-
- ${YourFavorite}/
79+
set jar files,
80+
- ${YourFavorite}/java-m3g.jar (any where you choiced)
81+
and native library location.
82+
- ${YourFavorite}/ (any where you choiced)
7883
Don't forget to set native library location.
79-
They need native libraries (libm3g.so, libjava-m3g.so).
84+
Also Java-M3G need their 2 native libraries (libm3g.so, libjava-m3g.so).
8085

8186
-------------------------------------------
8287
Test & Samples
8388
-------------------------------------------
8489

8590
= UnitTest =
8691
You can find UnitTest project on eclipse.
92+
But it's broken.
8793

8894
= Samples =
8995
You can find about 15 sample projects on eclipse.

jni/src/java-Mesh.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ JNIEXPORT void JNICALL Java_org_karlsland_m3g_Mesh_jni_1initialize__Lorg_karlsla
1616
(JNIEnv* env, jobject thiz, jobject vertices, jobjectArray submeshes, jobjectArray appearances)
1717
{
1818
//cout << "Java-Mesh: initialize1 is called.\n";
19-
VertexBuffer* vbuf = (VertexBuffer*)getNativePointer (env, vertices);
20-
int len = env->GetArrayLength (submeshes);
21-
IndexBuffer** ibufs = new IndexBuffer* [len];
22-
for (int i = 0; i < len; i++) {
19+
VertexBuffer* vbuf = (VertexBuffer*)getNativePointer (env, vertices);
20+
int ibufs_len = env->GetArrayLength (submeshes);
21+
IndexBuffer** ibufs = new IndexBuffer* [ibufs_len];
22+
for (int i = 0; i < ibufs_len; i++) {
2323
ibufs[i] = (IndexBuffer*)getNativePointer (env, env->GetObjectArrayElement(submeshes, i));
2424
}
25-
len = env->GetArrayLength (appearances);
26-
Appearance** apps = new Appearance* [len];
27-
for (int i = 0; i < len; i++) {
25+
int apps_len = env->GetArrayLength (appearances);
26+
Appearance** apps = new Appearance* [apps_len];
27+
for (int i = 0; i < apps_len; i++) {
2828
apps[i] = (Appearance*)getNativePointer (env, env->GetObjectArrayElement(appearances, i));
2929
}
3030
Mesh* mesh = NULL;
3131
__TRY__;
32-
mesh = new Mesh (vbuf, len, ibufs, apps);
32+
mesh = new Mesh (vbuf, ibufs_len, ibufs, apps_len, apps);
3333
__CATCH__;
3434
if (env->ExceptionOccurred ()) {
3535
return;

jni/src/java-MorphingMesh.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ JNIEXPORT void JNICALL Java_org_karlsland_m3g_MorphingMesh_jni_1initialize__Lorg
2222
for (int i = 0; i < tars_len; i++) {
2323
tars[i] = (VertexBuffer*)getNativePointer (env, env->GetObjectArrayElement(targets, i));
2424
}
25-
int len = env->GetArrayLength (submeshes);
26-
IndexBuffer** ibufs = new IndexBuffer* [len];
27-
for (int i = 0; i < len; i++) {
25+
int ibufs_len = env->GetArrayLength (submeshes);
26+
IndexBuffer** ibufs = new IndexBuffer* [ibufs_len];
27+
for (int i = 0; i < ibufs_len; i++) {
2828
ibufs[i] = (IndexBuffer*)getNativePointer (env, env->GetObjectArrayElement(submeshes, i));
2929
}
30-
len = env->GetArrayLength (appearances);
31-
Appearance** apps = new Appearance* [len];
32-
for (int i = 0; i < len; i++) {
30+
int apps_len = env->GetArrayLength (appearances);
31+
Appearance** apps = new Appearance* [apps_len];
32+
for (int i = 0; i < apps_len; i++) {
3333
apps[i] = (Appearance*)getNativePointer (env, env->GetObjectArrayElement(appearances, i));
3434
}
3535
MorphingMesh* mesh = NULL;
3636
__TRY__;
37-
mesh = new MorphingMesh (vbuf, tars_len, tars, len, ibufs, apps);
37+
mesh = new MorphingMesh (vbuf, tars_len, tars, ibufs_len, ibufs, apps_len, apps);
3838
__CATCH__;
3939
if (env->ExceptionOccurred ()) {
4040
return;

jni/src/java-SkinnedMesh.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ JNIEXPORT void JNICALL Java_org_karlsland_m3g_SkinnedMesh_jni_1initialize__Lorg_
1616
(JNIEnv* env, jobject thiz, jobject vertices, jobjectArray submeshes, jobjectArray appearances, jobject skeleton)
1717
{
1818
//cout << "Java-SkinnedMesh: initialize1 is caleld.\n";
19-
VertexBuffer* vbuf = (VertexBuffer*)getNativePointer (env, vertices);
20-
Group* skel = (Group*) getNativePointer (env, skeleton);
21-
int ibuf_len = env->GetArrayLength (submeshes);
22-
int app_len = env->GetArrayLength (appearances);
23-
IndexBuffer** ibufs = new IndexBuffer* [ibuf_len];
24-
Appearance** apps = new Appearance* [app_len];
25-
for (int i = 0; i < ibuf_len; i++) {
19+
VertexBuffer* vbuf = (VertexBuffer*)getNativePointer (env, vertices);
20+
int ibufs_len = env->GetArrayLength (submeshes);
21+
IndexBuffer** ibufs = new IndexBuffer* [ibufs_len];
22+
for (int i = 0; i < ibufs_len; i++) {
2623
ibufs[i] = (IndexBuffer*)getNativePointer (env, env->GetObjectArrayElement(submeshes, i));
2724
}
28-
for (int i = 0; i < app_len; i++) {
25+
int apps_len = env->GetArrayLength (appearances);
26+
Appearance** apps = new Appearance* [apps_len];
27+
for (int i = 0; i < apps_len; i++) {
2928
apps[i] = (Appearance*)getNativePointer (env, env->GetObjectArrayElement(appearances, i));
3029
}
30+
Group* skel = (Group*)getNativePointer (env, skeleton);
3131

3232
SkinnedMesh* mesh = NULL;
3333
__TRY__;
34-
mesh = new SkinnedMesh (vbuf, ibuf_len, ibufs, apps, skel);
34+
mesh = new SkinnedMesh (vbuf, ibufs_len, ibufs, apps_len, apps, skel);
3535
__CATCH__;
3636
if (env->ExceptionOccurred ()) {
3737
return;

jni/src/java-TriangleStripArray.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@ JNIEXPORT void JNICALL Java_org_karlsland_m3g_TriangleStripArray_jni_1initialize
1616
(JNIEnv* env, jobject thiz, jintArray indices, jintArray stripLengths)
1717
{
1818
//cout << "Java-TriangleStripArray: initilize1 is called.\n";
19-
int* indcs = env->GetIntArrayElements (indices, 0);
20-
int length = env->GetArrayLength (stripLengths);
21-
int* strip_lengths = env->GetIntArrayElements (stripLengths, 0);
19+
int inds_len = env->GetArrayLength (indices);
20+
int* inds = env->GetIntArrayElements (indices, 0);
21+
int lengths_len = env->GetArrayLength (stripLengths);
22+
int* lengths = env->GetIntArrayElements (stripLengths, 0);
2223
TriangleStripArray* tris = NULL;
2324
__TRY__;
24-
tris = new TriangleStripArray (indcs, length, strip_lengths);
25+
tris = new TriangleStripArray (inds_len, inds, lengths_len, lengths);
2526
__CATCH__;
2627
if (env->ExceptionOccurred ()) {
2728
return;
2829
}
29-
env->ReleaseIntArrayElements (indices, indcs, 0);
30-
env->ReleaseIntArrayElements (stripLengths, strip_lengths, 0);
30+
env->ReleaseIntArrayElements (indices, inds, 0);
31+
env->ReleaseIntArrayElements (stripLengths, lengths, 0);
3132
setNativePointer (env, thiz, tris);
3233
bindJavaReference (env, thiz, tris);
3334
}

0 commit comments

Comments
 (0)