Early first results from JNWN

Updates to AreaViewer and a few other files.

Placeables are now showing up correctly too!

I believe this completes the static geometry loading. Next up is the actual Java3D area loader. Following that I will either do geometry caching in this loader or begin work on the converter.

Still undone is dynamic geometry. This includes placeable animations and “emitters” (smoke from stacks, oving wter in the waterfall, etc). Also undone is using any of the map ligthing information.

Although both of these are useful and add to the environment I htin kat this point im more inerested in starting work on a basic client and then going back and adding that visual sugar afterward.

Hey Guys, and abies in pariticular.

I’ve decided the cleanest thing to do with all my bianry loader work is cut and paste it into Abies exisiting loader code so that we have one loader that will do both. (Besides, your organization is a alot cleaner then mine currently so it makes sense for me to use your structure :wink: )

I’ve grabbed a workign copy of Abies stuff as anonymous from sourceforge and ill apply for dev status on your project.

Thanks!

JK

A note to phazer.

Im folding the laoder part of my project into Abies’. Might it make sense for your project to do the same and we all share that code base for loading?

I took a look at your project. Looks something like mine which is cool, though mine is J3D based and yours is JOGL. Should be interesting to compare ntoes as we go fowards :slight_smile:

JK

Major update!

The MDLLoader is now a two stage loader. First it parses the binary file and creates an internal representation and then it compiels that down to a J3D scene.

The resulting code is much more modular and easier to expand and maintain as well as making it easier to inster som caching of thinsg like modle geometry,. It will also allow me to pull Abies’ ascii parser in and meld them into a single loader that handles both.

I have also elminated my use of the third party TGA imageio loader (removed all imageio in fact) and replaced it with my own TGA parsing code. The result is a screemingly fast map loads in Java :slight_smile:

There are two regressions in the latets code base to be aware of;

(1) Placables and doors are not being positioned right again. Thsi is next on my list tofix.

(2) BMPs are currently not supported and an attempt to load a BMP file with the ResurceManager will return null for the BufferedImage.

I’m not using JOGL, I’m using LWJGL. :wink:

I’m kinda happy with my NWN text loader now. It supports almost everything I need: animation, quaternions, correct normal calculations etc. Maybe I’ll add particle support later, but it’s not high on my priority list. Jeff, if you create a text and/or binary loader that’s not dependent of Java3D I might be interested in using it. I have no plans to use Java3D myself.

Btw, any1 got some recommendations on what file format is best if I want to import models with animation from Blender? The Blender NWN exporter doesn’t support animations I think.

I’ve done a TGA loader for my project as well. :slight_smile: It’s very easy to implement and can be made very fast. Loading JPG images with ImageIO takes centuries in comparison.

[quote]I Jeff, if you create a text and/or binary loader that’s not dependent of Java3D I might be interested in using it. I have no plans to use Java3D myself.
[/quote]
The problem is that there really is nto good general way to build a 3D scene loader without a well defined scene graph. So any laoder AFAICS woudkl have to be specific to J3D, XITH, Shawn’s scene graph, or one of your own.

Edit: I was thinkign about this. You COULD use my new code base if you wanted and just replace or add to the second pass that creates the j3D scene graph with your own.

Up to you

True, or it would require extra work without much benefit. Well, I know where to find your code if I need it :slight_smile:

Been awhile guys as I got heavy bogged down with work before GDC. As i ma now in documenting hell though i thought it might be good for my sanity to pick up my pet project again.

I just checked back a version that has the 2 passes really properly seperated. In the old version of the loader the NWN model nodes contained the knowledge of how to make j3D structures. In the new version there is a seperate MDLTranslator class that does that work.

This means that it shoudl be relaitvely easy to write translators for other scene graph formats. You can use MDLTransltor as a guide/example.

This also allowed me to cleanly seperate controllers, which is a pre-requisite for what NWN calls “animation” and what I call “model states”.

Hopefully the result will be animated models soon :slight_smile:

Alright!

Neew version uploaded.

It fixes a bug in the Controller loading code and the code now handles MDL “states”.

======================================
EDIT: This was unclear… it was late and I was tired

“States” are what NWN calls animations but as a “aniamtion” cna just be anew static position, and the base ground-state can have motion, I thought “state” was a cleaner term.

SO lets try re-explaining that…

NWN Mdls have various settinsg set by “controllers”. There sia default set that is in the main scene graph. Controllers coem in two types. Fixed value controlelrs and time-keyed controllers. Time-keyed con trolers animate the parameters in much the same way that J3D behaviors typically do.

Additionally each MDL faile can contain named dummy scene graphs that just contain alternate sets of controllers that over-lay the ones in the main scene graph. NWN calles these “aniamtions” but I call tyhem “states” because an NWN “animation” can be all static controlelrs and thus not really animate at all.

My loader code extends SceneBase witha MDLSceneBase calss that has an entry poitn to return the state list. Each state has a name that cna be fecthed from it, The state that was in the main scene graph is called “_ground”, the rest are named whatevr the name of that dummy tree was in teh file (these are the animation names you see in NWN C).

Each MDLState has two methdos on it. applyStatic() and applyDynamic(float time). applyStatic() applies all the static controllers of that state to the model. You call this when you chnage states. applyDynamic(flaot time) applies the time-keyed controlers for that particaulr moment in time. In genreal when you chnage states yo ushoudl call both applyStatic() and applyDynamic(0). It does the rest.

MDLViewer shows how all this is used.

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

Sorry no docs yet. You can see how they are used by lookign at the new MDLViewer class which now supports state switching and an animation-slider.

Next on my list is looking at getting the particle systems working…

Small Update:

The MDLViewer scroll bar now correctly coers the entire range of the animation.

Just posted a new update of JNWN

class com.worldwizards.jnwn.Main is the start of the actual JNWN client.

Currently it has very limited funtionality but if you run it from your root NWN directory and give the path to a .mod file as the one parameter, it will correctly load the starting map, place a cat at the starting position, and position the camera in a fixed chase position above the cat.

Next up, integrating animation and motion :slight_smile:

In terms of tech the area laoding and mdoel loading have been nciely cleaned up. there is an AreaLoader which returns an AreaSceneBase and a MDLLoader that returns an MDLSceneBase. These are both sub-classes of the Java3D SceneBase that have additional methods for retireving the relevent NWN meta-info (such as animation states on the model, width and height of the NWN Area map, etc).

Just did a putback. The cat now wlaks in place when you press the W key.

Next up is actualy making it move across the floor and implementing backwards and turn left/right.