Jump to content

Point Clouds - Vector Point Rendering?


rjmelter
 Share

Go to solution Solved by Josh,

Recommended Posts

Here you go. Just make sure you have indices as well as vertices:

points.thumb.png.8263a2230d9d06ba696dbb55d2254cae.png

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

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

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

    //Create a camera
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetPosition(0, 0, -1);

    auto model = CreateSphere(world);
    
    //Create point model
    auto model2 = CreateModel(world);
    std::vector<uint32_t> indices(model->lods[0]->meshes[0]->vertices.size());
    for (int n = 0; n < indices.size(); ++n) indices[n] = n;
    auto mesh = CreateMesh(MESH_POINTS, model->lods[0]->meshes[0]->vertices, indices);
    model2->AddMesh(mesh);

    model = nullptr;

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

 

  • Like 3

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