Beispiel #1
0
bool TerrainBlock::castRay(const Point3F &start, const Point3F &end, RayInfo *info)
{
   if( castRayI(start, end, info, false) )
   {
      // Set intersection point.

      info->setContactPoint( start, end );

      // Set material at contact point.

      Point2I gridPos = getGridPos( info->point );
      info->material = getMaterialInst( gridPos.x & BlockMask, gridPos.y & BlockMask );

      return true;
   }
   else
      return false;
}
Beispiel #2
0
bool TerrainBlock::castRay(const Point3F &start, const Point3F &end, RayInfo *info)
{
	PROFILE_SCOPE( TerrainBlock_castRay );

   if ( !castRayI(start, end, info, false) )
      return false;
      
   // Set intersection point.
   info->setContactPoint( start, end );
   getTransform().mulP( info->point );    // transform to world coordinates for getGridPos

   // Set material at contact point.
   Point2I gridPos = getGridPos( info->point );
   U8 layer = mFile->getLayerIndex( gridPos.x, gridPos.y );
   info->material = mFile->getMaterialMapping( layer );

   return true;
}