Jump to content

Thumbnails look wrong


Josh
 Share

Go to solution Solved by Josh,

Recommended Posts

This example shows the problem. This occurs with an ortho camera when the near range is less than zero and the object is behind you. I'm not even sure this is a bug, it might just be an unexpected mathematical outcome, but I think I can prevent it from happening: 

#include "UltraEngine.h"
#include "Components/Motion/Mover.hpp"
#include "Components/Player/CameraControls.hpp"
#include "Components/Player/FirstPersonControls.hpp"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto cl = ParseCommandLine(argc, argv);

    RegisterComponent<Mover>();
    RegisterComponent<CameraControls>();
    RegisterComponent<FirstPersonControls>();

    //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();

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

    world->SetEnvironmentMap(LoadTexture("materials/environment/default/diffuse.dds"), ENVIRONMENTMAP_DIFFUSE);
    world->SetEnvironmentMap(LoadTexture("materials/environment/default/specular.dds"), ENVIRONMENTMAP_SPECULAR);

    auto plg = LoadPlugin("Plugins/FITextureLoader");
    auto model = LoadModel(world, "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/DamagedHelmet/glTF/DamagedHelmet.gltf");

    auto camera = CreateCamera(world);
    camera->SetDepthPrepass(false);
    camera->SetClearColor(0.125);
    camera->Move(0, 0, -2);
    camera->SetProjectionMode(PROJECTION_ORTHOGRAPHIC);
    camera->SetRange(-100, 100); 
    camera->SetZoom(125);
    
    camera->AddComponent<CameraControls>();

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

 

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