added ag::object::setTransparency() and Engine::Object::setTransparency()
git-svn-id: svn://anubis/anaglym/trunk@316 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
1a2213f39c
commit
11da99b3ad
6
Engine.h
6
Engine.h
@ -68,7 +68,11 @@ class Engine
|
|||||||
m_color[0] = r;
|
m_color[0] = r;
|
||||||
m_color[1] = g;
|
m_color[1] = g;
|
||||||
m_color[2] = b;
|
m_color[2] = b;
|
||||||
m_color[3] = 1.0f;
|
render();
|
||||||
|
}
|
||||||
|
void setTransparency(float t)
|
||||||
|
{
|
||||||
|
m_color[3] = 1.0f - t;
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
void setTexture(GLuint tex);
|
void setTexture(GLuint tex);
|
||||||
|
16
ag.cc
16
ag.cc
@ -372,6 +372,8 @@ fail:
|
|||||||
lua_setfield(L, -2, "addTorqueRel");
|
lua_setfield(L, -2, "addTorqueRel");
|
||||||
lua_pushcfunction(L, object::setColor);
|
lua_pushcfunction(L, object::setColor);
|
||||||
lua_setfield(L, -2, "setColor");
|
lua_setfield(L, -2, "setColor");
|
||||||
|
lua_pushcfunction(L, object::setTransparency);
|
||||||
|
lua_setfield(L, -2, "setTransparency");
|
||||||
lua_pushcfunction(L, object::setGravityMode);
|
lua_pushcfunction(L, object::setGravityMode);
|
||||||
lua_setfield(L, -2, "setGravityMode");
|
lua_setfield(L, -2, "setGravityMode");
|
||||||
lua_pushcfunction(L, object::setTexture);
|
lua_pushcfunction(L, object::setTexture);
|
||||||
@ -1443,6 +1445,20 @@ fail:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setTransparency(lua_State * L)
|
||||||
|
{
|
||||||
|
int argc = lua_gettop(L);
|
||||||
|
if (argc == 2 && lua_isnumber(L, 2))
|
||||||
|
{
|
||||||
|
Engine::Object * obj = getObject(L, 1);
|
||||||
|
if (obj != NULL)
|
||||||
|
{
|
||||||
|
obj->setTransparency(lua_tonumber(L, 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int setGravityMode(lua_State * L)
|
int setGravityMode(lua_State * L)
|
||||||
{
|
{
|
||||||
int argc = lua_gettop(L);
|
int argc = lua_gettop(L);
|
||||||
|
1
ag.h
1
ag.h
@ -89,6 +89,7 @@ namespace ag
|
|||||||
int setGravityMode(lua_State * L);
|
int setGravityMode(lua_State * L);
|
||||||
int setTexture(lua_State * L);
|
int setTexture(lua_State * L);
|
||||||
int setTextureScale(lua_State * L);
|
int setTextureScale(lua_State * L);
|
||||||
|
int setTransparency(lua_State * L);
|
||||||
int getMass(lua_State * L);
|
int getMass(lua_State * L);
|
||||||
int setMass(lua_State * L);
|
int setMass(lua_State * L);
|
||||||
int getAABB(lua_State * L);
|
int getAABB(lua_State * L);
|
||||||
|
@ -3,9 +3,10 @@ function init_event()
|
|||||||
ground = ag.createBox(8, 8, 0.1, {static = true})
|
ground = ag.createBox(8, 8, 0.1, {static = true})
|
||||||
ground:setTexture(checker_texture)
|
ground:setTexture(checker_texture)
|
||||||
ag.setCamera(10, -10, 10, 0, 0, 0)
|
ag.setCamera(10, -10, 10, 0, 0, 0)
|
||||||
hilite = ag.createBox(2, 2, 0.1, {static = true})
|
hilite = ag.createBox(2, 2, 0.1, {static = true, enable_blending = true})
|
||||||
hilite:setColor(0.3, 0.5, 1)
|
hilite:setColor(0.3, 0.5, 1)
|
||||||
hilite:setPosition(1, 1, 0.1)
|
hilite:setPosition(1, 1, 0.1)
|
||||||
|
hilite:setTransparency(0.4)
|
||||||
|
|
||||||
ag.setCursorVisible(true)
|
ag.setCursorVisible(true)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user