Jump to content

Josh

Staff
  • Posts

    23,590
  • Joined

  • Last visited

Everything posted by Josh

  1. I don't know man, I think my tiny little brain cannot answer this today! 😝
  2. Is the background a panel? Maybe it should be a sprite so you can control the depth?
  3. It's probably an uninitialized value that hasn't been set yet. That should really be made a private member.
  4. For each widget in the interface, there is a value that starts with one and increments. The Z position of each widgetblock's sprite is calculated as follows: pos.z = 0.999f - float(gui->orderiterator) / 10000.0f; So if you set the Z position of your sprite to 0.999f it will appear behind all widgets, but still within the default orthographic camera depth range.
  5. Yes. Your app should be fine now.
  6. Okay, your changes to the preprocessor are live now. I also removed UPX compression from the VS template. I don't recommend using this because it can sometimes trigger antivirus programs.
  7. There are some things I want to add to Leadwerks. OpenAL-soft has proven to be very reliable, and it would eliminate the need for the OpenAL installer that occasionally causes problems. I was able to develop a PBR shading model in Ultra that works well with classic material specular. And some other things.
  8. Oh yeah, I changed those to LoadJson, SaveJson, ParseJson...
  9. How does it know what the application name is? You mean the executable file, right?
  10. You could also just create a model with a mesh that uses lines: https://www.ultraengine.com/learn/CreateMesh
  11. Update Fixed serious bug in thread manager that could have affected all system, physics, rendering, culling, etc. The wrong mutex was being locked when commands were added to the thread command buffer. 😱 Number of maximum GUI widgets visible will probably be about 20,000 now
  12. Yeah, just nudge it forward away from the camera: line->SetPosition(line->position + Vec3(0,0,0.1));
  13. No, because your sprites are in 3D space. Just calculate the Y position like this: y = framebuffer->size.y - y I suppose the fact there is no 2D drawing is an argument for camera project/unproject to pre-flip the Y coordinate.
  14. No, in the GUI system everything is right angles. I thought about adding lines and Bezier curves in a future update.
  15. I'm not going to worry about small cosmetic issues right now. There are a few places where a line is off by one pixel, or something like that. This should be resolved, but I would like to focus on anything more important right now.
  16. Yep, I confirmed this. I could make the increment smaller. I don't know what the lower limit is before Z-fighting will start happening. But I don't think this is really a problem, in any case.
  17. I know why this is happening. 🤡 The engine uses the depth buffer for 2D ordering, so it does not have to draw 2D objects in order. This is one of the reasons it is so fast. When the GUI generates sprites for all the interface elements, it starts by positioning them at the far depth range, and moves each one a little closer to the camera, to make it appear on top of the last one. It seems that at about 2000 the Z-position increments pass the near depth range, so the sprites after that are no longer visible to the camera. Not a bug, just the way it is designed. Normal sprites that you position yourself will not do this.
  18. When I run it I get to about 2300. Each update gets slower and slower. I don't have an explanation right now why new panels stop appearing though. The render stats say more instances are being drawn. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; bool EventCallback(const Event& event, shared_ptr<Object> extra) { switch (event.id) { case EVENT_MOUSEENTER: Print("MOUSE_ENTER"); break; case EVENT_MOUSELEAVE: Print("MOUSE_LEAVE"); break; case EVENT_MOUSEDOWN: Print("MOUSE_DOWN"); break; case EVENT_MOUSEMOVE: //Print("MOUSE_MOVE"); break; case EVENT_MOUSEUP: Print("MOUSE_UP"); break; case EVENT_MOUSEWHEEL: Print("MOUSE_WHEEL"); break; } return true; } 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(); auto framebuffer = CreateFramebuffer(window); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 2, -3); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->size); ui->SetRenderLayers(1); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); ui_camera->SetRenderLayers(1); ui_camera->SetClearMode(CLEAR_DEPTH); auto w1 = CreatePanel(0, 0, 1, 1, ui->root); ListenEvent(EVENT_NONE, w1, EventCallback); auto w2 = CreatePanel(0, 0, 1, 1, w1); ListenEvent(EVENT_NONE, w2, EventCallback); w2->SetColor(1, 0, 0); auto w3 = CreateTabber(10, 10, 1, 1, ui->root); w3->SetShape(25, 25, 256, 256); w3->AddItem("Page1"); w3->AddItem("Page2"); auto w4 = CreateButton("Test", 0, 0, 32, 32, w3); w4->SetShape(5, 5, 100, 50); auto terrain = CreateTerrain(world, 512, 512); terrain->SetMaterial(LoadMaterial("Data\\bluegrid.mat")); auto c = CreateCylinder(world); c->SetPhysicsMode(PHYSICS_PLAYER); vector<shared_ptr<Entity>> entities; Vec3 offset = Vec3(10.0f, 1.0f, 5.0f); float scale = 2.0f; for (int z = 0; z < 10; z++) { for (int x = 0; x < 10; x++) { auto e = CreateSphere(world); e->SetColor(Random(), Random(), Random()); e->SetPosition(Vec3((float)x * scale + Random() - 0.5f, 0.0f, (float)z * scale + Random() - 0.5f) + offset, true); e->SetMass(1.0f); entities.push_back(e); } } auto sprite = CreateSprite(world, default_font, "", 12); sprite->SetRenderLayers(1);//Still on layer 0? vector<shared_ptr<Widget>> widgets; widgets.push_back(ui->root); world->RecordStats(true); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { w1->SetShape(Random(0, 512), Random(0, 512), Random(64, 128), Random(64, 128)); w2->SetShape(Random(0, 10), Random(0, 10), Random(16, 128), Random(16, 32)); } if (!window->KeyDown(KEY_H)) { auto w = CreatePanel(Random(0, 512), Random(0, 512), Random(64, 128), Random(64, 128), ui->root);// widgets[(int)Random(0.0f, (float)widgets.size() - 0.1f)]); w->SetColor(Random(), Random(), Random()); ListenEvent(EVENT_NONE, w, EventCallback); widgets.push_back(w); } sprite->SetText(String(widgets.size())); while (PeekEvent()) { auto event = WaitEvent(); ui->ProcessEvent(event); } window->SetText(world->renderstats.instances); world->Update(); world->Render(framebuffer); } return 0; }
  19. Just use the correct camera and the correct render buffer, and everything works out: auto screen_pos = cam3->Project(box->position, buffer);
  20. These widgets do not emit mouse events.
  21. Update Fixed transparency problems
×
×
  • Create New...