forked from Mirrors/openclonk
parent
a597dc28d7
commit
2e03c3157b
|
@ -301,7 +301,6 @@ 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 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);
|
||||
|
|
|
@ -730,81 +730,6 @@ static inline long int lrintf(float f)
|
|||
}
|
||||
#endif
|
||||
|
||||
void CStdGL::PerformLine(C4Surface * sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width)
|
||||
{
|
||||
// render target?
|
||||
if (sfcTarget->IsRenderTarget())
|
||||
{
|
||||
// prepare rendering to target
|
||||
if (!PrepareRendering(sfcTarget)) return;
|
||||
SetTexture();
|
||||
SetupTextureEnv(false, false);
|
||||
float offx = y1 - y2;
|
||||
float offy = x2 - x1;
|
||||
float l = sqrtf(offx * offx + offy * offy);
|
||||
// avoid division by zero
|
||||
l += 0.000000005f;
|
||||
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;
|
||||
vtx[2].ftx = x2 - offx; vtx[2].fty = y2 - offy; vtx[2].ftz = 0;
|
||||
vtx[3].ftx = x2 + offx; vtx[3].fty = y2 + offy; vtx[3].ftz = 0;
|
||||
// global clr modulation map
|
||||
DWORD dwClr1 = dwClr;
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
if (fUseClrModMap)
|
||||
{
|
||||
if (shaders[0])
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glLoadIdentity();
|
||||
C4Surface * pSurface = pClrModMap->GetSurface();
|
||||
glScalef(1.0f/(pClrModMap->GetResolutionX()*(*pSurface->ppTex)->iSizeX), 1.0f/(pClrModMap->GetResolutionY()*(*pSurface->ppTex)->iSizeY), 1.0f);
|
||||
glTranslatef(float(-pClrModMap->OffX), float(-pClrModMap->OffY), 0.0f);
|
||||
|
||||
glClientActiveTexture(GL_TEXTURE3);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(C4BltVertex), &vtx[0].ftx);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ModulateClr(dwClr1, pClrModMap->GetModAt(lrintf(x1), lrintf(y1)));
|
||||
ModulateClr(dwClr, pClrModMap->GetModAt(lrintf(x2), lrintf(y2)));
|
||||
}
|
||||
}
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
DwTo4UB(dwClr1,vtx[0].color);
|
||||
DwTo4UB(dwClr1,vtx[1].color);
|
||||
DwTo4UB(dwClr,vtx[2].color);
|
||||
DwTo4UB(dwClr,vtx[3].color);
|
||||
vtx[0].tx = 0; vtx[0].ty = 0;
|
||||
vtx[1].tx = 0; vtx[1].ty = 2;
|
||||
vtx[2].tx = 1; vtx[2].ty = 2;
|
||||
vtx[3].tx = 1; vtx[3].ty = 0;
|
||||
// draw two triangles
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, lines_tex);
|
||||
glInterleavedArrays(GL_T2F_C4UB_V3F, sizeof(C4BltVertex), vtx);
|
||||
glDrawArrays(GL_POLYGON, 0, 4);
|
||||
glClientActiveTexture(GL_TEXTURE3);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
ResetTexture();
|
||||
}
|
||||
else
|
||||
{
|
||||
// emulate
|
||||
if (!LockSurfaceGlobal(sfcTarget)) return;
|
||||
ForLine((int32_t)x1,(int32_t)y1,(int32_t)x2,(int32_t)y2,&DLineSPixDw,(int) dwClr);
|
||||
UnLockSurfaceGlobal(sfcTarget);
|
||||
}
|
||||
}
|
||||
|
||||
void CStdGL::SetupMultiBlt(GLuint tex)
|
||||
{
|
||||
// Initialize multi blit shader. If pTexRef is given, use that as texture.
|
||||
|
|
|
@ -164,7 +164,6 @@ 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, float width);
|
||||
void PerformMultiPix(C4Surface* sfcTarget, const C4BltVertex* vertices, unsigned int n_vertices);
|
||||
void PerformMultiLines(C4Surface* sfcTarget, const C4BltVertex* vertices, unsigned int n_vertices, float width);
|
||||
// device objects
|
||||
|
|
Loading…
Reference in New Issue