GameSpawn Site Map
Advertisement
GameSpawn Update mailing list
Advertisement
Lee's Lessons

Basic Geometry 2

2000-05-18

Ok! I have the Diamond.java class ready. To make your own geometry you just follow the steps I laid out yesterday. I am probably going to eventually going to make some kind of generic level editor and this will involve using the entire map as one geometry. In the mean time, I am not in favor of using the basic geometry classes to make a shape. Instead, I would reccommend using a 3d program such as 3d Studio or, for the more budget minded, true space. Both of these programs export as DXF which is pretty much the defacto 3d standard. I digress. Anyway, here is the Diamond.java class.

Let me reiterate.

  1. Use an external 3d modeling package to generate your models. A graphic artist is the best thing for this. We have a great artist here at Gamespawn called Craig Enslin. He will be developing some free 3d models in DXF format for you to use some time in the next couple of months. I will use them myself for some future file model loaders.

  2. Use the geometry package when it is not feasible to use a modeling package such as a level editor or....well....I can't really think of too many reasons.

One BIG thing that makes Java3D great, which many Java3D developers fail to do, is reuse geometries. If you are going to use the same model all throughout a scene, then you should not have to use the same geometry. You should be able to share. Take a game such as quake. They have a bunch of crates (Boxes) all over this game that are all basically the same. It would be silly to load in separate geometries (and appearances, but that's later) for the same object. It just adds more overhead for the engine, and slows things down. I will admit that I have a program I wrote that I will submit here later that creates a bunch of the same geometries. I will modify this as an example later of how NOT to do it and then how to do it.

Diamond.java. I included LOTS of comments in the code to describe what is going on because I had never created my own geometry before this so I thought they would come in handy.

BasicGeometry2.java

This uses basically the same code as the BasicGeometry class except that it uses the new Diamond geometry instead of Sphere. It also does not have to handle making the normals because that is handled in the Diamond class. The Diamond class is included also. This is a generic geometry. It is in the package geometry while the BasicGeometry2 class is in the examples package. All are subpackages of com.gamespawn.lab.mikelee.j3d. The Diamond class can be confusing but do not worry about that for now. All you need to know is that basic geometries can be done. I prefer using object loaders.

Advertisement
Michael C. Lee, Jr.
Advertisement
About
Account
Arcade
Help
Library