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:
Diffstat (limited to 'intern/cycles/util/types_spectrum.h')
-rw-r--r--intern/cycles/util/types_spectrum.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/intern/cycles/util/types_spectrum.h b/intern/cycles/util/types_spectrum.h
new file mode 100644
index 00000000000..c59230b83ae
--- /dev/null
+++ b/intern/cycles/util/types_spectrum.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright 2022 Blender Foundation */
+
+#ifndef __UTIL_TYPES_SPECTRUM_H__
+#define __UTIL_TYPES_SPECTRUM_H__
+
+#ifndef __UTIL_TYPES_H__
+# error "Do not include this file directly, include util/types.h instead."
+#endif
+
+CCL_NAMESPACE_BEGIN
+
+#define SPECTRUM_CHANNELS 3
+#define SPECTRUM_DATA_TYPE float3
+#define PACKED_SPECTRUM_DATA_TYPE packed_float3
+
+using Spectrum = SPECTRUM_DATA_TYPE;
+using PackedSpectrum = PACKED_SPECTRUM_DATA_TYPE;
+
+#define make_spectrum(f) CONCAT(make_, SPECTRUM_DATA_TYPE(f))
+#define load_spectrum(f) CONCAT(load_, SPECTRUM_DATA_TYPE(f))
+#define store_spectrum(s, f) CONCAT(store_, SPECTRUM_DATA_TYPE((s), (f)))
+
+#define zero_spectrum CONCAT(zero_, SPECTRUM_DATA_TYPE)
+#define one_spectrum CONCAT(one_, SPECTRUM_DATA_TYPE)
+
+#define FOREACH_SPECTRUM_CHANNEL(counter) \
+ for (int counter = 0; counter < SPECTRUM_CHANNELS; counter++)
+
+#define GET_SPECTRUM_CHANNEL(v, i) (((ccl_private float *)(&(v)))[i])
+
+CCL_NAMESPACE_END
+
+#endif /* __UTIL_TYPES_SPECTRUM_H__ */