Jump to content

Dreikblack

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. How to change outline thickness? Tried to change m and pixelsize in Outline.frag but nothing changed (tried rebuild solution and Compile Shaders.bat). Also i wonder how to outline not whole brush but only one face of it.
  2. Brush changes only a color after setting a material. Maybe i missing something or doing it wrong. Putting brush->Build(); after brush->SetMaterial(mtl); don't change anything. Made a model box just to show how i do expect brush to look so it's not light or something. #include "UltraEngine.h" using namespace UltraEngine; const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets"; 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(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.8); camera->Turn(35, 0, 0); camera->Move(0, 0, -2); //Create light auto light = CreateBoxLight(world); light->SetRange(-20, 20); light->SetArea(20, 20); light->SetRotation(35, 35, 0); //Create brush auto brush = CreateBrush(world); // brush->SetColor(0, 0, 1); //Add brush vertices float w = 1; float h = 1; float d = 1; brush->AddVertex(w * 0.5, h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, h * 0.5, -d * 0.5); brush->AddVertex(w * 0.5, h * 0.5, -d * 0.5); brush->AddVertex(w * 0.5, -h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, -h * 0.5, d * 0.5); brush->AddVertex(-w * 0.5, -h * 0.5, -d * 0.5); brush->AddVertex(w * 0.5, -h * 0.5, -d * 0.5); //Add faces auto face = brush->AddFace(); face->AddIndice(0); face->AddIndice(1); face->AddIndice(2); face->AddIndice(3); auto mtl2 = CreateMaterial(); mtl2->SetTexture(LoadTexture(remotepath + "/Materials/tiles.dds")); face->SetMaterial(mtl2); face = brush->AddFace(); face->AddIndice(4); face->AddIndice(5); face->AddIndice(6); face->AddIndice(7); face = brush->AddFace(); face->AddIndice(0); face->AddIndice(1); face->AddIndice(5); face->AddIndice(4); face = brush->AddFace(); face->AddIndice(2); face->AddIndice(3); face->AddIndice(7); face->AddIndice(6); face = brush->AddFace(); face->AddIndice(1); face->AddIndice(2); face->AddIndice(6); face->AddIndice(5); face = brush->AddFace(); face->AddIndice(0); face->AddIndice(3); face->AddIndice(7); face->AddIndice(4); //Finalize the brush brush->Build(); auto mtl = CreateMaterial(); mtl->SetTexture(LoadTexture(remotepath + "/Materials/tiles.dds")); brush->SetMaterial(mtl); auto model = CreateBox(world); model->SetPosition(2, 0, 0); model->SetMaterial(mtl); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  3. How to get mesh of a model to do this translate? Found FindMesh() but it's require material and idk how to get model material either.
  4. Can be changed model center in the engine? I found the way to put quake models where i want by subtracting bounds center but i would need to repeat it every time when i turn model so maybe there is better way to deal with center offcet.
  5. Also it's looks like SetTileHidden works only once and "unHide" (LMB + control in an example) cause Runtime Error "Assert failed". https://www.ultraengine.com/learn/Terrain_SetTileHidden?lang=cpp
  6. Keep returning null if terrain resolution is lower than 64.
  7. Yea, i guess it was VS being VS - now it's just wokring on next day
  8. I changed CameraControls component to be tactical/isometric and noticed it's ignoring my new class member and in debug i found out it have vars that has been deleted and no my var there at all. My code Update() works fine tho except member issue. Tried to rebuild solution - nothing changes. Is there a proper way to recompile a component or maybe i should create new component instead of repurposing old one?
  9. Exception thrown at 0x00007FF72DFF37B3 in Test Project_d.exe: 0xC0000005: Access violation reading location 0x0000000000000000. https://www.ultraengine.com/learn/CreateTerrain?lang=cpp Actually CreateTerrain() seems to return null and exception happens lower in code due that.
  10. It happens after recreating window and UI on second screen, dragging app window and even if initially windows was created on 2nd display. Depending on window resolution it looks differently on second screen - invisible or partly visible. First screen: Second: #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> btn; shared_ptr<Widget> btn2; bool fullscreen = false; int displayId = 0; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); btn = CreateButton("Change display", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2, 200, 200, ui->root); btn->SetFontScale(2.0f); btn2 = CreateButton("Fullscreen", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2 + 250, 120, 30, ui->root, BUTTON_CHECKBOX); } void changeDisplay() { displayId = displayId == 0 ? 1 : 0; if (!fullscreen) { window = CreateWindow("Ultra Engine", 0, 0, 1000, 1000, GetDisplays()[displayId], WINDOW_DEFAULT); } else { window = CreateWindow("Ultra Engine", 0, 0, 1000, 1000, GetDisplays()[displayId], WINDOW_DEFAULT | WINDOW_FULLSCREEN); } framebuffer = CreateFramebuffer(window); initGui(); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1000, 1000, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); //Create scenery auto box = CreateBox(menuWold); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.source == btn && ev.id == EVENT_WIDGETACTION) { changeDisplay(); } if (ev.source == btn2 && ev.id == EVENT_WIDGETACTION) { fullscreen = !fullscreen; } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  11. Window becomes minimized if i create it fullscreen with resolution lesser than max screen size. Same example above shows it.
  12. Is there a new way to get it? Was using gui->GetLineHeight() and gui->MouseDown() in custom widgets
  13. 1. Change res button 2. You will see interface bug 3. Drag window to hit screen border - vulkan crash 4. Restart, click checkbox 5. Changer res button 6. Click this button agian with or without checkbox before it - vulkan crash (looks a bit differently depending what mode will be after first fullscreen) #include "UltraEngine.h" #include "../MainMenu.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> btn; shared_ptr<Widget> btn2; bool fullscreen = false; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); btn = CreateButton("change res", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2, 200, 200, ui->root); btn->SetFontScale(2.0f); btn2 = CreateButton("Checkbox", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2 + 250, 120, 30, ui->root, BUTTON_CHECKBOX); } void changeRes() { if (!fullscreen) { window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, window->display, WINDOW_DEFAULT); } else { window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, window->display, WINDOW_DEFAULT | WINDOW_FULLSCREEN); } framebuffer = CreateFramebuffer(window); initGui(); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1680, 1050, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); //Create scenery auto box = CreateBox(menuWold); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.source == btn && ev.id == EVENT_WIDGETACTION) { changeRes(); } if (ev.source == btn2 && ev.id == EVENT_WIDGETACTION) { fullscreen = !fullscreen; } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  14. I will try later. You need to create only one extra class (MainMenu) in main.cpp folder for this example tho.
  15. Should i make new thread with these new bugs from post above?
  16. I made an example for UI bug (old frame stays in new window) and Vulcan crash that happens if you drag new window with mouse. Update: Also it crashes if you enter window mode after fullscreen mode. (have no idea to mark your checkbox btw xd) main: #include "UltraEngine.h" #include "../MainMenu.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto menu = MainMenu::create(); return 0; } MainMenu.h: #pragma once #include "UltraEngine.h" using namespace UltraEngine; class MainMenu : public Object { protected: MainMenu(); shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> btn; shared_ptr<Widget> btn2; void init(); void initGui(); void changeRes(); bool fullscreen = false; public: static std::shared_ptr<MainMenu> create(); }; MainMenu.cpp: #include "UltraEngine.h" #include "MainMenu.h" MainMenu::MainMenu() { } std::shared_ptr<MainMenu> MainMenu::create() { struct Struct : public MainMenu {}; auto instance = std::make_shared<Struct>(); instance->init(); return instance; } void MainMenu::init() { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1680, 1050, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); //Create scenery auto box = CreateBox(menuWold); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.source == btn && ev.id == EVENT_WIDGETACTION) { changeRes(); } if (ev.source == btn2 && ev.id == EVENT_WIDGETACTION) { fullscreen = !fullscreen; } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } } void MainMenu::initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); btn = CreateButton("change res", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2, 200, 200, ui->root); btn->SetFontScale(2.0f); btn2 = CreateButton("Checkbox", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2 + 250, 120, 30, ui->root, BUTTON_CHECKBOX); } void MainMenu::changeRes() { if (!fullscreen) { window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, window->display, WINDOW_DEFAULT); } else { window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, window->display, WINDOW_DEFAULT | WINDOW_FULLSCREEN); } framebuffer = CreateFramebuffer(window); initGui(); }
  17. It's just a blank window for me if new framebuffer was not set instead of old one with & and idk how to make shared_point& as a class member (it has to be init as a const in class constuctor if i understand correctly)
  18. #include "UltraEngine.h" using namespace UltraEngine; void changeRes(shared_ptr<Window>& window, shared_ptr<Framebuffer>& framebuffer) { shared_ptr<Framebuffer> newFramebuffer = framebuffer; window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, window->display, WINDOW_DEFAULT); //this works //framebuffer = CreateFramebuffer(window); //this one does not newFramebuffer = CreateFramebuffer(window); } 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_DEFAULT); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); ui_camera->SetRenderLayers(2); ui_camera->SetClearMode(CLEAR_DEPTH); auto btn = CreateButton("change res", (float)framebuffer->GetSize().x / 2, framebuffer->GetSize().y / 2, 100, 30, ui->root); //Create scenery auto box = CreateBox(world); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.id == EVENT_WIDGETACTION) { changeRes(window, framebuffer); } ui->ProcessEvent(ev); } world->Update(); world->Render(framebuffer); } return 0; }
  19. Depends on case. I can workaround it. I just thought i was missing something. What about passing or calling framebuffer in another class though? I can make listener for settings widget in a class where framebuffer was created but maybe there is a proper way to get it for window recreate?
  20. How to keep 3D UI (ui = CreateInterface() and Redraw() does not help) and how to get buffer in other class? I can pass it as shared_ptr<Framebuffer>& but can't use as member for recreating window.
  21. Assert failed with this code (in Release mode too): #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_DEFAULT); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); //Create scenery auto box = CreateBox(world); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { window = CreateWindow("Ultra Engine", 0, 0, 1920, 1080, displays[0], WINDOW_DEFAULT); framebuffer = CreateFramebuffer(window); } world->Update(); world->Render(framebuffer); } return 0; }
  22. Actually window now freezes in Release mode even without error.
  23. Found out it happens only in debug mode. But i wonder now how to make existing window be fullscreen and vice verca.
  24. idk if there is another proper way to change a resolution of window. This way works in 2D UI. #include "UltraEngine.h" using namespace UltraEngine; bool EventCallback(const Event& ev, shared_ptr<Object> extra) { auto window = extra->As<Window>(); window->SetSize(1024, 768); 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, 0, -3); auto default_font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); ui_camera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); ui_camera->SetRenderLayers(2); ui_camera->SetClearMode(CLEAR_DEPTH); auto btn = CreateButton("change res", 0, 0, 100, 30, ui->root); ListenEvent(EVENT_WIDGETACTION, btn, EventCallback, window); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { auto ev = WaitEvent(); ui->ProcessEvent(ev); } world->Update(); world->Render(framebuffer); } return 0; }
×
×
  • Create New...