GetScreenWidth() private method

private GetScreenWidth ( ) : float
return float
Exemplo n.º 1
0
 public void SetBackgroundResolution(Camera mainCamera, GUITexture myGUITexture)
 {
     Rect temp = myGUITexture.pixelInset;
     temp.height = mainCamera.GetScreenHeight();
     temp.width = mainCamera.GetScreenWidth();
     temp.y = -(mainCamera.GetScreenHeight()/2);
     temp.x = -(mainCamera.GetScreenWidth()/2);
     myGUITexture.pixelInset = temp;
 }
Exemplo n.º 2
0
    public void RecalcLOD( Camera cam )
    {
        if ( !_started )
        {
            Start();
        }

        boundsMin = boundsCenter - _bounds.extents;
        boundsMax = boundsCenter + _bounds.extents;
        boundsMin = _transform.TransformPoint(boundsMin);
        boundsMax = _transform.TransformPoint(boundsMax);

        Vector3 screenMin = cam.WorldToScreenPoint(boundsMin);
        Vector3 screenMax = cam.WorldToScreenPoint(boundsMax);

        Vector3 diff = screenMax - screenMin;

        float heightPerc = Mathf.Abs(diff.y) / cam.GetScreenHeight();
        float widthPerc = Mathf.Abs(diff.x) / cam.GetScreenWidth();

        percentageSizeOnScreen = heightPerc > widthPerc ? heightPerc : widthPerc;

        LODLevel newLevel = LODLevel.LOD0;

        if ( percentageSizeOnScreen >= _LODSizes[2] )
        {
            newLevel = LODLevel.LOD0;
        }
        else if ( percentageSizeOnScreen >= _LODSizes[1] )
        {
            newLevel = LODLevel.LOD1;
        }
        else if ( percentageSizeOnScreen >= _LODSizes[0] )
        {
            newLevel = LODLevel.LOD2;
        }
        else
        {
            newLevel = LODLevel.LODCulled;
        }

        newLevel = EnableLODRenderers(newLevel);

        level = newLevel;
    }