Jump to content

Josh

Staff
  • Posts

    23,126
  • Joined

  • Last visited

Blog Comments posted by Josh

  1. Do you think Scintilla can be compiled as a DLL module for Lua to call? It would be interesting to see if we can add a script editor tool as an extension:

    local function hook(event, scripteditor)
    
        --Catch menu event to open script editor
        if event.id == EVENT_WIDGETACTION then
            if event.source == scripteditor.menuitem then
                scripteditor.window:SetHidden(false)
                scripteditor.window:Activate()
            end
    
        --Intercept asset browser open asset event
        else if event.id == EVENT_OPENASSET then
            ext = string.lower(ExtractExt(event.text))
          
            --If it's a code file let's steal the event
            if ext == "vert" or ext == "frag" or ext == "lua" then
                local code = LoadString(event.text)
                scripteditor.codearea:SetText(code)
                scripteditor.window:SetHidden(false)
                scripteditor.window:Activate()        
                return false --the rest of the program will never see the event! ha-ha 
            end
          
        end
    end
    
    local menu = program.menu:FindChild("Tools")
    
    local scripteditor = {}
    scripteditor.window = CreateWindow("Script Editor", 0,0,800,600,program.window, WINDOW_TITLEBAR + WINDOW_RESIZABLE)
    scripteditor.ui = CreateInterface(scripteditor.window)
    scripteditor.codearea = CreateCodeArea()---TODO!
    scripteditor.menuitem = CreateMenu("Script Editor", menu)
    
    --Listen for events
    ListenEvent(EVENT_WIDGETACTION, scripteditor.menuitem, hook, scripteditor)
    ListenEvent(EVENT_OPENASSET, program.assetbrowser, hook, scripteditor)

     

  2. 10 hours ago, Thirsty Panther said:

    Leadwerks could load FBX models, is that possible with Ultra or will we need a plugin?

    Will Leadwerks scripts work in Ultra?

    Are we close to a release of Ultra? 

    Thanks.

    The Leadwerks editor automatically converts FBX files to MDL, and that is what Leadwerks actually loads. You can load those, or you can use the included FBX to glTF converter to convert to glTF and load that.

    Lua support is not finished yet. It will allow multiple scripts, much better debugging in VSCode, and the Lua garbage collector will work together with C++ shared pointers so that invalid pointer errors are a thing of the past. I will have to look into it further, but I think Leadwerks scripts can probably be remapped to Ultra, at least most of the way.

    Ultra is nearly ready. At this point I am mostly just writing documentation and debugging.

    • Like 6
  3. What I ended up doing is running an HDR file through the IBL sampler above, then loading the KTX2, converting the mipmaps to BC6H, and saving as a DDS:

        auto plg = LoadPlugin("Plugins/KTX2TextureLoader");
        auto plg2 = LoadPlugin("Plugins/ISPCTexComp");
    
        auto skybox = LoadTexture("Materials/Environments/Cloudy Blue/specular.ktx2", LOAD_MIPCHAIN);
        std::vector<shared_ptr<Pixmap> > mipmaps;
        for (int layer = 0; layer < skybox->mipchain.size(); ++layer)
        {
            for (int miplevel = 0; miplevel < skybox->CountMipmaps(); ++miplevel)
            {
                auto mipmap = skybox->mipchain[layer][miplevel];
                mipmaps.push_back(mipmap->Convert(TEXTURE_BC6H));
            }
        }
        SaveTexture("Materials/Environments/Cloudy Blue/specular.dds", TEXTURE_CUBE, mipmaps, 6);

     

×
×
  • Create New...