Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmarSquircleArt <omar.squircleart@gmail.com>2019-09-12 18:42:13 +0300
committerOmarSquircleArt <omar.squircleart@gmail.com>2019-09-12 18:42:13 +0300
commit2ea82e86ca60c1c268c6074ecba10524cebd97ed (patch)
treebf355c2a930f584685f68a833ce620ad15e63a70 /intern/cycles/util
parentf80018b5f7497d7ed0fe79783c4cd76f05ec1c7c (diff)
Shading: Add Vertex Color node.
This patch adds a new Vertex Color node. The node also returns the alpha of the vertex color layer as an output. Reviewers: brecht Differential Revision: https://developer.blender.org/D5767
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_color.h18
-rw-r--r--intern/cycles/util/util_param.h5
2 files changed, 23 insertions, 0 deletions
diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h
index 6e61190de6b..c6937ca78fe 100644
--- a/intern/cycles/util/util_color.h
+++ b/intern/cycles/util/util_color.h
@@ -43,11 +43,29 @@ ccl_device uchar4 color_float_to_byte(float3 c)
return make_uchar4(r, g, b, 0);
}
+ccl_device uchar4 color_float4_to_uchar4(float4 c)
+{
+ uchar r, g, b, a;
+
+ r = float_to_byte(c.x);
+ g = float_to_byte(c.y);
+ b = float_to_byte(c.z);
+ a = float_to_byte(c.w);
+
+ return make_uchar4(r, g, b, a);
+}
+
ccl_device_inline float3 color_byte_to_float(uchar4 c)
{
return make_float3(c.x * (1.0f / 255.0f), c.y * (1.0f / 255.0f), c.z * (1.0f / 255.0f));
}
+ccl_device_inline float4 color_uchar4_to_float4(uchar4 c)
+{
+ return make_float4(
+ c.x * (1.0f / 255.0f), c.y * (1.0f / 255.0f), c.z * (1.0f / 255.0f), c.w * (1.0f / 255.0f));
+}
+
ccl_device float color_srgb_to_linear(float c)
{
if (c < 0.04045f)
diff --git a/intern/cycles/util/util_param.h b/intern/cycles/util/util_param.h
index cfbe416aba1..3f8e2d6d700 100644
--- a/intern/cycles/util/util_param.h
+++ b/intern/cycles/util/util_param.h
@@ -29,6 +29,11 @@ CCL_NAMESPACE_BEGIN
OIIO_NAMESPACE_USING
static constexpr TypeDesc TypeFloat2(TypeDesc::FLOAT, TypeDesc::VEC2);
+static constexpr TypeDesc TypeRGBA(TypeDesc::FLOAT, TypeDesc::VEC4, TypeDesc::COLOR);
+static constexpr TypeDesc TypeFloatArray4(TypeDesc::FLOAT,
+ TypeDesc::SCALAR,
+ TypeDesc::NOSEMANTICS,
+ 4);
CCL_NAMESPACE_END