void ProcTexTerrainRender::computeTexturesRecursive( ID3D11Device* pD3DDevice, ATLAS *atlas, PROCTEX_SURFACEPARAM &surface, int depth, 
	RenderTarget2D* currentCoverage, int additionalFlags) {
		
		// if this is our first layer, we do not need to evaluate constraints, but resample the height map
		if ( depth == 0 )
		{
			addTextureLayerRoot( pD3DDevice, atlas, surface, Color2RT->RTView, HeightCoverageLayerRT[ depth ]->RTView );
			lastHeightCoverage = HeightCoverageLayerRT[ depth ];
		}
		// ok, just add another layer
		{
			addTextureLayer( pD3DDevice, atlas, surface,
				Color2RT->SRView, HeightCoverageRT->SRView, HeightCoverageLayerRT[ depth - 1]->SRView, 
				Color2RT->RTView, HeightCoverageLayerRT[ depth ]->RTView );
			lastHeightCoverage = HeightCoverageLayerRT[ depth ];
		}

		// and don't forget child surface nodes
		for ( int i = 0; i < surface.nChilds; i++ )
		{
			int addFlags = 0;

			if ( i == surface.nChilds - 1 )
				if ( additionalFlags & NO_MORE_ON_THIS_LEVEL || depth == 0 )
					addFlags |= NO_MORE_ON_THIS_LEVEL;

			computeTexturesRecursive( pD3DDevice, atlas, *surface.child[ i ], depth + 1, HeightCoverageLayerRT[ depth - 1 ], addFlags );
		}
}
 /**
 Adds a new texture layer with the given texture to the list.
 \tparam T Specifies the texture-layer class.
 \param[in] Tex Pointer to the texture object which is to be added. By default null.
 \param[in] Layer Specifies the texture layer index.
 \see TextureLayer
 \see TextureLayerStandard
 \see TextureLayerRelief
 */
 template <class T> T* addTexture(Texture* Tex = 0, const u8 Layer = TEXLAYER_LAST)
 {
     T* NewTexLayer = new T();
     addTextureLayer(NewTexLayer, Tex, Layer);
     return NewTexLayer;
 }