fixed bug in 3d picking; ag.pickObjects() working now

git-svn-id: svn://anubis/anaglym/trunk@255 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2010-02-21 22:17:29 +00:00
parent b2feea1324
commit 83d6c60fea
3 changed files with 9 additions and 4 deletions

2
.todo
View File

@ -1,2 +1,2 @@
add 3d-picking routines using temporary ODE ray geometries
add API documentation for ag.pickObjects()
add audio capabilities

4
ag.cc
View File

@ -100,8 +100,8 @@ namespace ag
lua_getfield(L, -1, "_objects"); /* pushes 1 */
lua_pushinteger(L, *it); /* pushes 1 */
lua_gettable(L, -2); /* replace top */
lua_remove(L, -3); /* remove 1 */
lua_remove(L, -2); /* remove 1 */
lua_remove(L, -1); /* remove 1 */
if (!lua_isnil(L, -1))
{
lua_pushinteger(L, next_index++); /* push key */
@ -300,7 +300,7 @@ namespace ag
lua_getfield(L, LUA_GLOBALSINDEX, "ag"); /* pushes 1 */
lua_getfield(L, -1, "_objects"); /* pushes 1 */
lua_pushinteger(L, id); /* pushes 1 */
lua_pushvalue(L, 1); /* pushes 1 */
lua_pushvalue(L, -4); /* pushes 1 */
lua_settable(L, -3); /* pops 2 */
lua_pop(L, 2); /* pops 2 */
}

View File

@ -60,6 +60,11 @@ end
function mousebutton_down_event(button, x, y)
if (button == 1) then
ag.pickObjects(x, y)
objects = ag.pickObjects(x, y)
if (objects ~= nil) then
for id, obj in ipairs(objects) do
obj:setColor(0, 0, 1)
end
end
end
end