Blender V5.3
eevee_attributes_curves_lib.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
9
10/* -------------------------------------------------------------------- */
16
17float3 attr_load_orco(CurvesPoint point, float4 /*orco*/, int /*index*/)
18{
19 /* NOTE: Doesn't support ORCO attribute. */
20 return point.orco_default;
21}
22
23/* Return the index to use for looking up the attribute value in the sampler
24 * based on the attribute scope (point or spline). */
26{
27 if (flag_test(point.is_point_attribute, 1u << index)) {
28 return point.point_id;
29 }
30 return point.curve_id;
31}
32
33float4 attr_load_tangent(CurvesPoint /*point*/, samplerBuffer /*cd_buf*/, int /*index*/)
34{
35 /* Not supported for the moment. */
36 return float4(0.0f, 0.0f, 0.0f, 1.0f);
37}
38float3 attr_load_uv(CurvesPoint point, samplerBuffer cd_buf, int /*index*/)
39{
40 return texelFetch(cd_buf, point.curve_id).rgb;
41}
42float4 attr_load_color(CurvesPoint point, samplerBuffer cd_buf, int /*index*/)
43{
44 return texelFetch(cd_buf, point.curve_id).rgba;
45}
47{
48 return texelFetch(cd_buf, curves_attribute_element_id(point, index)).rgba;
49}
51{
52 return texelFetch(cd_buf, curves_attribute_element_id(point, index)).rgb;
53}
55{
56 return texelFetch(cd_buf, curves_attribute_element_id(point, index)).rg;
57}
59{
60 return texelFetch(cd_buf, curves_attribute_element_id(point, index)).r;
61}
62
float attr_load_float(CurvesPoint point, samplerBuffer cd_buf, int index)
float2 attr_load_float2(CurvesPoint point, samplerBuffer cd_buf, int index)
float3 attr_load_uv(CurvesPoint point, samplerBuffer cd_buf, int)
float4 attr_load_float4(CurvesPoint point, samplerBuffer cd_buf, int index)
float3 attr_load_float3(CurvesPoint point, samplerBuffer cd_buf, int index)
float3 attr_load_orco(CurvesPoint point, float4, int)
float4 attr_load_tangent(CurvesPoint, samplerBuffer, int)
int curves_attribute_element_id(CurvesPoint point, int index)
float4 attr_load_color(CurvesPoint point, samplerBuffer cd_buf, int)
#define index(i)
TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) RET
SamplerBase< float, 1 > samplerBuffer
bool flag_test(uint flag, uint val)