Ejemplo n.º 1
0
void CCCameraBase::scanFOVBounds()
{	
    for( uint i=0; i<max_fov_scans; ++i )
    {
        if( i == scan_flat )
        {
            CCMatrixLoadIdentity( modelViewMatrix );
            CCMatrixRotate( modelViewMatrix, CCAppManager::GetOrientation().current, 0.0f, 0.0f, 1.0f );
            GluLookAt( modelViewMatrix,
                       position.x, position.y, position.z,	// Position
                       lookAt.x, lookAt.y, lookAt.z,		// Looking At
                       0.0f, 1.0f, 0.0f );					// Up
        }
        
        static CCVector3 minPlane, maxPlane;
        project3DZ( &minPlane, 0.0f, 1.0f );
        project3DZ( &maxPlane, 1.0f, 0.0f );
        
        FOVBounds &bounds = fovBounds[i];
        bounds.size.x = fabsf( maxPlane.x - minPlane.x );
        bounds.size.y = fabsf( maxPlane.y - minPlane.y );
        bounds.min.x = minPlane.x;
        bounds.min.y = minPlane.y;
        bounds.max.x = maxPlane.x;
        bounds.max.y = maxPlane.y;
    }
}
void CCCameraBase::scanFOVBounds()
{	
    for( uint i=0; i<max_fov_scans; ++i )
    {
        if( i == scan_flat )
        {
            CCMatrixLoadIdentity( modelViewMatrix );
            CCMatrixRotate( modelViewMatrix, gEngine->renderer->orientation.current, 0.0f, 0.0f, 1.0f );
            GluLookAt( modelViewMatrix,
                       position.x, position.y, position.z,	// Position
                       lookAt.x, lookAt.y, lookAt.z,		// Looking At
                       0.0f, 1.0f, 0.0f );					// Up
        }
        
        static CCVector3 minPlane, maxPlane;
        project3DZ( &minPlane, 0.0f, 1.0f );
        project3DZ( &maxPlane, 1.0f, 0.0f );
        
        FOVScan &fovScan = fovScans[i];
        fovScan.size.x = fabsf( maxPlane.x - minPlane.x );
        fovScan.size.y = fabsf( maxPlane.y - minPlane.y );
        fovScan.min.x = minPlane.x;
        fovScan.min.y = minPlane.y;
        fovScan.max.x = maxPlane.x;
        fovScan.max.y = maxPlane.y;
    }
}