class ThreeDViewer.Renderer

Overview

The class that renders a 3D model on a System.Drawing.Bitmap. More…

class Renderer
{
public:
    // fields

    static const double CameraMoveSpeed = 0.5d;
    static const double CameraLookSpeed = 1d;
    static const double AxesSize = 3d;

    // properties

    bool ShowFill;
    bool ShowWireframe;
    bool ShowNormals;
    Size MathematicalSize;
    Size ImageSize;
    Pen OutlineColor;
    Bitmap Bitmap;
    CullingMode CullingMode;
    ProjectionMode ProjectionMode;
    Scene Scene;
    Color LightColor;

    // methods

    Renderer(
        Size mathematicalSize,
        Size imageSize,
        bool showFill = true,
        bool showWireframe = true
        );

    void GoDown();
    void GoUp();
    void GoForward();
    void GoBackward();
    void GoLeft();
    void GoRight();
    void LookLeft();
    void LookRight();
    void LookUp();
    void LookDown();
    void RenderNextFrame();
};

Detailed Documentation

The class that renders a 3D model on a System.Drawing.Bitmap.

Fields

static const double CameraMoveSpeed = 0.5d

Movement speed of the camera.

static const double CameraLookSpeed = 1d

Look (rotation) speed of the camera.

static const double AxesSize = 3d

Size of the axes in the world.

Properties

bool ShowFill

Gets or sets a value indicating whether the model should be drawn with filled triangles or not.

bool ShowWireframe

Gets or sets a value indicating whether the wireframe should be shown.

true if the wireframe should be shown; otherwise, false.

bool ShowNormals

Gets or sets a value indicating whether the normal of the faces should be shown.

Size MathematicalSize

Gets or sets the size of the mathematical projection area. It’s the zone that will be displayed on the picture box.

Size ImageSize

Gets or sets the size of the image.

The size of the image.

Pen OutlineColor

Gets or sets the color of the outline of the polygons.

The color of the outline of the polygons.

Bitmap Bitmap

Gets the rendered bitmap.

CullingMode CullingMode

Gets or sets the culling mode of the renderer.

ProjectionMode ProjectionMode

Gets or sets the projection mode of the camera.

Scene Scene

Gets or sets the scene contained in the renderer.

Color LightColor

Gets or sets the color of the lighting.

Methods

Renderer(
    Size mathematicalSize,
    Size imageSize,
    bool showFill = true,
    bool showWireframe = true
    )

Initializes a new instance of the Renderer class.

Parameters:

mathematicalSize

Size of the box that contains the mathematical coordinates of the projected model.

imageSize

Size of the image that will be displayed.

showFill

Tells if the model should be filled or not.

showWireframe

Tells if the wireframe should be displayed.

void GoDown()

Makes the camera go down.

void GoUp()

Makes the camera go up.

void GoForward()

Makes the camera go forward.

void GoBackward()

Makes the camera go backward.

void GoLeft()

Makes the camera go left.

void GoRight()

Makes the camera go right.

void LookLeft()

Makes camera look to the left.

void LookRight()

Makes the camera look to the right.

void LookUp()

Makes the camera look up.

void LookDown()

Makes the camera look down.

void RenderNextFrame()

Renders the next frame.