Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Content count

  • Joined

  • Last visited

Everything posted by AngryCPPCoder

  1. AngryCPPCoder

    Deciphering R_ScaleFromGlobalAngle

    Hello, I have spent so much time trying to understand R_ScaleFromGlobalAngle, I have documented all my notes here https://github.com/amroibrahim/DIYDoom/tree/Week015/tutorial my theories are slightly different than others :D Anyone is welcome to comment or even let me know if they think it is wrong! Hope to hear some feedback.
  2. AngryCPPCoder

    Deciphering R_ScaleFromGlobalAngle

    Anyone can shade some light on the math behind the polar coordinates mapping/projection?
  3. First, I'm happy to discuss and correct my understanding so don't worry about that point. 1- About the first the BSP traversal does use the player coordinates as a vector, so the player X, Y does make a difference in your traversal, (also the goal of the BSP traversal is to get to the sector closest to the player) Please correct me if you think this is not true. 2-Yes the code comment is misleading, let have a look at this code side = R_PointOnSide (viewx, viewy, bsp); // Recursively divide front space. (This comment is misleading and not true) R_RenderBSPNode (bsp->children[side]); if Side is true or false (front or back) you will still execute the R_RenderBSPNode but passing a different side, so you will call R_RenderBSPNode with sometimes Front and sometimes the back. This makes the above comment misleading which indicated front only space. If you think something I miss understood, please help me clarify my understanding and I will credit you for the correction.
  4. Just to clarify things to whoever needs to understand why this is a depth first search that looks like a "breadth first". The misconception of breadth first comes from visualizing what happens we render the walls closest to player to furthest, you can visualize this as a circle growing around the player giving the illusion of breadth first traversal, but that is not true. That illusion is due to how the data is stored in the BSP tree and how we visualize it. Most of the BSP data is used splitting the map and only leaf nodes are the ones we really care about or use in rendering. * How BSP is traversed by mixing Pre and Post order tree traversal or as I see it a modified binary search which are all a depth first traversal. * Breadth first algorithm requires a queue to keep tack of the tree breadth, which is not there in BSP traversal.
  5. That is not true, depth first is correct. the traversal goes left and right in tree until you find the player (that is depth) and then you go opposite direction based on your path in stack Link1, Link2.