ray:: reflective walls (turned off)

This commit is contained in:
Zeno Rogue 2019-10-26 10:55:19 +02:00
parent ee06fdc326
commit deb98cba7f
1 changed files with 11 additions and 0 deletions

View File

@ -106,6 +106,8 @@ void reset_raycaster() { our_raycaster = nullptr; };
void enable_raycaster() {
if(!our_raycaster) {
bool use_reflect = false;
string vsh =
"attribute vec4 aPosition;\n"
"uniform float uFovX, uFovY;\n"
@ -301,6 +303,9 @@ void enable_raycaster() {
"vec4 tan2 = tangent + acc * dist / 2.;\n"
"vec4 acc2 = christoffel(pos2, tan2, tan2);\n"
"vec4 nposition = position + tangent * dist + acc2 / 2. * dist * dist;\n";
if(use_reflect) fmain +=
"bool reflect = false;\n";
if(nil) {
fmain +=
@ -407,6 +412,12 @@ void enable_raycaster() {
if(nil) fmain +=
" if(abs(abs(position.x)-abs(position.y)) < .005) col.xyz /= 2.;\n";
if(use_reflect) fmain +=
" if(col.w == 1.) {\n"
" col.w = 0.9;\n"
" reflect = true;\n"
" }\n";
fmain +=
" gl_FragColor.xyz += left * col.xyz * col.w;\n"
" if(col.w == 1.) return;\n"