mirror of https://github.com/bjornbytes/lovr.git
Rasterizer;
This commit is contained in:
parent
a22740084c
commit
99a302ff38
|
@ -47,6 +47,7 @@ extern const luaL_Reg lovrMaterial[];
|
||||||
extern const luaL_Reg lovrMesh[];
|
extern const luaL_Reg lovrMesh[];
|
||||||
extern const luaL_Reg lovrModel[];
|
extern const luaL_Reg lovrModel[];
|
||||||
extern const luaL_Reg lovrRandomGenerator[];
|
extern const luaL_Reg lovrRandomGenerator[];
|
||||||
|
extern const luaL_Reg lovrRasterizer[];
|
||||||
extern const luaL_Reg lovrShader[];
|
extern const luaL_Reg lovrShader[];
|
||||||
extern const luaL_Reg lovrShape[];
|
extern const luaL_Reg lovrShape[];
|
||||||
extern const luaL_Reg lovrSliderJoint[];
|
extern const luaL_Reg lovrSliderJoint[];
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "data/texture.h"
|
|
||||||
#include "data/audioStream.h"
|
#include "data/audioStream.h"
|
||||||
|
#include "data/rasterizer.h"
|
||||||
|
#include "data/texture.h"
|
||||||
|
|
||||||
int l_lovrDataInit(lua_State* L) {
|
int l_lovrDataInit(lua_State* L) {
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
luaL_register(L, NULL, lovrData);
|
luaL_register(L, NULL, lovrData);
|
||||||
luax_registertype(L, "TextureData", lovrTextureData);
|
|
||||||
luax_registertype(L, "AudioStream", lovrAudioStream);
|
luax_registertype(L, "AudioStream", lovrAudioStream);
|
||||||
return 1;
|
luax_registertype(L, "Rasterizer", lovrRasterizer);
|
||||||
}
|
luax_registertype(L, "TextureData", lovrTextureData);
|
||||||
|
|
||||||
int l_lovrDataNewTextureData(lua_State* L) {
|
|
||||||
Blob* blob = luax_readblob(L, 1, "Texture");
|
|
||||||
TextureData* textureData = lovrTextureDataFromBlob(blob);
|
|
||||||
luax_pushtype(L, TextureData, textureData);
|
|
||||||
lovrRelease(&blob->ref);
|
|
||||||
lovrRelease(&textureData->ref);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,8 +23,40 @@ int l_lovrDataNewAudioStream(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int l_lovrDataNewTextureData(lua_State* L) {
|
||||||
|
Blob* blob = luax_readblob(L, 1, "Texture");
|
||||||
|
TextureData* textureData = lovrTextureDataFromBlob(blob);
|
||||||
|
luax_pushtype(L, TextureData, textureData);
|
||||||
|
lovrRelease(&blob->ref);
|
||||||
|
lovrRelease(&textureData->ref);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l_lovrDataNewRasterizer(lua_State* L) {
|
||||||
|
Blob* blob = NULL;
|
||||||
|
float size;
|
||||||
|
|
||||||
|
if (lua_type(L, 1) == LUA_TNUMBER || lua_isnoneornil(L, 1)) {
|
||||||
|
size = luaL_optnumber(L, 1, 32);
|
||||||
|
} else {
|
||||||
|
blob = luax_readblob(L, 1, "Font");
|
||||||
|
size = luaL_optnumber(L, 2, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rasterizer* rasterizer = lovrRasterizerCreate(blob, size);
|
||||||
|
luax_pushtype(L, Rasterizer, rasterizer);
|
||||||
|
|
||||||
|
if (blob) {
|
||||||
|
lovrRelease(&blob->ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
lovrRelease(&rasterizer->ref);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
const luaL_Reg lovrData[] = {
|
const luaL_Reg lovrData[] = {
|
||||||
{ "newAudioStream", l_lovrDataNewAudioStream },
|
{ "newAudioStream", l_lovrDataNewAudioStream },
|
||||||
|
{ "newRasterizer", l_lovrDataNewRasterizer },
|
||||||
{ "newTextureData", l_lovrDataNewTextureData },
|
{ "newTextureData", l_lovrDataNewTextureData },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#include "api.h"
|
||||||
|
|
||||||
|
const luaL_Reg lovrRasterizer[] = {
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
Loading…
Reference in New Issue