Friday, April 5, 2013

kxBox, shadows?, and kxBoxPlugin

So first I refactored my kxCube class to contain an IMeshSceneNode* to a proper irrlicht style mesh because I wanted shadows.  Took a hour or two to get shadows working but eventually got it.  Cool!  Shadows!  But aesthetically it wasn't working.  I thought shadows would help orient the player, but they looked odd with the way my levels are architected and they sucked up fps.  Fps I want to save for physics and gameplay.

Yet another refactor of my base class!  Hooray for refactoring : )
Can't promise this is is a final version of the class, but here is the update:
All kxCube's have now become kxBox's.  Cube implies that all dimensions are the same, but I wanted more flexibility!  I refactored the constructor to take a vector3df for dimensions.  Modifying the custom mesh was easy but refactoring the Fracture function was trickier.  Surprisingly I got it working rather quickly though +

Also I inserted a kxNode class between irr::scene::ISceneNode and all my classes.  The kxNode class carries the program context acquired with the singleton instance.  This avoids code duplication and obfuscation in many of my classes and gives them access to global textures, sounds, the physics world and scene manager.

My next step is to move the Fracture method from the kxFractureCube class to a method of the kx base game class (non-member non-friend) and dispose of that class altogether.  Rather I want to integrate rigid bodies and collision objects into the kxBox class.  This was inspired round-a-bout when I went to write a plug-in for 3ds that extends the 3ds native Box class.  Speaking of...

Lastly I wrote a proper plug-in for creating kxBoxes in maxscript!  Took me a couple days, was having issues with the class and super-class ID's and error-generating typos in the examples copied from MaxScript's documentation.  Finally got the base prototype the way I want.  Now to add those properties I mentioned earlier; isCollisionObject, isRigidBody

Then perhaps I'll write a material plug-in as well ++ 



No comments:

Post a Comment