mirror of
https://github.com/storytold/spark.git
synced 2026-10-09 00:09:53 +00:00
Support logarithmic depth buffer (#199)
* Support `logarithmicDepthBuffer` * Use `#include <logdepthbuf_pars_vertex>` * use includes everywhere if possible or reasonable
This commit is contained in:
committed by
GitHub
parent
589b6bcc00
commit
018a3ed422
@@ -3,6 +3,7 @@ precision highp float;
|
||||
precision highp int;
|
||||
|
||||
#include <splatDefines>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
|
||||
uniform float near;
|
||||
uniform float far;
|
||||
@@ -93,4 +94,5 @@ void main() {
|
||||
fragColor = rgba;
|
||||
#endif
|
||||
}
|
||||
#include <logdepthbuf_fragment>
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ precision highp int;
|
||||
precision highp usampler2DArray;
|
||||
|
||||
#include <splatDefines>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
|
||||
attribute uint splatIndex;
|
||||
|
||||
@@ -35,6 +36,12 @@ uniform float focalAdjustment;
|
||||
uniform usampler2DArray packedSplats;
|
||||
uniform vec4 rgbMinMaxLnScaleMinMax;
|
||||
|
||||
#ifdef USE_LOGDEPTHBUF
|
||||
bool isPerspectiveMatrix( mat4 m ) {
|
||||
return m[ 2 ][ 3 ] == - 1.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
// Default to outside the frustum so it's discarded if we return early
|
||||
gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
|
||||
@@ -215,4 +222,5 @@ void main() {
|
||||
vSplatUv = position.xy * maxStdDev;
|
||||
vNdc = ndc;
|
||||
gl_Position = vec4(ndc.xy * clipCenter.w, clipCenter.zw);
|
||||
#include <logdepthbuf_vertex>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user