Code:
Code: Select all
function gadget:DrawWorldPreUnit()
gf=Spring.GetGameFrame()
for featureID, featureinfo in pairs(treesdying) do
local x, y, z = featureinfo.posx, featureinfo.posy, featureinfo.posz
--Spring.Echo('drawing tree:', featureID, featureinfo.frame, gf,'defid',featureinfo.fDefID)
--local _, b, _ = spGetPositionLosState(x, y, z)
if (featureinfo.frame +90 < gf) then
treesdying[featureID]=nil
else
local losState = true
if ( losState == true ) then
--glow effect?
glColor(1.0, 1.0, 1.0, 0.8 )
glTexture(0,"%-" .. featureinfo.fDefID .. ":0 ")
glTexture(1,"%-" .. featureinfo.fDefID .. ":1 ")
glTexEnv( GL.TEXTURE_ENV, GL.TEXTURE_ENV_MODE, 0x8570 ) --GL_COMBINE_RGB
glPushMatrix()
glTranslate(x, y, z)
glRotate(featureinfo.angle,0,y,0)
glRotate((gf-featureinfo.frame)*1,x,0,0)
Spring.Echo('drawing', featureID,featureinfo.fDefID, x,y,z,"%-" .. featureinfo.fDefID .. ":0 ")
glFeatureShape(featureinfo.fDefID, gaiaTeamID)
glPopMatrix()
end
end
end
end
