Blender V5.3
gpu_shader_material_tex_checker.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
9[[node]]
11 float3 co, float4 color1, float4 color2, float scale, float4 &color, float &fac)
12{
13 float3 p = co * scale;
14
15 /* Prevent precision issues on unit coordinates. */
16 p = (p + 0.000001f) * 0.999999f;
17
18 int xi = int(abs(floor(p.x)));
19 int yi = int(abs(floor(p.y)));
20 int zi = int(abs(floor(p.z)));
21
22 bool check = ((mod(xi, 2) == mod(yi, 2)) == bool(mod(zi, 2)));
23
24 color = check ? color1 : color2;
25 fac = check ? 1.0f : 0.0f;
26}
#define abs
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET
#define floor
void node_tex_checker(float3 co, float4 color1, float4 color2, float scale, float4 &color, float &fac)
float3x3 scale(float3x3 mat, float2 scale)
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136