| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- =============
- Update planes
- =============
- planetrf = 22* 14+
- updatealltileplanes = planetrf * (15 + 15 + 256 * 2)
- sum = 11924* 7588+
- =============
- transform everything else
- =============
- 100 lights
- 1000 other spatials
- trfaabb = 30* 27+
- lighttrf = 900* 600+
- otherspatialstrf = 30000* 27000+
- =============
- transform them for 2D checks
- =============
- mat4mulvec4 = 16* 12+
- alllights = 3200* 2400+
- otherspatial = 128000* 96000+
- function create_tiles
-
- end
- algorithm cs aabb fr
- MAX_POINTS = 8
- pointsWorld[MAX_POINTS]
- if cs.type is pespective frustum
- pointsWorld[...] = get the 5 points
- n = 5
- else
- pointsWorld[...] = get the 8 aabb points
- n = 8
- end
- pointsNdc[MAX_POINTS]
- minZ, maxZ
- for i in (0, n)
- pointsNdc[i] = fr.projectionMat * pointsWorld[i]
- pointsNdc[i] /= pointsNdc[i].w
- update minZ and maxZ
- end
- edges = convexHull2D(pointsNdc, n)
- depth = log 2 TILES
- for edge in edges
- do_edge edge -1..1, -1..1 depth
- end
- end
- do_edge edge min max depth
- if min and max not inside min max
- return
- end
- if depth == 0
- mark visible
- endif
- center = (min + max) / 2
- inside[4] = false
- if center left of edge
- // right up
- p = max
- if p is left of edge
- inside[0] = true;
- end
- // center top
- p = center.x, max.y
- if p is left of edge
- inside[0] = true;
- inside[1] = true;
- end
- // left top
- p = min.x, max.y
- if p is left of edge
- inside[1] = true;
- end
- // blah blah
- else
- inside[all] = true
- end
-
- for all that are inside
- do_edge new_min new_max depth - 1
- end
- end
|