Ver código fonte

allow a 3d model to desice if a specific polygon deeds to be rendered or not

Kolja Strohm 2 anos atrás
pai
commit
6836a7ef96
12 arquivos alterados com 326 adições e 293 exclusões
  1. 31 28
      DX11GraphicsApi.cpp
  2. 124 121
      DX12GraphicsApi.cpp
  3. 16 16
      DX12PixelShader.h
  4. 16 16
      DX12VertexShader.h
  5. BIN
      Framework Tests/Framwork.dll
  6. 12 0
      Kam3D.cpp
  7. 4 0
      Kam3D.h
  8. 6 0
      Model3D.cpp
  9. 54 52
      Model3D.h
  10. 20 20
      UIPixelShader.h
  11. 15 15
      UIVertexShader.h
  12. 28 25
      Vec3.h

+ 31 - 28
DX11GraphicsApi.cpp

@@ -629,35 +629,38 @@ void DirectX11::renderObject( Model3D* zObj )
     int current = 0;
     for( auto i = zObj->zModelData()->getPolygons(); i; i++ )
     {
-        Textur* t = zTextur->zPolygonTextur( ind );
-        if( t && t->brauchtUpdate() )
-            t->updateTextur();
-        DXGI_FORMAT f = DXGI_FORMAT_R32_UINT;
-        if( indexBuffer->getElementLength() == 2 )
-            f = DXGI_FORMAT_R16_UINT;
-        if( indexBuffer->getElementLength() == 1 )
-            f = DXGI_FORMAT_R8_UINT;
-        d3d11Context->IASetIndexBuffer( indexBuffer->zBuffer(), f, 0 );
-        d3d11Context->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
-        if( t )
+        if( zObj->needRenderPolygon( ind ) )
         {
-            ID3D11ShaderResourceView* v[ 3 ];
-            v[ 0 ] = *(DX11Textur*)t;
-            v[ 1 ] = *diffuseLights;
-            v[ 2 ] = *pointLights;
-            d3d11Context->PSSetShaderResources( 0, 3, v );
-            d3d11Context->DrawIndexed( i->indexAnz, current, 0 );
-        }
-        else
-        {
-            d3d11Context->RSSetState( meshRS );
-            ID3D11ShaderResourceView* v[ 3 ];
-            v[ 0 ] = *(DX11Textur*)defaultTextur;
-            v[ 1 ] = *diffuseLights;
-            v[ 2 ] = *pointLights;
-            d3d11Context->PSSetShaderResources( 0, 3, v );
-            d3d11Context->DrawIndexed( i->indexAnz, current, 0 );
-            d3d11Context->RSSetState( texturRS );
+            Textur* t = zTextur->zPolygonTextur( ind );
+            if( t && t->brauchtUpdate() )
+                t->updateTextur();
+            DXGI_FORMAT f = DXGI_FORMAT_R32_UINT;
+            if( indexBuffer->getElementLength() == 2 )
+                f = DXGI_FORMAT_R16_UINT;
+            if( indexBuffer->getElementLength() == 1 )
+                f = DXGI_FORMAT_R8_UINT;
+            d3d11Context->IASetIndexBuffer( indexBuffer->zBuffer(), f, 0 );
+            d3d11Context->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
+            if( t )
+            {
+                ID3D11ShaderResourceView* v[ 3 ];
+                v[ 0 ] = *(DX11Textur*)t;
+                v[ 1 ] = *diffuseLights;
+                v[ 2 ] = *pointLights;
+                d3d11Context->PSSetShaderResources( 0, 3, v );
+                d3d11Context->DrawIndexed( i->indexAnz, current, 0 );
+            }
+            else
+            {
+                d3d11Context->RSSetState( meshRS );
+                ID3D11ShaderResourceView* v[ 3 ];
+                v[ 0 ] = *(DX11Textur*)defaultTextur;
+                v[ 1 ] = *diffuseLights;
+                v[ 2 ] = *pointLights;
+                d3d11Context->PSSetShaderResources( 0, 3, v );
+                d3d11Context->DrawIndexed( i->indexAnz, current, 0 );
+                d3d11Context->RSSetState( texturRS );
+            }
         }
         ind++;
         current += i->indexAnz;

+ 124 - 121
DX12GraphicsApi.cpp

@@ -120,14 +120,14 @@ DirectX12::~DirectX12()
         debug->Release();
 }
 
-typedef HRESULT( __stdcall *CreateDXGIFactory2Function )( UINT, REFIID, void ** );
+typedef HRESULT( __stdcall* CreateDXGIFactory2Function )(UINT, REFIID, void**);
 
-typedef HRESULT( __stdcall *D3D12CreateDeviceFunction )( IDXGIAdapter *, D3D_FEATURE_LEVEL,
-                                                         REFIID, void ** );
+typedef HRESULT( __stdcall* D3D12CreateDeviceFunction )(IDXGIAdapter*, D3D_FEATURE_LEVEL,
+                                                         REFIID, void**);
 
-typedef HRESULT( __stdcall *D3D12GetDebugInterfaceFunction )( REFIID, void ** );
+typedef HRESULT( __stdcall* D3D12GetDebugInterfaceFunction )(REFIID, void**);
 
-void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fullScreen )
+void DirectX12::initialize( WFenster* fenster, Vec2<int> backBufferSize, bool fullScreen )
 {
     if( device )
         return GraphicsApi::initialize( fenster, backBufferSize, fullScreen );
@@ -172,13 +172,13 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
         debug->EnableDebugLayer();
     }
 #endif
-    IDXGIFactory4 *factory;
+    IDXGIFactory4* factory;
     UINT createFactoryFlags = 0;
 #if defined(_DEBUG)
     if( debugDX )
         createFactoryFlags = DXGI_CREATE_FACTORY_DEBUG;
 #endif
-    HRESULT res = createFactory( createFactoryFlags, __uuidof( IDXGIFactory4 ), (void **)&factory );
+    HRESULT res = createFactory( createFactoryFlags, __uuidof(IDXGIFactory4), (void**)&factory );
     if( FAILED( res ) )
     {
         getDLLRegister()->releaseDLL( "dxgi.dll" );
@@ -189,19 +189,19 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     }
     int index = 0;
     unsigned __int64 maxVideoMemory = 0;
-    IDXGIAdapter1 *best = 0;
+    IDXGIAdapter1* best = 0;
     do
     {
-        IDXGIAdapter1 *current;
+        IDXGIAdapter1* current;
         res = factory->EnumAdapters1( index++, &current );
         if( res == S_OK )
         {
-            ID3D12Device2 *device = 0;
+            ID3D12Device2* device = 0;
             DXGI_ADAPTER_DESC1 dxgiAdapterDesc1;
             current->GetDesc1( &dxgiAdapterDesc1 );
-            if( ( dxgiAdapterDesc1.Flags & DXGI_ADAPTER_FLAG_SOFTWARE ) == 0 &&
+            if( (dxgiAdapterDesc1.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) == 0 &&
                 dxgiAdapterDesc1.DedicatedVideoMemory > maxVideoMemory &&
-                SUCCEEDED( createDevice( current, D3D_FEATURE_LEVEL_12_1, __uuidof( ID3D12Device2 ), (void **)&device ) ) )
+                SUCCEEDED( createDevice( current, D3D_FEATURE_LEVEL_12_1, __uuidof(ID3D12Device2), (void**)&device ) ) )
             {
                 device->Release();
                 if( best )
@@ -213,7 +213,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
                 current->Release();
         }
     } while( res != DXGI_ERROR_NOT_FOUND );
-    res = createDevice( best, D3D_FEATURE_LEVEL_12_0, __uuidof( ID3D12Device2 ), (void **)&device );
+    res = createDevice( best, D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device2), (void**)&device );
     best->Release();
     if( FAILED( res ) )
     {
@@ -224,7 +224,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
         WMessageBox( fenster->getFensterHandle(), new Text( "Fehler" ), new Text( "createDevice ist Fehlgeschlagen." ), MB_ICONERROR );
         return;
     }
-    res = device->QueryInterface( __uuidof( ID3D12InfoQueue ), (void **)&infoQueue );
+    res = device->QueryInterface( __uuidof(ID3D12InfoQueue), (void**)&infoQueue );
     if( SUCCEEDED( res ) )
     {
         infoQueue->SetBreakOnSeverity( D3D12_MESSAGE_SEVERITY_CORRUPTION, TRUE );
@@ -256,8 +256,8 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     copyCommandQueue = new DX12CopyCommandQueue( device );
     computeCommandQueue = new DX12ComputeCommandQueue( device );
 
-    IDXGIFactory5 *fac5 = 0;
-    factory->QueryInterface( __uuidof( IDXGIFactory5 ), (void **)&fac5 );
+    IDXGIFactory5* fac5 = 0;
+    factory->QueryInterface( __uuidof(IDXGIFactory5), (void**)&fac5 );
     if( fac5 )
     {
         res = fac5->CheckFeatureSupport( DXGI_FEATURE_PRESENT_ALLOW_TEARING, &tearing, sizeof( tearing ) );
@@ -278,7 +278,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
     swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
     swapChainDesc.Flags = tearing ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0;
-    IDXGISwapChain1 *tmpSwapChain;
+    IDXGISwapChain1* tmpSwapChain;
     res = factory->CreateSwapChainForHwnd( directCommandQueue->getQueue(), fenster->getFensterHandle(), &swapChainDesc, 0, 0, &tmpSwapChain );
     if( FAILED( res ) )
     {
@@ -287,7 +287,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
         WMessageBox( fenster->getFensterHandle(), new Text( "Fehler" ), new Text( "CreateSwapChainForHwnd ist Fehlgeschlagen." ), MB_ICONERROR );
         return;
     }
-    res = tmpSwapChain->QueryInterface( __uuidof( IDXGISwapChain4 ), (void **)&swapChain );
+    res = tmpSwapChain->QueryInterface( __uuidof(IDXGISwapChain4), (void**)&swapChain );
     tmpSwapChain->Release();
     if( FAILED( res ) )
     {
@@ -301,7 +301,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     D3D12_DESCRIPTOR_HEAP_DESC rtvhdesc = {};
     rtvhdesc.NumDescriptors = 2;
     rtvhdesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
-    res = device->CreateDescriptorHeap( &rtvhdesc, __uuidof( ID3D12DescriptorHeap ), (void **)&rtvHeap );
+    res = device->CreateDescriptorHeap( &rtvhdesc, __uuidof(ID3D12DescriptorHeap), (void**)&rtvHeap );
     if( FAILED( res ) )
     {
         factory->Release();
@@ -315,8 +315,8 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
 
     for( int i = 0; i < 2; i++ )
     {
-        ID3D12Resource *backBuffer;
-        res = swapChain->GetBuffer( i, __uuidof( ID3D12Resource ), (void **)&backBuffer );
+        ID3D12Resource* backBuffer;
+        res = swapChain->GetBuffer( i, __uuidof(ID3D12Resource), (void**)&backBuffer );
         if( FAILED( res ) )
         {
             factory->Release();
@@ -351,13 +351,13 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
 
     texturModel = new TexturModel();
 
-    Bild *renderB = new Bild( 1 );
+    Bild* renderB = new Bild( 1 );
     renderB->setAlpha3D( 1 );
     renderB->neuBild( this->backBufferSize.x, this->backBufferSize.y, 0 );
     uiTextur = createOrGetTextur( "_f_Render_Bild", renderB );
 
     texturModel->setSize( Vec2<float>( 2.f, 2.f ) );
-    texturModel->setTextur( dynamic_cast<Textur *>( uiTextur->getThis() ) );
+    texturModel->setTextur( dynamic_cast<Textur*>(uiTextur->getThis()) );
 
     vertexBufferView = new D3D12_VERTEX_BUFFER_VIEW();
     vertexBufferView->StrideInBytes = sizeof( Vertex3D );
@@ -376,8 +376,8 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
                                        1, 0, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL ),
         D3D12_RESOURCE_STATE_DEPTH_WRITE,
         &optimizedClearValue,
-        __uuidof( ID3D12Resource ),
-        (void **)&depthBuffer
+        __uuidof(ID3D12Resource),
+        (void**)&depthBuffer
     );
     if( FAILED( res ) )
     {
@@ -391,7 +391,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     dsvHeapDesc.NumDescriptors = 1;
     dsvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
     dsvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
-    res = device->CreateDescriptorHeap( &dsvHeapDesc, __uuidof( ID3D12DescriptorHeap ), (void **)&dsvHeap );
+    res = device->CreateDescriptorHeap( &dsvHeapDesc, __uuidof(ID3D12DescriptorHeap), (void**)&dsvHeap );
     if( FAILED( res ) )
     {
         factory->Release();
@@ -413,7 +413,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     sbheapDesc.NumDescriptors = 6;
     sbheapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
     sbheapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
-    res = device->CreateDescriptorHeap( &sbheapDesc, __uuidof( ID3D12DescriptorHeap ), (void **)&shaderBufferHeap );
+    res = device->CreateDescriptorHeap( &sbheapDesc, __uuidof(ID3D12DescriptorHeap), (void**)&shaderBufferHeap );
     if( FAILED( res ) )
     {
         factory->Release();
@@ -423,12 +423,12 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     }
 
     vertexShader = new DX12VertexShader( device, copyCommandQueue, directCommandQueue );
-    vertexShader->setCompiledByteArray( (unsigned char *)DX12VertexShaderBytes, sizeof( DX12VertexShaderBytes ) );
+    vertexShader->setCompiledByteArray( (unsigned char*)DX12VertexShaderBytes, sizeof( DX12VertexShaderBytes ) );
     vertexShader->erstelleConstBuffer( sizeof( Mat4< float > ) * 2, 0 );
     vertexShader->erstelleConstBuffer( sizeof( Mat4< float > ) * 128, 1 );
 
     pixelShader = new DX12PixelShader( device, copyCommandQueue, directCommandQueue );
-    pixelShader->setCompiledByteArray( (unsigned char *)DX12PixelShaderBytes, sizeof( DX12PixelShaderBytes ) );
+    pixelShader->setCompiledByteArray( (unsigned char*)DX12PixelShaderBytes, sizeof( DX12PixelShaderBytes ) );
     pixelShader->erstelleConstBuffer( sizeof( float ) * 4, 2 );
     pixelShader->erstelleConstBuffer( sizeof( float ) * 3, 3 );
     pixelShader->erstelleConstBuffer( sizeof( int ) * 2, 4 );
@@ -496,8 +496,8 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     rootSignatureDescription.Desc_1_1.pStaticSamplers = &sampler;
     rootSignatureDescription.Desc_1_1.Flags = rootSignatureFlags;
 
-    ID3DBlob *rootSignature;
-    ID3DBlob *error;
+    ID3DBlob* rootSignature;
+    ID3DBlob* error;
     res = D3DX12SerializeVersionedRootSignature( &rootSignatureDescription, featureData.HighestVersion, &rootSignature, &error, d3d12svrsf, d3d12srsf );
     if( FAILED( res ) )
     {
@@ -509,7 +509,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
         return;
     }
 
-    res = device->CreateRootSignature( 0, rootSignature->GetBufferPointer(), rootSignature->GetBufferSize(), __uuidof( ID3D12RootSignature ), (void **)&signature );
+    res = device->CreateRootSignature( 0, rootSignature->GetBufferPointer(), rootSignature->GetBufferSize(), __uuidof(ID3D12RootSignature), (void**)&signature );
     if( FAILED( res ) )
     {
         factory->Release();
@@ -577,11 +577,11 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     vd.Texture2D.MostDetailedMip = 0;
     vd.Texture2D.PlaneSlice = 0;
     vd.Texture2D.ResourceMinLODClamp = 0;
-    device->CreateShaderResourceView( ( (DX12Textur *)uiTextur )->getResource(), &vd, sbHeapHandle );
+    device->CreateShaderResourceView( ((DX12Textur*)uiTextur)->getResource(), &vd, sbHeapHandle );
 
     directCommandQueue->execute();
 
-    res = device->CreateGraphicsPipelineState( &psoDesc, __uuidof( ID3D12PipelineState ), (void **)&pipeline );
+    res = device->CreateGraphicsPipelineState( &psoDesc, __uuidof(ID3D12PipelineState), (void**)&pipeline );
     if( FAILED( res ) )
     {
         factory->Release();
@@ -622,12 +622,12 @@ void DirectX12::update()
         WMessageBox( fenster->getFensterHandle(), new Text( "Fehler" ), new Text( "GetDesc ist Fehlgeschlagen." ), MB_ICONERROR );
         return;
     }
-    IDXGIFactory4 *factory;
+    IDXGIFactory4* factory;
     UINT createFactoryFlags = 0;
 #if defined(_DEBUG)
     createFactoryFlags = DXGI_CREATE_FACTORY_DEBUG;
 #endif
-    res = createFactory( createFactoryFlags, __uuidof( IDXGIFactory4 ), (void **)&factory );
+    res = createFactory( createFactoryFlags, __uuidof(IDXGIFactory4), (void**)&factory );
     if( FAILED( res ) )
     {
         getDLLRegister()->releaseDLL( "dxgi.dll" );
@@ -649,8 +649,8 @@ void DirectX12::update()
 
     for( int i = 0; i < 2; i++ )
     {
-        ID3D12Resource *backBuffer;
-        res = swapChain->GetBuffer( i, __uuidof( ID3D12Resource ), (void **)&backBuffer );
+        ID3D12Resource* backBuffer;
+        res = swapChain->GetBuffer( i, __uuidof(ID3D12Resource), (void**)&backBuffer );
         if( FAILED( res ) )
         {
             getDLLRegister()->releaseDLL( "dxgi.dll" );
@@ -690,8 +690,8 @@ void DirectX12::update()
                                        1, 0, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL ),
         D3D12_RESOURCE_STATE_DEPTH_WRITE,
         0,
-        __uuidof( ID3D12Resource ),
-        (void **)&depthBuffer
+        __uuidof(ID3D12Resource),
+        (void**)&depthBuffer
     );
     if( FAILED( res ) )
     {
@@ -713,12 +713,12 @@ void DirectX12::update()
     if( uiTextur )
         uiTextur->release();
 
-    Bild *renderB = new Bild( 1 );
+    Bild* renderB = new Bild( 1 );
     renderB->setAlpha3D( 1 );
     renderB->neuBild( this->backBufferSize.x, this->backBufferSize.y, 0 );
     uiTextur = createOrGetTextur( "_f_Render_Bild", renderB );
 
-    texturModel->setTextur( dynamic_cast<Textur *>( uiTextur->getThis() ) );
+    texturModel->setTextur( dynamic_cast<Textur*>(uiTextur->getThis()) );
 
     factory->Release();
 }
@@ -742,10 +742,10 @@ void DirectX12::beginFrame( bool fill2D, bool fill3D, int fillColor )
     {
         float color[ 4 ];
         // Setup the color to clear the buffer.
-        color[ 0 ] = ( ( fillColor >> 16 ) & 0xFF ) / 255.f; // R
-        color[ 1 ] = ( ( fillColor >> 8 ) & 0xFF ) / 255.f; // G
-        color[ 2 ] = ( fillColor & 0xFF ) / 255.f; // B
-        color[ 3 ] = ( ( fillColor >> 24 ) & 0xFF ) / 255.f; // A
+        color[ 0 ] = ((fillColor >> 16) & 0xFF) / 255.f; // R
+        color[ 1 ] = ((fillColor >> 8) & 0xFF) / 255.f; // G
+        color[ 2 ] = (fillColor & 0xFF) / 255.f; // B
+        color[ 3 ] = ((fillColor >> 24) & 0xFF) / 255.f; // A
 
         auto rtvDescriptorSize = device->GetDescriptorHandleIncrementSize( D3D12_DESCRIPTOR_HEAP_TYPE_RTV );
         D3D12_CPU_DESCRIPTOR_HANDLE rtv = rtvHeap->GetCPUDescriptorHandleForHeapStart();
@@ -755,80 +755,83 @@ void DirectX12::beginFrame( bool fill2D, bool fill3D, int fillColor )
         directCommandQueue->getCommandList()->ClearRenderTargetView( rtv, color, 0, 0 );
     }
     int lc[] = { 0, 0 };
-    pixelShader->füllConstBuffer( (char *)lc, 4, sizeof( int ) * 2 );
+    pixelShader->füllConstBuffer( (char*)lc, 4, sizeof( int ) * 2 );
 }
 
-void DirectX12::renderObject( Model3D *zObj )
+void DirectX12::renderObject( Model3D* zObj )
 {
-    vertexBuffer->setData( (void *)texturModel->zVertexBuffer() );
+    vertexBuffer->setData( (void*)texturModel->zVertexBuffer() );
     vertexBuffer->setLength( sizeof( Vertex3D ) * texturModel->getVertexAnzahl() );
     vertexBuffer->copieren();
     Mat4< float > trans = Mat4< float >::identity();
     int anz = zObj->errechneMatrizen( trans, matrixBuffer );
     if( vertexShader )
-        vertexShader->füllConstBuffer( (char *)matrixBuffer, 1, sizeof( Mat4< float > ) * anz );
+        vertexShader->füllConstBuffer( (char*)matrixBuffer, 1, sizeof( Mat4< float > ) * anz );
     float matirialBuffer[ 3 ]; // light factors (phong model)
     matirialBuffer[ 0 ] = zObj->getAmbientFactor();
     matirialBuffer[ 1 ] = zObj->getDiffusFactor();
     matirialBuffer[ 2 ] = zObj->getSpecularFactor();
     if( pixelShader )
-        pixelShader->füllConstBuffer( (char *)matirialBuffer, 3, sizeof( float ) * 3 );
+        pixelShader->füllConstBuffer( (char*)matirialBuffer, 3, sizeof( float ) * 3 );
     unsigned int offset = 0;
     unsigned int es = (unsigned)vertexBuffer->getElementLength();
-    Model3DTextur *zTextur = zObj->zTextur();
+    Model3DTextur* zTextur = zObj->zTextur();
     int ind = 0;
     for( auto i = zObj->zModelData()->getPolygons(); i; i++ )
     {
-        indexBuffer->setData( i->indexList );
-        indexBuffer->setLength( sizeof( int ) * i->indexAnz );
-        indexBuffer->copieren();
-        Textur *t = zTextur->zPolygonTextur( ind );
-        //if( t &&t->brauchtUpdate() )
-        //    t->updateTextur();
-        DXGI_FORMAT f = DXGI_FORMAT_R32_UINT;
-        if( indexBuffer->getElementLength() == 2 )
-            f = DXGI_FORMAT_R16_UINT;
-        if( indexBuffer->getElementLength() == 1 )
-            f = DXGI_FORMAT_R8_UINT;
-        indexBufferView->Format = f;
-        if( t )
+        if( zObj->needRenderPolygon( ind ) )
         {
-            /*ID3D11ShaderResourceView *v[ 3 ];
-            v[ 0 ] = *(DX11Textur *)t;
-            v[ 1 ] = *diffuseLights;
-            v[ 2 ] = *pointLights;
-            d3d11Context->PSSetShaderResources( 0, 3, v );
-            d3d11Context->DrawIndexed( indexBuffer->getElementAnzahl(), 0, 0 );*/
-            directCommandQueue->getCommandList()->SetPipelineState( pipeline );
-            directCommandQueue->getCommandList()->SetGraphicsRootSignature( signature );
-            directCommandQueue->getCommandList()->SetDescriptorHeaps( 1, &shaderBufferHeap );
-            directCommandQueue->getCommandList()->SetGraphicsRootDescriptorTable( 0, shaderBufferHeap->GetGPUDescriptorHandleForHeapStart() );
-            directCommandQueue->getCommandList()->RSSetViewports( 1, viewPort );
-            directCommandQueue->getCommandList()->RSSetScissorRects( 1, allowedRenderArea );
-            auto rtvDescriptorSize = device->GetDescriptorHandleIncrementSize( D3D12_DESCRIPTOR_HEAP_TYPE_RTV );
-            D3D12_CPU_DESCRIPTOR_HANDLE rtv = rtvHeap->GetCPUDescriptorHandleForHeapStart();
-            rtv.ptr += rtvDescriptorSize * backBufferIndex;
-            directCommandQueue->getCommandList()->OMSetRenderTargets( 1, &rtv, 0, 0 );
-            indexBufferView->SizeInBytes = indexBuffer->getElementAnzahl() * indexBuffer->getElementLength();
-            indexBufferView->BufferLocation = indexBuffer->zBuffer()->GetGPUVirtualAddress();
-            directCommandQueue->getCommandList()->IASetIndexBuffer( indexBufferView );
-            vertexBufferView->SizeInBytes = vertexBuffer->getElementAnzahl() * vertexBuffer->getElementLength();
-            vertexBufferView->BufferLocation = vertexBuffer->zBuffer()->GetGPUVirtualAddress();
-            directCommandQueue->getCommandList()->IASetVertexBuffers( 0, 1, vertexBufferView );
-            directCommandQueue->getCommandList()->IASetPrimitiveTopology( D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
-            directCommandQueue->getCommandList()->DrawIndexedInstanced( indexBuffer->getElementAnzahl(), 1, 0, 0, 0 );
-        }
-        else
-        {
-            /*d3d11Context->RSSetState( meshRS );
-            ID3D11ShaderResourceView *v[ 3 ];
-            v[ 0 ] = *(DX11Textur *)defaultTextur;
-            v[ 1 ] = *diffuseLights;
-            v[ 2 ] = *pointLights;
-            d3d11Context->PSSetShaderResources( 0, 3, v );
-            d3d11Context->DrawIndexed( indexBuffer->getElementAnzahl(), 0, 0 );
-            d3d11Context->RSSetState( texturRS );*/
-            //directCommandQueue->getCommandList()->DrawIndexedInstanced( indexBuffer->getElementAnzahl(), 1, 0, 0, 0 );
+            indexBuffer->setData( i->indexList );
+            indexBuffer->setLength( sizeof( int ) * i->indexAnz );
+            indexBuffer->copieren();
+            Textur* t = zTextur->zPolygonTextur( ind );
+            //if( t &&t->brauchtUpdate() )
+            //    t->updateTextur();
+            DXGI_FORMAT f = DXGI_FORMAT_R32_UINT;
+            if( indexBuffer->getElementLength() == 2 )
+                f = DXGI_FORMAT_R16_UINT;
+            if( indexBuffer->getElementLength() == 1 )
+                f = DXGI_FORMAT_R8_UINT;
+            indexBufferView->Format = f;
+            if( t )
+            {
+                /*ID3D11ShaderResourceView *v[ 3 ];
+                v[ 0 ] = *(DX11Textur *)t;
+                v[ 1 ] = *diffuseLights;
+                v[ 2 ] = *pointLights;
+                d3d11Context->PSSetShaderResources( 0, 3, v );
+                d3d11Context->DrawIndexed( indexBuffer->getElementAnzahl(), 0, 0 );*/
+                directCommandQueue->getCommandList()->SetPipelineState( pipeline );
+                directCommandQueue->getCommandList()->SetGraphicsRootSignature( signature );
+                directCommandQueue->getCommandList()->SetDescriptorHeaps( 1, &shaderBufferHeap );
+                directCommandQueue->getCommandList()->SetGraphicsRootDescriptorTable( 0, shaderBufferHeap->GetGPUDescriptorHandleForHeapStart() );
+                directCommandQueue->getCommandList()->RSSetViewports( 1, viewPort );
+                directCommandQueue->getCommandList()->RSSetScissorRects( 1, allowedRenderArea );
+                auto rtvDescriptorSize = device->GetDescriptorHandleIncrementSize( D3D12_DESCRIPTOR_HEAP_TYPE_RTV );
+                D3D12_CPU_DESCRIPTOR_HANDLE rtv = rtvHeap->GetCPUDescriptorHandleForHeapStart();
+                rtv.ptr += rtvDescriptorSize * backBufferIndex;
+                directCommandQueue->getCommandList()->OMSetRenderTargets( 1, &rtv, 0, 0 );
+                indexBufferView->SizeInBytes = indexBuffer->getElementAnzahl() * indexBuffer->getElementLength();
+                indexBufferView->BufferLocation = indexBuffer->zBuffer()->GetGPUVirtualAddress();
+                directCommandQueue->getCommandList()->IASetIndexBuffer( indexBufferView );
+                vertexBufferView->SizeInBytes = vertexBuffer->getElementAnzahl() * vertexBuffer->getElementLength();
+                vertexBufferView->BufferLocation = vertexBuffer->zBuffer()->GetGPUVirtualAddress();
+                directCommandQueue->getCommandList()->IASetVertexBuffers( 0, 1, vertexBufferView );
+                directCommandQueue->getCommandList()->IASetPrimitiveTopology( D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
+                directCommandQueue->getCommandList()->DrawIndexedInstanced( indexBuffer->getElementAnzahl(), 1, 0, 0, 0 );
+            }
+            else
+            {
+                /*d3d11Context->RSSetState( meshRS );
+                ID3D11ShaderResourceView *v[ 3 ];
+                v[ 0 ] = *(DX11Textur *)defaultTextur;
+                v[ 1 ] = *diffuseLights;
+                v[ 2 ] = *pointLights;
+                d3d11Context->PSSetShaderResources( 0, 3, v );
+                d3d11Context->DrawIndexed( indexBuffer->getElementAnzahl(), 0, 0 );
+                d3d11Context->RSSetState( texturRS );*/
+                //directCommandQueue->getCommandList()->DrawIndexedInstanced( indexBuffer->getElementAnzahl(), 1, 0, 0, 0 );
+            }
         }
         ind++;
     }
@@ -838,7 +841,7 @@ void DirectX12::renderObject( Model3D *zObj )
 //  pos: Der Mittelpunkt der Kugel
 //  radius: Der Radius der Kugel
 //  dist: Einen Zeiger auf einen float, in dem das quadrat des Abstands zur Kammeraposition gespeichert wird, falls diese Funktion true zurückgiebt und der Zeiger nicht 0 ist
-bool DirectX12::isInFrustrum( const Vec3< float > &pos, float radius, float *dist ) const
+bool DirectX12::isInFrustrum( const Vec3< float >& pos, float radius, float* dist ) const
 {
     for( int i = 0; i < 6; i++ )
     {
@@ -850,9 +853,9 @@ bool DirectX12::isInFrustrum( const Vec3< float > &pos, float radius, float *dis
     return 1;
 }
 
-void DirectX12::renderKamera( Kam3D *zKamera )
+void DirectX12::renderKamera( Kam3D* zKamera )
 {
-    directCommandQueue->getCommandList()->RSSetViewports( 1, (D3D12_VIEWPORT *)zKamera->zViewPort() );
+    directCommandQueue->getCommandList()->RSSetViewports( 1, (D3D12_VIEWPORT*)zKamera->zViewPort() );
 
     Mat4< float > tmp = zKamera->getProjectionMatrix() * zKamera->getViewMatrix();
 
@@ -893,10 +896,10 @@ void DirectX12::renderKamera( Kam3D *zKamera )
     viewAndProj[ 1 ] = zKamera->getProjectionMatrix();
     kamPos = zKamera->getWorldPosition();
     if( vertexShader )
-        vertexShader->füllConstBuffer( (char *)viewAndProj, 0, sizeof( Mat4< float > ) * 2 );
+        vertexShader->füllConstBuffer( (char*)viewAndProj, 0, sizeof( Mat4< float > ) * 2 );
     if( pixelShader )
-        pixelShader->füllConstBuffer( (char *)&kamPos, 2, sizeof( float ) * 3 );
-    Welt3D *w = zKamera->zWelt();
+        pixelShader->füllConstBuffer( (char*)&kamPos, 2, sizeof( float ) * 3 );
+    Welt3D* w = zKamera->zWelt();
     w->lock();
     for( auto obj = w->getMembers(); obj; obj++ )
     {
@@ -914,7 +917,7 @@ void DirectX12::presentFrame()
     viewAndProj[ 0 ] = Mat4<float>::identity();
     viewAndProj[ 1 ] = Mat4<float>::identity();
     if( vertexShader )
-        vertexShader->füllConstBuffer( (char *)viewAndProj, 0, sizeof( Mat4< float > ) * 2 );
+        vertexShader->füllConstBuffer( (char*)viewAndProj, 0, sizeof( Mat4< float > ) * 2 );
 
     uiTextur->updateTextur();
 
@@ -939,7 +942,7 @@ void DirectX12::presentFrame()
     backBufferIndex = swapChain->GetCurrentBackBufferIndex();
 }
 
-Textur *DirectX12::createOrGetTextur( const char *name, Bild *b )
+Textur* DirectX12::createOrGetTextur( const char* name, Bild* b )
 {
     if( !device )
     {
@@ -949,22 +952,22 @@ Textur *DirectX12::createOrGetTextur( const char *name, Bild *b )
     }
     if( texturRegister->hatTextur( name ) )
     {
-        Textur *ret = texturRegister->getTextur( name );
+        Textur* ret = texturRegister->getTextur( name );
         if( b )
             ret->setBildZ( b );
         return ret;
     }
-    Textur *ret = new DX12Textur( device, copyCommandQueue, directCommandQueue );
+    Textur* ret = new DX12Textur( device, copyCommandQueue, directCommandQueue );
     if( b )
         ret->setBildZ( b );
-    texturRegister->addTextur( dynamic_cast<Textur *>( ret->getThis() ), name );
+    texturRegister->addTextur( dynamic_cast<Textur*>(ret->getThis()), name );
     ret->updateTextur();
     copyCommandQueue->execute();
     directCommandQueue->execute();
     return ret;
 }
 
-Bild *DirectX12::zUIRenderBild() const
+Bild* DirectX12::zUIRenderBild() const
 {
     return uiTextur ? uiTextur->zBild() : 0;
 }
@@ -996,16 +999,16 @@ bool DirectX12::isAvailable()
     }
 #ifdef _DEBUG
     D3D12GetDebugInterfaceFunction getDebugInterface = (D3D12GetDebugInterfaceFunction)GetProcAddress( d3d12DLL, "D3D12GetDebugInterface" );
-    ID3D12Debug *debug = 0;
-    getDebugInterface( __uuidof( ID3D12Debug ), (void **)&debug );
+    ID3D12Debug* debug = 0;
+    getDebugInterface( __uuidof(ID3D12Debug), (void**)&debug );
     debug->EnableDebugLayer();
 #endif
-    IDXGIFactory4 *factory;
+    IDXGIFactory4* factory;
     UINT createFactoryFlags = 0;
 #ifdef _DEBUG
     createFactoryFlags = DXGI_CREATE_FACTORY_DEBUG;
 #endif
-    HRESULT res = createFactory( createFactoryFlags, __uuidof( IDXGIFactory4 ), (void **)&factory );
+    HRESULT res = createFactory( createFactoryFlags, __uuidof(IDXGIFactory4), (void**)&factory );
     if( FAILED( res ) )
     {
         getDLLRegister()->releaseDLL( "dxgi.dll" );
@@ -1015,15 +1018,15 @@ bool DirectX12::isAvailable()
     int index = 0;
     do
     {
-        IDXGIAdapter1 *current;
+        IDXGIAdapter1* current;
         res = factory->EnumAdapters1( index++, &current );
         if( res == S_OK )
         {
             DXGI_ADAPTER_DESC1 dxgiAdapterDesc1;
             current->GetDesc1( &dxgiAdapterDesc1 );
-            ID3D12Device2 *device = 0;
-            if( ( dxgiAdapterDesc1.Flags & DXGI_ADAPTER_FLAG_SOFTWARE ) == 0 &&
-                SUCCEEDED( createDevice( current, D3D_FEATURE_LEVEL_12_1, __uuidof( ID3D12Device2 ), (void **)&device ) ) )
+            ID3D12Device2* device = 0;
+            if( (dxgiAdapterDesc1.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) == 0 &&
+                SUCCEEDED( createDevice( current, D3D_FEATURE_LEVEL_12_1, __uuidof(ID3D12Device2), (void**)&device ) ) )
             {
                 device->Release();
                 current->Release();

+ 16 - 16
DX12PixelShader.h

@@ -92,10 +92,10 @@ ret
 
 const BYTE DX12PixelShaderBytes[] =
 {
-     68,  88,  66,  67, 199,  72, 
-      1, 117, 228, 191, 237,  87, 
-    143, 180,  79,  17,  44,  16, 
-     11, 118,   1,   0,   0,   0, 
+     68,  88,  66,  67, 174,  73, 
+    236, 208,  61, 207, 110, 134, 
+     13, 212, 188,  24, 208,  73, 
+     14,  59,   1,   0,   0,   0, 
     184,  91,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
      36,   2,   0,   0, 188,   2, 
@@ -763,11 +763,11 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 148,  46, 
-     49,   1, 138, 198, 168,  97, 
-      1,   0,   0,   0, 112, 251, 
-      1, 234, 122, 157, 213,  78, 
-    150, 147, 150, 190, 206, 139, 
-    238, 188,   0,   0,   0,   0, 
+     49,   1, 213, 106, 170,  97, 
+      1,   0,   0,   0, 224, 185, 
+    133, 133,  52, 228,  31,  73, 
+    145,  72, 151, 149, 229, 231, 
+     74, 241,   0,   0,   0,   0, 
       0,   0,   0,   0,   1,   0, 
       0,   0,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -1788,7 +1788,7 @@ const BYTE DX12PixelShaderBytes[] =
     117, 114, 101,  50,  68,  32, 
     115, 104,  97, 100,  27, 226, 
      48,   1, 128,   0,   0,   0, 
-    163,  47,  26, 112, 126, 231, 
+    222, 203, 137, 243, 120, 232, 
     215,   1,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -3408,11 +3408,11 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 138, 198, 
-    168,  97,   1,   0,   0,   0, 
-    112, 251,   1, 234, 122, 157, 
-    213,  78, 150, 147, 150, 190, 
-    206, 139, 238, 188, 128,   0, 
+    148,  46,  49,   1, 213, 106, 
+    170,  97,   1,   0,   0,   0, 
+    224, 185, 133, 133,  52, 228, 
+     31,  73, 145,  72, 151, 149, 
+    229, 231,  74, 241, 128,   0, 
       0,   0,  47,  76, 105, 110, 
     107,  73, 110, 102, 111,   0, 
      47, 110,  97, 109, 101, 115, 
@@ -3512,7 +3512,7 @@ const BYTE DX12PixelShaderBytes[] =
       0,   0,   2,   0,   9,   0, 
     220,   4,   0,   0,   0,   0, 
       0,   0, 156,   1,   0,   0, 
-      1,   0,  73, 200,   0,   0, 
+      1,   0, 234,  65,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 109,  97, 
     105, 110,   0, 110, 111, 110, 

+ 16 - 16
DX12VertexShader.h

@@ -129,10 +129,10 @@ ret
 
 const BYTE DX12VertexShaderBytes[] =
 {
-     68,  88,  66,  67, 104,  83, 
-    220, 213, 203, 189, 140, 156, 
-    207, 123, 133,  45, 133,  90, 
-    201, 131,   1,   0,   0,   0, 
+     68,  88,  66,  67, 122, 122, 
+     47, 158, 148,  79,  31, 140, 
+    240, 147, 131,  22,  22,  27, 
+     38, 207,   1,   0,   0,   0, 
     108,  78,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
     124,   2,   0,   0,  16,   3, 
@@ -915,11 +915,11 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 138, 198, 
-    168,  97,   1,   0,   0,   0, 
-    241, 108, 183, 211, 105, 209, 
-    219,  79, 142, 158,  30,  16, 
-     89,   7, 151,  59,   0,   0, 
+    148,  46,  49,   1, 213, 106, 
+    170,  97,   1,   0,   0,   0, 
+    102, 130,   8, 181, 199,  23, 
+    190,  69, 180, 250, 133, 108, 
+    110, 250, 252, 221,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       1,   0,   0,   0,   1,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -1684,8 +1684,8 @@ const BYTE DX12VertexShaderBytes[] =
     112, 111, 115, 105, 116, 105, 
     111, 110,  32, 111, 102,  32, 
      27, 226,  48,   1, 128,   0, 
-      0,   0, 158, 124,  82, 112, 
-    126, 231, 215,   1,   1,   0, 
+      0,   0, 141,   4, 208, 243, 
+    120, 232, 215,   1,   1,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -3134,11 +3134,11 @@ const BYTE DX12VertexShaderBytes[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0, 148,  46, 
-     49,   1, 138, 198, 168,  97, 
-      1,   0,   0,   0, 241, 108, 
-    183, 211, 105, 209, 219,  79, 
-    142, 158,  30,  16,  89,   7, 
-    151,  59, 129,   0,   0,   0, 
+     49,   1, 213, 106, 170,  97, 
+      1,   0,   0,   0, 102, 130, 
+      8, 181, 199,  23, 190,  69, 
+    180, 250, 133, 108, 110, 250, 
+    252, 221, 129,   0,   0,   0, 
      47,  76, 105, 110, 107,  73, 
     110, 102, 111,   0,  47, 110, 
      97, 109, 101, 115,   0,  47, 

BIN
Framework Tests/Framwork.dll


+ 12 - 0
Kam3D.cpp

@@ -378,6 +378,18 @@ const Vec3< float > Kam3D::getRotation() const
     return { rotX, rotY, rotZ };
 }
 
+//! Gibt die Position der Kamera auf dem Bildschirm zurück
+const Punkt Kam3D::getScreenPos() const
+{
+    return Punkt( (int)viewport.x, (int)viewport.y );
+}
+
+//! Gibt die Größe der Kamera auf dem Bildschirm zurück
+const Punkt Kam3D::getScreenSize() const
+{
+    return Punkt( (int)viewport.width, (int)viewport.height );
+}
+
 // Gibt die Welt zurück
 Welt3D* Kam3D::getWelt() const
 {

+ 4 - 0
Kam3D.h

@@ -141,6 +141,10 @@ namespace Framework
         DLLEXPORT const Mat4< float > &getViewMatrix() const;
         //! Gibt die Rotation um die einzelnen axen zurück
         DLLEXPORT const Vec3< float > getRotation() const;
+        //! Gibt die Position der Kamera auf dem Bildschirm zurück
+        DLLEXPORT const Punkt getScreenPos() const;
+        //! Gibt die Größe der Kamera auf dem Bildschirm zurück
+        DLLEXPORT const Punkt getScreenSize() const;
         //! Gibt die Welt zurück
         DLLEXPORT Welt3D *getWelt() const;
         //! Gibt die Welt zurück

+ 6 - 0
Model3D.cpp

@@ -898,4 +898,10 @@ int Model3D::getVertexAnzahl() const
 const Vertex3D* Model3D::zVertexBuffer() const
 {
     return model ? model->zVertexBuffer() : 0;
+}
+
+//! Gibt true zurück wenn ein bestimmtes polygon gezeichnet werden muss
+bool Model3D::needRenderPolygon( int index )
+{
+    return 1;
 }

+ 54 - 52
Model3D.h

@@ -25,8 +25,8 @@ namespace Framework
     private:
         Vec3< float > pos;
         Vec3< float > winkel;
-        Knochen *geschwister;
-        Knochen *kinder;
+        Knochen* geschwister;
+        Knochen* kinder;
         int id;
 
     public:
@@ -36,29 +36,29 @@ namespace Framework
         DLLEXPORT ~Knochen();
         //! Setzt die Position des Knochens relativ zum Model Ursprung
         //! \param pos Die Position
-        DLLEXPORT void setPosition( Vec3< float > &pos );
+        DLLEXPORT void setPosition( Vec3< float >& pos );
         //! Setzt die Drehung des Knochens relativ zum Model Ursprung
         //! \param winkel Ein Vektor der die Drehung um die verschiedenen Achsen als Komponenten hat
-        DLLEXPORT void setDrehung( Vec3< float > &winkel );
+        DLLEXPORT void setDrehung( Vec3< float >& winkel );
         //! Fügt dem Knochen ein Geschwister Knochen hinzu
         //! \param k Der Knochen, der hinzugefügt werden soll
-        void addGeschwisterKnochen( Knochen *k );
+        void addGeschwisterKnochen( Knochen* k );
         //! Fügt einem bestimmten Knochen ein Kind Knochen hinzu
         //! \param id Die id des Knochens, wo der Knochen als Kind hinzugefügt werden soll
         //! \param k Der Knochen, der hinzugefügt werden soll
-        DLLEXPORT void addKind( int id, Knochen *k );
+        DLLEXPORT void addKind( int id, Knochen* k );
         //! Berechnet die Matrizen des Knochen und die von all seinen Geschwister Knochen und Kind Knochen
         //! \param elternMat Die fertig berechnete Matrix des Elternknochens
         //! \param matBuffer Ein Array, in dem alle berechneten Matrizen gespeichert werden sollen
         //! \param scaleFactor Die skallierung des Objektes
         //! \param kamMatrix Die vereiniegung der view und projektions Matrizen
-        DLLEXPORT void kalkulateMatrix( Mat4< float > &elternMat, Mat4< float > *matBuffer, float scaleFactor, Mat4< float > &kamMat );
+        DLLEXPORT void kalkulateMatrix( Mat4< float >& elternMat, Mat4< float >* matBuffer, float scaleFactor, Mat4< float >& kamMat );
         //! Gibt den ersten Geschwisterknochen zurück
-        DLLEXPORT Knochen *zGeschwister() const;
+        DLLEXPORT Knochen* zGeschwister() const;
         //! Gibt den ersten KindKnochen zurück
-        DLLEXPORT Knochen *zKind() const;
+        DLLEXPORT Knochen* zKind() const;
         //! Kopiert den Knochen mit allen Geschwister Knochen und Kind Knochen
-        DLLEXPORT Knochen *kopiereKnochen() const;
+        DLLEXPORT Knochen* kopiereKnochen() const;
         //! Gibt die Id des Knochens zurück
         DLLEXPORT int getId() const;
         //! Gibt die Drehung des Knochens zurück
@@ -75,7 +75,7 @@ namespace Framework
     class Skelett : public virtual ReferenceCounter
     {
     private:
-        Knochen *k;
+        Knochen* k;
         int nextId;
 
     public:
@@ -92,20 +92,20 @@ namespace Framework
         //! Fügt dem Skellet einen Knochen hinzu
         //! \param k Der Knochen
         //! \param elternId Die Id des Eltern Knochens. Wenn der Knochen kein Elternknochen besitzt, kannder Parameter weggelassen werden.
-        DLLEXPORT void addKnochen( Knochen *k, int elternId = -1 );
+        DLLEXPORT void addKnochen( Knochen* k, int elternId = -1 );
         //! Berechnet die Matrizen der Knochen
         //! \param modelMatrix Die Matrix, die das Skelett in den Raum der Welt transformiert
         //! \param matBuffer Ein Array von Matrizen, der durch die Knochen Matrizen gefüllt wird
         //! \param scaleFactor Die skallierung des Objektes
         //! \param kamMatrix Die vereiniegung der view und projektions Matrizen
         //! \return gibt die Anzahl der verwendeten Matrizen zurück
-        DLLEXPORT int kalkulateMatrix( Mat4< float > &modelMatrix, Mat4< float > *matBuffer, float scaleFactor, Mat4< float > &kamMatrix );
+        DLLEXPORT int kalkulateMatrix( Mat4< float >& modelMatrix, Mat4< float >* matBuffer, float scaleFactor, Mat4< float >& kamMatrix );
         //! Berechnet den Radius des Skeletts
         DLLEXPORT float getRadius() const;
         //! gibt den Wurzel Knochen zurück
-        DLLEXPORT Knochen *zKnochen() const;
+        DLLEXPORT Knochen* zKnochen() const;
         //! Kopiert das Skelett
-        DLLEXPORT Skelett *kopiereSkelett() const;
+        DLLEXPORT Skelett* kopiereSkelett() const;
         //! Gibt die id des nächsten Knochens zurück ohne sie zu erhöhen
         DLLEXPORT int zNextKnochenId() const;
 
@@ -124,7 +124,7 @@ namespace Framework
     //! Eine Struktur, die alle Dreiecke eines 3D Polygons speichert
     struct Polygon3D
     {
-        int *indexList; //! Die Liste mit den IDs der Ecken
+        int* indexList; //! Die Liste mit den IDs der Ecken
         int indexAnz; //! Die Länge der Liste mit den Ids der Ecken
 
         //! Konstruktor
@@ -138,15 +138,15 @@ namespace Framework
     class Model3DData : public virtual ReferenceCounter
     {
     private:
-        Skelett *skelett;
-        Vertex3D *vertexList;
+        Skelett* skelett;
+        Vertex3D* vertexList;
         int vertexCount;
-        Array< Polygon3D * > *polygons;
+        Array< Polygon3D* >* polygons;
         float ambientFactor;
         float diffusFactor;
         float specularFactor;
         float radius;
-        int *indexBuffer;
+        int* indexBuffer;
         int indexCount;
         int id;
 
@@ -163,14 +163,14 @@ namespace Framework
         DLLEXPORT void buildIndexBuffer();
         //! Setzt den Zeiger auf ein standartmäßig verwendete Skelett
         //! \param s Das Skelett, das verwendet werden soll
-        DLLEXPORT void setSkelettZ( Skelett *s );
+        DLLEXPORT void setSkelettZ( Skelett* s );
         //! Setzt einen Zeiger auf eine Liste mit allen Vertecies des Models
         //! \param vertexList Ein Array mit Vertecies
         //! \param anz Die Anzahl der Vertecies im Array
-        DLLEXPORT void setVertecies( Vertex3D *vertexList, int anz );
+        DLLEXPORT void setVertecies( Vertex3D* vertexList, int anz );
         //! Fügt ein Polygon zum Model hinzu
         //! \param polygon Das Polygon, das hinzugefügt erden soll
-        DLLEXPORT void addPolygon( Polygon3D *polygon );
+        DLLEXPORT void addPolygon( Polygon3D* polygon );
         //! Git den Factor an, mit dem das umgebungslicht (textur farbe) multipliziert wird
         //! \param f der neue Faktor (von 0 bis 1, ambient + specular + diffuse = 1)
         DLLEXPORT void setAmbientFactor( float f );
@@ -183,7 +183,7 @@ namespace Framework
         //! Konvertiert ein 2d Model zu 3D
         //! \param model Das 2d Model, das zu 3d konvertiert werden soll
         //! \param z Die z koordinate aller punkte des Models
-        DLLEXPORT void copyModel2D( Model2DData *model, float z );
+        DLLEXPORT void copyModel2D( Model2DData* model, float z );
         //! Entfernt ein Polygon
         //! \param index Der Index des Polygons
         DLLEXPORT void removePolygon( int index );
@@ -193,14 +193,14 @@ namespace Framework
         //! \param scaleFactor Die Skallierung des Modells
         //! \param kamMatrix Die vereiniegung der view und projektions Matrizen
         //! \return gibt die Anzahl der verwendeten Matrizen zurück. 0, falls kein Standart Skelett gesetzt wurde
-        int kalkulateMatrix( Mat4< float > &modelMatrix, Mat4< float > *matBuffer, float scaleFactor, Mat4< float > &kamMatrix ) const;
+        int kalkulateMatrix( Mat4< float >& modelMatrix, Mat4< float >* matBuffer, float scaleFactor, Mat4< float >& kamMatrix ) const;
         //! Gibt die Anzahl an Polygonen zurück
         DLLEXPORT int getPolygonAnzahl() const;
         //! Gibt ein bestimmtes Polygon zurück
         //! \param index Der Index des Polygons
-        DLLEXPORT Polygon3D *getPolygon( int index ) const;
+        DLLEXPORT Polygon3D* getPolygon( int index ) const;
         //! Gibt einen Iterator zurück, mit dem sich die Polygons auflisten lassen
-        DLLEXPORT Iterator< Polygon3D * > getPolygons() const;
+        DLLEXPORT Iterator< Polygon3D* > getPolygons() const;
         //! Gibt den radius einer Kugel zurück, die das gesammte Model umschließt
         DLLEXPORT float getRadius() const;
         //! Gibt die Id der Daten zurück, wenn sie in einer Model3DList registriert wurden. (siehe Framework::zM3DRegister())
@@ -212,13 +212,13 @@ namespace Framework
         //! Git den Factor an, mit dem die Reflektion von Lichtquellen multipliziert wird
         DLLEXPORT float getSpecularFactor() const;
         //! Gibt eine Kopie des Skeletts zurück, welches für annimationen verwendet werden kann
-        DLLEXPORT Skelett *copySkelett() const;
+        DLLEXPORT Skelett* copySkelett() const;
         //! Gibt die Anzahl an Vertices zurück
         DLLEXPORT int getVertexAnzahl() const;
         //! Gibt einen Buffer mit allen Vertecies des Models zurück
-        DLLEXPORT const Vertex3D *zVertexBuffer() const;
+        DLLEXPORT const Vertex3D* zVertexBuffer() const;
         //! Gibt eine refferenz auf den beginn des indexBuffers zurück
-        DLLEXPORT const int *getIndexBuffer() const;
+        DLLEXPORT const int* getIndexBuffer() const;
         //! Gibt eine die Anzahl der indizes im indexBuffer zurück
         DLLEXPORT int getIndexCount() const;
 
@@ -229,7 +229,7 @@ namespace Framework
     class Model3DTextur : public virtual ReferenceCounter
     {
     private:
-        RCArray< Textur > *textures;
+        RCArray< Textur >* textures;
 
     public:
         //! Konstruktor
@@ -239,10 +239,10 @@ namespace Framework
         //! Legt fest, welche Textur für welches Polygon ist
         //! \param pI Der Index des Polygons
         //! \param txt Die Textur des Polygons
-        DLLEXPORT void setPolygonTextur( int pI, Textur *txt );
+        DLLEXPORT void setPolygonTextur( int pI, Textur* txt );
         //! Gibt einen Zeiger auf die Textur eines Polygons zurück ohne erhöhten Reference Counter
         //! \param i Der Index des Polygons
-        DLLEXPORT Textur *zPolygonTextur( int i ) const;
+        DLLEXPORT Textur* zPolygonTextur( int i ) const;
     };
 
     //! Eine Zeichnung des 3D Frameworks, die ein 3D Model mit Textur und Animation darstellen kann
@@ -251,18 +251,18 @@ namespace Framework
     protected:
         struct AnimationData
         {
-            Animation3D *a;
+            Animation3D* a;
             double speed;
             double offset;
 
-            AnimationData *getThis();
-            AnimationData *release();
+            AnimationData* getThis();
+            AnimationData* release();
         };
 
-        Skelett *skelett;
-        Model3DData *model;
-        Model3DTextur *textur;
-        RCArray< AnimationData > *animations;
+        Skelett* skelett;
+        Model3DData* model;
+        Model3DTextur* textur;
+        RCArray< AnimationData >* animations;
         float ambientFactor;
         float diffusFactor;
         float specularFactor;
@@ -274,16 +274,16 @@ namespace Framework
         DLLEXPORT virtual ~Model3D();
         //! Fügt eine Animation hinzu
         //! \param a Die neue Animation
-        DLLEXPORT void addAnimation( Animation3D *a, double speed = 1 );
+        DLLEXPORT void addAnimation( Animation3D* a, double speed = 1 );
         //! Entfernt eine Animation
         //! \param zA Die zu entfernende Animation
-        DLLEXPORT void removeAnimation( Animation3D *zA );
+        DLLEXPORT void removeAnimation( Animation3D* zA );
         //! Setzt die Daten des Models
         //! \param data Die Daten
-        DLLEXPORT void setModelDaten( Model3DData *data );
+        DLLEXPORT void setModelDaten( Model3DData* data );
         //! Setzt die zum Zeichnen zu benutzenden Texturen
         //! \param txt Ein Liste mit Texturen zu den verschiedenen Polygonen zugeordnet
-        DLLEXPORT void setModelTextur( Model3DTextur *txt );
+        DLLEXPORT void setModelTextur( Model3DTextur* txt );
         //! Git den Factor an, mit dem das umgebungslicht (textur farbe) multipliziert wird
         //! \param f der neue Faktor (von 0 bis 1, ambient + specular + diffuse = 1)
         DLLEXPORT void setAmbientFactor( float f );
@@ -297,32 +297,32 @@ namespace Framework
         //! \param viewProj Die miteinander multiplizierten Kameramatrizen
         //! \param matBuffer Ein Array mit Matrizen, der gefüllt werden soll
         //! \return Die Anzahl der Matrizen, die das Model benötigt
-        DLLEXPORT int errechneMatrizen( Mat4< float > &viewProj, Mat4< float > *matBuffer ) override;
+        DLLEXPORT int errechneMatrizen( Mat4< float >& viewProj, Mat4< float >* matBuffer ) override;
         //! Verarbeitet die vergangene Zeit
         //! \param tickval Die zeit in sekunden, die seit dem letzten Aufruf der Funktion vergangen ist
         //! \return true, wenn sich das Objekt verändert hat, false sonnst.
         DLLEXPORT virtual bool tick( double tickval ) override;
         //! Gibt die Textur zurück
-        DLLEXPORT Model3DTextur *getTextur();
+        DLLEXPORT Model3DTextur* getTextur();
         //! Gibt die Textur zurück (ohne erhöhten Reference Counter)
-        DLLEXPORT Model3DTextur *zTextur();
+        DLLEXPORT Model3DTextur* zTextur();
         //! Gibt die ModelDaten zurück
-        DLLEXPORT Model3DData *getModelData();
+        DLLEXPORT Model3DData* getModelData();
         //! Gibt die ModelDaten zurück (ohne erhöhten Reference Counter)
-        DLLEXPORT Model3DData *zModelData();
+        DLLEXPORT Model3DData* zModelData();
         //! prüft, ob ein Strahl dieses Objekt trifft
         //! \param point der startpunkt des Strahls in Weltkoordinaten
         //! \param dir die Richtung des Strahls in Weltkoordinaten
         //! \param maxSqDist Die maximale quadratische distanz die erlaubt ist
         //! \param pId die Id des Polygons, zu dem der Schnittpunkt gehört
         //! \return den quadratischen Abstand des Schnittpunktes zum Ursprung des Strahls oder -1, wenn kein schnittpunkt existiert 
-        DLLEXPORT virtual float traceRay( Vec3< float > &point, Vec3< float > &dir, float maxSqDist, int &pId ) const;
+        DLLEXPORT virtual float traceRay( Vec3< float >& point, Vec3< float >& dir, float maxSqDist, int& pId ) const;
         //! berechnet die Farbe des Schnittpunktes deines Strahls
         //! \param point der startpunkt des Strahls in Weltkoordinaten
         //! \param dir die Richtung des Strahls in Weltkoordinaten
         //! \param zWelt die Welt, aus der der Strahl kommt
         //! \return die Farbe des Schnittpunktes 
-        DLLEXPORT virtual int traceRay( Vec3< float > &point, Vec3< float > &dir, int pId, Welt3D *zWelt ) const;
+        DLLEXPORT virtual int traceRay( Vec3< float >& point, Vec3< float >& dir, int pId, Welt3D* zWelt ) const;
         //! Gibt die Id der Daten zurück, wenn sie in einer Model3DList registriert wurden. (siehe Framework::zM3DRegister())
         DLLEXPORT int getDatenId() const;
         //! Git den Factor an, mit dem das umgebungslicht (textur farbe) multipliziert wird
@@ -334,6 +334,8 @@ namespace Framework
         //! Gibt die Anzahl an Vertices zurück
         DLLEXPORT int getVertexAnzahl() const;
         //! Gibt einen Buffer mit allen Vertecies des Models zurück
-        DLLEXPORT const Vertex3D *zVertexBuffer() const;
+        DLLEXPORT const Vertex3D* zVertexBuffer() const;
+        //! Gibt true zurück wenn ein bestimmtes polygon gezeichnet werden muss
+        DLLEXPORT virtual bool needRenderPolygon( int index );
     };
 }

+ 20 - 20
UIPixelShader.h

@@ -284,10 +284,10 @@ ret
 
 const BYTE UIPixelShader[] =
 {
-     68,  88,  66,  67,  40, 227, 
-    199,  33,   0,  60,  71,  26, 
-    143, 223,  23,  54,  70,  94, 
-     57, 207,   1,   0,   0,   0, 
+     68,  88,  66,  67, 126, 158, 
+     30, 212, 156,  16, 253,  56, 
+    165,  43, 140, 104, 171,  65, 
+    127, 182,   1,   0,   0,   0, 
     132, 113,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
     124,   5,   0,   0,  12,   6, 
@@ -1544,10 +1544,10 @@ const BYTE UIPixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    138, 198, 168,  97,   1,   0, 
-      0,   0, 143,  75, 245, 205, 
-    161, 172,  86,  71, 132, 125, 
-    173, 209,  68,  86,  36,  96, 
+    213, 106, 170,  97,   1,   0, 
+      0,   0, 205,  46, 115,  22, 
+    201, 124, 195,  71, 191,  39, 
+    131, 132,  55, 196, 205, 231, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   1,   0,   0,   0, 
       1,   0,   0,   0,   0,   0, 
@@ -1719,9 +1719,9 @@ const BYTE UIPixelShader[] =
     242,  56,   1,   0,  43, 236, 
       3,   0,  28,  19,   2,   0, 
      65,  36,   1,   0, 236, 179, 
-      1,   0, 120, 255,   1,   0, 
+      1,   0, 173,  79,   0,   0, 
     125,  10,   2,   0, 125, 181, 
-      2,   0,  50,  45,   0,   0, 
+      2,   0, 223,   1,   2,   0, 
     193,  33,   3,   0,  65, 185, 
       2,   0,   9, 241,   2,   0, 
     146, 230,   3,   0, 125, 218, 
@@ -2568,8 +2568,8 @@ const BYTE UIPixelShader[] =
      84, 101, 120, 116, 117, 114, 
     101,  50,  68,  32, 115, 104, 
      97, 100,  27, 226,  48,   1, 
-    128,   0,   0,   0,  23,  16, 
-    125, 112, 126, 231, 215,   1, 
+    128,   0,   0,   0,  51,  12, 
+    251, 243, 120, 232, 215,   1, 
       1,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -3641,13 +3641,13 @@ const BYTE UIPixelShader[] =
      23,   0,   1,   0,   5,  16, 
       0,   0,  14,   0,  23,  21, 
       0,  16,   0,   0,   3,   2, 
-     80,   1,   0,   0, 242, 241, 
+    160,  90,   0,   0, 242, 241, 
      10,   0,  24,  21,   8,  16, 
       0,   0,   1,   0,   1,   0, 
      10,   0,  24,  21,   9,  16, 
       0,   0,   1,   0,   0,   2, 
      14,   0,  23,  21,   0,   0, 
-      0,   0,  10,   2,  80,   1, 
+      0,   0,  10,   2, 160,  90, 
       0,   0, 242, 241,  10,   0, 
      24,  21,  11,  16,   0,   0, 
       1,   0,   1,   0,  10,   0, 
@@ -4786,11 +4786,11 @@ const BYTE UIPixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 138, 198, 
-    168,  97,   1,   0,   0,   0, 
-    143,  75, 245, 205, 161, 172, 
-     86,  71, 132, 125, 173, 209, 
-     68,  86,  36,  96, 128,   0, 
+    148,  46,  49,   1, 213, 106, 
+    170,  97,   1,   0,   0,   0, 
+    205,  46, 115,  22, 201, 124, 
+    195,  71, 191,  39, 131, 132, 
+     55, 196, 205, 231, 128,   0, 
       0,   0,  47,  76, 105, 110, 
     107,  73, 110, 102, 111,   0, 
      47, 110,  97, 109, 101, 115, 
@@ -4890,7 +4890,7 @@ const BYTE UIPixelShader[] =
       0,   0,   2,   0,   9,   0, 
     164,   7,   0,   0,   0,   0, 
       0,   0,  68,  11,   0,   0, 
-      1,   0,  20,   1,   0,   0, 
+      1,   0, 120,  90,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,  84, 101, 
     120, 116, 117, 114, 101,  80, 

+ 15 - 15
UIVertexShader.h

@@ -119,10 +119,10 @@ ret
 
 const BYTE UIVertexShader[] =
 {
-     68,  88,  66,  67, 219, 222, 
-    160, 130,  22, 126,  13, 243, 
-     72,  30,   0,  11, 113, 201, 
-     75, 146,   1,   0,   0,   0, 
+     68,  88,  66,  67, 100, 188, 
+     86, 237,  50,  79, 224, 127, 
+     86, 114, 250, 141, 179, 128, 
+     69,  14,   1,   0,   0,   0, 
     168,  77,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
      20,   2,   0,   0, 168,   2, 
@@ -873,10 +873,10 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    139, 198, 168,  97,   1,   0, 
-      0,   0,  55, 109, 171,  77, 
-    214, 133, 101,  66, 175, 124, 
-     66, 213,  22, 223, 191,  17, 
+    214, 106, 170,  97,   1,   0, 
+      0,   0, 228,  37, 154,  17, 
+    203,  78, 175,  77, 174, 175, 
+    101, 226, 159,  47, 116,  36, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   1,   0,   0,   0, 
       1,   0,   0,   0,   0,   0, 
@@ -1556,8 +1556,8 @@ const BYTE UIVertexShader[] =
      32,  32,  32,  32,  32,  32, 
      32,  32,  32,  32,  32,  32, 
      27, 226,  48,   1, 128,   0, 
-      0,   0, 138, 214, 179, 112, 
-    126, 231, 215,   1,   1,   0, 
+      0,   0,  41,  57,  58, 244, 
+    120, 232, 215,   1,   1,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -2921,10 +2921,10 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    139, 198, 168,  97,   1,   0, 
-      0,   0,  55, 109, 171,  77, 
-    214, 133, 101,  66, 175, 124, 
-     66, 213,  22, 223, 191,  17, 
+    214, 106, 170,  97,   1,   0, 
+      0,   0, 228,  37, 154,  17, 
+    203,  78, 175,  77, 174, 175, 
+    101, 226, 159,  47, 116,  36, 
     129,   0,   0,   0,  47,  76, 
     105, 110, 107,  73, 110, 102, 
     111,   0,  47, 110,  97, 109, 
@@ -3024,7 +3024,7 @@ const BYTE UIVertexShader[] =
       0,   0,   0,   0,   2,   0, 
       9,   0,  80,   5,   0,   0, 
       0,   0,   0,   0, 236,   2, 
-      0,   0,   1,   0, 184,  76, 
+      0,   0,   1,   0, 130, 192, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
      84, 101, 120, 116, 117, 114, 

+ 28 - 25
Vec3.h

@@ -27,11 +27,11 @@ namespace Framework
         {}
         //! Konstruktor
         //! \param vect Ein Vektor, dessen Werte kopiert werden sollen
-        inline Vec3( const Vec3 &vect )
+        inline Vec3( const Vec3& vect )
             : Vec3( vect.x, vect.y, vect.z )
         {}
         //! Skalliert den Vektor, so dass er die Länge 1 hat
-        inline Vec3 &normalize()
+        inline Vec3& normalize()
         {
             const T length = getLength();
             x /= length;
@@ -41,7 +41,7 @@ namespace Framework
         }
         //! Vertaucht die Werte des Vektors mit denen eines anderen Vektor
         //! \param vect Der andere Vektor
-        inline Vec3 &swap( Vec3 &vect )
+        inline Vec3& swap( Vec3& vect )
         {
             const Vec3 tmp = vect;
             vect = *this;
@@ -51,11 +51,11 @@ namespace Framework
         //! Berechnet einen winkel zwischen diesem und einem anderen Vektor
         inline float angle( Vec3 vect )
         {
-            return lowPrecisionACos( (float)( *this * vect ) / ( (float)getLength() * (float)vect.getLength() ) );
+            return lowPrecisionACos( (float)(*this * vect) / ((float)getLength() * (float)vect.getLength()) );
         }
         //! Kopiert die Werte eines anderen Vektors
         //! \param r Der andere Vektor
-        inline Vec3 operator=( const Vec3 & r )
+        inline Vec3 operator=( const Vec3& r )
         {
             x = r.x;
             y = r.y;
@@ -64,7 +64,7 @@ namespace Framework
         }
         //! Addiert einen anderen Vektor zu diesem Hinzu
         //! \param r Der andere Vektor
-        inline Vec3 operator+=( const Vec3 & r )
+        inline Vec3 operator+=( const Vec3& r )
         {
             x += r.x;
             y += r.y;
@@ -73,7 +73,7 @@ namespace Framework
         }
         //! Zieht einen anderen Vektor von diesem ab
         //! \param r Der andere Vektor
-        inline Vec3 operator-=( const Vec3 & r )
+        inline Vec3 operator-=( const Vec3& r )
         {
             x -= r.x;
             y -= r.y;
@@ -82,7 +82,7 @@ namespace Framework
         }
         //! Skalliert diesen Vektor
         //! \param r Der Faktor
-        inline Vec3 operator*=( const T & r )
+        inline Vec3 operator*=( const T& r )
         {
             x *= r;
             y *= r;
@@ -91,7 +91,7 @@ namespace Framework
         }
         //! Skalliert diesen Vektor mit 1/Faktor
         //! \param r Der Faktor
-        inline Vec3 operator/=( const T & r )
+        inline Vec3 operator/=( const T& r )
         {
             x /= r;
             y /= r;
@@ -100,13 +100,13 @@ namespace Framework
         }
         //! Errechnet das Quadrat des Abstands zwischen zewi Vektoren
         //! \param p Der andere Vektor
-        inline T abstandSq( const Vec3 & p ) const
+        inline T abstandSq( const Vec3& p ) const
         {
-            return ( x - p.x ) * ( x - p.x ) + ( y - p.y ) * ( y - p.y ) + ( z - p.z ) * ( z - p.z );
+            return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y) + (z - p.z) * (z - p.z);
         }
         //! Errechnet den Abstand zwischen zwei Vektoren
         //! \param p Der andere Vektor
-        inline T abstand( const Vec3 & p ) const
+        inline T abstand( const Vec3& p ) const
         {
             return sqrt( abstandSq( p ) );
         }
@@ -124,7 +124,7 @@ namespace Framework
         //! Errechnet das Quadrat der Länge des Vektors
         inline T getLengthSq() const
         {
-            return *this **this;
+            return *this * *this;
         }
         //! Errechnet due Länge des Vektors
         inline T getLength() const
@@ -133,54 +133,54 @@ namespace Framework
         }
         //! Bildet das Skalarprodukt zwischen zwei Vektoren
         //! \param r Der andere Vektor
-        inline T operator*( const Vec3 & r ) const
+        inline T operator*( const Vec3& r ) const
         {
             return x * r.x + y * r.y + z * r.z;
         }
         //! Errechnet die Summe zweier Vektoren
         //! \param r Der andere Vektor
-        inline Vec3 operator+( const Vec3 & r ) const
+        inline Vec3 operator+( const Vec3& r ) const
         {
             return Vec3( *this ) += r;
         }
         //! Zieht zwei Vektoren von einander ab
         //! \param r Der andere Vektor
-        inline Vec3 operator-( const Vec3 & r ) const
+        inline Vec3 operator-( const Vec3& r ) const
         {
             return Vec3( *this ) -= r;
         }
         //! Skalliert den Vektor ohne ihn zu verändern
         //! \param r Der Faktor
-        inline Vec3 operator*( const T & r ) const
+        inline Vec3 operator*( const T& r ) const
         {
             return Vec3( *this ) *= r;
         }
         //! Skalliert den Vektor mit 1/Faktor ohne ihn zu Verändern
         //! \param r Der Faktor
-        inline Vec3 operator/( const T & r ) const
+        inline Vec3 operator/( const T& r ) const
         {
             return Vec3( *this ) /= r;
         }
         //! Überprüft zwei Vektoren auf Gleichheit
         //! \param r Der andere Vektor
-        inline bool operator==( const Vec3 & r ) const
+        inline bool operator==( const Vec3& r ) const
         {
             return x == r.x && y == r.y && z == r.z;
         }
         //! Überprüft zwei Vektoren auf Ungleichheit
         //! \param r Der andere Vektor
-        inline bool operator!=( const Vec3 & r ) const
+        inline bool operator!=( const Vec3& r ) const
         {
-            return !( *this == r );
+            return !(*this == r);
         }
         //! Gibt das Kreutzprodukt zwischen diesem und einem anderen Vector zurück
         //! \param b der andere Vector
-        inline Vec3 crossProduct( const Vec3 & b ) const
+        inline Vec3 crossProduct( const Vec3& b ) const
         {
             return Vec3( y * b.z - z * b.y, z * b.x - x * b.z, x * b.y - y * b.x );
         }
 
-        inline void rotateY( float radian )
+        inline Vec3& rotateY( float radian )
         {
             const float cosTheta = lowPrecisionCos( radian );
             const float sinTheta = lowPrecisionSin( radian );
@@ -188,9 +188,10 @@ namespace Framework
             float z = -sinTheta * this->x + cosTheta * this->z;
             this->x = (T)x;
             this->z = (T)z;
+            return *this;
         }
 
-        inline void rotateX( float radian )
+        inline Vec3& rotateX( float radian )
         {
             const float cosTheta = lowPrecisionCos( radian );
             const float sinTheta = lowPrecisionSin( radian );
@@ -198,15 +199,17 @@ namespace Framework
             float z = sinTheta * this->y + cosTheta * this->z;
             this->y = (T)y;
             this->z = (T)z;
+            return *this;
         }
 
-        inline void rotateZ( float radian )
+        inline Vec3& rotateZ( float radian )
         {
             const float cosTheta = lowPrecisionCos( radian );
             const float sinTheta = lowPrecisionSin( radian );
             float x = cosTheta * this->x + -sinTheta * this->y;
             this->x = (T)x;
             this->z = (T)z;
+            return *this;
         }
     };
 }