-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Ported over portal fixes - now supports up to 65536 portals as orig…
…inally intended. * Ported over "8-bit interpolated" color mode. * Ported over shader refactoring to pull out common functionality such as lighting and texture sampling. * Ported over UI refactoring for "setting templates." * Ported over fixes to GPU renderer index buffer (now 32-bit, supports the proper number of indices/vertices). * Fixed wireframe so it works properly in Release. * Fixed wireframe so 3D objects, sector geometry, and sprites are all solid color and color coded.
- Loading branch information
Showing
23 changed files
with
756 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Adjust the output | ||
vec2 bilinearSharpness(vec2 uv, float sharpness) | ||
{ | ||
// Sharpness == 0 is the same as standard bilinear. | ||
if (sharpness == 0.0) { return uv; } | ||
|
||
// Sharpness == 1 adjust the filter width based on the per-pixel texel size in order | ||
// to approximate "antialised point-sampling". | ||
if (sharpness == 1.0) | ||
{ | ||
vec2 w = fwidth(uv); | ||
float scale = 0.5; | ||
float mag = clamp(-log2(dot(w, w))*scale, 0.0, 1.0); | ||
sharpness = mag * 0.5 + 0.5; | ||
} | ||
|
||
// Adjust the sub-texel sample position by mapping the linear change to an exponentiated S-Curve. | ||
float ex = max(1.0, (sharpness - 0.5) * 32.0); | ||
vec2 st = fract(uv); | ||
vec2 stAdj = pow(uv*uv*(3.0 - 2.0*st), vec2(ex)); | ||
st = mix(st, stAdj, min(1.0, sharpness*2.0)); | ||
|
||
// The final texture coordinate is the integer position + adjusted sub-texel position. | ||
return floor(uv) + st; | ||
} | ||
|
||
float computeMipLevel(vec2 uv) | ||
{ | ||
vec2 dx = dFdx(uv); | ||
vec2 dy = dFdy(uv); | ||
float maxSq = max(dot(dx, dx), dot(dy, dy)); | ||
return 0.5 * log2(maxSq); // same as log2(maxSq^0.5) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.