C# Class renderers.Rasterizer

Represents a software rasterizer that can render BFSOctrees. It supports phong shading and can render models consisting of 200k - 750k voxels in realtime on multi-core systems. The rasterizer is used for testing purposes. If a voxel covers many pixels, the rasterizer doesn't color all of them for performance reasons. It only colors the pixel nearest to the voxel center. This information is encoded in textures which are sent to the GPU, which then fills all pixels of the image (via shaders).
Mostra file Open project: denniskb/asvo

Public Properties

Property Type Description
_colorBuffer Color[][]
_depthBuffer SharedDepthBuffer
horRes int

Public Methods

Method Description
Rasterizer ( int horRes, int vertRes )

Creates a new Rasterizer.

draw ( GraphicsDevice device ) : void

Called by Game1, draws the final image. This happens independent of a call to Rasterizer.render. If this method is called without calling Rasterizer.render prior to it, an empty screen appears.

loadContent ( GraphicsDevice device, ContentManager cm ) : void

Called by Game1. Initializes textures, buffers, etc.

render ( Object3D object3D, Camera fromPerspective, int threadIndex ) : void

Renders the sparse voxel octree stored in obj. - Viewing frustum culling - Level of detail

Private Methods

Method Description
traverse ( Object3D obj, uint offset, int x, int y, int z, Matrix projection, Matrix worldView, Matrix worldViewProjection, byte level, float halfDim, int threadIndex, Vector3 octreeMin ) : void

Traverses all octree nodes and draws them. Used by Rasterizer.render.

Method Details

Rasterizer() public method

Creates a new Rasterizer.
public Rasterizer ( int horRes, int vertRes )
horRes int Horizontal screen resolution.
vertRes int Vertixal screen resolution.

draw() public method

Called by Game1, draws the final image. This happens independent of a call to Rasterizer.render. If this method is called without calling Rasterizer.render prior to it, an empty screen appears.
public draw ( GraphicsDevice device ) : void
device GraphicsDevice
return void

loadContent() public method

Called by Game1. Initializes textures, buffers, etc.
public loadContent ( GraphicsDevice device, ContentManager cm ) : void
device GraphicsDevice
cm ContentManager
return void

render() public method

Renders the sparse voxel octree stored in obj. - Viewing frustum culling - Level of detail
public render ( Object3D object3D, Camera fromPerspective, int threadIndex ) : void
object3D Object3D The object to be rendered.
fromPerspective Camera The camera this model shall be rendered from.
threadIndex int The index of the calling thread, starting by 0.
return void

Property Details

_colorBuffer public_oe property

public Color[][] _colorBuffer
return Color[][]

_depthBuffer public_oe property

public SharedDepthBuffer _depthBuffer
return SharedDepthBuffer

horRes public_oe property

public int horRes
return int