Jump to content

Missing Lua-Bindings: A collection


Go to solution Solved by Josh,

Recommended Posts

Posted

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
Posted
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.

Let's build cool stuff and have fun. :)

Posted
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
Posted

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
Posted

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
Posted

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
Posted

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; },

 

Let's build cool stuff and have fun. :)

  • 2 weeks later...
  • 2 months later...
  • Solution
Posted
On 8/9/2024 at 2:26 PM, Dexter said:

one related thing I ran across, lua math's Random() is missing the bindings with params, and further 'Random()' only returns 1 or 0 atm which seems off?

Run this one-liner in the editor console:

n = Random(0, 10) Print(n)

I believe everything listed in this thread is now fixed.

Let's build cool stuff and have fun. :)

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.

×
×
  • Create New...