Home Forums Development discussions Future development

Viewing 15 posts - 16 through 30 (of 157 total)
  • Author
    Posts
  • #233
    SponkSponk
    Keymaster

    Currently I’m creating Lua API calls as I need them in my game or in a editor plugin. Most of the things necessary for creating most things are done.

    If you have ideas you can propose them here.

    #234
    AvatarAkira_San
    Participant

    lua api: ReplaceObject() Useful when you want to replace the object with another one. Its sort of a shortcut to: delete the destroyed barrel, make a new clone(shattered barrel) and then, play destroyed barrel animation.

    #235
    SponkSponk
    Keymaster

    What’s wrong with writing this function in your Lua script?

    function replaceObject(object, newMesh)
        newObject = loadMesh(newMesh)
        setPosition(newObject, getPosition(object))
        setRotation(newObject, getRotation(object))
        setScale(newObject, getScale(object))
    
        updateMatrix(newObject)
        deleteObject(object)
        return newObject
    end

    Then you could also set an animation as you suggested.

    I think this function should reside in your personal code and not in the C++ core engine since it’s only using already available functionality. You can of course package your script as library and distribute it for others to use. That is the preferred way of getting this function to the public.

    #236
    AvatarAkira_San
    Participant

    Thats very nice. 🙂 I didnt thought of that! If i have a multiple of objects, then how do i do that?

    #237
    SponkSponk
    Keymaster

    That’s easy. Just put them in a list and iterate through it:

    local objectList = {}
    -- Do this with all objects you want to have. You only have to change "SomeObject" to the new name
    objectList[#objectList+1] = getObject("SomeObject")
    
    for i = 1, #objectList, 1 do
        -- Insert your mesh file here
        replaceObject(objectList[i], "meshs/somefile.mesh")
    end
    
    -- Set the list to nil so we can't try to access invalid pointers to objects
    -- That got deleted in "replaceObject"
    objectList = nil
    • This reply was modified 6 years, 2 months ago by SponkSponk.
    #238
    AvatarAkira_San
    Participant

    Thank you!
    What about some api, about highlights. When you hover the mouse over an object, the object starts to glow. I see on the other engine they have like: matcolor = material.color.red or replace_material = material.replace_shader(“glow.mat”)?

    #240
    SponkSponk
    Keymaster

    Material options should not be problematic. Please open an issue for that on GitHub 🙂

    #246
    AvatarAkira_San
    Participant

    Done. 🙂
    Will you be adding cube maps like bpcem?

    #248
    SponkSponk
    Keymaster

    Well, it could be done but I don’t think that it’s necessary right now since there would be hardly anyone using it 😀

    If you need it a better way would be pre-baking it in Blender and using a custom GLSL shader. That would save rendering time each frame and give good results in almost all scenarios.

    #249
    AvatarAkira_San
    Participant

    I see, any good websites for learning glsl?

    #250
    SponkSponk
    Keymaster

    NeHe of course: http://nehe.gamedev.net/article/glsl_an_introduction/25007/
    Then the DGL wiki: http://wiki.delphigl.com/index.php/Tutorial_glsl

    It’s german but someone else may find it interesting 😀

    This one is also nice: http://www.lighthouse3d.com/opengl/glsl/

    I have a very basic environment mapping shader working. I can upload it if you want.
    It’s just per-vertex but it’s simple and gives nice results.

    #251
    AvatarAkira_San
    Participant

    Sure i could take a look. Are you planning to add some more lamps like a Sun lamp?

    #252
    AvatarAkira_San
    Participant

    Thx for the links, been reading the first link, now i have some understanding of the glsl shaders. 🙂 Although writing them is a long time task…

    #253
    SponkSponk
    Keymaster

    Yep, GLSL shaders can take a long time to debug 😀

    You can already use a directional light. Simply create a light, set it to spot-light and set the angle to 0 🙂

    #255
    AvatarAkira_San
    Participant

    Damn, Maratis is hiding all of this functionality behind… I must say, thats not even user friendly.

Viewing 15 posts - 16 through 30 (of 157 total)
  • You must be logged in to reply to this topic.