Jump to content

Missing Lua-Bindings: A collection


klepto2
 Share

Recommended Posts

Hi, 

while normally working with the cpp version, i was often using lua lately to try things out. Unfortunatly i have found out, that some essential stuff is missing from lua:

  • PostEffect:
    • only LoadPostEffect is available
    • no other class member except Asset and Object ones are available
  • Material:
    • Some Set and get Values are missing like:
      • SetBackfaceculling
      • SetDepthTest
      • SetDepthMask
      • and maybe some other
  • tableplusplus
    • Can't create a table without loading a dummy one
  • Entity
    • properties 
      • is available, but always nil in the lua context
      • in the editor trying to save a gameobject in map which has properties set like: entity.properties = {}; entity.properties["table"] = a leads to an error that userdata needs to be a cpp table.
    • some more might be missing
  • Camera
    • SetRefraction is missing
    • Getters for each settting should be available (same for cpp) 
      • only 2 are available
  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

On 7/26/2024 at 4:10 AM, klepto2 said:

PostEffect:

  • only LoadPostEffect is available
  • no other class member except Asset and Object ones are available

 

Posteffect class has no other methods?

On 7/26/2024 at 4:10 AM, klepto2 said:

Material:

  • Some Set and get Values are missing like:
    • SetBackfaceculling
    • SetDepthTest
    • SetDepthMask
    • and maybe some other

Added Get/SetBackFaceCullMode, Get/SetBackFaceLighting, 

I am not completely sure that Get/SetDepthMask and Get/SetDepthTest should be exposed, or how they should work. I would consider the commands not official currently.

On 7/26/2024 at 4:10 AM, klepto2 said:

Camera

  • SetRefraction is missing
  • Getters for each settting should be available (same for cpp) 
    • only 2 are available

 

Added a lot of missing camera methods.

The editor is updated now. Have not updated the Lua interpreter yet.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

5 hours ago, Josh said:

Posteffect class has no other methods?

Yeah, noticed it as well after posting it :) I somehow mixed up camera:SetUniform with posteffect:SetUniform. and the camera:SetUniform is there. 

  • Haha 1
  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

While camera:SetUniform is exposed, it doesn't work correctly.

for textures i get no matching overload found and the other SetUniforms throw some index out of range errors (in cpp it both works)

  fft.showTexturePFX = LoadPostEffect("Shaders/Ocean/effect/display.fx")
    fft.testTexture = LoadTexture("Materials/water_foam.dds")
    for k,v in pairs(program.world:GetEntities()) do
        local c = Camera(v)
        if c ~= nil then
            local index = c:AddPostEffect(fft.showTexturePFX)
            c:SetUniform(index,"display_texture", fft.testTexture)
            c:SetUniform(index,"color_mask", Vec4(1.0,0.0,1.0,1.0))
        end
    end

 

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

They are there, but using the new SetUniform leads to crash to desktop (tested only within the editor).

using SetUniform for eg: Vec4 types leads to index out of range errors.

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

Of course, but what does the call of an ultraengine method have to do with the lua index? if i get the index 0 from the posteffect, then i should use that as a parameter in the SetUniform. This isn't a lua table, shouldn't it work the same way as in cpp?

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

In Lua, I have made anything that is an array index one-based, since that is how Lua is designed.

When you add a post-effect, one will be added to the index before it is returned.

"AddPostEffect", [](Camera& c, shared_ptr<PostEffect> f) { return c.AddPostEffect(f) + 1; },

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...