MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / Map1

Method Map1

src/lua/LuaOpenGL.cpp:614–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

612
613
614int LuaOpenGL::Map1(lua_State* L) {
615 CheckDrawingEnabled(L, __FUNCTION__);
616 if (lua_gettop(L) != 6) { // NOTE: required for ParseFloatArray()
617 return 0;
618 }
619 const GLenum target = (GLenum)luaL_checkint(L, 1);
620 const GLfloat u1 = luaL_checkfloat(L, 2);
621 const GLfloat u2 = luaL_checkfloat(L, 3);
622 const GLint stride = luaL_checkint(L, 4);
623 const GLint order = luaL_checkint(L, 5);
624
625 const int dataSize = GetMap1TargetDataSize(target);
626 if (dataSize <= 0) {
627 return 0;
628 }
629 if ((order <= 0) || (stride != dataSize)) {
630 return 0;
631 }
632 const int fullSize = (order * dataSize);
633 float* points = new float[fullSize];
634 if (ParseFloatArray(L, points, fullSize) == fullSize) {
635 glMap1f(target, u1, u2, stride, order, points);
636 }
637 delete[] points;
638 return 0;
639}
640
641
642int LuaOpenGL::Map2(lua_State* L) {

Callers

nothing calls this directly

Calls 4

luaL_checkfloatFunction · 0.85
GetMap1TargetDataSizeFunction · 0.85
ParseFloatArrayFunction · 0.70
lua_gettopFunction · 0.50

Tested by

no test coverage detected