diff --git a/game/modules/tome/data/gfx/shockbolt/terrain/cloud-world.png b/game/modules/tome/data/gfx/shockbolt/terrain/cloud-world.png new file mode 100644 index 0000000000000000000000000000000000000000..312f17ab3611f08bc2158f94422521b9efe394d2 Binary files /dev/null and b/game/modules/tome/data/gfx/shockbolt/terrain/cloud-world.png differ diff --git a/game/modules/tome/data/zones/abashed-expanse/zone.lua b/game/modules/tome/data/zones/abashed-expanse/zone.lua index 2c39b37df9c93b1ccdd81acebc85fee4252337c9..034b6a7b3f92e267f35df180886f78a5443fe80d 100644 --- a/game/modules/tome/data/zones/abashed-expanse/zone.lua +++ b/game/modules/tome/data/zones/abashed-expanse/zone.lua @@ -217,9 +217,9 @@ return { local Quadratic = require "engine.Quadratic" level.background_particle1 = require("engine.Particles").new("starfield_static", 1, {width=Map.viewport.width, height=Map.viewport.height, nb=300, a_min=0.5, a_max = 0.8, size_min = 1, size_max = 3}) level.background_particle2 = require("engine.Particles").new("starfield_static", 1, {width=Map.viewport.width, height=Map.viewport.height, nb=300, a_min=0.5, a_max = 0.9, size_min = 4, size_max = 8}) - level.world_particle = require("engine.Particles").new("image", 1, {size=1, image="shockbolt/terrain/eyal-world", x=400, y=400}) level.world_sphere = Quadratic.new() game.zone.world_sphere_rot = (game.zone.world_sphere_rot or 0) + game.zone.cloud_sphere_rot = (game.zone.world_cloud_rot or 0) end, background = function(level, x, y, nb_keyframes) @@ -227,15 +227,27 @@ return { level.background_particle1.ps:toScreen(x, y, true, 1) local parx, pary = level.map.mx / (level.map.w - Map.viewport.mwidth), level.map.my / (level.map.h - Map.viewport.mheight) level.background_particle2.ps:toScreen(x - parx * 40, y - pary * 40, true, 1) - level.world_particle.ps:toScreen(x - parx * 60, y - pary * 60, true, 1) + core.display.glDepthTest(true) core.display.glMatrix(true) core.display.glTranslate(x + 350 - parx * 60, y + 350 - pary * 60, 0) core.display.glRotate(120, 0, 1, 0) core.display.glRotate(300, 1, 0, 0) - level.world_sphere.q:sphere(0, 0, 300, game.zone.world_sphere_rot, 0, 0, 1) + core.display.glRotate(game.zone.world_sphere_rot, 0, 0, 1) + + local tex = Map.tiles:get('', 0, 0, 0, 0, 0, 0, "shockbolt/terrain/eyal-world.png") + tex:bind(0) + level.world_sphere.q:sphere(300) + + local tex = Map.tiles:get('', 0, 0, 0, 0, 0, 0, "shockbolt/terrain/cloud-world.png") + tex:bind(0) + core.display.glRotate(game.zone.cloud_sphere_rot, 0, 0, 1) + level.world_sphere.q:sphere(304) + game.zone.world_sphere_rot = game.zone.world_sphere_rot + 0.01 + game.zone.cloud_sphere_rot = game.zone.cloud_sphere_rot + rng.float(0.01, 0.02) core.display.glMatrix(false) + core.display.glDepthTest(false) end, } diff --git a/src/core_lua.c b/src/core_lua.c index a18d68a86d5591e487cd049a3984570c5f5b7d6d..6776df1d561db57da241187bd7624e53fca154b8 100644 --- a/src/core_lua.c +++ b/src/core_lua.c @@ -1308,6 +1308,13 @@ static int gl_matrix(lua_State *L) return 0; } +static int gl_depth_test(lua_State *L) +{ + if (lua_toboolean(L, 1)) glEnable(GL_DEPTH_TEST); + else glDisable(GL_DEPTH_TEST); + return 0; +} + static int sdl_texture_bind(lua_State *L) { GLuint *t = (GLuint*)auxiliar_checkclass(L, "gl{texture}", 1); @@ -1563,23 +1570,9 @@ static int gl_free_quadratic(lua_State *L) static int gl_quadratic_sphere(lua_State *L) { GLUquadricObj **quadratic = (GLUquadricObj**)auxiliar_checkclass(L, "gl{quadratic}", 1); - float x = luaL_checknumber(L, 2); - float y = luaL_checknumber(L, 3); - float rad = luaL_checknumber(L, 4); - float rot = luaL_checknumber(L, 5); - float rot_x = luaL_checknumber(L, 6); - float rot_y = luaL_checknumber(L, 7); - float rot_z = luaL_checknumber(L, 8); + float rad = luaL_checknumber(L, 2); - glPushMatrix(); - glTranslatef(x, y, 0); - glRotatef(rot, rot_x, rot_y, rot_z); - - glEnable(GL_DEPTH_TEST); gluSphere(*quadratic, rad, 64, 64); - glDisable(GL_DEPTH_TEST); - - glPopMatrix(); return 0; } @@ -1864,6 +1857,7 @@ static const struct luaL_reg displaylib[] = {"glScale", gl_scale}, {"glRotate", gl_rotate}, {"glMatrix", gl_matrix}, + {"glDepthTest", gl_depth_test}, {NULL, NULL}, };