Home Forums Development discussions Future development

Viewing 15 posts - 16 through 30 (of 157 total)
  • Author
    Posts
  • #233
    Sponk
    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
    Akira_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
    Sponk
    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
    Akira_San
    Participant

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

    #237
    Sponk
    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 9 years, 7 months ago by Sponk.
    #238
    Akira_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
    Sponk
    Keymaster

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

    #246
    Akira_San
    Participant

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

    #248
    Sponk
    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
    Akira_San
    Participant

    I see, any good websites for learning glsl?

    #250
    Sponk
    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
    Akira_San
    Participant

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

    #252
    Akira_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
    Sponk
    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
    Akira_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.