Skip to content

Commit 6ad716a

Browse files
authored
Update AfflictionLib.glsllib (#1905)
This PR goes along with my last PR cleaning up the AdvancedPBRTerrain.j3md shader. The method getTriPlanarBlendFromTexArray() was put into this glsllib that contains all of the other commonly used functions for the pbr terrain shaders.
1 parent 58c137f commit 6ad716a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

jme3-terrain/src/main/resources/Common/MatDefs/Terrain/AfflictionLib.glsllib

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ vec4 getTriPlanarBlend(in vec4 coords, in vec3 blending, in sampler2D map, in fl
1111
return tex;
1212
}
1313

14+
vec4 getTriPlanarBlendFromTexArray(in vec4 coords, in vec3 blending, in int idInTexArray, in float scale, in sampler2DArray texArray) {
15+
vec4 col1 = texture2DArray( texArray, vec3((coords.yz * scale), idInTexArray ) );
16+
vec4 col2 = texture2DArray( texArray, vec3((coords.xz * scale), idInTexArray ) );
17+
vec4 col3 = texture2DArray( texArray, vec3((coords.xy * scale), idInTexArray ) );
18+
// blend the results of the 3 planar projections.
19+
vec4 tex = col1 * blending.x + col2 * blending.y + col3 * blending.z;
20+
21+
return tex;
22+
}
23+
1424

1525
//used for mixing normal map normals with the world normals. texture slots without a normal map use wNormal as their blending value instead
1626
vec3 calculateTangentsAndApplyToNormals(in vec3 normalIn, in vec3 worldNorm){

0 commit comments

Comments
 (0)