|
@@ -15,6 +15,7 @@
|
|
|
#include "Textur.h"
|
|
|
#include "TexturModel.h"
|
|
|
#include "TexturList.h"
|
|
|
+#include "GraphicsApi.h"
|
|
|
#ifdef WIN32
|
|
|
#include "Kam3D.h"
|
|
|
#include <DirectXMath.h>
|
|
@@ -34,8 +35,8 @@ using namespace Framework;
|
|
|
|
|
|
|
|
|
Bildschirm::Bildschirm( WFenster *f )
|
|
|
- : fenster( f ),
|
|
|
- renderB( new Bild( 1 ) ),
|
|
|
+ : api( 0 ),
|
|
|
+ fenster( f ),
|
|
|
ref( 1 ),
|
|
|
members( new RCArray<Zeichnung>() ),
|
|
|
fillColor( 0xFF000000 ),
|
|
@@ -43,24 +44,19 @@ Bildschirm::Bildschirm( WFenster *f )
|
|
|
onTop( 0 ),
|
|
|
renderOnTop( 0 ),
|
|
|
renderZeichnungen( 1 ),
|
|
|
- vollbild( 0 ),
|
|
|
rendering( 0 ),
|
|
|
renderZeit( new ZeitMesser() ),
|
|
|
- backBufferSize( 0, 0 ),
|
|
|
tips( new RCArray< ToolTip >() ),
|
|
|
tipAnzahl( 0 ),
|
|
|
testRend( 1 ),
|
|
|
fill( 1 ),
|
|
|
rend( 0 )
|
|
|
-{
|
|
|
-}
|
|
|
+{}
|
|
|
|
|
|
|
|
|
Bildschirm::~Bildschirm()
|
|
|
{
|
|
|
lock();
|
|
|
- if( renderB )
|
|
|
- renderB->release();
|
|
|
#ifdef WIN32
|
|
|
if( fenster )
|
|
|
fenster->release();
|
|
@@ -71,6 +67,8 @@ Bildschirm::~Bildschirm()
|
|
|
renderZeit->release();
|
|
|
if( onTop )
|
|
|
onTop->release();
|
|
|
+ if( api )
|
|
|
+ api->release();
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
@@ -90,6 +88,14 @@ void Bildschirm::setFill( bool f )
|
|
|
fill = f;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+void Bildschirm::update()
|
|
|
+{
|
|
|
+ lock();
|
|
|
+ api->update();
|
|
|
+ unlock();
|
|
|
+}
|
|
|
+
|
|
|
void Bildschirm::setTestRend( bool tr )
|
|
|
{
|
|
|
testRend = tr;
|
|
@@ -109,7 +115,7 @@ void Bildschirm::setOnTop( bool onTop )
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
-void Bildschirm::setOnTopZeichnung( Zeichnung *obj )
|
|
|
+void Bildschirm::setOnTopZeichnung( Zeichnung * obj )
|
|
|
{
|
|
|
lock();
|
|
|
if( onTop )
|
|
@@ -125,7 +131,7 @@ void Bildschirm::setdeckFarbe( int f )
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
-void Bildschirm::addMember( Zeichnung *obj )
|
|
|
+void Bildschirm::addMember( Zeichnung * obj )
|
|
|
{
|
|
|
lock();
|
|
|
members->add( obj );
|
|
@@ -133,7 +139,7 @@ void Bildschirm::addMember( Zeichnung *obj )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm::removeMember( Zeichnung *zObj )
|
|
|
+void Bildschirm::removeMember( Zeichnung * zObj )
|
|
|
{
|
|
|
lock();
|
|
|
for( int i = 0; i < members->getEintragAnzahl(); i++ )
|
|
@@ -145,6 +151,15 @@ void Bildschirm::removeMember( Zeichnung *zObj )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+void Bildschirm::render()
|
|
|
+{
|
|
|
+ lock();
|
|
|
+ api->update();
|
|
|
+ rend = 1;
|
|
|
+ unlock();
|
|
|
+}
|
|
|
+
|
|
|
void Bildschirm::setFillFarbe( int f )
|
|
|
{
|
|
|
fillColor = f;
|
|
@@ -154,8 +169,7 @@ void Bildschirm::setFillFarbe( int f )
|
|
|
void Bildschirm::setVollbild( bool vollbild )
|
|
|
{
|
|
|
lock();
|
|
|
- this->vollbild = vollbild;
|
|
|
- rend = 1;
|
|
|
+ api->setFullScreen( vollbild );
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
@@ -181,33 +195,30 @@ void Bildschirm::tick( double tickval )
|
|
|
void Bildschirm::setBackBufferSize( int breite, int height )
|
|
|
{
|
|
|
lock();
|
|
|
- backBufferSize.x = breite;
|
|
|
- backBufferSize.y = height;
|
|
|
- rend = 1;
|
|
|
+ api->setBackBufferSize( Vec2< int >( breite, height ) );
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm::setBackBufferSize( Punkt &size )
|
|
|
+void Bildschirm::setBackBufferSize( Punkt & size )
|
|
|
{
|
|
|
lock();
|
|
|
- backBufferSize = size;
|
|
|
- rend = 1;
|
|
|
+ api->setBackBufferSize( size );
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm::doMausEreignis( MausEreignis &me )
|
|
|
+void Bildschirm::doMausEreignis( MausEreignis & me )
|
|
|
{
|
|
|
- int fBr = backBufferSize.x;
|
|
|
- int fHi = backBufferSize.y;
|
|
|
+ int fBr = api->getBackBufferSize().x;
|
|
|
+ int fHi = api->getBackBufferSize().y;
|
|
|
#ifdef WIN32
|
|
|
- if( fenster )
|
|
|
- {
|
|
|
- fBr = fenster->getKörperBreite();
|
|
|
- fHi = fenster->getKörperHöhe();
|
|
|
- }
|
|
|
+ if( fenster )
|
|
|
+ {
|
|
|
+ fBr = fenster->getKörperBreite();
|
|
|
+ fHi = fenster->getKörperHöhe();
|
|
|
+ }
|
|
|
#endif
|
|
|
- me.mx = (int)( me.mx * backBufferSize.x / (double)fBr + 0.5 );
|
|
|
- me.my = (int)( me.my * backBufferSize.y / (double)fHi + 0.5 );
|
|
|
+ me.mx = (int)( me.mx * api->getBackBufferSize().x / (double)fBr + 0.5 );
|
|
|
+ me.my = (int)( me.my * api->getBackBufferSize().y / (double)fHi + 0.5 );
|
|
|
lock();
|
|
|
if( !renderOnTop )
|
|
|
{
|
|
@@ -225,7 +236,7 @@ void Bildschirm::doMausEreignis( MausEreignis &me )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm::doTastaturEreignis( TastaturEreignis &te )
|
|
|
+void Bildschirm::doTastaturEreignis( TastaturEreignis & te )
|
|
|
{
|
|
|
lock();
|
|
|
if( !renderOnTop )
|
|
@@ -238,7 +249,7 @@ void Bildschirm::doTastaturEreignis( TastaturEreignis &te )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm::addToolTip( ToolTip *tip )
|
|
|
+void Bildschirm::addToolTip( ToolTip * tip )
|
|
|
{
|
|
|
lock();
|
|
|
tips->add( tip, tipAnzahl );
|
|
@@ -247,7 +258,7 @@ void Bildschirm::addToolTip( ToolTip *tip )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-bool Bildschirm::removeToolTip( ToolTip *zTip )
|
|
|
+bool Bildschirm::removeToolTip( ToolTip * zTip )
|
|
|
{
|
|
|
lock();
|
|
|
bool gefunden = 0;
|
|
@@ -270,15 +281,15 @@ bool Bildschirm::removeToolTip( ToolTip *zTip )
|
|
|
|
|
|
Bild *Bildschirm::getRenderBild() const
|
|
|
{
|
|
|
- return renderB->getThis();
|
|
|
+ return api->zUIRenderBild()->getThis();
|
|
|
}
|
|
|
|
|
|
Bild *Bildschirm::zRenderBild() const
|
|
|
{
|
|
|
- return renderB;
|
|
|
+ return api->zUIRenderBild();
|
|
|
}
|
|
|
|
|
|
-Iterator<Zeichnung*> Bildschirm::getMembers() const
|
|
|
+Iterator<Zeichnung *> Bildschirm::getMembers() const
|
|
|
{
|
|
|
return members->getIterator();
|
|
|
}
|
|
@@ -290,12 +301,12 @@ int Bildschirm::getFillFarbe() const
|
|
|
|
|
|
bool Bildschirm::istVolbild() const
|
|
|
{
|
|
|
- return vollbild;
|
|
|
+ return api->isFullScreen();
|
|
|
}
|
|
|
|
|
|
-const Punkt &Bildschirm::getBackBufferSize() const
|
|
|
+const Punkt Bildschirm::getBackBufferSize() const
|
|
|
{
|
|
|
- return backBufferSize;
|
|
|
+ return api->getBackBufferSize();
|
|
|
}
|
|
|
|
|
|
void Bildschirm::warteAufRendern() const
|
|
@@ -335,7 +346,7 @@ int MonitorEnum( HMONITOR m, HDC dc, LPRECT r, LPARAM p )
|
|
|
mon->y = r->top;
|
|
|
mon->breite = r->right - r->left;
|
|
|
mon->height = r->bottom - r->top;
|
|
|
- ( ( Array< Monitor* >* )p )->add( mon );
|
|
|
+ ( ( Array< Monitor * > * )p )->add( mon );
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
@@ -347,7 +358,7 @@ Monitor Framework::getMonitor( int id )
|
|
|
m.existiert = 0;
|
|
|
return m;
|
|
|
}
|
|
|
- Array< Monitor* > *monitore = new Array< Monitor* >();
|
|
|
+ Array< Monitor * > *monitore = new Array< Monitor * >();
|
|
|
EnumDisplayMonitors( 0, 0, (MONITORENUMPROC)MonitorEnum, (LPARAM)monitore );
|
|
|
int anz = monitore->getEintragAnzahl();
|
|
|
if( id >= monitore->getEintragAnzahl() )
|
|
@@ -367,144 +378,52 @@ Monitor Framework::getMonitor( int id )
|
|
|
}
|
|
|
|
|
|
|
|
|
-Bildschirm2D::Bildschirm2D( WFenster *fenster )
|
|
|
- : Bildschirm( fenster ),
|
|
|
- pDirect3D( 0 ),
|
|
|
- pDevice( 0 ),
|
|
|
- pBackBuffer( 0 ),
|
|
|
- backRect( new D3DLOCKED_RECT() )
|
|
|
-{}
|
|
|
-
|
|
|
-
|
|
|
-Bildschirm2D::~Bildschirm2D()
|
|
|
-{
|
|
|
- cleanUpDirectX();
|
|
|
- delete backRect;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-void Bildschirm2D::cleanUpDirectX()
|
|
|
+Bildschirm2D::Bildschirm2D( WFenster * fenster )
|
|
|
+ : Bildschirm( fenster )
|
|
|
{
|
|
|
- backRect->pBits = NULL;
|
|
|
- if( pDevice )
|
|
|
- {
|
|
|
- pDevice->Release();
|
|
|
- pDevice = NULL;
|
|
|
- }
|
|
|
- if( pDirect3D )
|
|
|
- {
|
|
|
- pDirect3D->Release();
|
|
|
- pDirect3D = NULL;
|
|
|
- }
|
|
|
- if( pBackBuffer )
|
|
|
- {
|
|
|
- pBackBuffer->Release();
|
|
|
- pBackBuffer = NULL;
|
|
|
- }
|
|
|
+ api = new DirectX9();
|
|
|
+ api->initialize( fenster->getThis(), fenster->getKörperGröße(), 0 );
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-void Bildschirm2D::update()
|
|
|
-{
|
|
|
- lock();
|
|
|
- HRESULT result;
|
|
|
-
|
|
|
- cleanUpDirectX();
|
|
|
-
|
|
|
- pDirect3D = Direct3DCreate9( D3D_SDK_VERSION );
|
|
|
-
|
|
|
- D3DPRESENT_PARAMETERS d3dpp;
|
|
|
- ZeroMemory( &d3dpp, sizeof( d3dpp ) );
|
|
|
- d3dpp.Windowed = !vollbild;
|
|
|
- d3dpp.hDeviceWindow = fenster->getFensterHandle();
|
|
|
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
|
|
- d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
|
|
|
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
|
|
|
- d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
|
|
|
- if( !backBufferSize.x || !backBufferSize.y )
|
|
|
- backBufferSize = fenster->getKörperGröße();
|
|
|
- d3dpp.BackBufferHeight = backBufferSize.y;
|
|
|
- d3dpp.BackBufferWidth = backBufferSize.x;
|
|
|
- if( renderB )
|
|
|
- renderB->release();
|
|
|
- renderB = new Bild( 1 );
|
|
|
- renderB->neuBild( backBufferSize.x, backBufferSize.y, fillColor );
|
|
|
-
|
|
|
- result = pDirect3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, fenster->getFensterHandle(),
|
|
|
- D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &d3dpp, &pDevice );
|
|
|
- if( pDevice )
|
|
|
- result = pDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer );
|
|
|
- rend = 1;
|
|
|
- unlock();
|
|
|
-}
|
|
|
+
|
|
|
+Bildschirm2D::~Bildschirm2D()
|
|
|
+{}
|
|
|
|
|
|
void Bildschirm2D::render()
|
|
|
{
|
|
|
if( !rend && testRend )
|
|
|
return;
|
|
|
rendering = 1;
|
|
|
- int count = 0;
|
|
|
- if( renderB && pDevice )
|
|
|
+ Bild * ui = api->zUIRenderBild();
|
|
|
+ if( ui )
|
|
|
{
|
|
|
lock();
|
|
|
renderZeit->messungStart();
|
|
|
- if( fill )
|
|
|
- renderB->setFarbe( fillColor );
|
|
|
+ api->beginFrame( fill && ( rend || !testRend ), 0, fillColor );
|
|
|
if( renderZeichnungen )
|
|
|
{
|
|
|
- if( renderOnTop && deckFarbe && ( deckFarbe & ( fillColor | 0xFF000000 ) ) == deckFarbe )
|
|
|
+ if( renderOnTop &&deckFarbe && ( deckFarbe &( fillColor | 0xFF000000 ) ) == deckFarbe )
|
|
|
{
|
|
|
- renderB->setAlpha( 255 - (unsigned char)( deckFarbe >> 24 ) );
|
|
|
+ ui->setAlpha( 255 - (unsigned char)( deckFarbe >> 24 ) );
|
|
|
for( auto i = members->getIterator(); i; i++ )
|
|
|
- i->render( *renderB );
|
|
|
- renderB->releaseAlpha();
|
|
|
+ i->render( *ui );
|
|
|
+ ui->releaseAlpha();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for( auto i = members->getIterator(); i; i++ )
|
|
|
- i->render( *renderB );
|
|
|
- if( renderOnTop && deckFarbe )
|
|
|
- renderB->alphaRegion( 0, 0, renderB->getBreite(), renderB->getHeight(), deckFarbe );
|
|
|
+ i->render( *ui );
|
|
|
+ if( renderOnTop &&deckFarbe )
|
|
|
+ ui->alphaRegion( 0, 0, ui->getBreite(), ui->getHeight(), deckFarbe );
|
|
|
}
|
|
|
for( int i = 0; i < tipAnzahl; ++i )
|
|
|
- tips->z( i )->render( *renderB );
|
|
|
+ tips->z( i )->render( *ui );
|
|
|
}
|
|
|
- if( renderOnTop && onTop )
|
|
|
- onTop->render( *renderB );
|
|
|
- Bild *tmp = renderB->getThis();
|
|
|
- unlock();
|
|
|
-
|
|
|
- HRESULT result;
|
|
|
- if( !fillColor )
|
|
|
- result = pDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB( 0, 0, 0 ), 0.0f, 0 );
|
|
|
- result = pBackBuffer->LockRect( backRect, 0, 0 );
|
|
|
-
|
|
|
- int *bgBuff = tmp->getBuffer();
|
|
|
- int tmpBr = sizeof( D3DCOLOR )* tmp->getBreite();
|
|
|
- for( int y = 0, pitch = 0, bry = 0; y < tmp->getHeight(); ++y, pitch += backRect->Pitch, bry += tmp->getBreite() )
|
|
|
- memcpy( &( (BYTE *)backRect->pBits )[ pitch ], ( void* )&( bgBuff[ bry ] ), tmpBr );
|
|
|
-
|
|
|
- result = pBackBuffer->UnlockRect();
|
|
|
- tmp->release();
|
|
|
- result = pDevice->Present( 0, 0, 0, 0 );
|
|
|
+ if( renderOnTop &&onTop )
|
|
|
+ onTop->render( *ui );
|
|
|
+ api->presentFrame();
|
|
|
renderZeit->messungEnde();
|
|
|
- if( result != S_OK )
|
|
|
- {
|
|
|
- ++count;
|
|
|
- update();
|
|
|
- }
|
|
|
- else if( count )
|
|
|
- --count;
|
|
|
- }
|
|
|
- if( !pDevice )
|
|
|
- {
|
|
|
- ++count;
|
|
|
- update();
|
|
|
- }
|
|
|
- if( count > 10 )
|
|
|
- {
|
|
|
- WMessageBox( fenster ? fenster->getFensterHandle() : 0, new Text( "Fehler" ), new Text( "Es ist ein Fehler beim rendern aufgetreten." ), MB_ICONERROR );
|
|
|
- count = 0;
|
|
|
+ unlock();
|
|
|
}
|
|
|
rendering = 0;
|
|
|
rend = 0;
|
|
@@ -512,115 +431,23 @@ void Bildschirm2D::render()
|
|
|
|
|
|
|
|
|
|
|
|
-Bildschirm3D::Bildschirm3D( WFenster *fenster )
|
|
|
+Bildschirm3D::Bildschirm3D( WFenster * fenster )
|
|
|
: Bildschirm( fenster ),
|
|
|
- d3d11Device( 0 ),
|
|
|
- d3d11Context( 0 ),
|
|
|
- d3d11SpawChain( 0 ),
|
|
|
- frameworkTextur( 0 ),
|
|
|
- vertexShader( 0 ),
|
|
|
- pixelShader( 0 ),
|
|
|
- sampleState( 0 ),
|
|
|
- rtview( 0 ),
|
|
|
- dsView( 0 ),
|
|
|
- depthStencilBuffer( 0 ),
|
|
|
- depthStencilState( 0 ),
|
|
|
- depthDisabledStencilState( 0 ),
|
|
|
- blendStateAlphaBlend( 0 ),
|
|
|
kameras( new RCArray< Kam3D >() ),
|
|
|
- rend3D( 0 ),
|
|
|
- vp( 0 ),
|
|
|
- renderObj( new Render3D() ),
|
|
|
- texturModel( new TexturModel() )
|
|
|
-{}
|
|
|
+ rend3D( 0 )
|
|
|
+{
|
|
|
+ api = new DirectX11();
|
|
|
+ api->initialize( fenster->getThis(), fenster->getKörperGröße(), 0 );
|
|
|
+}
|
|
|
|
|
|
|
|
|
Bildschirm3D::~Bildschirm3D()
|
|
|
{
|
|
|
kameras->release();
|
|
|
- texturModel->release();
|
|
|
- cleanUpDirectX();
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-void Bildschirm3D::cleanUpDirectX()
|
|
|
-{
|
|
|
- if( renderObj )
|
|
|
- {
|
|
|
- renderObj->release();
|
|
|
- renderObj = 0;
|
|
|
- }
|
|
|
- if( blendStateAlphaBlend )
|
|
|
- {
|
|
|
- blendStateAlphaBlend->Release();
|
|
|
- blendStateAlphaBlend = NULL;
|
|
|
- }
|
|
|
- if( frameworkTextur )
|
|
|
- {
|
|
|
- frameworkTextur->release();
|
|
|
- frameworkTextur = NULL;
|
|
|
- }
|
|
|
- if( sampleState )
|
|
|
- {
|
|
|
- sampleState->Release();
|
|
|
- sampleState = NULL;
|
|
|
- }
|
|
|
- if( pixelShader )
|
|
|
- {
|
|
|
- pixelShader->release();
|
|
|
- pixelShader = NULL;
|
|
|
- }
|
|
|
- if( vertexShader )
|
|
|
- {
|
|
|
- vertexShader->release();
|
|
|
- vertexShader = NULL;
|
|
|
- }
|
|
|
- if( depthDisabledStencilState )
|
|
|
- {
|
|
|
- depthDisabledStencilState->Release();
|
|
|
- depthDisabledStencilState = NULL;
|
|
|
- }
|
|
|
- delete vp;
|
|
|
- vp = 0;
|
|
|
- if( dsView )
|
|
|
- {
|
|
|
- dsView->Release();
|
|
|
- dsView = NULL;
|
|
|
- }
|
|
|
- if( depthStencilState )
|
|
|
- {
|
|
|
- depthStencilState->Release();
|
|
|
- depthStencilState = NULL;
|
|
|
- }
|
|
|
- if( depthStencilBuffer )
|
|
|
- {
|
|
|
- depthStencilBuffer->Release();
|
|
|
- depthStencilBuffer = NULL;
|
|
|
- }
|
|
|
- if( rtview )
|
|
|
- {
|
|
|
- rtview->Release();
|
|
|
- rtview = NULL;
|
|
|
- }
|
|
|
- if( d3d11SpawChain )
|
|
|
- {
|
|
|
- d3d11SpawChain->Release();
|
|
|
- d3d11SpawChain = NULL;
|
|
|
- }
|
|
|
- if( d3d11Device )
|
|
|
- {
|
|
|
- d3d11Device->Release();
|
|
|
- d3d11Device = NULL;
|
|
|
- }
|
|
|
- if( d3d11Context )
|
|
|
- {
|
|
|
- d3d11Context->Release();
|
|
|
- d3d11Context = NULL;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|
|
|
-void Bildschirm3D::addKamera( Kam3D *obj )
|
|
|
+void Bildschirm3D::addKamera( Kam3D * obj )
|
|
|
{
|
|
|
lock();
|
|
|
kameras->add( obj );
|
|
@@ -628,7 +455,7 @@ void Bildschirm3D::addKamera( Kam3D *obj )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm3D::removeKamera( Kam3D *zObj )
|
|
|
+void Bildschirm3D::removeKamera( Kam3D * zObj )
|
|
|
{
|
|
|
lock();
|
|
|
for( int i = 0; kameras->z( i ); i++ )
|
|
@@ -643,290 +470,16 @@ void Bildschirm3D::removeKamera( Kam3D *zObj )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm3D::update()
|
|
|
-{
|
|
|
- lock();
|
|
|
- HRESULT result;
|
|
|
- cleanUpDirectX();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- DXGI_SWAP_CHAIN_DESC scd;
|
|
|
-
|
|
|
-
|
|
|
- ZeroMemory( &scd, sizeof( DXGI_SWAP_CHAIN_DESC ) );
|
|
|
-
|
|
|
-
|
|
|
- scd.BufferCount = 1;
|
|
|
- scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
|
|
- scd.OutputWindow = fenster ? fenster->getFensterHandle() : 0;
|
|
|
- scd.SampleDesc.Count = 1;
|
|
|
-
|
|
|
- scd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
|
|
|
- scd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
|
|
- scd.Windowed = !vollbild;
|
|
|
- if( !backBufferSize.x || !backBufferSize.y )
|
|
|
- backBufferSize = fenster ? fenster->getKörperGröße() : Punkt( 0, 0 );
|
|
|
- scd.BufferDesc.Width = backBufferSize.x;
|
|
|
- scd.BufferDesc.Height = backBufferSize.y;
|
|
|
- scd.BufferDesc.RefreshRate.Denominator = 1;
|
|
|
- scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
-
|
|
|
- scd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
|
|
- if( renderB )
|
|
|
- renderB->release();
|
|
|
- renderB = new Bild( 1 );
|
|
|
- renderB->setAlpha3D( 1 );
|
|
|
- renderB->neuBild( backBufferSize.x, backBufferSize.y, fillColor );
|
|
|
-
|
|
|
- D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0;
|
|
|
- D3D_FEATURE_LEVEL support = D3D_FEATURE_LEVEL_11_0;
|
|
|
-
|
|
|
- UINT flag = 0;
|
|
|
-#ifdef _DEBUG
|
|
|
- flag |= D3D11_CREATE_DEVICE_DEBUG;
|
|
|
-#endif
|
|
|
- result = D3D11CreateDeviceAndSwapChain( NULL,
|
|
|
- D3D_DRIVER_TYPE_HARDWARE,
|
|
|
- NULL,
|
|
|
- flag,
|
|
|
- &featureLevel,
|
|
|
- 1,
|
|
|
- D3D11_SDK_VERSION,
|
|
|
- &scd,
|
|
|
- &d3d11SpawChain,
|
|
|
- &d3d11Device,
|
|
|
- &support,
|
|
|
- &d3d11Context );
|
|
|
- if( result != S_OK )
|
|
|
- {
|
|
|
- std::cout << "ERROR: D3D11CreateDeviceAndSwapChain returned " << result << "\n";
|
|
|
- return;
|
|
|
- }
|
|
|
- ID3D11Texture2D *backBufferPtr;
|
|
|
-
|
|
|
- result = d3d11SpawChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), (LPVOID*)&backBufferPtr );
|
|
|
-
|
|
|
- result = d3d11Device->CreateRenderTargetView( backBufferPtr, NULL, &rtview );
|
|
|
-
|
|
|
- backBufferPtr->Release();
|
|
|
-
|
|
|
- D3D11_TEXTURE2D_DESC depthBufferDesc;
|
|
|
- ZeroMemory( &depthBufferDesc, sizeof( depthBufferDesc ) );
|
|
|
-
|
|
|
- depthBufferDesc.Width = backBufferSize.x;
|
|
|
- depthBufferDesc.Height = backBufferSize.y;
|
|
|
- depthBufferDesc.MipLevels = 1;
|
|
|
- depthBufferDesc.ArraySize = 1;
|
|
|
- depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
|
|
- depthBufferDesc.SampleDesc.Count = 1;
|
|
|
- depthBufferDesc.Usage = D3D11_USAGE_DEFAULT;
|
|
|
- depthBufferDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
|
|
-
|
|
|
- result = d3d11Device->CreateTexture2D( &depthBufferDesc, NULL, &depthStencilBuffer );
|
|
|
-
|
|
|
-
|
|
|
- D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
|
|
|
- ZeroMemory( &depthStencilDesc, sizeof( depthStencilDesc ) );
|
|
|
-
|
|
|
-
|
|
|
- depthStencilDesc.DepthEnable = true;
|
|
|
- depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
|
|
- depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
|
|
|
- depthStencilDesc.StencilEnable = true;
|
|
|
- depthStencilDesc.StencilReadMask = 0xFF;
|
|
|
- depthStencilDesc.StencilWriteMask = 0xFF;
|
|
|
-
|
|
|
- depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
|
|
|
- depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
|
|
-
|
|
|
- depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
|
|
|
- depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
|
|
-
|
|
|
- result = d3d11Device->CreateDepthStencilState( &depthStencilDesc, &depthStencilState );
|
|
|
-
|
|
|
- d3d11Context->OMSetDepthStencilState( depthStencilState, 1 );
|
|
|
-
|
|
|
-
|
|
|
- D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
|
|
|
- ZeroMemory( &depthStencilViewDesc, sizeof( depthStencilViewDesc ) );
|
|
|
-
|
|
|
-
|
|
|
- depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
|
|
- depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
|
|
-
|
|
|
-
|
|
|
- result = d3d11Device->CreateDepthStencilView( depthStencilBuffer, &depthStencilViewDesc, &dsView );
|
|
|
-
|
|
|
- d3d11Context->OMSetRenderTargets( 1, &rtview, dsView );
|
|
|
-
|
|
|
- vp = new D3D11_VIEWPORT();
|
|
|
- memset( vp, 0, sizeof( D3D11_VIEWPORT ) );
|
|
|
- vp->Width = (float)backBufferSize.x;
|
|
|
- vp->Height = (float)backBufferSize.y;
|
|
|
- vp->MinDepth = 0.0f;
|
|
|
- vp->MaxDepth = 1.0f;
|
|
|
- vp->TopLeftX = 0.0f;
|
|
|
- vp->TopLeftY = 0.0f;
|
|
|
-
|
|
|
- d3d11Context->RSSetViewports( 1, vp );
|
|
|
-
|
|
|
- D3D11_DEPTH_STENCIL_DESC depthDisabledStencilDesc;
|
|
|
-
|
|
|
- ZeroMemory( &depthDisabledStencilDesc, sizeof( depthDisabledStencilDesc ) );
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- depthDisabledStencilDesc.DepthEnable = false;
|
|
|
- depthDisabledStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
|
|
- depthDisabledStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
|
|
|
- depthDisabledStencilDesc.StencilEnable = true;
|
|
|
- depthDisabledStencilDesc.StencilReadMask = 0xFF;
|
|
|
- depthDisabledStencilDesc.StencilWriteMask = 0xFF;
|
|
|
- depthDisabledStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthDisabledStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
|
|
|
- depthDisabledStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthDisabledStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
|
|
- depthDisabledStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthDisabledStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
|
|
|
- depthDisabledStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
|
|
- depthDisabledStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
|
|
-
|
|
|
-
|
|
|
- result = d3d11Device->CreateDepthStencilState( &depthDisabledStencilDesc, &depthDisabledStencilState );
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- vertexShader = new VertexShader();
|
|
|
- vertexShader->setCompiledByteArray( d3d11Device, (unsigned char*)UIVertexShader, sizeof( UIVertexShader ) );
|
|
|
-
|
|
|
- pixelShader = new PixelShader();
|
|
|
- pixelShader->setCompiledByteArray( d3d11Device, (unsigned char*)UIPixelShader, sizeof( UIPixelShader ) );
|
|
|
-
|
|
|
- D3D11_INPUT_ELEMENT_DESC polygonLayout[ 4 ];
|
|
|
-
|
|
|
-
|
|
|
- polygonLayout[ 0 ].SemanticName = "POSITION";
|
|
|
- polygonLayout[ 0 ].SemanticIndex = 0;
|
|
|
- polygonLayout[ 0 ].Format = DXGI_FORMAT_R32G32B32_FLOAT;
|
|
|
- polygonLayout[ 0 ].InputSlot = 0;
|
|
|
- polygonLayout[ 0 ].AlignedByteOffset = 0;
|
|
|
- polygonLayout[ 0 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
|
|
- polygonLayout[ 0 ].InstanceDataStepRate = 0;
|
|
|
-
|
|
|
- polygonLayout[ 1 ].SemanticName = "TEXCOORD";
|
|
|
- polygonLayout[ 1 ].SemanticIndex = 0;
|
|
|
- polygonLayout[ 1 ].Format = DXGI_FORMAT_R32G32_FLOAT;
|
|
|
- polygonLayout[ 1 ].InputSlot = 0;
|
|
|
- polygonLayout[ 1 ].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
|
|
|
- polygonLayout[ 1 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
|
|
- polygonLayout[ 1 ].InstanceDataStepRate = 0;
|
|
|
-
|
|
|
- polygonLayout[ 2 ].SemanticName = "NORMAL";
|
|
|
- polygonLayout[ 2 ].SemanticIndex = 0;
|
|
|
- polygonLayout[ 2 ].Format = DXGI_FORMAT_R32G32B32_FLOAT;
|
|
|
- polygonLayout[ 2 ].InputSlot = 0;
|
|
|
- polygonLayout[ 2 ].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
|
|
|
- polygonLayout[ 2 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
|
|
- polygonLayout[ 2 ].InstanceDataStepRate = 0;
|
|
|
-
|
|
|
- polygonLayout[ 3 ].SemanticName = "KNOCHEN_ID";
|
|
|
- polygonLayout[ 3 ].SemanticIndex = 0;
|
|
|
- polygonLayout[ 3 ].Format = DXGI_FORMAT_R32_UINT;
|
|
|
- polygonLayout[ 3 ].InputSlot = 0;
|
|
|
- polygonLayout[ 3 ].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
|
|
|
- polygonLayout[ 3 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
|
|
|
- polygonLayout[ 3 ].InstanceDataStepRate = 0;
|
|
|
-
|
|
|
- vertexShader->erstelleInputLayout( d3d11Device, polygonLayout, 4 );
|
|
|
- vertexShader->erstelleConstBuffer( d3d11Device, sizeof( Mat4< float > ) * MAX_KNOCHEN_ANZ, 0 );
|
|
|
- vertexShader->erstelleConstBuffer( d3d11Device, sizeof( Mat4< float > ) * 2, 1 );
|
|
|
-
|
|
|
- pixelShader->erstelleConstBuffer( d3d11Device, sizeof( float ) * 3, 0 );
|
|
|
- pixelShader->erstelleConstBuffer( d3d11Device, sizeof( float ) * 3, 1 );
|
|
|
- pixelShader->erstelleConstBuffer( d3d11Device, sizeof( int ) * 2, 2 );
|
|
|
-
|
|
|
- int lc[] = { 1, 6 };
|
|
|
- pixelShader->füllConstBuffer( d3d11Context, (char *)lc, 2, sizeof( int ) * 2 );
|
|
|
-
|
|
|
-
|
|
|
- D3D11_SAMPLER_DESC samplerDesc;
|
|
|
- samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
|
|
- samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
|
|
- samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
|
|
- samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
|
|
- samplerDesc.MipLODBias = 0.0f;
|
|
|
- samplerDesc.MaxAnisotropy = 1;
|
|
|
- samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
|
|
|
- samplerDesc.BorderColor[ 0 ] = 0;
|
|
|
- samplerDesc.BorderColor[ 1 ] = 0;
|
|
|
- samplerDesc.BorderColor[ 2 ] = 0;
|
|
|
- samplerDesc.BorderColor[ 3 ] = 0;
|
|
|
- samplerDesc.MinLOD = 0;
|
|
|
- samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
|
|
|
-
|
|
|
-
|
|
|
- result = d3d11Device->CreateSamplerState( &samplerDesc, &sampleState );
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- frameworkTextur = new Textur();
|
|
|
- frameworkTextur->setBildZ( renderB->getThis() );
|
|
|
- texturRegister->addTextur( frameworkTextur->getThis(), "f_Render_Bild" );
|
|
|
-
|
|
|
- texturModel->setSize( backBufferSize );
|
|
|
- texturModel->setTextur( frameworkTextur->getId() );
|
|
|
-
|
|
|
- D3D11_BLEND_DESC blendState;
|
|
|
- ZeroMemory( &blendState, sizeof( D3D11_BLEND_DESC ) );
|
|
|
- blendState.AlphaToCoverageEnable = false;
|
|
|
- blendState.IndependentBlendEnable = false;
|
|
|
- blendState.RenderTarget[ 0 ].BlendEnable = true;
|
|
|
- blendState.RenderTarget[ 0 ].SrcBlend = D3D11_BLEND_SRC_ALPHA;
|
|
|
- blendState.RenderTarget[ 0 ].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
|
|
|
- blendState.RenderTarget[ 0 ].BlendOp = D3D11_BLEND_OP_ADD;
|
|
|
- blendState.RenderTarget[ 0 ].SrcBlendAlpha = D3D11_BLEND_ZERO;
|
|
|
- blendState.RenderTarget[ 0 ].DestBlendAlpha = D3D11_BLEND_ONE;
|
|
|
- blendState.RenderTarget[ 0 ].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
|
|
- blendState.RenderTarget[ 0 ].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
|
|
-
|
|
|
- d3d11Device->CreateBlendState( &blendState, &blendStateAlphaBlend );
|
|
|
- d3d11Context->OMSetBlendState( blendStateAlphaBlend, 0, 0xFFFFFFFF );
|
|
|
-
|
|
|
-
|
|
|
- if( renderObj )
|
|
|
- renderObj->release();
|
|
|
- renderObj = new Render3D();
|
|
|
- d3d11Device->AddRef();
|
|
|
- renderObj->setDevice( d3d11Device );
|
|
|
- d3d11Context->AddRef();
|
|
|
- renderObj->setContext( d3d11Context );
|
|
|
-
|
|
|
- renderObj->benutzeShader( VERTEX, vertexShader->getThis() );
|
|
|
- d3d11Context->PSSetSamplers( 0, 1, &sampleState );
|
|
|
- renderObj->benutzeShader( PIXEL, pixelShader->getThis() );
|
|
|
-
|
|
|
- rend = 1;
|
|
|
- unlock();
|
|
|
-}
|
|
|
-
|
|
|
void Bildschirm3D::tick( double tickval )
|
|
|
{
|
|
|
lock();
|
|
|
__super::tick( tickval );
|
|
|
for( auto i = kameras->getIterator(); i; i++ )
|
|
|
rend3D |= i->tick( tickval );
|
|
|
- rend3D |= texturModel->tick( tickval );
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm3D::doMausEreignis( MausEreignis &me )
|
|
|
+void Bildschirm3D::doMausEreignis( MausEreignis & me )
|
|
|
{
|
|
|
lock();
|
|
|
__super::doMausEreignis( me );
|
|
@@ -935,7 +488,7 @@ void Bildschirm3D::doMausEreignis( MausEreignis &me )
|
|
|
unlock();
|
|
|
}
|
|
|
|
|
|
-void Bildschirm3D::doTastaturEreignis( TastaturEreignis &te )
|
|
|
+void Bildschirm3D::doTastaturEreignis( TastaturEreignis & te )
|
|
|
{
|
|
|
lock();
|
|
|
__super::doTastaturEreignis( te );
|
|
@@ -949,103 +502,49 @@ void Bildschirm3D::render()
|
|
|
if( !rend && !rend3D && testRend )
|
|
|
return;
|
|
|
rendering = 1;
|
|
|
- int count = 0;
|
|
|
- if( renderB && d3d11Device )
|
|
|
+ lock();
|
|
|
+ renderZeit->messungStart();
|
|
|
+
|
|
|
+ api->beginFrame( fill && ( rend || !testRend ), fill && ( rend3D || !testRend || rend ), fillColor );
|
|
|
+ if( rend3D || !testRend || rend )
|
|
|
{
|
|
|
- lock();
|
|
|
- renderZeit->messungStart();
|
|
|
- float color[ 4 ];
|
|
|
-
|
|
|
- color[ 0 ] = ( ( fillColor >> 16 ) & 0xFF ) / 255.f;
|
|
|
- color[ 1 ] = ( ( fillColor >> 8 ) & 0xFF ) / 255.f;
|
|
|
- color[ 2 ] = ( fillColor & 0xFF ) / 255.f;
|
|
|
- color[ 3 ] = ( ( fillColor >> 24 ) & 0xFF ) / 255.f;
|
|
|
-
|
|
|
- if( rend3D || !testRend || rend )
|
|
|
+
|
|
|
+ for( auto i = kameras->getIterator(); i; i++ )
|
|
|
+ api->renderKamera( i._ );
|
|
|
+ rend3D = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ Bild *ui = api->zUIRenderBild();
|
|
|
+ if( ( rend || !testRend ) && ui )
|
|
|
+ {
|
|
|
+ if( renderZeichnungen )
|
|
|
{
|
|
|
- if( fill )
|
|
|
+ if( renderOnTop &&deckFarbe && ( deckFarbe &( fillColor | 0xFF000000 ) ) == deckFarbe )
|
|
|
{
|
|
|
- d3d11Context->ClearRenderTargetView( rtview, color );
|
|
|
-
|
|
|
- d3d11Context->ClearDepthStencilView( dsView, D3D11_CLEAR_DEPTH, 1, 0 );
|
|
|
+ ui->setAlpha( 255 - (unsigned char)( deckFarbe >> 24 ) );
|
|
|
+ for( auto i = members->getIterator(); i; i++ )
|
|
|
+ i->render( *ui );
|
|
|
+ ui->releaseAlpha();
|
|
|
}
|
|
|
-
|
|
|
- d3d11Context->OMSetRenderTargets( 1, &rtview, dsView );
|
|
|
-
|
|
|
-
|
|
|
- d3d11Context->OMSetDepthStencilState( depthStencilState, 1 );
|
|
|
-
|
|
|
- for( auto i = kameras->getIterator(); i; i++ )
|
|
|
- i->render( renderObj );
|
|
|
- rend3D = 0;
|
|
|
- }
|
|
|
-
|
|
|
- d3d11Context->OMSetDepthStencilState( depthDisabledStencilState, 1 );
|
|
|
-
|
|
|
- if( rend || !testRend )
|
|
|
- {
|
|
|
- if( fill )
|
|
|
- renderB->setFarbe( fillColor );
|
|
|
- if( renderZeichnungen )
|
|
|
+ else
|
|
|
{
|
|
|
- if( renderOnTop && deckFarbe && ( deckFarbe & ( fillColor | 0xFF000000 ) ) == deckFarbe )
|
|
|
- {
|
|
|
- renderB->setAlpha( 255 - (unsigned char)( deckFarbe >> 24 ) );
|
|
|
- for( auto i = members->getIterator(); i; i++ )
|
|
|
- i->render( *renderB );
|
|
|
- renderB->releaseAlpha();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- for( auto i = members->getIterator(); i; i++ )
|
|
|
- i->render( *renderB );
|
|
|
- if( renderOnTop && deckFarbe )
|
|
|
- renderB->alphaRegion( 0, 0, renderB->getBreite(), renderB->getHeight(), deckFarbe );
|
|
|
- }
|
|
|
- for( int i = 0; i < tipAnzahl; ++i )
|
|
|
- tips->z( i )->render( *renderB );
|
|
|
+ for( auto i = members->getIterator(); i; i++ )
|
|
|
+ i->render( *ui );
|
|
|
+ if( renderOnTop &&deckFarbe )
|
|
|
+ ui->alphaRegion( 0, 0, ui->getBreite(), ui->getHeight(), deckFarbe );
|
|
|
}
|
|
|
- if( renderOnTop && onTop )
|
|
|
- onTop->render( *renderB );
|
|
|
+ for( int i = 0; i < tipAnzahl; ++i )
|
|
|
+ tips->z( i )->render( *ui );
|
|
|
}
|
|
|
-
|
|
|
- HRESULT result;
|
|
|
-
|
|
|
- if( rend || !testRend )
|
|
|
- frameworkTextur->updateTextur( renderObj );
|
|
|
-
|
|
|
- d3d11Context->RSSetViewports( 1, vp );
|
|
|
-
|
|
|
- float screenAspect = (float)backBufferSize.x / (float)backBufferSize.y;
|
|
|
- Mat4< float > view = view.translation( Vec3< float >( 0.f, 0.f, backBufferSize.y * 1.2075f ) );
|
|
|
- renderObj->setKameraMatrix( view, view.projektion( DirectX::XM_PI / 4.0f, screenAspect, 0.1f, 10000.f ), Vec3< float >( 0.f, 0.f, backBufferSize.y * 1.2075f ) );
|
|
|
- if( fenster && !IsIconic( fenster->getFensterHandle() ) )
|
|
|
- texturModel->render( renderObj );
|
|
|
- unlock();
|
|
|
-
|
|
|
- result = d3d11SpawChain->Present( 0, 0 );
|
|
|
- renderZeit->messungEnde();
|
|
|
+ if( renderOnTop &&onTop )
|
|
|
+ onTop->render( *ui );
|
|
|
+ }
|
|
|
+ api->presentFrame();
|
|
|
+ renderZeit->messungEnde();
|
|
|
+ unlock();
|
|
|
#ifdef _DEBUG
|
|
|
-
|
|
|
+
|
|
|
#endif
|
|
|
- if( !SUCCEEDED( result ) )
|
|
|
- {
|
|
|
- ++count;
|
|
|
- update();
|
|
|
- }
|
|
|
- else if( count )
|
|
|
- --count;
|
|
|
- }
|
|
|
- if( !d3d11Device )
|
|
|
- {
|
|
|
- ++count;
|
|
|
- update();
|
|
|
- }
|
|
|
- if( count > 10 )
|
|
|
- {
|
|
|
- WMessageBox( fenster ? fenster->getFensterHandle() : 0, new Text( "Fehler" ), new Text( "Es ist ein Fehler beim rendern aufgetreten." ), MB_ICONERROR );
|
|
|
- count = 0;
|
|
|
- }
|
|
|
rendering = 0;
|
|
|
rend = 0;
|
|
|
}
|