Lua UnitRendering: Difference between revisions

From Spring
Jump to navigationJump to search
JK (talk | contribs)
JK (talk | contribs)
No edit summary
Line 32: Line 32:
'''Spring.UnitRendering.Debug''' <font color=darkgreen>(prints some usefull debug informations)</font>
'''Spring.UnitRendering.Debug''' <font color=darkgreen>(prints some usefull debug informations)</font>
   ( [ number unitID ] ) -> nil
   ( [ number unitID ] ) -> nil
==Material UserData==
<font color=red>fill me</font>
==Material Table==
  material = {
    ["order"  = number ,]
    ["shader" = [[Lua_GLSL_Api|lua_shader]] | string "3do" | string "s3o" ,]
    ["texunits" = {
        [ [0] = { ["tex" = <font color=darkgreen>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font> ,]
                  ["enable" = boolean true ] }, ]
        [ [3] = <font color=darkgreen>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font>, ]
      } ,]
    ["texunit0" = <font color=darkgreen>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font> ,]
    ...
    ["texunit7" = <font color=darkgreen>[[Lua_OpenGL_Api#Textures|see gl.Texture]]</font> ,]
    ["prelist"  = [[Lua_OpenGL_Api#Display_Lists|lua_displaylist]] ,]
    ["postlist"  = [[Lua_OpenGL_Api#Display_Lists|lua_displaylist]] ,]
    ["usecamera" = boolean ,]
    ["cameraloc" = number ,]
  }

Revision as of 03:50, 15 June 2008

Unit Rendering

Spring.UnitRendering.SetLODCount

 ( int lodCount ) -> nil

Spring.UnitRendering.SetLODLength (`lod` is 1-indexed)

 ( int lod, number lodLength ) -> nil

Spring.UnitRendering.SetLODDistance (same as SetLODLength(), but adjusted for 45deg FOV + 1024x768)

 ( 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 MaterialName, table Material ) -> ??

Spring.UnitRendering.SetMaterial

 ( number unitID, int lod, string MaterialName, userdata Material | table Material ) -> nil

Spring.UnitRendering.SetMaterialLastLOD

 ( number unitID, string MaterialName, int lastLOD ) -> nil

Spring.UnitRendering.SetMaterialDisplayLists

 ( number unitID, string MaterialName, preDisplayList, postDisplayList ) -> nil

Spring.UnitRendering.SetUnitUniform (unfinished)

 ( number unitID, string MaterialName, 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


Material UserData

fill me

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, ]
     } ,]
   ["texunit0" = see gl.Texture ,]
    ...
   ["texunit7" = see gl.Texture ,]
   ["prelist"   = lua_displaylist ,]
   ["postlist"  = lua_displaylist ,]
   ["usecamera" = boolean ,]
   ["cameraloc" = number ,]
 }