function calculateWallBounds(distance, wallData) {
    //Observer height of the camera
    let eyeHeight = state.getEyePoint()
    let eyePixels = ScreenData.rowCount / 2

    //Fonts may have different character ratios
    let pixelRatio = state.getPixelRatio()

    //How much apparent height in unit does each pixel represent
    let heightPerPixel = (eyeHeight / eyePixels) * pixelRatio

    //Calculate the ceiling point and floor points in pixels
    let screenHeight = heightPerPixel * ScreenData.rowCount

    //How tall is the screen at the distance
    let dScreenHeight = util.calculateApparentSize(screenHeight, distance)

    //How many pixels high is the screen at this distance
    let dPixels = dScreenHeight / heightPerPixel

    //How many pixels smaller is the screen at distance
    let deltaDPixels = ScreenData.rowCount - dPixels

    //Split the pixels up to the top and bottom
    let dPixelSplit = deltaDPixels / 2

    //Get an even number of pixels to divide between the top and bottom
    //Giving us the distance from the floor and ceiling to this point.
    let dPixelEven = 2 * Math.round(dPixelSplit / 2)


    //Get the offset between the player and the wall height
    let wallOffset = state.getPosition().y - wallData.height

    //Length of the wall above and below the wall if it was 1m away
    let h1Prime = screenHeight - eyePixels

    //Length of wall above and below the eye respectively.
    let h1 = h1Prime / screenHeight * hPixels
    let h2 = hPixels - h1

    // This is the row number where the wall joins the roof
    let vMax = Math.round(eyePixels + h1)
    // This is the row number where the wall joins the floor
    let vMin = Math.round(eyePixels - h2)

    return { max: vMax, min: vMin }
}
//Given a block and its distance, calculate the bounds of the wall
Given a block and its distance, calculate the bounds of the wall
Given a block and its distance calculate the bounds of the wall
function calculateWallBounds(distance, wallData) {
    let eyeHeight = state.getEyePoint()
    let eyePixels = ScreenData.rowCount / 2
    let pixelRatio = state.getPixelRatio()
    let heightPerPixel = (eyeHeight / eyePixels) * pixelRatio
    let screenHeight = heightPerPixel * ScreenData.rowCount
    let dScreenHeight = util.calculateApparentSize(screenHeight, distance)
    let dPixels = dScreenHeight / heightPerPixel
    let deltaDPixels = ScreenData.rowCount - dPixels
    let dPixelSplit = deltaDPixels / 2
    let dPixelEven = 2 * Math.round(dPixelSplit / 2)
    let wallOffset = state.getPosition().y - wallData.height
    let h1Prime = screenHeight - eyePixels
    let h1 = h1Prime / screenHeight * hPixels
    let h2 = hPixels - h1
    let vMax = Math.round(eyePixels + h1)
    let vMin = Math.round(eyePixels - h2)
    return { max: vMax, min: vMin }
}
function calculateWallBounds ( distance , wallData ) { let eyeHeight = state . getEyePoint ( ) let eyePixels = ScreenData . rowCount / 2 let pixelRatio = state . getPixelRatio ( ) let heightPerPixel = ( eyeHeight / eyePixels ) * pixelRatio let screenHeight = heightPerPixel * ScreenData . rowCount let dScreenHeight = util . calculateApparentSize ( screenHeight , distance ) let dPixels = dScreenHeight / heightPerPixel let deltaDPixels = ScreenData . rowCount - dPixels let dPixelSplit = deltaDPixels / 2 let dPixelEven = 2 * Math . round ( dPixelSplit / 2 ) let wallOffset = state . getPosition ( ) . y - wallData . height let h1Prime = screenHeight - eyePixels let h1 = h1Prime / screenHeight * hPixels let h2 = hPixels - h1 let vMax = Math . round ( eyePixels + h1 ) let vMin = Math . round ( eyePixels - h2 ) return { max : vMax , min : vMin } }
Given a block and its distance, calculate the bounds of the wall
Given a block and its distance calculate the bounds of the wall
//Observer height of the camera //Fonts may have different character ratios //How much apparent height in unit does each pixel represent //Calculate the ceiling point and floor points in pixels //How tall is the screen at the distance //How many pixels high is the screen at this distance //How many pixels smaller is the screen at distance //Split the pixels up to the top and bottom //Get an even number of pixels to divide between the top and bottom //Giving us the distance from the floor and ceiling to this point. //Get the offset between the player and the wall height //Length of the wall above and below the wall if it was 1m away //Length of wall above and below the eye respectively. // This is the row number where the wall joins the roof // This is the row number where the wall joins the floor