Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

About This project represents the use of Z-Buffer for rendering of basic 3D objects.

License

NotificationsYou must be signed in to change notification settings

goldest-star/zBuffer-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This project uses C# (and winforms) to present a basic approach to the z-buffer rendering algorithm (wikipedia) for objects in 3D space.

The application allows stacking of various objects

And moving objects around the scene

Application Overview

The winforms main window isDisplay.cs. Cubes are added and defined ininitializeCubes(). A cube is added in the following way:

Cubec3=Cube.UnitCube(1337);// Create a unit cube with color seed (int)c3.Rescale(2,5,15);// Rescale on x, y and z dimensionsc3.Translate(newVector3D(0,-15,0));// Set offsetc3.RotateAroundOrigin(-Math.PI/3,Math.PI/8,-Math.PI/2);// Rotate with respect to/anchored in Origin point (0, 0, 0)cubes.Add(c3);// Add the cube to list of cubes

Drawing.cs is the master class used for z-buffer rendering andZBuffer.cs is used to store z-indicies of the projected points. Points are drawn to a bitmap with an extension method which directly writes to memory for better performance.

Control Set

The below set of combinations of keys and functional keys (shift/ctrl) are used to control the simulation.

Where applicable (in Note column), keys may be modified with the Ctrl key to increase the value of action (ie.<selected key> + Ctrl will perfrom the appropriate action with higher value - translation by 10 points instead of 2, etc.)

Objects are always moved with respect to their local axis.

Screen/Scene Controls

Key(s)ActionNote
RRefresh screen.This action is called by default after every other action
R + CtrlReset scene to initial view.-
ODecreases camera FOV by pi/12-
PIncreases camera FOV by pi/12-
1 - 9Select the nth object in scene (numbered by programatic order - added to list)Maximum of 9 objects are controllable with keys
0Select all objects-

Translation Controls

Key(s)ActionNote
Right arrowTranslates selected objects towards negative XMay be increased with Ctrl
Left arrowTranslates selected objects towards positive XMay be increased with Ctrl
Up arrowTranslates selected objects towards negative YMay be increased with Ctrl
Down arrowTranslates selected objects towards positive YMay be increased with Ctrl
ZTranslates selected objects towards positive ZMay be increased with Ctrl
XTranslates selected objects towards negative ZMay be increased with Ctrl

Rotation Controls

Key(s)ActionNote
ARotates selected objects around positive origin YMay be increased with Ctrl
A + ShiftRotates selected objects around positive local YMay be increased with Ctrl
DRotates selected objects around negative origin YMay be increased with Ctrl
D + ShiftRotates selected objects around negative local YMay be increased with Ctrl
QRotates selected objects around positive origin ZMay be increased with Ctrl
Q + ShiftRotates selected objects around positive local ZMay be increased with Ctrl
ERotates selected objects around negative origin ZMay be increased with Ctrl
E + ShiftRotates selected objects around negative local ZMay be increased with Ctrl
WRotates selected objects around negative origin XMay be increased with Ctrl
W + ShiftRotates selected objects around negative local XMay be increased with Ctrl
SRotates selected objects around positive origin XMay be increased with Ctrl
S + ShiftRotates selected objects around positive local XMay be increased with Ctrl

Scale Controls

Key(s)ActionNote
.Upscales selected objectsMay be increased with Ctrl
,Downscales selected objectsMay be increased with Ctrl

About

About This project represents the use of Z-Buffer for rendering of basic 3D objects.

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp