C# Класс 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).
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
_colorBuffer Color[][]
_depthBuffer SharedDepthBuffer
horRes int

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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.

Описание методов

Rasterizer() публичный Метод

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

draw() публичный Метод

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
Результат void

loadContent() публичный Метод

Called by Game1. Initializes textures, buffers, etc.
public loadContent ( GraphicsDevice device, ContentManager cm ) : void
device GraphicsDevice
cm ContentManager
Результат void

render() публичный Метод

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.
Результат void

Описание свойств

_colorBuffer публичное свойство

public Color[][] _colorBuffer
Результат Color[][]

_depthBuffer публичное свойство

public SharedDepthBuffer _depthBuffer
Результат SharedDepthBuffer

horRes публичное свойство

public int horRes
Результат int