From 0035e0d47bbce8311d3a4e559e74b8cdc5209d47 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Oct 2021 01:06:48 +0800 Subject: *load image --- Runtime/Scripting/Rendering/Rendering.bind.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'Runtime/Scripting/Rendering/Rendering.bind.cpp') diff --git a/Runtime/Scripting/Rendering/Rendering.bind.cpp b/Runtime/Scripting/Rendering/Rendering.bind.cpp index 40b3ac5..9bb6242 100644 --- a/Runtime/Scripting/Rendering/Rendering.bind.cpp +++ b/Runtime/Scripting/Rendering/Rendering.bind.cpp @@ -2,29 +2,7 @@ #include "Runtime/Graphics/Texture.h" #include "Runtime/Graphics/ImageData.h" -#define STB_IMAGE_IMPLEMENTATION -#include "ThirdParty/stb/stb_image.h" - -// imgData = Rendering.LoadImage(path) -int LoadImage(lua_State* L) -{ - LUA_BIND_STATE(L); - - const char* path = state.GetValue(1, ""); - - stbi_set_flip_vertically_on_load(true); - ImageData* data = new ImageData(state.GetVM()); - int channels; - data->pixels = stbi_load(path, &data->width, &data->height, &channels, 0); - data->format = ImageData::EPixelFormat::RGB; - data->type = ImageData::EPixelElementType::UNSIGNED_BYTE; - - data->PushUserdata(state); - return 1; -} - static luaL_Reg funcs[] = { - {"LoadImage", LoadImage}, {0, 0} }; -- cgit v1.1-26-g67d0