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

Method GetFaceNorms

src/lua/LuaObstacle.cpp:578–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576
577
578int LuaObstacle::GetFaceNorms(lua_State* L) {
579 const MeshFace* face = ParseMeshFace(L, 1);
580 if (face == NULL) {
581 return luaL_pushnil(L);
582 }
583 if (!face->useNormals()) {
584 return luaL_pushnil(L);
585 }
586 const int elements = face->getVertexCount();
587 lua_createtable(L, elements, 0);
588 for (int i = 0; i < elements; i++) {
589 const fvec3& vec = face->getNormal(i);
590 lua_createtable(L, 3, 0);
591 lua_pushfloat(L, vec.x); lua_rawseti(L, -2, 1);
592 lua_pushfloat(L, vec.y); lua_rawseti(L, -2, 2);
593 lua_pushfloat(L, vec.z); lua_rawseti(L, -2, 3);
594 lua_rawseti(L, -2, i + 1);
595 }
596 return 1;
597}
598
599
600int LuaObstacle::GetFaceTxcds(lua_State* L) {

Callers

nothing calls this directly

Calls 8

ParseMeshFaceFunction · 0.85
luaL_pushnilFunction · 0.85
lua_pushfloatFunction · 0.85
useNormalsMethod · 0.80
lua_createtableFunction · 0.50
lua_rawsetiFunction · 0.50
getVertexCountMethod · 0.45
getNormalMethod · 0.45

Tested by

no test coverage detected