summaryrefslogtreecommitdiff
path: root/src/core/shader.c
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-12-04 00:07:32 +0800
committerchai <chaifix@163.com>2019-12-04 00:07:32 +0800
commit2e82e2ddd0852b8063a3d6645366f53ee844e273 (patch)
tree41ec10760f2d2c9f1f782a918f48e1287da2a4b4 /src/core/shader.c
+init
Diffstat (limited to 'src/core/shader.c')
-rw-r--r--src/core/shader.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/shader.c b/src/core/shader.c
new file mode 100644
index 0000000..fe25408
--- /dev/null
+++ b/src/core/shader.c
@@ -0,0 +1,34 @@
+#include "shader.h"
+#include "vert.h"
+#include "device.h"
+
+void ssrS_bcpcolor(Vec3* bc, Color A, Color B, Color C, Color* out) {
+ ssr_assert(bc && out);
+ *out = ssr_color(
+ bc->A * COLOR_R(A) + bc->B * COLOR_R(B) + bc->C * COLOR_R(C),
+ bc->A * COLOR_G(A) + bc->B * COLOR_G(B) + bc->C * COLOR_G(C),
+ bc->A * COLOR_B(A) + bc->B * COLOR_B(B) + bc->C * COLOR_B(C),
+ bc->A * COLOR_A(A) + bc->B * COLOR_A(B) + bc->C * COLOR_A(C)
+ );
+}
+
+void ssrS_bcpvec2(Vec3* bc, Vec2* A, Vec2* B, Vec2* C, Vec2* out) {
+ ssr_assert(bc && A && B && C && out);
+ out->x = bc->A * A->x + bc->B * B->x + bc->C * C->x;
+ out->y = bc->A * A->y + bc->B * B->y + bc->C * C->y;
+}
+
+void ssrS_bcpvec3(Vec3* bc, Vec3* A, Vec3* B, Vec3* C, Vec3* out) {
+ ssr_assert(bc && A && B && C && out);
+ out->x = bc->A * A->x + bc->B * B->x + bc->C * C->x;
+ out->y = bc->A * A->y + bc->B * B->y + bc->C * C->y;
+ out->z = bc->A * A->z + bc->B * B->z + bc->C * C->z;
+}
+
+void ssrS_bcpvec4(Vec3* bc, Vec4* A, Vec4* B, Vec4* C, Vec4* out) {
+ ssr_assert(bc && A && B && C && out);
+ out->x = bc->A * A->x + bc->B * B->x + bc->C * C->x;
+ out->y = bc->A * A->y + bc->B * B->y + bc->C * C->y;
+ out->z = bc->A * A->z + bc->B * B->z + bc->C * C->z;
+ out->w = bc->A * A->w + bc->B * B->w + bc->C * C->w;
+}