Browse Source

Example 49 - hextile (Changes to fix regular tiling (tiling rate) to match hex tile rate) (#2924)

blackhole 3 years ago
parent
commit
2b11045331

BIN
examples/49-hextile/fs_hextile.bin


+ 8 - 8
examples/49-hextile/fs_hextile.sc

@@ -196,19 +196,19 @@ void FetchColorAndWeight(out vec3 color, out vec3 weights, vec2 uv)
 
 void main()
 {
+	// actual world space position
+	vec3 surfPosInWorld = v_position.xyz;
+
+	vec3 sp = GetTileRate() * surfPosInWorld;
+
+	vec2 uv0 = vec2(sp.x, sp.z);
+		
 	if(u_useRegularTiling > 0.0) 
 	{
-		gl_FragColor = vec4(texture2D(s_trx_d, v_texcoord0.xy));
+		gl_FragColor = vec4(texture2D(s_trx_d, uv0.xy));
 	} 
 	else 
 	{
-		// actual world space position
-		vec3 surfPosInWorld = v_position.xyz;
-
-		vec3 sp = GetTileRate() * surfPosInWorld;
-
-		vec2 uv0 = vec2(sp.x, sp.z);
-
 		vec3 color, weights;
 		FetchColorAndWeight(color, weights, uv0);
 		

BIN
examples/runtime/shaders/dx11/fs_hextile.bin


BIN
examples/runtime/shaders/essl/fs_hextile.bin


BIN
examples/runtime/shaders/glsl/fs_hextile.bin


BIN
examples/runtime/shaders/metal/fs_hextile.bin


BIN
examples/runtime/shaders/spirv/fs_hextile.bin