Lua UnitRendering: Difference between revisions
From Spring
Jump to navigationJump to search
m Font colors, 2 (used #55ee99) |
|||
| Line 3: | Line 3: | ||
( number unitID, int lodCount ) -> nil | ( number unitID, int lodCount ) -> nil | ||
'''Spring.UnitRendering.SetLODLength''' <font color= | '''Spring.UnitRendering.SetLODLength''' <font color=#55ee99>(`lod` is 1-indexed)</font> | ||
( number unitID, int lod, number lodLength ) -> nil | ( number unitID, int lod, number lodLength ) -> nil | ||
'''Spring.UnitRendering.SetLODDistance''' <font color= | '''Spring.UnitRendering.SetLODDistance''' <font color=#55ee99>(same as SetLODLength(), but adjusted for 45deg FOV + 1024x768)</font> | ||
(number unitID, int lod, number lodDistance ) -> nil | (number unitID, int lod, number lodDistance ) -> nil | ||
'''Spring.UnitRendering.SetPieceList''' <font color= | '''Spring.UnitRendering.SetPieceList''' <font color=#55ee99>(displayList=nil reset to default)</font> | ||
( number unitID, int lod, int piece [, number displayList = nil ] ) -> nil | ( number unitID, int lod, int piece [, number displayList = nil ] ) -> nil | ||
'''Spring.UnitRendering.GetMaterial''' <font color= | '''Spring.UnitRendering.GetMaterial''' <font color=#55ee99>(creates a material userdata)</font> | ||
( [[Lua_UnitRendering#MaterialType|string MaterialType]], [[Lua_UnitRendering#Material_Table|table Material]] ) -> [[Lua_UnitRendering#Material_UserData|userdata Material]] | ( [[Lua_UnitRendering#MaterialType|string MaterialType]], [[Lua_UnitRendering#Material_Table|table Material]] ) -> [[Lua_UnitRendering#Material_UserData|userdata Material]] | ||
| Line 27: | Line 27: | ||
( number unitID, [[Lua_UnitRendering#MaterialType|string MaterialType]], int lod, arg1, arg2, ... ) -> nil | ( number unitID, [[Lua_UnitRendering#MaterialType|string MaterialType]], int lod, arg1, arg2, ... ) -> nil | ||
'''Spring.UnitRendering.SetUnitLuaDraw''' <font color= | '''Spring.UnitRendering.SetUnitLuaDraw''' <font color=#55ee99>(enables the DrawUnit callin)</font> | ||
( number unitID, boolean enabled ) -> nil | ( number unitID, boolean enabled ) -> nil | ||
'''Spring.UnitRendering.Debug''' <font color= | '''Spring.UnitRendering.Debug''' <font color=#55ee99>(prints some usefull debug informations)</font> | ||
( [ number unitID ] ) -> nil | ( [ number unitID ] ) -> nil | ||
| Line 49: | Line 49: | ||
["texunits" = { | ["texunits" = { | ||
[ [0] = { ["tex" = <font color= | [ [0] = { ["tex" = <font color=#55ee99>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font> ,] | ||
["enable" = boolean true ] }, ] | ["enable" = boolean true ] }, ] | ||
[ [3] = <font color= | [ [3] = <font color=#55ee99>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font>, ] | ||
<font color= | <font color=#55ee99>(upto [15] and supports holes in it)</font> | ||
} ,] | } ,] | ||
["texunit0" = <font color= | ["texunit0" = <font color=#55ee99>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font> ,] | ||
... | ... | ||
["texunit7" = <font color= | ["texunit7" = <font color=#55ee99>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font> ,] | ||
["prelist" = [[Lua_OpenGL_Api#Display_Lists|lua_displaylist]] ,] | ["prelist" = [[Lua_OpenGL_Api#Display_Lists|lua_displaylist]] ,] | ||
Revision as of 20:52, 27 October 2008
Unit Rendering
Spring.UnitRendering.SetLODCount
( number unitID, int lodCount ) -> nil
Spring.UnitRendering.SetLODLength (`lod` is 1-indexed)
( number unitID, int lod, number lodLength ) -> nil
Spring.UnitRendering.SetLODDistance (same as SetLODLength(), but adjusted for 45deg FOV + 1024x768)
(number unitID, int lod, number lodDistance ) -> nil
Spring.UnitRendering.SetPieceList (displayList=nil reset to default)
( number unitID, int lod, int piece [, number displayList = nil ] ) -> nil
Spring.UnitRendering.GetMaterial (creates a material userdata)
( string MaterialType, table Material ) -> userdata Material
Spring.UnitRendering.SetMaterial
( number unitID, int lod, string MaterialType, userdata Material | table Material ) -> nil
Spring.UnitRendering.SetMaterialLastLOD
( number unitID, sstring MaterialType, int lastLOD ) -> nil
Spring.UnitRendering.SetMaterialDisplayLists
( number unitID, int lod, string MaterialType, preDisplayList, postDisplayList ) -> nil
Spring.UnitRendering.SetUnitUniform (unfinished)
( number unitID, string MaterialType, int lod, arg1, arg2, ... ) -> nil
Spring.UnitRendering.SetUnitLuaDraw (enables the DrawUnit callin)
( number unitID, boolean enabled ) -> nil
Spring.UnitRendering.Debug (prints some usefull debug informations)
( [ number unitID ] ) -> nil
MaterialTypes
"alpha" "opaque" "alpha_reflect" "opaque_reflect" "shadow"
Material UserData
none user accessible methods (yet)
Material Table
material = {
["order" = number ,]
["shader" = lua_shader | string "3do" | string "s3o" ,]
["texunits" = {
[ [0] = { ["tex" = see gl.Texture ,]
["enable" = boolean true ] }, ]
[ [3] = see gl.Texture, ]
(upto [15] and supports holes in it)
} ,]
["texunit0" = see gl.Texture ,] ... ["texunit7" = see gl.Texture ,]
["prelist" = lua_displaylist ,] ["postlist" = lua_displaylist ,] ["usecamera" = boolean ,] ["cameraloc" = number ,] }