Jump to content

reepblue

Developers
  • Posts

    2,600
  • Joined

  • Last visited

Everything posted by reepblue

  1. Forgot to add a semicolon on line 669. My example never called the function so it was missed. Also, I guess LoadJSON got thanos snapped from the API...
  2. Should note that my EOF fix doesn't work when compiling with the engine. But it's super simple to fix with a comment. // 230102 - reep: Make me compatible with the engine. #if !defined (Eof) #define Eof EOF #endif The engine defines _ULTRA_APPKIT so there isn't a safe way to find a difference between the two. However, it's more ideal to keep compile this with UAK as it's a shorter build time.
  3. Yes. If the preprocessor is ever newer than an existing project, it'll force a rebuild. //Compare it with the time of this application. //If this application is newer, force a rebuild. if (FileTime(WString(argv[0])) > headertime && !rebuild) { Print("Regenerating Component System files as the pre-processor has been updated since last generation."); rebuild = true; }
  4. @Josh Made a pull request to the preprocessor to allow user flexibility. It'll still work the same way without any additional parameters set. Decided to contribute it as this will probably change as the engine matures. Added arguments to define search paths and file names. Added timestamps to be written to generated files. Added timestamp to the start of the application. The preprocessor will force a rebuild if the application is newer than the component system files. Fixed GetComponent() not having a return value in all cases. Added Help screen. when -help is set. Set the project to be built as a console application. Fixed size conversion warnings. Fixed a typo.
  5. On the topic of transparency, that reminds me that in this example, you can notice a ghosting effect if the alpha is set to 0.0f #include "UltraEngine.h" #include "ComponentSystem.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 world 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, 0, -3); //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); //Create a box auto box = CreateBox(world); auto material = CreateMaterial(); if (material) { material->SetColor(0.0f, 0.0f, 1.0f, 1.0f); material->SetTransparent(true); box->SetMaterial(material); material = NULL; } //Entity component system auto actor = CreateActor(box); auto component = actor->AddComponent<Mover>(); component->rotation.y = 45; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { // Adjust the alpha of the sprite. float alpha = box->GetColor().a; if (window->KeyDown(KEY_UP)) { alpha = Clamp((alpha + 0.01f), 0.0f, 1.0f); box->SetColor(1.0f, 1.0f, 1.0f, alpha); } if (window->KeyDown(KEY_DOWN)) { alpha = Clamp((alpha - 0.01f), 0.0f, 1.0f); box->SetColor(1.0f, 1.0f, 1.0f, alpha); } world->Update(); world->Render(framebuffer); } return 0; }
  6. reepblue

    Ultra Engine Editor WIP

    Glad to see this again!
  7. Yeah, I can understand that there might be confusion. The current system prioritizes packages before raw contents on the disk. If you have 2 files integrated with the same paths on the same file structure, which file does it actually load? Should the contents of the mod folder take priority over the in-game files? As an experiment, I implemented my own with custom load wrappers. Right now, I'm more worried about loading files that aren't there vs overriding my game files. This doesn't affect engine loading calls. If you added mod folder support, it would fix my dilemma. const UltraEngine::WString GetGlobalFile(const UltraEngine::WString& pszFilePath) { UltraEngine::WString path = pszFilePath; if (!path.empty()) { // If we've found it within the game directory, return this path. if (UltraEngine::FileType(UltraEngine::CasedPath(path)) != 0 and UltraEngine::FileSize(UltraEngine::CasedPath(path)) != 0) return path; // File isn't located where we thougnt it was. Check addional search paths.. for (const auto& p : m_vSearchPaths) { auto trypath = UltraEngine::CasedPath(p + L"/" + pszFilePath); if (UltraEngine::FileType(trypath) != 0 and UltraEngine::FileSize(trypath) != 0) { // This is good, break the loop.. path = trypath; break; } } } return path; }
  8. Something else I was playing with last night was loading in additional search paths, so I didn't have to copy and paste assets to test. First I added the following to my Ultra.json file to look like this. { "project": { "name": "Sample App", "templates": [ "C++", "Common" ], "validationLayers": { "debug": [ "VK_LAYER_KHRONOS_validation" ], "release": [] }, "packages": [ "../core/core_shaders.zip" ] } } This worked for packages, because I used FullPath when loading the package entry. Now I'm wondering if we could load an unpackaged directory the same way. I want it so I only have to update my core directory with the client and have all my projects load all those files. LoadDir only indexes the contents of the directory and not load it within the virtual filesystem. Would it be possible to make a plugin that does this?
  9. This makes me so happy. Going to start redoing the UI layer. I want my panels to act like windows and I think I can make it work.
  10. Does this mean lua scripts will work upon loading Leadwerks maps? I remember you told me you disabled that.
  11. That's because GetValue is a function that read script values. I don't think Josh shipped the dll as it's not 100% supported yet.
  12. It'll probably be a bit faster once those drop shadows are instanced! One thing imGUI does have out of the box is resizable/moveable panel windows within the context, but can probably make my own with some work. Can't wait to try these updates. I have so many ideas.
  13. I have noticed that when I reprint the user's entry it's blotched, but when a response is printed, it's just fine. I thought it was because of wide strings but that doesn't make sense. I'll probably try your example and see if I can ether break it or it's on my side. Also, thanks for fixing everything else. 🙂
  14. Almost there.... Text Area is still messed up as it randomly blotches out on some lines. Just create a text box in 3D and My console in the left corner updates in real time, pushing older messages down were they nicely fade out. It's so wonderful, I wish I could have it in Cyclone but making context calls just slows Leadwerks down. Resizing works 100% with some work. When I rebuild my window, I emit the EVENT_WINDOWSIZE event so everything else can reposition itself when the event is triggered. For the HUD camera, I might leave it in the center and work out of the default position of the middle. This will remove the need of repositioning the camera and centered huds are more friendly to ultrawide users like myself. Also, I was getting exceptions thrown when using Interface::ProcessEvent although the examples work. Doing this prevents the crash. while (UltraEngine::PeekEvent()) { const auto ev = UltraEngine::WaitEvent(); // IDK why I have to do this.. if (ev.id != UltraEngine::EVENT_WINDOWSIZE && m_spInterface != NULL) m_spInterface->ProcessEvent(ev); .... Also, I found an assert when instancing a text sprite and then setting its text to a new string. My stats counter makes new pointers for each drop shadow. I'll write an example demonstrating this when it's not midnight... Once UI is done, then I have to make a client/server setup.
  15. Wonderful! I can't wait to check everything out!
  16. Yeah, I dug up the example on this thread and updated the code and that still works fine. Looking forward to this being resolved. Resizing the UI is why I have players with Cyclone to restart the game when they change their window settings, and I don't wish to have that be the case going forward.
  17. Hmm, ok. I'll take a look. I kind of want to make a system that'll allow Huds and such on to be created and released in between layer 0 and the UI and debug layers. This way a player or weapon component can manage it's own hud independently from everything else. Since I know the order of creation doesn't matter if the settings are correct, should be doable. Nothing you need to do, this is my riddle to solve.
  18. It took me forever to spot but I guess the cameras have to has matching clear colors? I probably wouldn't ever have known that. But now it kind of makes sense. I'll try it tonight, but I might just set all my camera clear colors to 0. I also plan on setting up a git repo with all my examples so people can refer to in the future.
  19. Today I found this. What's the difference between these two? extern WString AppDir(); extern WString AppPath(); Most things seem to be working wonderfully in my complex application. One thing that caught me off guard was that the black panel (Which is a sprite) needed some code to work correctly. I thought I could use SetColor to change its alpha, I figured out that I needed to load a material with the unlit shader family first, then tell the material to allow transparency.
  20. This example demonstrates that camera creation order matters when I feel like it shouldn't. Comment/Uncomment the macro to toggle. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; // Toggle me to change the order. // Creation order of the cameras should not matter. //#define DRAW_2DCAM_FIRST 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 framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); #ifdef DRAW_2DCAM_FIRST //Create a ortho camera first auto camera2D = CreateCamera(world, UltraEngine::PROJECTION_ORTHOGRAPHIC); camera2D->SetDepthPrepass(false); camera2D->SetClearMode(UltraEngine::CLEAR_DEPTH); camera2D->SetRenderLayers(UltraEngine::RENDERLAYER_7); camera2D->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); //Create sprite auto sprite = LoadSprite(world, "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Sprites/nightraider.dds"); sprite->SetRenderLayers(UltraEngine::RENDERLAYER_7); sprite->SetPosition(0, 0); sprite->mesh->material->SetAlphaMask(true); #endif //Create the 3D camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); #ifndef DRAW_2DCAM_FIRST //Create a ortho camera first auto camera2D = CreateCamera(world, UltraEngine::PROJECTION_ORTHOGRAPHIC); camera2D->SetDepthPrepass(false); camera2D->SetClearMode(UltraEngine::CLEAR_DEPTH); camera2D->SetRenderLayers(UltraEngine::RENDERLAYER_7); camera2D->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); //Create sprite auto sprite = LoadSprite(world, "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Sprites/nightraider.dds"); sprite->SetRenderLayers(UltraEngine::RENDERLAYER_7); sprite->SetPosition(0, 0); sprite->mesh->material->SetAlphaMask(true); #endif // Create a box for us to see auto model = CreateBox(world); model->SetColor(1, 0, 0); model->Turn(45, 45, 0); //Main loop while (window->Closed() == false and window->KeyHit(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  21. Even with that fix, it's still not drawing correctly after resizing the window. It might have to do with the validation error you're getting, but not sure. #include "UltraEngine.h" #include "ComponentSystem.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 - Normal", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world 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, 0, -3); camera->SetViewport(200, 0, framebuffer->size.x - 200, framebuffer->size.y); auto uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); uiCamera->SetRenderLayers(RENDERLAYER_1); uiCamera->SetClearMode(CLEAR_DEPTH); uiCamera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); auto ui = CreateInterface(world, LoadFont("Fonts/arial.ttf"), iVec2(200, framebuffer->size.y)); ui->SetRenderLayers(RENDERLAYER_1); auto sz = ui->root->ClientSize(); auto listbox = CreateListBox(5, 5, sz.x - 10, 200, ui->root, LISTBOX_DEFAULT)->As<ListBox>(); auto tabber = CreateTabber(5, 205, sz.x - 10, sz.y - 205, ui->root)->As<Tabber>(); tabber->AddItem("Settings", true); tabber->AddItem("Output"); for (int i = 0; i < 100; i++) { listbox->AddItem("Item " + String(i)); } //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); //Create a box auto box = CreateBox(world); box->SetColor(0, 0, 1); //Entity component system auto actor = CreateActor(box); auto component = actor->AddComponent<Mover>(); component->rotation.y = 45; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { auto ev = WaitEvent(); ui->ProcessEvent(ev); switch (ev.id) { case UltraEngine::EVENT_WINDOWCLOSE: if (ev.source == window) exit(0); break; default: break; } } // Rebuild the window. if (window->KeyDown(KEY_SPACE)) { static bool bSwapped = false; framebuffer = NULL; window = NULL; if (!bSwapped) { // Make it a tad bigger window = CreateWindow("Ultra Engine - Resized", 0, 0, 1400, 800, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); framebuffer = CreateFramebuffer(window); } else { window = CreateWindow("Ultra Engine - Normal", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); framebuffer = CreateFramebuffer(window); } // Reposition the camera. uiCamera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0); // Resize the ui ui->Redraw(0, 0, framebuffer->size.x, framebuffer->size.y); ui->UpdateLayout(); bSwapped = !bSwapped; } world->Update(); if (framebuffer) world->Render(framebuffer); } return 0; }
  22. I didn't have LunarG installed on my Win11 machine or else I would have said something as my code does this. Maybe that's a reason why repositioning the UI isn't working properly. Also, I was getting huge performance loss when doing this but it can also be my 1050 outputting 2580x1920.
  23. I think the only other engines that allow this is id tech and Source. I have yet to fix my example from last night but I'm looking forward getting an fps demo up and running soon. 🙂
  24. That's because I pulled @klepto2's example from the last page and I was making stupid mistakes because it was getting late. 🙃 I think the issue would can still happen even if that typo was corrected. I don't think independently resizing the UI isn't an event. I'll try it again tonight.
  25. Oh wow, that parameter isn't supposed to be there. There wasn't supposed to be any 2D drawing at all. That's what I get for saying "Just one more thing" til midnight. I'll try removing it tomorrow.
×
×
  • Create New...