zomgistania

Main page | About | Articles | Previous Posts | Archives

Tuesday, June 13, 2006

Batching code

Since it seems there's not much resources around regarding batching quads or such, and my batching code seems to be working fine, I thought I'd post it. Maybe someone can learn something from it (or hopefully someone will point out obvious mistakes from it so I can learn something, *cough* *cough*)


Note:
It's not ready
It probably does not work with other things than quads
It probably has bugs
It probably could be done better

The GEngine-class:
DeviceAvailable is true if the device can be rendered to
GfxDevice is the actual DirectX.Device


Here's the code

I tried to add some useful comments, but if something is unclear, ask away.

Basic usage:
Create some quads (which implement IPipelineable)
Use RenderPipeline.Add(foo) to add each of them into the pipeline
In the render loop, call RenderPipeline.Work() and RenderPipeline.Render()


Also, here's my Quad class. Probably useful for seeing the IPipelineable implementation
Quad code
Note:
This is probably even more WIP than the batching code
Contains old, pre-batching code because I'm lazy
Doesn't contain (much) comments, also because I'm lazy

Labels:

3 Comments:

  • Cool, I'll have a browse through this tonight.

    By Blogger Dan, at 9:00 AM  

  • I've got a basic working version now thanks. I'm going to try and clean it up so its quite flexible. Then Ill push it into my current game.

    Thanks for the help!

    By Blogger Dan, at 4:46 AM  

  • That's great :)

    By Blogger Jani, at 3:14 PM  

Post a Comment

<< Home