DrawVertex uses thinner lines for the cross

floating-point
Günther Brammer 2012-06-08 16:19:36 +02:00
parent 06cb8b595d
commit 692fb103f1
8 changed files with 15 additions and 15 deletions

View File

@ -1045,7 +1045,7 @@ void C4Draw::DrawPix(C4Surface * sfcDest, float tx, float ty, DWORD dwClr)
PerformPix(sfcDest, tx, ty, dwClr);
}
void C4Draw::DrawLineDw(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr)
void C4Draw::DrawLineDw(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width)
{
ApplyZoom(x1, y1);
ApplyZoom(x2, y2);
@ -1089,7 +1089,7 @@ void C4Draw::DrawLineDw(C4Surface * sfcTarget, float x1, float y1, float x2, flo
// apply color modulation
ClrByCurrentBlitMod(dwClr);
PerformLine(sfcTarget, x1, y1, x2, y2, dwClr);
PerformLine(sfcTarget, x1, y1, x2, y2, dwClr, width);
}
void C4Draw::DrawFrameDw(C4Surface * sfcDest, int x1, int y1, int x2, int y2, DWORD dwClr) // make these parameters float...?

View File

@ -267,7 +267,7 @@ public:
void DrawBoxFade(C4Surface * sfcDest, float iX, float iY, float iWdt, float iHgt, DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, DWORD dwClr4, int iBoxOffX, int iBoxOffY); // calls DrawQuadDw
void DrawPatternedCircle(C4Surface * sfcDest, int x, int y, int r, BYTE col, C4Pattern & Pattern, CStdPalette &rPal);
void DrawFrameDw(C4Surface * sfcDest, int x1, int y1, int x2, int y2, DWORD dwClr);
virtual void DrawLineDw(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr);
virtual void DrawLineDw(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width = 1.0f);
virtual void DrawQuadDw(C4Surface * sfcTarget, float *ipVtx, DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, DWORD dwClr4) = 0;
// gamma
void SetGamma(DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, int32_t iRampIndex); // set gamma ramp
@ -311,7 +311,7 @@ public:
protected:
bool StringOut(const char *szText, C4Surface * sfcDest, float iTx, float iTy, DWORD dwFCol, BYTE byForm, bool fDoMarkup, C4Markup &Markup, CStdFont *pFont, float fZoom);
virtual void PerformPix(C4Surface * sfcDest, float tx, float ty, DWORD dwCol) = 0; // without ClrModMap
virtual void PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr) = 0;
virtual void PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width) = 0;
bool CreatePrimaryClipper(unsigned int iXRes, unsigned int iYRes);
virtual bool CreatePrimarySurfaces(bool Editor, unsigned int iXRes, unsigned int iYRes, int iColorDepth, unsigned int iMonitor) = 0;
virtual bool Error(const char *szMsg);

View File

@ -766,7 +766,7 @@ void CStdD3D::DrawQuadDw(C4Surface * sfcTarget, float *ipVtx, DWORD dwClr1, DWOR
lpDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 2 );
}
void CStdD3D::PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr)
void CStdD3D::PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width)
{
// FIXME: zoom width
//dwClr |= 0xf0000000;

View File

@ -139,7 +139,7 @@ public:
void FillBG(DWORD dwClr=0);
// Drawing
void DrawQuadDw(C4Surface * sfcTarget, float *ipVtx, DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, DWORD dwClr4);
void PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr);
void PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width);
void PerformPix(C4Surface * sfcDest, float tx, float ty, DWORD dwCol);
void DrawPixPrimary(C4Surface * sfcDest, int tx, int ty, DWORD dwCol);
// Gamma

View File

@ -1785,7 +1785,7 @@ static inline long int lrintf(float f)
}
#endif
void CStdGL::PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr)
void CStdGL::PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width)
{
// render target?
if (sfcTarget->IsRenderTarget())
@ -1799,8 +1799,8 @@ void CStdGL::PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, fl
float l = sqrtf(offx * offx + offy * offy);
// avoid division by zero
l += 0.000000005f;
offx /= l; offx *= Zoom;
offy /= l; offy *= Zoom;
offx /= l; offx *= Zoom * width;
offy /= l; offy *= Zoom * width;
C4BltVertex vtx[4];
vtx[0].ftx = x1 + offx; vtx[0].fty = y1 + offy; vtx[0].ftz = 0;
vtx[1].ftx = x1 - offx; vtx[1].fty = y1 - offy; vtx[1].ftz = 0;

View File

@ -129,7 +129,7 @@ public:
void FillBG(DWORD dwClr=0);
// Drawing
void DrawQuadDw(C4Surface * sfcTarget, float *ipVtx, DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, DWORD dwClr4);
void PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr);
void PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width);
void PerformPix(C4Surface * sfcDest, float tx, float ty, DWORD dwCol);
// device objects
bool RestoreDeviceObjects(); // restore device dependent objects

View File

@ -41,7 +41,7 @@ public:
virtual void FillBG(DWORD dwClr=0) { }
virtual void PerformBlt(C4BltData &, C4TexRef *, DWORD, bool, bool) { }
virtual void PerformMesh(StdMeshInstance &, float, float, float, float, DWORD, C4BltTransform* pTransform) { }
virtual void PerformLine(C4Surface *, float, float, float, float, DWORD) { }
virtual void PerformLine(C4Surface *, float, float, float, float, DWORD, float) { }
virtual void DrawQuadDw(C4Surface *, float *, DWORD, DWORD, DWORD, DWORD) { }
virtual void PerformPix(C4Surface *, float, float, DWORD) { }
virtual void SetTexture() { }

View File

@ -127,13 +127,13 @@ void C4MeshDenumerator::DenumeratePointers(StdMeshInstance::AttachedMesh* attach
}
}
static void DrawVertex(C4Facet &cgo, int32_t tx, int32_t ty, int32_t col, int32_t contact)
static void DrawVertex(C4Facet &cgo, float tx, float ty, int32_t col, int32_t contact)
{
if (Inside<int32_t>(tx,cgo.X,cgo.X+cgo.Wdt) && Inside<int32_t>(ty,cgo.Y,cgo.Y+cgo.Hgt))
{
pDraw->DrawLineDw(cgo.Surface, tx - 1, ty, tx + 1, ty, col);
pDraw->DrawLineDw(cgo.Surface, tx, ty - 1, tx, ty + 1, col);
if (contact) pDraw->DrawFrameDw(cgo.Surface,tx-2,ty-2,tx+2,ty+2,C4RGB(0xff, 0xff, 0xff));
pDraw->DrawLineDw(cgo.Surface, tx - 1, ty, tx + 1, ty, col, 0.5f);
pDraw->DrawLineDw(cgo.Surface, tx, ty - 1, tx, ty + 1, col, 0.5f);
if (contact) pDraw->DrawFrameDw(cgo.Surface,tx-1.5,ty-1.5,tx+1.5,ty+1.5,C4RGB(0xff, 0xff, 0xff));
}
}