Jump to content

How to build plugin for Ultra?


Go to solution Solved by Josh,

Recommended Posts

  • Solution
Posted

The plugins system presently supports images and packages. The interface for model plugins needs a little more love, and in fact I plan to add Quake model loading into the Quake plugin as the first implementation.

  • Thanks 1

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

Posted

Now that the thumbnails system is done, my next task is to finalize the model plugin system.

  • Like 3

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

Posted

I was interested in just Quake model plagin for now. I have a problem with it btw. I updated client and project but have no thumbnails and there is error when i'm trying to open model in editor: 

image.thumb.png.16adf4dc102c566b378ef7d4fbfb724c.png

Posted

Since your Quake folder does not contain the required shaders folder, it can't render the models. In my examples I copied the pak files into an Ultra Engine project folder.

I am working on a solution to this issue, but I want to approach it carefully and choose the right design.

  • Thanks 1

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

Posted

Yes, you can load the assets straight out of the game files, and it's no different from distributing a mod. In fact there are a few custom builds of the Quake engine that act like this.

  • Thanks 1

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

Posted

Quake model from pak is not visible in the engine. I can see model being loaded in debug (i.e. model var is not empty) but scene is empty. 

PAK0 is in app dir (because of shader issue, crash if pak in game folder atm).

 

#include "UltraEngine.h"
#include "Components/CameraControls.hpp"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a world
    auto world = CreateWorld();
    world->SetAmbientLight(0);

    //Create a framebuffer
    auto framebuffer = CreateFramebuffer(window);

    //Load FreeImage plugin
    auto plg = LoadPlugin("Plugins/FITextureLoader");
    auto quakeLoaderPlugin = LoadPlugin("Plugins/QuakeLoader");

    //Load model
    WString path = AppDir();
    auto pak = LoadPackage(path + "/PAK0.PAK");
    ChangeDir(path);
    auto model = LoadModel(world, "progs/quaddama.mdl");
    model->Turn(0, 180, 0, true);

    //Environment maps
    auto specmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/specular.dds");
    auto diffmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/diffuse.dds");
    world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_BACKGROUND);
    world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR);
    world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE);

    //Create a camera    
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetPosition(0, 1.4, -1);
    camera->SetFov(70);
    camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/FXAA.json"));

    //Add camera controls
    camera->AddComponent<CameraControls>();

    //Create light
    auto light = CreateBoxLight(world);
    light->SetRange(-10, 10);
    light->SetArea(15, 15);
    light->SetRotation(45, 35, 0);
    light->SetColor(1.2);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

Posted

The model's center position may be strange:

#include "UltraEngine.h"
#include "Components/CameraControls.hpp"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a world
    auto world = CreateWorld();
    world->SetAmbientLight(0);

    //Create a framebuffer
    auto framebuffer = CreateFramebuffer(window);

    //Load FreeImage plugin
    auto plg = LoadPlugin("Plugins/FITextureLoader");
    auto quakeLoaderPlugin = LoadPlugin("Plugins/QuakeLoader");

    //Load model
    WString path = AppDir();
    auto pak = LoadPackage(path + "/PAK0.PAK");
    ChangeDir(path);
    auto model = LoadModel(world, "progs/quaddama.mdl");
    model->Turn(0, 180, 0, true);

    //Environment maps
    auto specmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/specular.dds");
    auto diffmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/diffuse.dds");
    //world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_BACKGROUND);
    world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR);
    world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE);

    //Create a camera    
    auto camera = CreateCamera(world);
    camera->SetClearColor(0,0,1);
    camera->SetPosition(model->GetBounds().center);
    camera->Move(0, 0, -0.3);
    camera->SetRange(0.01, 100);
    camera->SetFov(70);
    camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/FXAA.json"));

    //Add camera controls
    //camera->AddComponent<CameraControls>();

    //Create light
    auto light = CreateBoxLight(world);
    light->SetRange(-10, 10);
    light->SetArea(15, 15);
    light->SetRotation(45, 35, 0);
    light->SetColor(1.2);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

  • Thanks 1

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

Posted

Is your project up to date? It looks like it is using some old shader binaries.

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

  • 3 weeks later...
Posted

Can be changed model center in the engine? I found the way to put quake models where i want by subtracting bounds center but i would need to repeat it every time when i turn model so maybe there is better way to deal with center offcet.

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