|
@@ -18,6 +18,7 @@ Textur::Textur()
|
|
|
bild = 0;
|
|
|
lastGr = Punkt(0, 0);
|
|
|
id = -1;
|
|
|
+ changed = 0;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -30,6 +31,7 @@ Textur::~Textur()
|
|
|
|
|
|
void Textur::setBildZ(Bild* b)
|
|
|
{
|
|
|
+ if (bild != b) changed = 1;
|
|
|
if (bild) bild->release();
|
|
|
bild = b;
|
|
|
}
|
|
@@ -39,6 +41,7 @@ void Textur::setBildZ(Bild* b)
|
|
|
void Textur::setBild(Bild* b)
|
|
|
{
|
|
|
if (!b) return;
|
|
|
+ if (bild != b) changed = 1;
|
|
|
if (!bild || bild->getBreite() != b->getBreite()
|
|
|
|| bild->getHeight() != b->getHeight())
|
|
|
{
|
|
@@ -124,8 +127,9 @@ bool DX11Textur::updateTextur()
|
|
|
HRESULT r = device->CreateTexture2D(&bufferDesc, 0, &txt);
|
|
|
if (r != S_OK) return 0;
|
|
|
}
|
|
|
- if (!renderTarget)
|
|
|
+ if (!renderTarget && (bild->getRend() || changed))
|
|
|
{
|
|
|
+ changed = 0;
|
|
|
D3D11_MAPPED_SUBRESOURCE buffer;
|
|
|
context->Map(txt, 0, D3D11_MAP::D3D11_MAP_WRITE_DISCARD, 0, &buffer);
|
|
|
int* bgBuff = bild->getBuffer();
|