Jump to content

No Accessible Mesh


Go to solution Solved by Josh,

Recommended Posts

Posted

I can't figure this one out.  I was playing around with exporting from Blender and it displays on screen but only shows 1 LOD and no meshes for that LOD.  It's worth mentioning it has no materials or images, not sure why that'd make a difference though.

 

EDIT :  It might be the newer GLTF export in blender.  The files that work are with "Khronos glTF Blender I/O v1.4.40" and the ones I've uploaded that don't work are "Khronos glTF Blender I/O v3.6.27".

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

using namespace UltraEngine;


int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto world = CreateWorld();

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

    //Create a camera
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetFov(70);
    camera->SetPosition(0, 5, -8);

    //Create a light
    auto light = CreateBoxLight(world);
    light->SetRotation(35, 45, 0);
    light->SetRange(-10, 10);

    auto model = LoadModel(world, "Models\\PineLarge_001.gltf");

    //Only one LOD and no meshes.
    //Output says LOD_1 was loaded but then deleted

    int l = 0;
    for (auto lod : model->lods) {
        auto m = 0;
        for (auto mesh : lod->meshes) {
            Notify("lod : " + String(l) + ", mesh : " + String(m), "");
            m++;
        }
        l++;
    }

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

 

PineLarge.zip

Posted

Did you open this in the model viewer? Maybe there is an extra node in the hierarchy?

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

Posted

I loaded this into the model viewer and re-saved it from there.  In C++ it still says only 1 LOD is available and it has a mesh size of 0.  Even though the output says it loaded the other LOD and it renders perfectly.

  • Solution
Posted

It looks like branches and leaves are two separate children:

    int l = 0;
    for (int n = 0; n < model->kids.size(); ++n)
    {
        for (auto lod : model->kids[n]->As<Model>()->lods) {
            auto m = 0;
            for (auto mesh : lod->meshes) {
                Notify("lod : " + String(l) + ", mesh : " + String(m), "");
                m++;
            }
            l++;
        }
    }

 

  • Thanks 1

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

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