Initial
This commit is contained in:
72
engine/DIB3D.CPP
Normal file
72
engine/DIB3D.CPP
Normal file
@@ -0,0 +1,72 @@
|
||||
#include <engine/dib3d.hpp>
|
||||
#include <common/vector2d.hpp>
|
||||
#include <engine/rect3d.hpp>
|
||||
#include <engine/point3d.hpp>
|
||||
#include <engine/asmutil.hpp>
|
||||
|
||||
CallbackData::ReturnType DIB3D::sizeHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
size(mDisplayWindow.width(),mDisplayWindow.height());
|
||||
return (CallbackData::ReturnType)FALSE;
|
||||
}
|
||||
|
||||
void DIB3D::line(Point3D &firstPoint3D,Point3D &secondPoint3D,BYTE byteValue)
|
||||
{
|
||||
Point firstPoint;
|
||||
Point secondPoint;
|
||||
|
||||
mapCoordinates(firstPoint3D,firstPoint);
|
||||
mapCoordinates(secondPoint3D,secondPoint);
|
||||
DIBitmap::line(firstPoint,secondPoint,byteValue);
|
||||
}
|
||||
|
||||
void DIB3D::axis(BOOL drawFlag)
|
||||
{
|
||||
int blackIndex(0);
|
||||
int whiteIndex(255);
|
||||
int maxValue(200);
|
||||
int minValue(-200);
|
||||
|
||||
if(!drawFlag)
|
||||
{
|
||||
line(Point3D(minValue,0,0),Point3D(maxValue,0,0),blackIndex);
|
||||
line(Point3D(0,minValue,0),Point3D(0,maxValue,0),blackIndex);
|
||||
line(Point3D(0,0,minValue),Point3D(0,0,maxValue),blackIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
line(Point3D(minValue,0,0),Point3D(maxValue,0,0),whiteIndex);
|
||||
line(Point3D(0,minValue,0),Point3D(0,maxValue,0),whiteIndex);
|
||||
line(Point3D(0,0,minValue),Point3D(0,0,maxValue),whiteIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void DIB3D::rectangle(const Rect3D &someRect3D,int paletteIndex)
|
||||
{
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.firstPlane()))[1],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.firstPlane()))[2],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.firstPlane()))[3],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.firstPlane()))[0],paletteIndex);
|
||||
|
||||
line(((Vector3D&)(someRect3D.nextPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[1],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.nextPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[2],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.nextPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[3],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.nextPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[0],paletteIndex);
|
||||
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[0],((Vector3D&)(someRect3D.nextPlane()))[0],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[1],((Vector3D&)(someRect3D.nextPlane()))[1],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[2],((Vector3D&)(someRect3D.nextPlane()))[2],paletteIndex);
|
||||
line(((Vector3D&)(someRect3D.firstPlane()))[3],((Vector3D&)(someRect3D.nextPlane()))[3],paletteIndex);
|
||||
}
|
||||
|
||||
// virtual overloads
|
||||
|
||||
WORD DIB3D::viewPortWidth(void)const
|
||||
{
|
||||
return mDisplayWindow.width();
|
||||
}
|
||||
|
||||
WORD DIB3D::viewPortHeight(void)const
|
||||
{
|
||||
return mDisplayWindow.height();
|
||||
}
|
||||
Reference in New Issue
Block a user