forked from Mirrors/openclonk
Rename CTexMgr and CTexRef to C4TexMgr and C4TexRef
parent
68d6b34f72
commit
ad89e12a2c
|
@ -117,6 +117,8 @@ class C4SVal;
|
|||
class C4TargetFacet;
|
||||
class C4TeamList;
|
||||
class C4TexMapEntry;
|
||||
class C4TexMgr;
|
||||
class C4TexRef;
|
||||
class C4TextureMap;
|
||||
class C4Value;
|
||||
class C4ValueArray;
|
||||
|
@ -135,8 +137,6 @@ class StdMeshBone;
|
|||
class StdMeshInstance;
|
||||
class StdMeshMaterial;
|
||||
class StdMeshSkeletonLoader;
|
||||
class CTexRef;
|
||||
class CTexMgr;
|
||||
class CStdDDraw;
|
||||
class C4AbstractApp;
|
||||
class C4Window;
|
||||
|
|
|
@ -381,7 +381,7 @@ void C4LandscapeRenderGL::Update(C4Rect To, C4Landscape *pSource)
|
|||
}
|
||||
|
||||
// Get tex refs (shortcut, we will use them quite heavily)
|
||||
CTexRef *TexRefs[C4LR_SurfaceCount];
|
||||
C4TexRef *TexRefs[C4LR_SurfaceCount];
|
||||
x = y = 0;
|
||||
for(int i = 0; i < C4LR_SurfaceCount; i++)
|
||||
Surfaces[i]->GetTexAt(&TexRefs[i], x, y);
|
||||
|
|
|
@ -160,7 +160,7 @@ public:
|
|||
};
|
||||
|
||||
// Ref-counted texture. When a meterial inherits from one which contains
|
||||
// a TextureUnit, then they will share the same CTexRef.
|
||||
// a TextureUnit, then they will share the same C4TexRef.
|
||||
class Tex
|
||||
{
|
||||
public:
|
||||
|
@ -176,9 +176,9 @@ public:
|
|||
// C4Surface should go away and the file loading/saving
|
||||
// should be free functions instead. I also think the file
|
||||
// loading/saving should be decoupled from the surfaces, so we
|
||||
// can skip the surface here and simply use a CTexRef. armin.
|
||||
// can skip the surface here and simply use a C4TexRef. armin.
|
||||
C4Surface* Surf;
|
||||
CTexRef& Texture;
|
||||
C4TexRef& Texture;
|
||||
};
|
||||
|
||||
// Simple wrapper which handles refcounting of Tex
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
|
||||
bool HasTexture() const { return !Textures.empty(); }
|
||||
size_t GetNumTextures() const { return Textures.size(); }
|
||||
const CTexRef& GetTexture(unsigned int i) const { return Textures[i].pTex->Texture; }
|
||||
const C4TexRef& GetTexture(unsigned int i) const { return Textures[i].pTex->Texture; }
|
||||
bool HasFrameAnimation() const { return Duration > 0; }
|
||||
bool HasTexCoordAnimation() const { return !Transformations.empty(); }
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ bool C4Surface::ReadPNG(CStdStream &hGroup)
|
|||
{
|
||||
assert (tX>=0 && tY>=0 && tX<iTexX && tY<iTexY);
|
||||
// Get Texture and lock it
|
||||
CTexRef *pTexRef = *(ppTex+tY*iTexX+tX);
|
||||
C4TexRef *pTexRef = *(ppTex+tY*iTexX+tX);
|
||||
if (!pTexRef->Lock()) continue;
|
||||
// At the edges, not the whole texture is used
|
||||
int maxY = Min(iTexSize, Hgt - tY * iTexSize), maxX = Min(iTexSize, Wdt - tX * iTexSize);
|
||||
|
|
|
@ -277,12 +277,12 @@ bool C4Surface::CreateTextures(int MaxTextureSize)
|
|||
iTexX=(Wdt-1)/iTexSize +1;
|
||||
iTexY=(Hgt-1)/iTexSize +1;
|
||||
// get mem for texture array
|
||||
ppTex = new CTexRef * [iTexX*iTexY];
|
||||
memset(ppTex, 0, iTexX*iTexY*sizeof(CTexRef *));
|
||||
ppTex = new C4TexRef * [iTexX*iTexY];
|
||||
memset(ppTex, 0, iTexX*iTexY*sizeof(C4TexRef *));
|
||||
// cvan't be render target if it's not a single surface
|
||||
if (!IsSingleSurface()) fIsRenderTarget = false;
|
||||
// create textures
|
||||
CTexRef **ppCTex=ppTex;
|
||||
C4TexRef **ppCTex=ppTex;
|
||||
for (int y = 0; y < iTexY; ++y)
|
||||
{
|
||||
for(int x = 0; x < iTexX; ++x)
|
||||
|
@ -292,7 +292,7 @@ bool C4Surface::CreateTextures(int MaxTextureSize)
|
|||
if(x == iTexX-1) sizeX = GetNeedTexSize( (Wdt - 1) % iTexSize + 1);
|
||||
if(y == iTexY-1) sizeY = GetNeedTexSize( (Hgt - 1) % iTexSize + 1);
|
||||
|
||||
*ppCTex = new CTexRef(sizeX, sizeY, fIsRenderTarget);
|
||||
*ppCTex = new C4TexRef(sizeX, sizeY, fIsRenderTarget);
|
||||
|
||||
if (fIsBackground && ppCTex) (*ppCTex)->FillBlack();
|
||||
|
||||
|
@ -312,7 +312,7 @@ bool C4Surface::CreateTextures(int MaxTextureSize)
|
|||
{
|
||||
// regular textures or if last texture fits exactly into the space by Wdt or Hgt
|
||||
if (i-1 || !(Wdt%iTexSize) || !(Hgt%iTexSize))
|
||||
*ppCTex = new CTexRef(iTexSize, fIsRenderTarget);
|
||||
*ppCTex = new C4TexRef(iTexSize, fIsRenderTarget);
|
||||
else
|
||||
{
|
||||
// last texture might be smaller
|
||||
|
@ -325,7 +325,7 @@ bool C4Surface::CreateTextures(int MaxTextureSize)
|
|||
while ((1<<++n) < iNeedSize) {}
|
||||
iNeedSize=1<<n;
|
||||
}
|
||||
*ppCTex = new CTexRef(iNeedSize, fIsRenderTarget);
|
||||
*ppCTex = new C4TexRef(iNeedSize, fIsRenderTarget);
|
||||
}
|
||||
if (fIsBackground && ppCTex) (*ppCTex)->FillBlack();
|
||||
#ifdef USE_DIRECTX
|
||||
|
@ -353,7 +353,7 @@ void C4Surface::FreeTextures()
|
|||
if (ppTex)
|
||||
{
|
||||
// clear all textures
|
||||
CTexRef **ppTx=ppTex;
|
||||
C4TexRef **ppTx=ppTex;
|
||||
for (int i=0; i<iTexX*iTexY; ++i,++ppTx)
|
||||
if (*ppTx) delete *ppTx;
|
||||
// clear texture list
|
||||
|
@ -490,7 +490,7 @@ bool C4Surface::SetAsClrByOwnerOf(C4Surface *pOfSurface)
|
|||
// create texture array
|
||||
CreateTextures();
|
||||
// get from framebuffer
|
||||
CTexRef **ppTexRef = ppTex;
|
||||
C4TexRef **ppTexRef = ppTex;
|
||||
for (int iY=0; iY<Hgt; iY+=iTexSize)
|
||||
for (int iX=0; iX<Wdt; iX+=iTexSize)
|
||||
{
|
||||
|
@ -822,7 +822,7 @@ bool C4Surface::Unlock()
|
|||
else
|
||||
{
|
||||
// non-primary unlock: unlock all texture surfaces (if locked)
|
||||
CTexRef **ppTx=ppTex;
|
||||
C4TexRef **ppTx=ppTex;
|
||||
for (int i=0; i<iTexX*iTexY; ++i,++ppTx)
|
||||
(*ppTx)->Unlock();
|
||||
}
|
||||
|
@ -830,7 +830,7 @@ bool C4Surface::Unlock()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool C4Surface::GetTexAt(CTexRef **ppTexRef, int &rX, int &rY)
|
||||
bool C4Surface::GetTexAt(C4TexRef **ppTexRef, int &rX, int &rY)
|
||||
{
|
||||
// texture present?
|
||||
if (!ppTex) return false;
|
||||
|
@ -848,7 +848,7 @@ bool C4Surface::GetTexAt(CTexRef **ppTexRef, int &rX, int &rY)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool C4Surface::GetLockTexAt(CTexRef **ppTexRef, int &rX, int &rY)
|
||||
bool C4Surface::GetLockTexAt(C4TexRef **ppTexRef, int &rX, int &rY)
|
||||
{
|
||||
// texture present?
|
||||
if (!GetTexAt(ppTexRef, rX, rY)) return false;
|
||||
|
@ -892,7 +892,7 @@ DWORD C4Surface::GetPixDw(int iX, int iY, bool fApplyModulation)
|
|||
/*if (!ppTex) if (!CreatePrimaryGLTextures()) return 0;
|
||||
// get+lock affected texture - inverse Y as primary is locked upside down!
|
||||
iY = Hgt-iY-1;
|
||||
CTexRef *pTexRef;
|
||||
C4TexRef *pTexRef;
|
||||
if (!GetLockTexAt(&pTexRef, iX, iY)) return 0;
|
||||
pBuf=(BYTE *) pTexRef->texLock.pBits;
|
||||
iPitch=pTexRef->texLock.Pitch;
|
||||
|
@ -940,7 +940,7 @@ DWORD C4Surface::GetPixDw(int iX, int iY, bool fApplyModulation)
|
|||
{
|
||||
// get+lock affected texture
|
||||
if (!ppTex) return 0;
|
||||
CTexRef *pTexRef;
|
||||
C4TexRef *pTexRef;
|
||||
if (!GetLockTexAt(&pTexRef, iX, iY)) return 0;
|
||||
pBuf=(BYTE *) pTexRef->texLock.pBits;
|
||||
iPitch=pTexRef->texLock.Pitch;
|
||||
|
@ -1077,7 +1077,7 @@ bool C4Surface::SetPixDw(int iX, int iY, DWORD dwClr)
|
|||
if (!ppTex) return false;
|
||||
// if color is fully transparent, ensure it's black
|
||||
if (dwClr>>24 == 0x00) dwClr=0x00000000;
|
||||
CTexRef *pTexRef;
|
||||
C4TexRef *pTexRef;
|
||||
#ifdef USE_GL
|
||||
// openGL: use glTexSubImage2D
|
||||
// This optimization was moved to LockForUpdate, as it only slows down mass updates here
|
||||
|
@ -1138,7 +1138,7 @@ bool C4Surface::SetPixAlpha(int iX, int iY, BYTE byAlpha)
|
|||
if ((iX<ClipX) || (iX>ClipX2) || (iY<ClipY) || (iY>ClipY2)) return true;
|
||||
// get+lock affected texture
|
||||
if (!ppTex) return false;
|
||||
CTexRef *pTexRef;
|
||||
C4TexRef *pTexRef;
|
||||
if (!GetLockTexAt(&pTexRef, iX, iY)) return false;
|
||||
// set alpha value of pix in surface
|
||||
if (byBytesPP == 4)
|
||||
|
@ -1157,7 +1157,7 @@ bool C4Surface::SetPixAlpha(int iX, int iY, BYTE byAlpha)
|
|||
bool C4Surface::BltPix(int iX, int iY, C4Surface *sfcSource, int iSrcX, int iSrcY, bool fTransparency)
|
||||
{
|
||||
// 16- or 32bit-blit. lock target
|
||||
CTexRef *pTexRef;
|
||||
C4TexRef *pTexRef;
|
||||
if (!GetLockTexAt(&pTexRef, iX, iY)) return false;
|
||||
if (byBytesPP == 4)
|
||||
{
|
||||
|
@ -1229,7 +1229,7 @@ void C4Surface::ClearBoxDw(int iX, int iY, int iWdt, int iHgt)
|
|||
{
|
||||
for (int x=iTexX1; x<iTexX2; ++x)
|
||||
{
|
||||
CTexRef *pTex = *(ppTex + y * iTexX + x);
|
||||
C4TexRef *pTex = *(ppTex + y * iTexX + x);
|
||||
// get current offset in texture
|
||||
int iBlitX=iTexSize*x;
|
||||
int iBlitY=iTexSize*y;
|
||||
|
@ -1242,7 +1242,7 @@ void C4Surface::ClearBoxDw(int iX, int iY, int iWdt, int iHgt)
|
|||
// then get this surface as same offset as from other surface
|
||||
// assuming this is only valid as long as there's no texture management,
|
||||
// organizing partially used textures together!
|
||||
CTexRef *pBaseTex = *(pMainSfc->ppTex + y * iTexX + x);
|
||||
C4TexRef *pBaseTex = *(pMainSfc->ppTex + y * iTexX + x);
|
||||
pBaseTex->ClearRect(rtClear);
|
||||
}
|
||||
// clear this texture
|
||||
|
@ -1254,7 +1254,7 @@ void C4Surface::ClearBoxDw(int iX, int iY, int iWdt, int iHgt)
|
|||
bool C4Surface::CopyBytes(BYTE *pImageData)
|
||||
{
|
||||
// copy image data directly into textures
|
||||
CTexRef **ppCurrTex = ppTex, *pTex = *ppTex;
|
||||
C4TexRef **ppCurrTex = ppTex, *pTex = *ppTex;
|
||||
int iSrcPitch = Wdt * byBytesPP; int iLineTotal = 0;
|
||||
for (int iY=0; iY<iTexY; ++iY)
|
||||
{
|
||||
|
@ -1282,7 +1282,7 @@ bool C4Surface::CopyBytes(BYTE *pImageData)
|
|||
return true;
|
||||
}
|
||||
|
||||
CTexRef::CTexRef(int iSizeX, int iSizeY, bool fSingle)
|
||||
C4TexRef::C4TexRef(int iSizeX, int iSizeY, bool fSingle)
|
||||
{
|
||||
// zero fields
|
||||
#ifdef USE_DIRECTX
|
||||
|
@ -1296,7 +1296,7 @@ CTexRef::CTexRef(int iSizeX, int iSizeY, bool fSingle)
|
|||
this->iSizeX=iSizeX;
|
||||
this->iSizeY=iSizeY;
|
||||
// add to texture manager
|
||||
if (!pTexMgr) pTexMgr = new CTexMgr();
|
||||
if (!pTexMgr) pTexMgr = new C4TexMgr();
|
||||
pTexMgr->RegTex(this);
|
||||
// create texture: check ddraw
|
||||
if (!lpDDraw) return;
|
||||
|
@ -1343,7 +1343,7 @@ CTexRef::CTexRef(int iSizeX, int iSizeY, bool fSingle)
|
|||
}
|
||||
}
|
||||
|
||||
CTexRef::~CTexRef()
|
||||
C4TexRef::~C4TexRef()
|
||||
{
|
||||
fIntLock=false;
|
||||
// free texture
|
||||
|
@ -1365,7 +1365,7 @@ CTexRef::~CTexRef()
|
|||
pTexMgr->UnregTex(this);
|
||||
}
|
||||
|
||||
bool CTexRef::LockForUpdate(C4Rect & rtUpdate)
|
||||
bool C4TexRef::LockForUpdate(C4Rect & rtUpdate)
|
||||
{
|
||||
// already locked?
|
||||
if (texLock.pBits)
|
||||
|
@ -1420,7 +1420,7 @@ bool CTexRef::LockForUpdate(C4Rect & rtUpdate)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CTexRef::Lock()
|
||||
bool C4TexRef::Lock()
|
||||
{
|
||||
// already locked?
|
||||
if (texLock.pBits) return true;
|
||||
|
@ -1458,7 +1458,7 @@ bool CTexRef::Lock()
|
|||
return false;
|
||||
}
|
||||
|
||||
void CTexRef::Unlock()
|
||||
void C4TexRef::Unlock()
|
||||
{
|
||||
// locked?
|
||||
if (!texLock.pBits || fIntLock) return;
|
||||
|
@ -1511,7 +1511,7 @@ void CTexRef::Unlock()
|
|||
}
|
||||
}
|
||||
|
||||
bool CTexRef::ClearRect(C4Rect &rtClear)
|
||||
bool C4TexRef::ClearRect(C4Rect &rtClear)
|
||||
{
|
||||
// ensure locked
|
||||
if (!LockForUpdate(rtClear)) return false;
|
||||
|
@ -1538,7 +1538,7 @@ bool CTexRef::ClearRect(C4Rect &rtClear)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CTexRef::FillBlack()
|
||||
bool C4TexRef::FillBlack()
|
||||
{
|
||||
// ensure locked
|
||||
if (!Lock()) return false;
|
||||
|
@ -1567,25 +1567,25 @@ bool CTexRef::FillBlack()
|
|||
|
||||
// texture manager
|
||||
|
||||
CTexMgr::CTexMgr()
|
||||
C4TexMgr::C4TexMgr()
|
||||
{
|
||||
// clear textures
|
||||
Textures.clear();
|
||||
}
|
||||
|
||||
CTexMgr::~CTexMgr()
|
||||
C4TexMgr::~C4TexMgr()
|
||||
{
|
||||
// unlock all textures
|
||||
IntUnlock();
|
||||
}
|
||||
|
||||
void CTexMgr::RegTex(CTexRef *pTex)
|
||||
void C4TexMgr::RegTex(C4TexRef *pTex)
|
||||
{
|
||||
// add texture to list
|
||||
Textures.push_front(pTex);
|
||||
}
|
||||
|
||||
void CTexMgr::UnregTex(CTexRef *pTex)
|
||||
void C4TexMgr::UnregTex(C4TexRef *pTex)
|
||||
{
|
||||
// remove texture from list
|
||||
Textures.remove(pTex);
|
||||
|
@ -1593,13 +1593,13 @@ void CTexMgr::UnregTex(CTexRef *pTex)
|
|||
if (Textures.empty()) { delete this; pTexMgr=NULL; }
|
||||
}
|
||||
|
||||
void CTexMgr::IntLock()
|
||||
void C4TexMgr::IntLock()
|
||||
{
|
||||
// lock all textures
|
||||
int j=Textures.size();
|
||||
for (std::list<CTexRef *>::iterator i=Textures.begin(); j--; ++i)
|
||||
for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
|
||||
{
|
||||
CTexRef *pRef = *i;
|
||||
C4TexRef *pRef = *i;
|
||||
if (pRef->Lock() && pRef->texLock.pBits)
|
||||
{
|
||||
pRef->fIntLock = true;
|
||||
|
@ -1617,15 +1617,15 @@ void CTexMgr::IntLock()
|
|||
}
|
||||
}
|
||||
|
||||
void CTexMgr::IntUnlock()
|
||||
void C4TexMgr::IntUnlock()
|
||||
{
|
||||
// unlock all internally locked textures
|
||||
int j=Textures.size();
|
||||
for (std::list<CTexRef *>::iterator i=Textures.begin(); j--; ++i)
|
||||
for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
|
||||
{
|
||||
CTexRef *pRef = *i;
|
||||
C4TexRef *pRef = *i;
|
||||
if (pRef->fIntLock) { pRef->fIntLock = false; pRef->Unlock(); }
|
||||
}
|
||||
}
|
||||
|
||||
CTexMgr *pTexMgr;
|
||||
C4TexMgr *pTexMgr;
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
};
|
||||
};
|
||||
#endif
|
||||
CTexRef **ppTex; // textures
|
||||
C4TexRef **ppTex; // textures
|
||||
BYTE byBytesPP; // bytes per pixel (2 or 4)
|
||||
C4Surface *pMainSfc; // main surface for simple ColorByOwner-surfaces
|
||||
DWORD ClrByOwnerClr; // current color to be used for ColorByOwner-blits
|
||||
|
@ -142,8 +142,8 @@ public:
|
|||
void ClearBoxDw(int iX, int iY, int iWdt, int iHgt);
|
||||
bool Unlock();
|
||||
bool Lock();
|
||||
bool GetTexAt(CTexRef **ppTexRef, int &rX, int &rY); // get texture and adjust x/y
|
||||
bool GetLockTexAt(CTexRef **ppTexRef, int &rX, int &rY); // get texture; ensure it's locked and adjust x/y
|
||||
bool GetTexAt(C4TexRef **ppTexRef, int &rX, int &rY); // get texture and adjust x/y
|
||||
bool GetLockTexAt(C4TexRef **ppTexRef, int &rX, int &rY); // get texture; ensure it's locked and adjust x/y
|
||||
DWORD GetPixDw(int iX, int iY, bool fApplyModulation); // get 32bit-px
|
||||
bool IsPixTransparent(int iX, int iY); // is pixel's alpha value <= 0x7f?
|
||||
bool SetPixDw(int iX, int iY, DWORD dwCol); // set pix in surface only
|
||||
|
@ -207,7 +207,7 @@ typedef struct _D3DLOCKED_RECT
|
|||
#endif
|
||||
|
||||
// one texture encapsulation
|
||||
class CTexRef
|
||||
class C4TexRef
|
||||
{
|
||||
public:
|
||||
D3DLOCKED_RECT texLock; // current lock-data
|
||||
|
@ -237,8 +237,8 @@ public:
|
|||
bool fIntLock; // if set, texref is locked internally only
|
||||
C4Rect LockSize;
|
||||
|
||||
CTexRef(int iSizeX, int iSizeY, bool fAsRenderTarget); // create texture with given size
|
||||
~CTexRef(); // release texture
|
||||
C4TexRef(int iSizeX, int iSizeY, bool fAsRenderTarget); // create texture with given size
|
||||
~C4TexRef(); // release texture
|
||||
bool Lock(); // lock texture
|
||||
// Lock a part of the rect, discarding the content
|
||||
// Note: Calling Lock afterwards without an Unlock first is undefined
|
||||
|
@ -257,22 +257,22 @@ public:
|
|||
};
|
||||
|
||||
// texture management
|
||||
class CTexMgr
|
||||
class C4TexMgr
|
||||
{
|
||||
public:
|
||||
std::list<CTexRef *> Textures;
|
||||
std::list<C4TexRef *> Textures;
|
||||
|
||||
public:
|
||||
CTexMgr(); // ctor
|
||||
~CTexMgr(); // dtor
|
||||
C4TexMgr(); // ctor
|
||||
~C4TexMgr(); // dtor
|
||||
|
||||
void RegTex(CTexRef *pTex);
|
||||
void UnregTex(CTexRef *pTex);
|
||||
void RegTex(C4TexRef *pTex);
|
||||
void UnregTex(C4TexRef *pTex);
|
||||
|
||||
void IntLock(); // do an internal lock
|
||||
void IntUnlock(); // undo internal lock
|
||||
};
|
||||
|
||||
extern CTexMgr *pTexMgr;
|
||||
extern C4TexMgr *pTexMgr;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -221,7 +221,7 @@ bool CStdD3D::PrepareRendering(C4Surface * sfcToSurface)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CStdD3D::PerformBlt(C4BltData &rBltData, CTexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact)
|
||||
void CStdD3D::PerformBlt(C4BltData &rBltData, C4TexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact)
|
||||
{
|
||||
if (!lpDevice || !pVB) return;
|
||||
|
||||
|
@ -315,7 +315,7 @@ unsigned int Format2BitDepth(D3DFORMAT format)
|
|||
}
|
||||
}
|
||||
|
||||
bool CStdD3D::BlitTex2Window(CTexRef *pTexRef, HDC hdcTarget, RECT &rtFrom, RECT &rtTo)
|
||||
bool CStdD3D::BlitTex2Window(C4TexRef *pTexRef, HDC hdcTarget, RECT &rtFrom, RECT &rtTo)
|
||||
{
|
||||
// lock
|
||||
if (!pTexRef->Lock()) return false;
|
||||
|
@ -363,9 +363,9 @@ bool CStdD3D::BlitSurface2Window(C4Surface * sfcSource,
|
|||
int iTexY=fY/iTexSizeY;
|
||||
int iTexX2=Min((fX+fWdt-1)/iTexSizeX +1, sfcSource->iTexX);
|
||||
int iTexY2=Min((fY+fHgt-1)/iTexSizeY +1, sfcSource->iTexY);
|
||||
CTexRef **ppTex=sfcSource->ppTex+iTexY*sfcSource->iTexX+iTexX;
|
||||
C4TexRef **ppTex=sfcSource->ppTex+iTexY*sfcSource->iTexX+iTexX;
|
||||
// blit from all these textures
|
||||
CTexRef **ppTexRow, *pBaseTex=NULL;
|
||||
C4TexRef **ppTexRow, *pBaseTex=NULL;
|
||||
for (int iY=iTexY; iY<iTexY2; ++iY)
|
||||
{
|
||||
ppTexRow=ppTex;
|
||||
|
|
|
@ -133,8 +133,8 @@ public:
|
|||
bool PrepareRendering(C4Surface * sfcToSurface); // check if/make rendering possible to given surface
|
||||
// Blit
|
||||
virtual void PerformMesh(StdMeshInstance &instance, float tx, float ty, float twdt, float thgt, DWORD dwPlayerColor, C4BltTransform* pTransform);
|
||||
void PerformBlt(C4BltData &rBltData, CTexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact);
|
||||
bool BlitTex2Window(CTexRef *pTexRef, HDC hdcTarget, RECT &rtFrom, RECT &rtTo);
|
||||
void PerformBlt(C4BltData &rBltData, C4TexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact);
|
||||
bool BlitTex2Window(C4TexRef *pTexRef, HDC hdcTarget, RECT &rtFrom, RECT &rtTo);
|
||||
bool BlitSurface2Window(C4Surface * sfcSource, int fX, int fY, int fWdt, int fHgt, HWND hWnd, int tX, int tY, int tWdt, int tHgt);
|
||||
void FillBG(DWORD dwClr=0);
|
||||
// Drawing
|
||||
|
@ -166,7 +166,7 @@ protected:
|
|||
|
||||
|
||||
friend class C4Surface;
|
||||
friend class CTexRef;
|
||||
friend class C4TexRef;
|
||||
friend class C4Pattern;
|
||||
};
|
||||
|
||||
|
|
|
@ -616,7 +616,7 @@ bool CStdDDraw::Blit(C4Surface * sfcSource, float fx, float fy, float fwdt, floa
|
|||
{
|
||||
for (int iX=iTexX; iX<iTexX2; ++iX)
|
||||
{
|
||||
CTexRef *pTex = *(sfcSource->ppTex + iY * sfcSource->iTexX + iX);
|
||||
C4TexRef *pTex = *(sfcSource->ppTex + iY * sfcSource->iTexX + iX);
|
||||
// get current blitting offset in texture
|
||||
int iBlitX=sfcSource->iTexSize*iX;
|
||||
int iBlitY=sfcSource->iTexSize*iY;
|
||||
|
@ -691,7 +691,7 @@ bool CStdDDraw::Blit(C4Surface * sfcSource, float fx, float fy, float fwdt, floa
|
|||
BltData.vtVtx[2].tx = fTexBlt.right / iTexSizeX; BltData.vtVtx[2].ty = fTexBlt.bottom / iTexSizeY;
|
||||
BltData.vtVtx[3].tx = fTexBlt.left / iTexSizeX; BltData.vtVtx[3].ty = fTexBlt.bottom / iTexSizeY;
|
||||
|
||||
CTexRef * pBaseTex = pTex;
|
||||
C4TexRef * pBaseTex = pTex;
|
||||
// is there a base-surface to be blitted first?
|
||||
if (fBaseSfc)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
// texref-predef
|
||||
class CStdDDraw;
|
||||
class CTexRef;
|
||||
class C4TexRef;
|
||||
class C4Surface;
|
||||
struct CStdPalette;
|
||||
class CStdGLCtx;
|
||||
|
@ -261,7 +261,7 @@ public:
|
|||
C4Surface * sfcTarget, float tx, float ty, float twdt, float thgt,
|
||||
bool fSrcColKey=false, const C4BltTransform *pTransform=NULL);
|
||||
bool RenderMesh(StdMeshInstance &instance, C4Surface * sfcTarget, float tx, float ty, float twdt, float thgt, DWORD dwPlayerColor, C4BltTransform* pTransform); // Call PrepareMaterial with Mesh's material before
|
||||
virtual void PerformBlt(C4BltData &rBltData, CTexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact) = 0;
|
||||
virtual void PerformBlt(C4BltData &rBltData, C4TexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact) = 0;
|
||||
virtual void PerformMesh(StdMeshInstance &instance, float tx, float ty, float twdt, float thgt, DWORD dwPlayerColor, C4BltTransform* pTransform) = 0;
|
||||
bool Blit8(C4Surface * sfcSource, int fx, int fy, int fwdt, int fhgt, // force 8bit-blit (inline)
|
||||
C4Surface * sfcTarget, int tx, int ty, int twdt, int thgt,
|
||||
|
@ -341,7 +341,7 @@ protected:
|
|||
}
|
||||
|
||||
friend class C4Surface;
|
||||
friend class CTexRef;
|
||||
friend class C4TexRef;
|
||||
friend class C4Pattern;
|
||||
friend class CStdD3DShader;
|
||||
};
|
||||
|
|
|
@ -151,7 +151,7 @@ bool CStdGL::PrepareMaterial(StdMeshMaterial& mat)
|
|||
StdMeshMaterialTextureUnit& texunit = pass.TextureUnits[k];
|
||||
for (unsigned int l = 0; l < texunit.GetNumTextures(); ++l)
|
||||
{
|
||||
const CTexRef& texture = texunit.GetTexture(l);
|
||||
const C4TexRef& texture = texunit.GetTexture(l);
|
||||
glBindTexture(GL_TEXTURE_2D, texture.texName);
|
||||
switch (texunit.TexAddressMode)
|
||||
{
|
||||
|
@ -185,10 +185,10 @@ bool CStdGL::PrepareMaterial(StdMeshMaterial& mat)
|
|||
// gluBuild2DMipmaps. GL_GENERATE_MIPMAP is probably still more
|
||||
// efficient though.
|
||||
|
||||
// Disabled for now, until we find a better place for this (CTexRef?)
|
||||
// Disabled for now, until we find a better place for this (C4TexRef?)
|
||||
#if 0
|
||||
if (GLEW_VERSION_1_4)
|
||||
{ glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); const_cast<CTexRef*>(&texunit.GetTexture())->Lock(); const_cast<CTexRef*>(&texunit.GetTexture())->Unlock(); }
|
||||
{ glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); const_cast<C4TexRef*>(&texunit.GetTexture())->Lock(); const_cast<C4TexRef*>(&texunit.GetTexture())->Unlock(); }
|
||||
else
|
||||
technique.Available = false;
|
||||
#else
|
||||
|
@ -376,7 +376,7 @@ void CStdGL::SetupTextureEnv(bool fMod2, bool landscape)
|
|||
glShadeModel((fUseClrModMap && !shaders[0]) ? GL_SMOOTH : GL_FLAT);
|
||||
}
|
||||
|
||||
void CStdGL::PerformBlt(C4BltData &rBltData, CTexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact)
|
||||
void CStdGL::PerformBlt(C4BltData &rBltData, C4TexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact)
|
||||
{
|
||||
// global modulation map
|
||||
int i;
|
||||
|
@ -1477,7 +1477,7 @@ void CStdGL::BlitLandscape(C4Surface * sfcSource, float fx, float fy,
|
|||
DWORD dwModClr = BlitModulated ? BlitModulateClr : 0xffffffff;
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
CTexRef *pTex = *(sfcSource->ppTex + iY * sfcSource->iTexX + iX);
|
||||
C4TexRef *pTex = *(sfcSource->ppTex + iY * sfcSource->iTexX + iX);
|
||||
glBindTexture(GL_TEXTURE_2D, pTex->texName);
|
||||
if (!mattextures && Zoom != 1.0)
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
#endif
|
||||
// Blit
|
||||
void SetupTextureEnv(bool fMod2, bool landscape);
|
||||
virtual void PerformBlt(C4BltData &rBltData, CTexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact);
|
||||
virtual void PerformBlt(C4BltData &rBltData, C4TexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact);
|
||||
virtual void PerformMesh(StdMeshInstance &instance, float tx, float ty, float twdt, float thgt, DWORD dwPlayerColor, C4BltTransform* pTransform);
|
||||
virtual void BlitLandscape(C4Surface * sfcSource, float fx, float fy,
|
||||
C4Surface * sfcTarget, float tx, float ty, float wdt, float hgt, const C4Surface * textures[]);
|
||||
|
@ -153,7 +153,7 @@ protected:
|
|||
#endif
|
||||
|
||||
friend class C4Surface;
|
||||
friend class CTexRef;
|
||||
friend class C4TexRef;
|
||||
friend class C4Pattern;
|
||||
friend class CStdGLCtx;
|
||||
friend class C4StartupOptionsDlg;
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
virtual bool PrepareMaterial(StdMeshMaterial& mesh);
|
||||
virtual bool PrepareRendering(C4Surface *) { return true; }
|
||||
virtual void FillBG(DWORD dwClr=0) { }
|
||||
virtual void PerformBlt(C4BltData &, CTexRef *, DWORD, bool, bool) { }
|
||||
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 DrawQuadDw(C4Surface *, float *, DWORD, DWORD, DWORD, DWORD) { }
|
||||
|
|
Loading…
Reference in New Issue