void ExternalRenderer::drawBitmapBlock(TriStorageBlock& block, unsigned int pass, vec4x* triangleData, const MC2BoundingBox& box, OverlapDetector<MC2BoundingBox>& detector, TileMapContainer& tileMapCont, TileMapFormatDesc& formatDesc, bool skipOutlines) { if(pass == 0) { return; } for(std::vector<TriSection>::iterator sectIt = block.primitives.begin(); sectIt != block.primitives.end(); sectIt++){ TriSection& section = *sectIt; TilePrimitiveFeature& feat = *section.src; const TileFeatureArg* arg = feat.getArg( TileArgNames::coord ); const CoordArg* coordArg = static_cast<const CoordArg*>( arg ); MC2Coordinate coord = coordArg->getCoord(); if( box.contains( coord ) ) { const StringArg* bitMapName = static_cast<const StringArg*> ( feat.getArg(TileArgNames::image_name) ); if ( bitMapName == NULL ) { continue; } TextureBlock* texture = static_cast<TextureBlock*>( m_impl->mapHandler->getOrRequestBitMap( bitMapName->getValue() ) ); if ( texture != NULL ) { MC2Point position; transform(position, coord); /** * We subtract the anchor position, to position the texture * on the anchor instead of the top left corner. */ PixelBox overlapBox = texture->boundingBox; MC2Point topLeft = overlapBox.getTopLeft(); MC2Point bottomRight = overlapBox.getBottomRight(); overlapBox.set( topLeft, bottomRight ); overlapBox.move( MC2Point( position.getX(), position.getY() ) ); bool notOverlapping = true; notOverlapping = detector.addIfNotOverlapping( overlapBox ); if (notOverlapping) { drawSprite( texture, position, 0.0f, texture->centerOffset, 1.0f, 1.0f); feat.setDrawn( true ); } } } } }