mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	asonov:: mirrors in ray
This commit is contained in:
		| @@ -88,7 +88,7 @@ struct raycaster : glhr::GLprogram { | |||||||
|   GLint uStart, uStartid, uM, uLength, uFovX, uFovY, uIPD; |   GLint uStart, uStartid, uM, uLength, uFovX, uFovY, uIPD; | ||||||
|   GLint uWallstart, uWallX, uWallY; |   GLint uWallstart, uWallX, uWallY; | ||||||
|   GLint tConnections, tWallcolor, tTextureMap; |   GLint tConnections, tWallcolor, tTextureMap; | ||||||
|   GLint uBinaryWidth, uPLevel, uLP, uStraighten; |   GLint uBinaryWidth, uPLevel, uLP, uStraighten, uReflectX, uReflectY; | ||||||
|   GLint uLinearSightRange, uExpStart, uExpDecay; |   GLint uLinearSightRange, uExpStart, uExpDecay; | ||||||
|   GLint uBLevel; |   GLint uBLevel; | ||||||
|    |    | ||||||
| @@ -110,6 +110,8 @@ struct raycaster : glhr::GLprogram { | |||||||
|     uStraighten =  glGetUniformLocation(_program, "uStraighten"); |     uStraighten =  glGetUniformLocation(_program, "uStraighten"); | ||||||
|     uPLevel = glGetUniformLocation(_program, "uPLevel"); |     uPLevel = glGetUniformLocation(_program, "uPLevel"); | ||||||
|     uLP = glGetUniformLocation(_program, "uLP"); |     uLP = glGetUniformLocation(_program, "uLP"); | ||||||
|  |     uReflectX = glGetUniformLocation(_program, "uReflectX"); | ||||||
|  |     uReflectY = glGetUniformLocation(_program, "uReflectY"); | ||||||
|  |  | ||||||
|     uLinearSightRange = glGetUniformLocation(_program, "uLinearSightRange"); |     uLinearSightRange = glGetUniformLocation(_program, "uLinearSightRange"); | ||||||
|     uExpDecay = glGetUniformLocation(_program, "uExpDecay"); |     uExpDecay = glGetUniformLocation(_program, "uExpDecay"); | ||||||
| @@ -135,7 +137,7 @@ void enable_raycaster() { | |||||||
|   deg = S7; if(prod) deg += 2; |   deg = S7; if(prod) deg += 2; | ||||||
|   if(!our_raycaster) {  |   if(!our_raycaster) {  | ||||||
|     bool asonov = hr::asonov::in(); |     bool asonov = hr::asonov::in(); | ||||||
|     bool use_reflect = reflect_val && !nil && !levellines && !asonov; |     bool use_reflect = reflect_val && !nil && !levellines; | ||||||
|  |  | ||||||
|     string vsh =  |     string vsh =  | ||||||
|       "attribute vec4 aPosition;\n" |       "attribute vec4 aPosition;\n" | ||||||
| @@ -682,7 +684,23 @@ void enable_raycaster() { | |||||||
|         "  tangent = xpush(x) * xtan;\n" |         "  tangent = xpush(x) * xtan;\n" | ||||||
|         "  continue;\n" |         "  continue;\n" | ||||||
|         "  }\n"; |         "  }\n"; | ||||||
|       if(sol && !nih) fmain +=  |       if(asonov) { | ||||||
|  |         fmain +=  | ||||||
|  |           "  if(reflect) {\n" | ||||||
|  |           "    if(which == 4 || which == 10) tangent = refl(tangent, position.z, uReflectX);\n" | ||||||
|  |           "    else if(which == 5 || which == 11) tangent = refl(tangent, position.z, uReflectY);\n" | ||||||
|  |           "    else tangent.z = -tangent.z;\n" | ||||||
|  |           "    }\n"; | ||||||
|  |         fsh +=  | ||||||
|  |           "uniform vec4 uReflectX, uReflectY;\n" | ||||||
|  |           "vec4 refl(vec4 t, float z, vec4 r) {\n" | ||||||
|  |             "t.x *= exp(z); t.y /= exp(z);\n" | ||||||
|  |             "t -= dot(t, r) * r;\n" | ||||||
|  |             "t.x /= exp(z); t.y *= exp(z);\n" | ||||||
|  |             "return t;\n" | ||||||
|  |             "}\n";            | ||||||
|  |         } | ||||||
|  |       else if(sol && !nih && !asonov) fmain +=  | ||||||
|         "  if(reflect) {\n" |         "  if(reflect) {\n" | ||||||
|         "    if(which == 0 || which == 4) tangent.x = -tangent.x;\n" |         "    if(which == 0 || which == 4) tangent.x = -tangent.x;\n" | ||||||
|         "    else if(which == 1 || which == 5) tangent.y = -tangent.y;\n" |         "    else if(which == 1 || which == 5) tangent.y = -tangent.y;\n" | ||||||
| @@ -937,6 +955,12 @@ EX void cast() { | |||||||
|   if(o->uStraighten != -1) { |   if(o->uStraighten != -1) { | ||||||
|     glUniformMatrix4fv(o->uStraighten, 1, 0, glhr::tmtogl_transpose(asonov::straighten).as_array()); |     glUniformMatrix4fv(o->uStraighten, 1, 0, glhr::tmtogl_transpose(asonov::straighten).as_array()); | ||||||
|     } |     } | ||||||
|  |   if(o->uReflectX != -1) { | ||||||
|  |     auto h = glhr::pointtogl(tangent_length(spin(90*degree) * asonov::ty, 2)); | ||||||
|  |     glUniform4fv(o->uReflectX, 1, &h[0]); | ||||||
|  |     h = glhr::pointtogl(tangent_length(spin(90*degree) * asonov::tx, 2)); | ||||||
|  |     glUniform4fv(o->uReflectY, 1, &h[0]); | ||||||
|  |     } | ||||||
|   if(o->uPLevel != -1) |   if(o->uPLevel != -1) | ||||||
|     glUniform1f(o->uPLevel, cgi.plevel / 2); |     glUniform1f(o->uPLevel, cgi.plevel / 2); | ||||||
|   if(o->uBLevel != -1) |   if(o->uBLevel != -1) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue