Ticket #1680: small.patch

File small.patch, 3.1 KB (added by pragma, 12 years ago)
  • source/graphics/GameView.cpp

     
    515515    const ssize_t patchesPerSide = pTerrain->GetPatchesPerSide();
    516516
    517517    // find out which patches will be drawn
     518    CPatch * patch = NULL;
     519    CPatch *nPatch = NULL;
     520    float waterHeight;
     521    CBoundingBoxAligned bounds;
     522   
    518523    for (ssize_t j=0; j<patchesPerSide; j++) {
    519524        for (ssize_t i=0; i<patchesPerSide; i++) {
    520             CPatch* patch=pTerrain->GetPatch(i,j);  // can't fail
     525            patch=pTerrain->GetPatch(i,j);  // can't fail
    521526
    522527            // If the patch is underwater, calculate a bounding box that also contains the water plane
    523             CBoundingBoxAligned bounds = patch->GetWorldBounds();
    524             float waterHeight = g_Renderer.GetWaterManager()->m_WaterHeight + 0.001f;
     528            bounds = patch->GetWorldBounds();
     529            waterHeight = g_Renderer.GetWaterManager()->m_WaterHeight + 0.001f;
     530           
    525531            if(bounds[1].Y < waterHeight) {
    526532                bounds[1].Y = waterHeight;
    527533            }
     
    533539                patch->setDrawState(true);
    534540
    535541                // set the renderstate for the neighbors
    536                 CPatch *nPatch;
    537542
    538543                nPatch = pTerrain->GetPatch(i-1,j-1);
    539544                if(nPatch) nPatch->setDrawState(true);
     
    567572    {
    568573        for (ssize_t i=0; i<patchesPerSide; i++)
    569574        {
    570             CPatch* patch=pTerrain->GetPatch(i,j);  // can't fail
     575            patch=pTerrain->GetPatch(i,j);  // can't fail
    571576            if(patch->getDrawState() == true)
    572577            {
    573578                c->Submit(patch);
  • source/graphics/Frustum.cpp

     
    9595}
    9696bool CFrustum::IsSphereVisible (const CVector3D &center, float radius) const
    9797{
     98   float Dist;
     99   
    98100    for (size_t i=0; i<m_NumPlanes; i++)
    99101    {
    100         float Dist = m_aPlanes[i].DistanceToPlane (center);
     102        Dist = m_aPlanes[i].DistanceToPlane (center);
    101103       
    102104        //is it behind the plane
    103105        if (Dist < 0)
  • source/graphics/Camera.cpp

     
    415415
    416416    // intermediate planes
    417417    CVector3D intermediatePoints[4];
    418     for(int i = 0; i < intermediates; ++i)
    419     {
    420         float t = (i+1.0)/(intermediates+1.0);
    421418
    422         for(int j = 0; j < 4; ++j)
    423             intermediatePoints[j] = nearPoints[j]*t + farPoints[j]*(1.0-t);
     419   float t;
     420   
     421   for(int i = 0; i < intermediates; ++i)
     422   { 
     423      t = (i+1.0)/(intermediates+1.0);
     424     
     425       for(int j = 0; j < 4; ++j)
     426           intermediatePoints[j] = nearPoints[j]*t + farPoints[j]*(1.0-t);
    424427
    425         glBegin(GL_POLYGON);
    426             glVertex3fv(&intermediatePoints[0].X);
    427             glVertex3fv(&intermediatePoints[1].X);
    428             glVertex3fv(&intermediatePoints[2].X);
    429             glVertex3fv(&intermediatePoints[3].X);
    430         glEnd();
    431     }
     428       glBegin(GL_POLYGON);
     429           glVertex3fv(&intermediatePoints[0].X);
     430           glVertex3fv(&intermediatePoints[1].X);
     431           glVertex3fv(&intermediatePoints[2].X);
     432           glVertex3fv(&intermediatePoints[3].X);
     433       glEnd();
     434   }
    432435#endif
    433436}