summaryrefslogtreecommitdiff
path: root/src/glm_vec3_bindings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glm_vec3_bindings.c')
-rw-r--r--src/glm_vec3_bindings.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/glm_vec3_bindings.c b/src/glm_vec3_bindings.c
index a8157f2..e6ea407 100644
--- a/src/glm_vec3_bindings.c
+++ b/src/glm_vec3_bindings.c
@@ -247,6 +247,33 @@ int honey_glm_vec3_mul(lua_State* L)
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+int honey_glm_vec3_muls(lua_State* L)
+{
+ honey_glm_array *self, *dest;
+ float s;
+ int choice = honey_lua_parse_arguments
+ (L, 2,
+ 2, HONEY_USERDATA, &self, HONEY_NUMBER, &s,
+ 3, HONEY_USERDATA, &self, HONEY_NUMBER, &s, HONEY_USERDATA, &dest);
+
+ if (choice == 0)
+ dest = self;
+ else {
+ if (dest->type != VEC3)
+ honey_lua_throw_error
+ (L, "destination vector must be of type VEC3 (%d); got %d instead",
+ VEC3, dest->type);
+ }
+
+ dest->data[0] = s * self->data[0];
+ dest->data[1] = s * self->data[1];
+ dest->data[2] = s * self->data[2];
+
+ return 0;
+}
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
int honey_glm_vec3_scale(lua_State* L)
{
honey_glm_array *self, *dest;