Wednesday 27 June 2012

The Randomchaos3DEngine


This is where my first real blog post for the engine stated, I kind of laid out the outline of the engine, some of the changes I made to the tutorial code and listed some of the engines objects.
This time I am going to try and to the descriptions of those objects..

RCGame.cs
So I guess the best place to start is going to be RCGame. This is where the main game loop will be managed, it also exposes the engine objects required to add objects to a scene, set up post processing and sound etc...

I added a number of events so that the calling game project can add functionality to the main game loop, OnEngineDraw, OnEngineUpdate, OnScreenResize, OnEnd and OnLoadContent. There is also the ability to show the FPS (frames per second), switch the octree culling on or off (I had issues with it, that's why it's there), also a switch to activate the debug form (never finished that)
There are also an RCInput,ButtonList and KeyList class' in here, I don't think this has changed much from the tutorial.


RCInterfaces.cs
Again I don't think I have added much here.


RCHelpers.cs
Right, this is totally new to the tutorial code.
RCFog, here you will find my class for Render State generated fog. RCHelper, now this class was still being added to and played with prior to me releasing the source (another un finished area). The Render State fog class is managed in here, global water height and some methods from when I was trying to get Riemers water method to work in here (again un finished), the class is intended to be a holding place for global engine variables/objects. Most of the stuff in here is of no use to you, just the Dice functions and the fog object really. I started trying to implement a method for detecting if you can use a data type int for your index buffers as on my poop laptop I can only use shorts, but this limits the size of your index buffer and in the case of terrain will case it to fold in on it's self if you set the buffer too high. As you will see MaxInt and MaxShort should be replaced with a method to detect the max buffer size.....


RCCameras.cs
Again, little or no change here.


RCShader.cs
How the class interacts with the rest of the engine in unchanged but what I have introduced here is the use if Semantics. As this is my experimental engine I wanted to use shaders from pretty much anywhere, in the old model this left you with an issue of variable naming conventions as one shader may have a variable for the World matrix as "world" another may have "wld" another "WORLD" etc. So toy get around this you can use semantics. Your old shader class might be expecting World so it would not pass the matrix to the shader and you would have to go through the whole shader changing the name of the parameter, but now all you have to do is post fix the parameter with the required semantic, in the case of the World matrix you would use ":WORLD" or ":world" (its not case sensitive).


frmDebug.cs and frmRenderStateSniffer.cs
Again, not complete :(


RCFont.cs
This was my original attempt at getting fonts into XNA. I took the method for this from a blog I found. Lost the link now :( But I suggest you drop this as we now have this native to XNA.


RCGUI.cs
Yet another incomplete part lol, but there are a few useful bits still in there. I think the GUI framework is there and could be further extended should you wish, all the controls work with the exception of RCListBox. There is no code example of this is use, but if anyone would like to see one, I would happily knock one up.


RCNuclexFonts.cs
This is now the main font handling class of the engine. As fonts are now native to XNA I would suggest removing this and creating a class based on the native methodology.


PostProcessor.cs
Now this was an experimental PP that a friend of mine asked to test and give comments on, it works well but I can't remember implementing it fully.


RCPostProcessor.cs
This is a combined PP, it uses both the first PP from the HM tutorial and the latest incarnation so you can still use either methods (some shaders only worked with one or the other)


RCBillboard.cs
A billboarding class that uses the RCTexturedQuad class.


RCFire.cs
This is where the NVIDIA volumetric fire is implemented.


RCObject.cs
A fair bit added to the base object from the tutorial, from bounding box's to object naming on to retrieval of an objects 2D coordinates on screen.


RCSkyBox,cs
No change.


RCSkyDome.cs
This is my attempt at a sky dome, 90% of the method is from Riemers tutorial on the subject.


RCSpriteBatch.cs
hmmm, can't remember why I added this one.....


RCTexturedQuad.cs
As well as the base Textured Quad class there are 2 new classes I have added, one for creating bumped textured quads and another for a double sided quad, why when I could just turn the cull mode to none? Because I wanted a true image on the back, not a mirror of it.


RCAnimationData.cs
Holds data required for animated models.


RCModel.cs
Lots of changes here. Have implemented semantic here again and also extended it to allow for my own shader annotation.


RCParticles.cs
SpriteBatch particle system. This was taken directly from an example posted by JSedlak, the link is now no moor :(


RCSnowEmmiter.cs
Looks like I have re written this, it used to use the RCBillboarding for the effect, but that meant that it had to make a draw call per particle...how poop was that! Now it uses the RCParticleCollection to do the job.


RCTerrain.cs
Yes, you guessed it, it's where the terrain code sits.


RCWater.cs
:) The class that implements the NVIDIA Ocean shader.


RCOctreeManager.cs
If Octree culling is switched on then this is where it is managed. I personally don't like this method, but due to be being such a noob, I am yet to come up with a better solution.


RCScene.cs
Changed this along with the RCObject class so that I can pull objects out of the scene graph by name.


RCScenePicker.cs
Code in here is used to do ray picking of objects in the scene graph.


RCSound.cs
My first attempt at giving something back to the tutorial, it is not perfect but it does the job.


RCAnimationDataContent.cs
Guess where the code for model animation data is held...


RCModelProcessor.cs
This source holds the model processor and the AnimationContentWriter class.
Well thats the overview of all the source files. Hope it is of some use if you want to go diving in there and have a play. I am now going to start recycling my old blog and moving the posts (as is) here. Then I can start some new posts...


Posted Sat, Oct 13 2007 8:10 PM by Charles Humphrey | Add post to favorites | Add blog to favorites
Filed under: Randomchaos 3D Engine, XNA 1.0 [Edit Tags]

No comments:

Post a Comment