Implements Truchet tiles as a texture node.
Border Width Parameter
Flip Tiles Option
Texture mapping is still missing. Looking at other textures' OSL files, you will notice two extra inputs:
int use_mapping = 0, matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
as well as a call to the transform function:
if (use_mapping) coord = transform(mapping, coord);
For EEVEE, you will notice a call to two functions:
node_shader_gpu_default_tex_coord(mat, node, &in.link); node_shader_gpu_tex_mapping(mat, node, in, out);
Finally, notice that we can't use the custom variables in the nodes because texture mapping requires a dedicated DNA struct, which you already created. In this case, the struct needs to be initialized appropriately like so:
NodeTexTruchet *tex = MEM_callocN(sizeof(NodeTexTruchet), "NodeTexTruchet"); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping);
Also, I feel like some of the files are still not formatted using clang format. Make sure to format OSL and GLSL code as well.