Some updates to the code

Hello all,



With some discussion over IM with Mojo, and a bit of JProbe work, I’ve added some changes to a few classes in jME that I believe greatly improve the object creation behavior of jME (to the point where I believe only one new object is created – for normalizing vectors – per frame in the simple demos.)



Also, I’ve added a smoothing algo to the LWJGL timer to smooth out abrupt changes in the FPS calc due to system activity or gc. I’ve found that this fixes my mouse issues mentioned in the last post.



If deemed worthy of submission, I’d like the power to check them in. How do I go about getting that? :slight_smile:



PS: Thanks for the help today, Mojo.

I checked in your changes, you have developer status. Thanks for your hard work, things are smooth as a baby’s butt.

Awesome, thanks for that!

MD2 Model is acting wonky now. The lighting is totally screwed up, like the normals aren’t right. So, I undid the



sum.addLocal() and went back to sum = sum.add()



It’s a one time method call anyways (only called during creation of the model), so it should incur that bad of a penalty.





EDIT: Same with ASE, the normals were messed up, so I reverted.

Ugh, sorry about the models one. I always have to add that one crap update at the end, hehe… :confused:



Actually, the Matriz3f.get() and .set() are possible areas to optimize because where you are using them in the core code, you always know that the boundaries (from 0-2) for row and col are going to be ok… so you should replace those calls with direct access to the matrix field. The compiler will not likely do this optimization for you because of the boundary check inside of the .get and .set methods.



Doing so helped shave off a point or three in methods I did this to last night.

Update… Got those fixes back into the models… Tested and working the right way this time!



Although you are right that they are only called that once, I suppose in a game, models may be loaded in many times throughout the lifetime of the game. Since this code was creating a new object for every face in the model, taking that down to 1 object that is reused in the calcs of all objects in the normalization process couldn’t hurt.