Jump to content

Dreikblack

Members
  • Posts

    664
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. Dreikblack

    VK_EXT_line_rasterization

    Is SetLineStipple available yet? Can't find it in a Material.
  2. Last update installed, no such problem in 1.02. Can be reproduced in Learn example by pressing any keyboard key in app window. https://www.ultraengine.com/learn/Interface_ProcessEvent?lang=cpp #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]); //Create framebuffer auto framebuffer = CreateFramebuffer(window); //Create world auto world = CreateWorld(); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface auto ui = CreateInterface(world, font, framebuffer->size); //Create widget iVec2 sz = ui->root->ClientSize(); auto button = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->root); //Create camera auto camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); camera->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2, 0); while (true) { while (PeekEvent()) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; default: ui->ProcessEvent(ev); break; } } world->Update(); world->Render(framebuffer); } return 0; }
  3. You was right about SetTransparent. After all i found out i was keeping same unlit mat so accidentally applied transparency to every model/brush with it (alpha channel was 1 tho for objects that non intended to be transparent)
  4. Yes. I think only character second model for outlines uses another renderlayer and they looks fine (or i did not yet found angle for them to see an issues)
  5. Only yellow tetrahedron is transparent object in scene tho. Blue squares and yellow lines are not transparent, they just has a unlit shader ans that's it.
  6. No. It's not an arrow tho but 3 not transparent lines from 1 point to 3 characters. Yep. Probably had to do screen from another angle from bigger distance but pale yellow transparent shape is tetrahedron with sharp angle behind bottom left corner. I can make an example later for an issue reproducing.
  7. If you mean tetrahedron i need it to be transparent with ~25% alpha. Other brushes are not transparent. btw i'm using unlit material, idk if there is a better ways to achieve this visual result (except bug part). 3 lines are not wireframe but 3 models.
  8. btw is that culling effect when brushes partly disappear behind another one? But should not be due transparency of the brush in this case. For clarification blue outlines and yellow tetrahedron are brushes. Yellow lines are models. This happens with some camera positions and with another ones all looks fine.
  9. widget->SetColor(1, 0, 0, 1, WIDGETCOLOR_FOREGROUND);
  10. Edit button just for having 2 buttons in a menu: add shared_ptr<Panel> contextMenu; to ListView.h In ListView.cpp update Initialize method: bool ListView::Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, shared_ptr<ListViewData> header, int columnCount) { bool isInit = Widget::Initialize("", x, y, width, height, parent, 0); itemSize = iVec2(width, getItemHeight()); ListView::columnCount = columnCount; initBlockCount += (columnCount * 2); ListView::header = header; contextMenu = CreatePanel(0, 0, 100, 40, gui->root); contextMenu->Hide(); auto editButton = CreateButton("Edit", 0, 0, 100, 20, contextMenu);//just for an example, no function auto removeButton = CreateButton("Remove", 0, 20, 100, 20, contextMenu); ListenEvent(EVENT_WIDGETACTION, removeButton, RemoveCallback, Self()->As<ListView>()); return isInit; } and MouseDown method: void ListView::MouseDown(const MouseButton button, const int x, const int y) { contextMenu->Hide(); if (x >= 0 and y >= getItemHeight() and x < size.x and y < size.y) { int itemId = y / getItemHeight() - 1; if (itemId >= 0 and itemId < items.size()) { selectedItemId = itemId; Redraw(); if (button == MOUSE_LEFT) { if (pickItemListener) { pickItemListener(Event(EVENT_WIDGETACTION, Self(), selectedItemId)); } } else if (button == MOUSE_RIGHT) { contextMenu->Show(); contextMenu->SetShape(iVec2(x, y), contextMenu->GetSize()); } } } } Also add this function to same class: bool RemoveCallback(const Event& ev, shared_ptr<Object> extra) { auto listView = extra->As<ListView>(); listView->removeSelectedItem(); listView->contextMenu->Hide(); return true; }
  11. I may try to make something like that for UAK a bit later.
  12. Done! ListViewData.cpp: #pragma once #include <UltraEngine.h> using namespace UltraEngine; class ListViewData { protected: ListViewData() {} public: static std::shared_ptr<ListViewData> create() { struct Struct : public ListViewData {}; auto instance = std::make_shared<Struct>(); return instance; } static std::shared_ptr<ListViewData> create(vector<WString> fields) { struct Struct : public ListViewData {}; auto instance = std::make_shared<Struct>(); instance->fields = fields; return instance; } vector<WString> fields; bool operator==(const ListViewData& other) const { if (fields.size() != other.fields.size()) return false; for (int i = 0; i < fields.size(); i++) { if (fields[i] != other.fields[i]) { return false; } } return true; } }; ListView.h #pragma once #include <UltraEngine.h> #include "ListViewData.cpp" using namespace UltraEngine; class ListView : public Widget { protected: ListView(); virtual bool Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, shared_ptr<ListViewData> header, int columnCount); iVec2 itemSize = iVec2(100, 20); //Called each time the widget is redrawn virtual void Draw(const int x, const int y, const int width, const int height); //Called when the mouse button is pressed virtual void MouseDown(const MouseButton button, const int x, const int y); //Called when the mouse moves if this widget has the focus virtual void MouseMove(const int x, const int y); std::function<bool(Event)> pickItemListener; int initBlockCount = 4; int selectedItemId = -1; int highlightItemId = -1; int columnCount = 1; int textAlignment = TEXT_CENTER | TEXT_MIDDLE; vector <shared_ptr<ListViewData>> items; shared_ptr<ListViewData> header; public: static std::shared_ptr<ListView> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, shared_ptr<ListViewData> header, int columnCount = 1); virtual void Show(); int getItemHeight(); void setListener(std::function<bool(Event)> listener); void addItem(shared_ptr<ListViewData> item); void addItems(vector<shared_ptr<ListViewData>> items); void selectItem(shared_ptr<ListViewData> item); void removeSelectedItem(); void clearItems(); vector <shared_ptr<ListViewData>> getItems(); shared_ptr<ListViewData> getSelectedItem(); int getItemCount(); int getHeight(); void resize(); }; ListView.cpp: #include "UltraEngine.h" #include "ListView.h" ListView::ListView() { blocks.resize(initBlockCount);//background, border, highlight background for selected item, highlight under cursor textAlignment = TEXT_MIDDLE; } std::shared_ptr<ListView> ListView::create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, shared_ptr<ListViewData> header, int columnCount) { struct Struct : public ListView {}; auto instance = std::make_shared<Struct>(); instance->Initialize(x, y, width, height, parent, header, columnCount); return instance; } bool ListView::Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent, shared_ptr<ListViewData> header, int columnCount) { bool isInit = Widget::Initialize("", x, y, width, height, parent, 0); itemSize = iVec2(width, getItemHeight()); ListView::columnCount = columnCount; initBlockCount += (columnCount * 2); ListView::header = header; return isInit; } int ListView::getItemHeight() { return Round(float(GetInterface()->GetFontHeight(font, fontscale, fontweight))); } void ListView::Draw(const int x, const int y, const int width, const int height) { for (auto& block : blocks) { block.hidden = true; } //Background blocks[0].color = color[WIDGETCOLOR_SUNKEN]; blocks[0].wireframe = false; blocks[0].position = iVec2(0); blocks[0].size = size; blocks[0].hidden = false; //Border blocks[1].hidden = false; blocks[1].color = color[WIDGETCOLOR_BORDER]; blocks[1].wireframe = true; blocks[1].position = iVec2(0); blocks[1].size = size; blocks[1].radius = 0; //Highlight for selected if (selectedItemId >= 0) { blocks[2].color = color[WIDGETCOLOR_SUNKEN] * 0.6f; blocks[2].wireframe = false; blocks[2].position = iVec2(0, itemSize.height * (selectedItemId + 1)); blocks[2].size = itemSize; blocks[2].hidden = false; } //Highlight under cursor if (highlightItemId >= 0 && highlightItemId != selectedItemId) { blocks[3].color = color[WIDGETCOLOR_SUNKEN] * 0.85f; blocks[3].wireframe = false; blocks[3].position = iVec2(0, itemSize.height * (highlightItemId + 1)); blocks[3].size = itemSize; blocks[3].hidden = false; } int fieldWidth = itemSize.width / columnCount; //headers for (int column = 0; column < columnCount; column++) { blocks[4 + column].hidden = false; blocks[4 + column].position = iVec2(fieldWidth * column, 0); blocks[4 + column].size = iVec2(fieldWidth, itemSize.height); blocks[4 + column].SetText(header->fields[column]); blocks[4 + column].textalignment = textAlignment; blocks[4 + column].color = 1; blocks[4 + column + columnCount].hidden = false; blocks[4 + column + columnCount].position = iVec2(fieldWidth * column, 0); blocks[4 + column + columnCount].size = iVec2(fieldWidth, itemSize.height); blocks[4 + column + columnCount].wireframe = true; blocks[4 + column + columnCount].color = Vec4(0.6f, 0.6f, 0.6f, 1); } // items int blockSize = initBlockCount + items.size(); for (int column = 0; column < columnCount; column++) { int extraFiledI = items.size() * column; auto iterItem = items.begin(); for (int i = initBlockCount; i < blockSize; i++) { blocks[i + extraFiledI].hidden = false; blocks[i + extraFiledI].position = iVec2(fieldWidth * column, itemSize.height * (i - initBlockCount + 1)); blocks[i + extraFiledI].size = iVec2(fieldWidth, itemSize.height); blocks[i + extraFiledI].SetText(iterItem->get()->fields[column]); blocks[i + extraFiledI].textalignment = textAlignment; blocks[i + extraFiledI].color = 1; iterItem++; } for (int i = initBlockCount; i < blockSize; i++) { blocks[items.size() * columnCount + i + extraFiledI].hidden = false; blocks[items.size() * columnCount + i + extraFiledI].position = iVec2(fieldWidth * column, itemSize.height * (i - initBlockCount + 1)); blocks[items.size() * columnCount + i + extraFiledI].size = iVec2(fieldWidth, itemSize.height); blocks[items.size() * columnCount + i + extraFiledI].wireframe = true; blocks[items.size() * columnCount + i + extraFiledI].color = color[WIDGETCOLOR_BORDER]; } } } void ListView::MouseDown(const MouseButton button, const int x, const int y) { if (button == MOUSE_LEFT) { if (x >= 0 and y >= getItemHeight() and x < size.x and y < size.y) { int itemId = y / getItemHeight() - 1; if (itemId >= 0 and itemId < items.size()) { selectedItemId = itemId; Redraw(); if (pickItemListener) { pickItemListener(Event(EVENT_WIDGETACTION, Self(), selectedItemId)); } } } } } void ListView::MouseMove(const int x, const int y) { int oldValue = highlightItemId; if (x >= 0 and y >= getItemHeight() and x < size.x and y < size.y) { int itemId = y / getItemHeight() - 1; if (itemId >= 0 and itemId < items.size()) { highlightItemId = itemId; } else { highlightItemId = -1; } } else { highlightItemId = -1; } if (oldValue != highlightItemId) { Redraw(); } } void ListView::Show() { highlightItemId = -1; } void ListView::addItem(shared_ptr<ListViewData> item) { items.push_back(item); resize(); Redraw(); } void ListView::addItems(vector<shared_ptr<ListViewData>> newItems) { items.insert(items.end(), newItems.begin(), newItems.end()); resize(); Redraw(); } void ListView::selectItem(shared_ptr<ListViewData> item) { int i = 0; for (shared_ptr<ListViewData>& currentItem : items) { if (currentItem == item) { selectedItemId = i; break; } i++; } } void ListView::removeSelectedItem() { if (selectedItemId == -1) return; items.erase(items.begin() + selectedItemId); //for some reason without readding items with just erase + Redraw() some fields has visual glitches auto newItems = items; clearItems(); addItems(newItems); } void ListView::clearItems() { selectedItemId = -1; highlightItemId = -1; items.clear(); blocks.resize(initBlockCount); Redraw(); } vector<shared_ptr<ListViewData>> ListView::getItems() { return items; } shared_ptr<ListViewData> ListView::getSelectedItem() { if (selectedItemId >= 0 && selectedItemId < getItemCount()) { return items[selectedItemId]; } return nullptr; } int ListView::getItemCount() { return items.size(); } int ListView::getHeight() { return GetSize().height; } void ListView::resize() { blocks.resize(initBlockCount + items.size() * 2 * columnCount); } void ListView::setListener(std::function<bool(Event)> listener) { pickItemListener = listener; } main.cpp: #include "UltraEngine.h" #include "ListView.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, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CENTER); //Create User Interface auto ui = CreateInterface(window); //Create widget auto sz = ui->root->GetSize(); auto listView = ListView::create(10, 10, 600, 300, ui->root, ListViewData::create({ WString("header0 "), WString("header1") }), 2); for (int i = 0; i < 2; i++) { listView->addItem(ListViewData::create({ WString("filed0 ") + WString(i), WString("filed1 ") + WString(i) })); } auto textField0 = CreateTextField(10, 320, 100, 20, ui->root); textField0->SetText("filed0"); auto textField1 = CreateTextField(110, 320, 100, 20, ui->root); textField1->SetText("filed1"); auto addBtn = CreateButton("Add", 10, 340, 100, 20, ui->root); auto removeBtn = CreateButton("Remove", 110, 340, 100, 20, ui->root); listView->setListener( [textField0, textField1, listView](Event event) { auto data = listView->getSelectedItem(); textField0->SetText(data->fields[0]); textField0->Redraw(); textField1->SetText(data->fields[1]); textField1->Redraw(); return true; }); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WIDGETACTION: if (ev.source == addBtn) { listView->addItem(ListViewData::create({ WString(textField0->GetText()), WString(textField1->GetText()) })); } if (ev.source == removeBtn) { listView->removeSelectedItem(); } break; case EVENT_QUIT: case EVENT_WINDOWCLOSE: return 0; break; default: break; } } return 0; }
  13. Tried newer version from here - https://github.com/UltraEngine/ultraengine.github.io/raw/main/files/UltraClient.exe and it worked . Found in a patch notes. Probably main link should be updated? - https://ultraengine.github.io/files/UltraClient.exe
  14. Moved to the forum since apparently it's harder to soilve than i thought, I can login after first client start and after that i see only this pic for few sces before it's closes: Tried: - Run as Admin - Compatobilty mode - Clean reinstall at different disc - Using configs from old PC where it's still works with connection (Windows 10) - Disabling Anti-Virus and adding an exception Config folder has only user.dat and WebCache with my pfp. Everything else (Ultra App Kit client, few games and programs) for now seems to working on this fresh W11 setup (drivers updated, Vulkan SDK and ms redistributable visual c++ installed)
  15. For some reason it was not working in one of components but in another one it worked
  16. I know how to do it in .c and .cpp classes with forward declaration but it does not work for component .hpp classes. I have one component having a second component member and i need a first component member for a second component.
  17. #include "UltraEngine.h" #include "Components/Mover.hpp" 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<Scene> scene; 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("Delete", 0, 0, 100, 20, ui->root); //Create scenery auto box = CreateBox(menuWold); box->AddComponent<Mover>(); scene->AddEntity(box); } 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); scene = CreateScene(); 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) { scene->entities.clear(); } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  18. Similar issue with icons: #include "UltraEngine.h" 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(); 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 button = CreateButton("Button", 10, 10, 120, 30, ui->root); auto icon = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/23cbb91bbaa1f22d6f3eb20cfa54a747d3062c33/Assets/Icons/help.svg"); button->SetIcon(icon); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { auto ev = WaitEvent(); if (ev.source == button && ev.id == EVENT_WIDGETACTION) { button->SetIcon(LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/23cbb91bbaa1f22d6f3eb20cfa54a747d3062c33/Assets/Icons/new.svg")); } ui->ProcessEvent(ev); } world->Update(); world->Render(framebuffer); } return 0; }
  19. Replaced tile outlines with brushed. Better perfomance and i think it's looks better. But even one camera outline still degrade perfomance significantly and i wonder how to do proper downsampling for outline. I don't know what am i doing wrong in Outline.json for that: { "postEffect": { "buffers": [ { "size": [ 0.25, 0.25 ] } ], "subpasses": [ { "samplers": [ "DEPTH", "PREVPASS" ], "shader": { "float32": { "fragment": "Shaders/Outline.frag.spv" } } } ] } }
  20. What exactly? My whole UI made of custom widgets of my own. Basic ones mostly same as default but having listeners that attach when i create them, plus some few things as scaling from parameter, localization, fix for vertical text offset in 3D UI etc. For settings i have a singleton manager that reads parameters from a json when it's first called before creating main menu window to define sizes and fullscreen mode. If something was changed in settings menu after hitting OK button a settings manager updates parameter members and settings config file, and a window and UI are recreates with new parameters if something that requires it was changed. For localization i have another manager that reads a text file of current language and keep it in a strings map.
  21. I remade it in Ultra + main menu with settings.
  22. Ok, thanks. I will try something else instead of outlines for tiles then.
×
×
  • Create New...