Changeset 484


Ignore:
Timestamp:
12/27/05 20:35:04 (18 years ago)
Author:
mattausch
Message:

work around preprocessor bug

Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r483 r484  
    146146        loadFromFile false 
    147147        #type kdTree 
    148         #type vspKdTree 
     148        type vspKdTree 
    149149        #type bspTree 
    150         type vspBspTree 
     150        #type vspBspTree 
    151151         
    152152        #type sceneDependent 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r483 r484  
    286286        ViewCellContainer viewcells; 
    287287         
    288         /*Vector3 origin = ray.mOrigin; 
    289         Vector3 termination = ray.mTermination; 
    290         static Ray hray; 
     288        Ray hray(ray); 
    291289        float tmin = 0, tmax = 1.0; 
    292         hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
    293         GetSceneBbox().ComputeMinMaxT(hray, &tmin, &tmax); 
    294         if (tmin >= tmax) 
     290        // matt TODO: remove this!! 
     291        //hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
     292 
     293        if (!GetSceneBbox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
    295294                return; 
    296295 
    297         if (tmin > 0.0f) 
    298                 origin = ray.Extrap(tmin); 
    299          
    300         if (tmax < 1.0f) 
    301                 termination = ray.Extrap(tmax);*/ 
    302          
    303         CastLineSegment(ray.mOrigin, 
    304                                         ray.mTermination, 
     296        Vector3 origin = hray.Extrap(tmin); 
     297        Vector3 termination = hray.Extrap(tmax); 
     298         
     299        CastLineSegment(origin, 
     300                                        termination, 
    305301                                        viewcells); 
    306302         
     
    16991695        { 
    17001696                VssRay *vssRay = *it; 
     1697                 
     1698                Ray hray(*vssRay); 
     1699                float tmin = 0, tmax = 1.0; 
     1700         
     1701                //hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
     1702 
     1703                if (!GetSceneBbox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
     1704                        continue; 
     1705 
     1706                Vector3 origin = hray.Extrap(tmin); 
     1707                Vector3 termination = hray.Extrap(tmax); 
     1708         
    17011709                BspRay *ray = new BspRay(vssRay); 
    17021710 
     
    17041712 
    17051713                // cast line segment and store intersections with the rays 
    1706                 CastLineSegment(vssRay->mTermination, vssRay->mOrigin, viewCells); 
     1714                CastLineSegment(origin, termination, viewCells); 
    17071715 
    17081716                ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r483 r484  
    229229        mBox.Initialize();      // initialise BSP tree bounding box 
    230230 
     231        if (forcedBoundingBox) 
     232                mBox = *forcedBoundingBox; 
     233         
    231234        PolygonContainer polys; 
    232235        RayInfoContainer *rays = new RayInfoContainer(); 
     
    245248                VssRay *ray = *rit; 
    246249 
    247                 if (ray->mTerminationObject && !ray->mTerminationObject->Mailed()) 
     250                if ((mBox.IsInside(ray->mTermination) || !forcedBoundingBox) && 
     251                        ray->mTerminationObject &&  
     252                        !ray->mTerminationObject->Mailed()) 
    248253                { 
    249254                        ray->mTerminationObject->Mail(); 
    250255                        MeshInstance *obj = dynamic_cast<MeshInstance *>(ray->mTerminationObject); 
    251256                        AddMeshToPolygons(obj->GetMesh(), polys, obj); 
    252                 } 
    253  
    254                 if (ray->mOriginObject && !ray->mOriginObject->Mailed()) 
     257                        //-- compute bounding box 
     258                        if (!forcedBoundingBox) 
     259                                mBox.Include(ray->mTermination); 
     260                } 
     261 
     262                if ((mBox.IsInside(ray->mOrigin) || !forcedBoundingBox) && 
     263                        ray->mOriginObject &&  
     264                        !ray->mOriginObject->Mailed()) 
    255265                { 
    256266                        ray->mOriginObject->Mail(); 
    257267                        MeshInstance *obj = dynamic_cast<MeshInstance *>(ray->mOriginObject); 
    258268                        AddMeshToPolygons(obj->GetMesh(), polys, obj); 
     269                        //-- compute bounding box 
     270                        if (!forcedBoundingBox) 
     271                                mBox.Include(ray->mOrigin); 
    259272                } 
    260273        } 
    261274 
    262275        //-- compute bounding box 
    263         if (forcedBoundingBox) 
    264                 mBox = *forcedBoundingBox; 
    265         else 
    266                 Polygon3::IncludeInBox(polys, mBox); 
     276        //if (!forcedBoundingBox) Polygon3::IncludeInBox(polys, mBox); 
    267277 
    268278        //-- store rays 
Note: See TracChangeset for help on using the changeset viewer.