MCPcopy Create free account
hub / github.com/defold/defold / Matrix4_mul

Function Matrix4_mul

engine/script/src/script_vmath.cpp:796–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794 }
795
796 static int Matrix4_mul(lua_State *L)
797 {
798 Matrix4 m1;
799 if (lua_isnumber(L, 1))
800 {
801 float f = (float) lua_tonumber(L, 1);
802 m1 = *CheckMatrix4(L, 2);
803 PushMatrix4(L, m1 * f);
804 }
805 else
806 {
807 m1 = *CheckMatrix4(L, 1);
808 Matrix4* m2 = ToMatrix4(L, 2);
809 Vector4* v = m2 != 0 ? 0 : ToVector4(L, 2);
810 if (m2 != 0)
811 {
812 PushMatrix4(L, m1 * *m2);
813 }
814 else if (v != 0)
815 {
816 PushVector4(L, m1 * *v);
817 }
818 else if (lua_isnumber(L, 2))
819 {
820 float f = (float) luaL_checknumber(L, 2);
821 PushMatrix4(L, m1 * f);
822 }
823 else
824 {
825 return luaL_error(L, "%s.%s can only be multiplied with a number, another %s or a %s.", SCRIPT_LIB_NAME, SCRIPT_TYPE_NAME_MATRIX4, SCRIPT_TYPE_NAME_MATRIX4, SCRIPT_TYPE_NAME_VECTOR4);
826 }
827 }
828 return 1;
829 }
830
831 static int Matrix4_concat(lua_State *L)
832 {

Callers

nothing calls this directly

Calls 9

lua_isnumberFunction · 0.85
lua_tonumberFunction · 0.85
CheckMatrix4Function · 0.85
PushMatrix4Function · 0.85
ToVector4Function · 0.85
PushVector4Function · 0.85
luaL_checknumberFunction · 0.85
luaL_errorFunction · 0.85
ToMatrix4Function · 0.70

Tested by

no test coverage detected