//----------------------------------------------------------------------------- void ZonePlugin::zoneUtility( void ) { const osScalar drawExtent = _zoneExtent.x * OS_SCALAR( 2.0 ) - 0.005f; if( 1 == _solid ) { // colors for checkerboard const Color gray(0.27f); Color zoneGray( getZoneColor() ); zoneGray.setR( zoneGray.r() * gray.r() ); zoneGray.setG( zoneGray.g() * gray.g() ); zoneGray.setB( zoneGray.b() * gray.b() ); // draw checkerboard grid drawXZCheckerboardGrid( drawExtent, 10, position(), zoneGray, gray); #if 0 AABBox kZoneAABBox; kZoneAABBox.initializeWithCenterAndExtent( position(), _zoneExtent ); kZoneAABBox.draw( getZoneColor() ); #endif } else { // alternate style drawXZLineGrid( drawExtent, 1, position(), _ZoneColor ); } const osScalar borderWidth = getBorderWidth(); if( borderWidth > 0 ) { drawXZLineGrid( drawExtent + borderWidth * OS_SCALAR( 2.0 ), 1, position(), _BorderColor ); } }
bool ZonePlugin::isVehicleInsideBorder( const AbstractVehicle& vehicle ) const { osVector3 checkZoneExtent = _zoneExtent; checkZoneExtent.x += _borderWidth; checkZoneExtent.z += _borderWidth; AABBox testBox; testBox.initializeWithCenterAndExtent( position(), checkZoneExtent ); return testBox.insideXZWithRadius(vehicle); }