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

Function GetSamplerParametersFromLua

engine/gamesys/src/gamesys/gamesys_script.cpp:375–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373 }
374
375 void GetSamplerParametersFromLua(lua_State* L, dmGraphics::TextureWrap* u_wrap, dmGraphics::TextureWrap* v_wrap, dmGraphics::TextureFilter* min_filter, dmGraphics::TextureFilter* mag_filter, float* max_anisotropy)
376 {
377 // parse u_wrap
378 {
379 lua_getfield(L, -1, "u_wrap");
380 if (!lua_isnil(L, -1))
381 {
382 *u_wrap = (dmGraphics::TextureWrap) lua_tointeger(L, -1);
383 }
384 lua_pop(L, 1);
385 }
386
387 // parse v_wrap
388 {
389 lua_getfield(L, -1, "v_wrap");
390 if (!lua_isnil(L, -1))
391 {
392 *v_wrap = (dmGraphics::TextureWrap) lua_tointeger(L, -1);
393 }
394 lua_pop(L, 1);
395 }
396
397 // parse min_filter
398 {
399 lua_getfield(L, -1, "min_filter");
400 if (!lua_isnil(L, -1))
401 {
402 *min_filter = (dmGraphics::TextureFilter) lua_tointeger(L, -1);
403 }
404 lua_pop(L, 1);
405 }
406
407 // parse mag_filter
408 {
409 lua_getfield(L, -1, "mag_filter");
410 if (!lua_isnil(L, -1))
411 {
412 *mag_filter = (dmGraphics::TextureFilter) lua_tointeger(L, -1);
413 }
414 lua_pop(L, 1);
415 }
416
417 // parse max_anisotropy
418 {
419 lua_getfield(L, -1, "max_anisotropy");
420 if (!lua_isnil(L, -1))
421 {
422 *max_anisotropy = lua_tonumber(L, -1);
423 }
424 lua_pop(L, 1);
425 }
426 }
427
428 static dmVMath::Vector4* FillConstantsFromLua(lua_State* L, int index, dmVMath::Vector4* v4_in)
429 {

Callers 2

SetMaterialSamplerFunction · 0.85
SetComputeSamplerFunction · 0.85

Calls 3

lua_getfieldFunction · 0.85
lua_tointegerFunction · 0.85
lua_tonumberFunction · 0.85

Tested by

no test coverage detected