Jump to content

Slice miss creates brushes which can't be copied


Canardia
 Share

Go to solution Solved by Josh,

Recommended Posts

#include "UltraEngine.h"

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 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

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

    // Create a world
    auto world = CreateWorld();

    // Let there be light and a ship
    auto camera = CreateCamera(world);
    camera->Move(0, 20, -20);
    camera->Turn(30, 0, 0);
    auto ship = CreateBoxBrush(world, 10, 10, 10);
    auto light = CreatePointLight(world, 100);
    light->Move(0, 20, 0);

    // Slice the dice
    Plane plane = Plane(0,0,1,0);
    auto A = CreateBrush(world);
    auto B = CreateBrush(world);
    // comment the next line out if you don't want a crash
    ship->Move(0, 0, 50);           // cash me ousside howbow dah
    ship->Slice(plane, A, B);
    ship = B->Copy(world, false, false)->As<Brush>();

    // Move the sliced result right
    ship->Move(20, 0, 0);

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

 

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

  • Solution

There is a bug where a brush will crash in its UpdateBounds routine if it has no vertices. I am fixing it now...

  • Like 1

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

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...