
M3G Chapter 1. Loading OBJ Models into M3G

From:
  Java Programming Techniques for 2D, 2.5D, 3D, and Network Games

  Dr. Andrew Davison
  Dept. of Computer Engineering
  Prince of Songkla University
  Hat yai, Songkhla 90112, Thailand
  E-mail: dandrew@ratree.psu.ac.th

  Web Site for the book: http://fivedots.coe.psu.ac.th/~ad/jg


If you use this code, please mention my name, and include a link
to the Web page.

Thanks,
  Andrew


============================

Contents:
   ObjView/              // contains the ObjView application
   Models/               // contains several OBJ examples:

   ModelDisplay/         // the J2ME ModelDisplay midlet

   HandDisplay/          // an instantiation of ModelDisplay for 
                            displaying hand.obj

   MatCubeDisplay/       // an instantiation of ModelDisplay for 
                            displaying matCube.obj

   
   SwordDisplay/         // an instantiation of ModelDisplay for 
                            displaying sword.obj


==============================

More on ObjView/
---------------

ObjView is a Java 3D application. To compile and run it, Java 3D
must be installed. Get a copy from 
http://java.sun.com/products/java-media/3D/download.html

On Windows, I use the OpenGL version, which can be downloaded as
java3d-1_3_1-windows-i586-opengl-sdk.exe

ObjView consists of two files: ObjView.java and WrapObjView.java

Compilation:
> javac *.java

Execution:
> java ObjView <OBJ filename>	
      // all the files used by the OBJ model must be in the same
      // directory as ObjView

e.g.
> java ObjView hand.obj
or
> java ObjView penguin.obj

A (lengthy) examObj.txt file will be generated, containing the 
model methods that need to be pasted into ModelCanvas.java.

==============================
 
More on Models/
---------------

The OBJ files in Models/ are:             
       dumbbell, cone, hand, heli (a helicopter),
       humanoid, matCube, sword
     
When ObjView is applied to a model, all of its files must be
in the same directory as ObjView.

Some of the .obj files have associated .mtl (material files).

The R.gif texture is used by cone.obj. Originally cone.obj
used metal.jpg.

The swordTextures.gif texture is used by sword.obj.

dumbbell.obj, and heli.obj generate nultiple model method sets, so cannot
be pasted into ModelCanvas without some major changes to ModelCanvas'
code. See the article for details.

humanoid.obj generates arrays which are too large for the Wireless
Toolkit compiler. See the article for details.

==============================
 
More on ModelDisplay/
---------------------

ModelDisplay requires the Mobile 3D Graphics API which only
came avalable in version 2.2. of the J2ME Wirelss Toolkit.
It can be downloaded from 
http://java.sun.com/products/j2mewtoolkit/

ModelDisplay consists of 3 files:
   ModelDisplay.java, ModelCanvas.java, KeyRepeat.java

ModelCanvas.java is **INCOMPLETE**. The model methods generated
by the ObjView application must be pasted into it. It may also
be necessary to set the TEX_FNM constant, or comment out certain
methods. The details can be found in the article.

-----
Last updated: 21st October 2004

