Jump to content

Dreikblack

Members
  • Posts

    516
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. 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.
  2. #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; }
  3. 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; }
  4. 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" } } } ] } }
  5. 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.
  6. I remade it in Ultra + main menu with settings.
  7. Ok, thanks. I will try something else instead of outlines for tiles then.
  8. I have a new problem with this implementation- can't see outline of first object if it's above another one. It's crucial for cases when selected (and outlined) unit stays on outlined tiles (which shows where can unit go to) (also i used to outline avaiable tile under cursor with another color ad can't see it now as well) outlineBox2->SetPosition(0.5f, 0.5f, 0); box2->SetPosition(0.5f, 0.5f, 0);
  9. Damn, it was correct .frag this time - i just had few mistakes in a code. #include "UltraEngine.h" #include "Components/Mover.hpp" 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, displays[0]->GetSize().width, displays[0]->GetSize().height, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR | WINDOW_FULLSCREEN); //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); box->SetColor(1, 0, 0); auto outlineBox = CreateBox(world); outlineBox->SetColor(0, 1, 0); auto material = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.json"); material->SetShaderFamily(unlitShader); outlineBox->SetMaterial(material); //Create a box2 auto box2 = CreateBox(world); box2->SetColor(1, 0, 0); auto outlineBox2 = CreateBox(world); outlineBox2->SetColor(0, 0, 1); auto material2 = CreateMaterial(); auto unlitShader2 = LoadShaderFamily("Shaders/Unlit.json"); material2->SetShaderFamily(unlitShader); outlineBox2->SetMaterial(material); outlineBox2->SetPosition(2, 0, 0); box2->SetPosition(2, 0, 0); //Entity component system auto component = box->AddComponent<Mover>(); component->rotationspeed.y = 45; auto outlineComponent = outlineBox->AddComponent<Mover>(); outlineComponent->rotationspeed.y = 45; auto component2 = box2->AddComponent<Mover>(); component2->rotationspeed.y = 45; auto outlineComponent2 = outlineBox2->AddComponent<Mover>(); outlineComponent2->rotationspeed.y = 45; //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ //Render to texture outlineBox->SetRenderLayers(2); outlineBox2->SetRenderLayers(2); auto cam2 = CreateCamera(world); cam2->SetClearColor(0, 0, 0, 0); cam2->SetRenderLayers(2); cam2->SetFov(camera->GetFov()); cam2->SetMatrix(camera->matrix); cam2->AddPostEffect(LoadPostEffect("Shaders/PostEffects/Outline.json")); auto sz = framebuffer->GetSize(); auto texbuffer = CreateTextureBuffer(sz.x, sz.y); cam2->SetRenderTarget(texbuffer); ////Display overlay auto sprite = CreateSprite(world, sz.x, sz.y); sprite->SetRenderLayers(4); auto mtl = CreateMaterial(); sprite->SetMaterial(mtl); mtl->SetTransparent(true); mtl->SetTexture(texbuffer->GetColorAttachment()); auto cam3 = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); cam3->SetClearMode(CLEAR_DEPTH); cam3->SetRenderLayers(4); cam3->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false); } return 0; }
  10. This works in 2D UI but in 3D widget became not interactive but visible. Maybe where is another way to delete widgets in 3D UI? #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); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { while (PeekEvent()) { const Event ev = WaitEvent(); if (ev.source == button && ev.id == EVENT_WIDGETACTION) { button->SetParent(NULL); } ui->ProcessEvent(ev); } world->Update(); world->Render(framebuffer); } return 0; }
  11. Oh wait, wav, not waw, so it was a typo after all
  12. I chose for an example a sound with simple name and path just to make sure it has not typo Will make water tiles but later.
  13. No problem with models but LoadSound returns null (and works for sounds outside an archive). In the asset editor sounds can be loaded. #include "UltraEngine.h" #include "Components/CameraControls.hpp" 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(); world->SetAmbientLight(0); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Load FreeImage plugin auto plg = LoadPlugin("Plugins/FITextureLoader"); auto quakeLoaderPlugin = LoadPlugin("Plugins/QuakeLoader"); //Load model WString path = AppDir(); auto pak = LoadPackage(path + "/PAK0.PAK"); ChangeDir(path); auto model = LoadModel(world, "progs/quaddama.mdl"); model->Turn(0, 180, 0, true); auto soundPath = WString("sound/misc/water2.waw"); auto sound = LoadSound(soundPath); sound->Play(); //Environment maps auto specmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/specular.dds"); auto diffmap = LoadTexture("https://github.com/UltraEngine/Assets/raw/main/Materials/Environment/footprint_court/diffuse.dds"); world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_BACKGROUND); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR); world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0, 0, 1); camera->SetPosition(model->GetBounds().center); camera->Move(0, 0, -0.3); camera->SetRange(0.01, 100); camera->SetFov(70); camera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/FXAA.json")); //Create light auto light = CreateBoxLight(world); light->SetRange(-10, 10); light->SetArea(15, 15); light->SetRotation(45, 35, 0); light->SetColor(1.2); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  14. Still no outline with main.cpp above: { "postEffect": { "subpasses": [ { "samplers": [ "DEPTH", "PREVPASS"], "shader": { "float32": { "fragment": "Shaders/Outline.frag.spv" } } } ] } } #version 450 #extension GL_GOOGLE_include_directive : enable #extension GL_ARB_separate_shader_objects : enable #extension GL_EXT_multiview : enable #include "../Base/PushConstants.glsl" #include "../Base/CameraInfo.glsl" #include "../Base/TextureArrays.glsl" #include "../Utilities/Dither.glsl" layout(location = 0) in vec2 texCoords; layout(location = 0) out vec4 outColor; void main() { outColor = texture(texture2DSampler[PostEffectTexture1], texCoords.xy); outColor.a = 0.0f; float depth = texture(texture2DSampler[PostEffectTexture0], texCoords.xy).r; vec4 c; bool sel; //Handle selected objects if (depth < 1.0f) { const int m = 3; vec2 pixelsize = 1.0f / BufferSize; for (int x = -m; x <= m; ++x) { for (int y = -m; y <= m; ++y) { if (x == 0 && y == 0) continue; float neighbor = texture(texture2DSampler[PostEffectTexture0], texCoords.xy + pixelsize * vec2(x, y)).r; if (neighbor == 1.0f) { outColor = texture(texture2DSampler[PostEffectTexture1], texCoords.xy); return; } } } } }
  15. I just don't know how to get this color in .frag. Trying this but nothing happens: #version 450 #extension GL_GOOGLE_include_directive : enable #extension GL_ARB_separate_shader_objects : enable #extension GL_EXT_multiview : enable #include "../Base/PushConstants.glsl" #include "../Base/CameraInfo.glsl" #include "../Base/TextureArrays.glsl" #include "../Utilities/Dither.glsl" layout(location = 0) in vec2 texCoords; layout(location = 0) out vec4 outColor; const vec4 SelectionColor = vec4(1,1,1,1); void main() { outColor = SelectionColor; outColor.a = 0.0f; float depth = texture(texture2DSampler[PostEffectTexture0], texCoords.xy).r; vec4 c; bool sel; //Handle selected objects if (depth < 1.0f) { const int m = 3; vec2 pixelsize = 1.0f / BufferSize; for (int x = -m; x <= m; ++x) { for (int y = -m; y <= m; ++y) { if (x == 0 && y == 0) continue; float neighbor = texture(texture2DSampler[PostEffectTexture0], texCoords.xy + pixelsize * vec2(x, y)).r; if (neighbor == 1.0f) { outColor = texture(texture2DSampler[PostEffectTexture0], texCoords.xy); return; } } } } } #include "UltraEngine.h" #include "Components/Mover.hpp" 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, displays[0]->GetSize().width, displays[0]->GetSize().height, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR | WINDOW_FULLSCREEN); //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); box->SetColor(0.5f, 0.5f, 0); auto outlineBox = CreateBox(world); outlineBox->SetColor(0, 0, 1); auto material = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.json"); material->SetShaderFamily(unlitShader); outlineBox->SetMaterial(material); //Entity component system auto component = box->AddComponent<Mover>(); component->rotationspeed.y = 45; auto component2 = outlineBox->AddComponent<Mover>(); component2->rotationspeed.y = 45; //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ //Render to texture outlineBox->SetRenderLayers(1 + 2); auto cam2 = CreateCamera(world); cam2->SetClearColor(0, 0, 0, 0); cam2->SetRenderLayers(2); cam2->SetFov(camera->GetFov()); cam2->SetMatrix(camera->matrix); cam2->AddPostEffect(LoadPostEffect("Shaders/PostEffects/Outline.json")); auto sz = framebuffer->GetSize(); auto texbuffer = CreateTextureBuffer(sz.x, sz.y); cam2->SetRenderTarget(texbuffer); ////Display overlay auto sprite = CreateSprite(world, sz.x, sz.y); // sprite->SetColor(0, 1, 1, 1); sprite->SetRenderLayers(4); auto mtl = CreateMaterial(); sprite->SetMaterial(mtl); mtl->SetTransparent(true); mtl->SetTexture(texbuffer->GetColorAttachment()); auto cam3 = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); cam3->SetClearMode(CLEAR_DEPTH); cam3->SetRenderLayers(4); cam3->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false); } return 0; }
  16. Do you mean Outline.frag by post effect in this context? Sorry, I'm not quite follow you Is whole set from signle outline (cameras, buffer. sprite etc.) still needed for this?
  17. Did another test - cameras on but removed Outline: 500 fps. Tried again for testing first example with 1 outline - 500 fps. No outlnies - 2000 fps D:
  18. Not really sure how to do it and i still have 70 fps with single texture buffer. For a test i hide cameras in cycle (renderToTextureCamera->SetHidden(true)) and got 700 fps.
  19. tbh i have no idea how to do this since i don't know much about graphic programing, especially in Vulkan. Anyway it's looks shader is not what degrades perfomance. Removed AddPostEffect() - same low fps. Just realized you probably meant Outline.json and not frag Anyway this did not helped. "buffers": [ { "size": [0.5, 0.5] } ],
  20. Outlines drops FPS a lot, noticed only now Difference is crazy between 2 and 3 outlines already - from 230-240 to 120-130. RTX 2070, 2K screen res. Can anything be done about that (in my code or in the engine later) or i should limit my self by 2 outlines? #include "UltraEngine.h" #include "Components/Mover.hpp" using namespace UltraEngine; enum OUTLINE_TYPE { OUTLINE_RENDER_LAYER = 4, OUTLINE_MOVEMENT = 8, OUTLINE_TARGET_MOVEMENT = 16, OUTLINE_ACTION = 32, OUTLINE_SELECTABLE_UNIT = 64, OUTLINE_SELECTED_UNIT = 128, OUTLINE_ENEMY = 256 }; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, displays[0]->GetSize().width, displays[0]->GetSize().height, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR | WINDOW_FULLSCREEN); //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(3, 0, -5); //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto gameScene = CreateScene(); //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ std::vector<Vec4> outlineColors; outlineColors.push_back(Vec4(0.1f, 0.6f, 0.6f, 1)); outlineColors.push_back(Vec4(0.1f, 0.3f, 1.0f, 1)); outlineColors.push_back(Vec4(0.5f, 0.8f, 0.1f, 1)); outlineColors.push_back(Vec4(0.1f, 0.6f, 0.1f, 1)); outlineColors.push_back(Vec4(0.1f, 1.0f, 0.1f, 1)); outlineColors.push_back(Vec4(0.8f, 0.1f, 0.1f, 1)); auto sz = framebuffer->GetSize(); for (int i = 0; i < outlineColors.size(); i++) { auto renderToTextureCamera = CreateCamera(world); renderToTextureCamera->SetClearColor(0, 0, 0, 0); renderToTextureCamera->SetRenderLayers(OUTLINE_MOVEMENT << i); renderToTextureCamera->SetFov(camera->GetFov()); renderToTextureCamera->SetMatrix(camera->matrix); renderToTextureCamera->AddPostEffect(LoadPostEffect("Shaders/PostEffects/Outline.json")); auto texbuffer = CreateTextureBuffer(sz.x, sz.y); renderToTextureCamera->SetRenderTarget(texbuffer); gameScene->AddEntity(renderToTextureCamera); //Display overlay auto displayOverlaySprite = CreateSprite(world, sz.x, sz.y); displayOverlaySprite->SetColor(outlineColors[i]); displayOverlaySprite->SetRenderLayers(OUTLINE_RENDER_LAYER); auto displayOverlayMaterial = CreateMaterial(); displayOverlayMaterial->SetTransparent(true); displayOverlayMaterial->SetTexture(texbuffer->GetColorAttachment()); displayOverlaySprite->SetMaterial(displayOverlayMaterial); gameScene->AddEntity(displayOverlaySprite); //Box auto box = CreateBox(world); box->SetPosition(i, 0, 0); box->SetRenderLayers(1 + (OUTLINE_MOVEMENT << i)); gameScene->AddEntity(box); } auto overlayCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); overlayCamera->SetClearMode(CLEAR_DEPTH); overlayCamera->SetRenderLayers(OUTLINE_RENDER_LAYER); overlayCamera->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); gameScene->AddEntity(overlayCamera); //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  21. Hi! Unfortunately Redraw() changes nothing in this case. Pixmap painting worken for me in Ultra App Kit.
  22. Painting working only before first Render() #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> drawPanel; shared_ptr<Widget> btn; shared_ptr<Pixmap> px; int progress = 0; void paint() { progress++; for (int x = 0; x < progress * 10; x++) { for (int y = 0; y < 200; y++) { px->WritePixel(x, y, Rgba (20, 250, 10)); } } } 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); drawPanel = CreatePanel(0, 50, 200, 200 , ui->root, PANEL_DEFAULT); drawPanel->SetColor(1, 0, 0); px = CreatePixmap(200, 200); drawPanel->SetPixmap(px); btn = CreateButton("Progress", 0, 0, 100, 20, ui->root); //works for (int i = 0; i < 5; i++) { paint(); } } 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) { //pixmap not changes paint(); } ui->ProcessEvent(ev); } menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
  23. NavMesh can't be seen (with setDebuggint(true)) or used if you use brushes as a scene instead of models. #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_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetFov(70); camera->SetClearColor(0.125); camera->SetPosition(0, 3, -6); camera->SetRotation(35, 0, 0); //Create light auto light = CreateBoxLight(world); light->SetRange(-20, 20); light->SetArea(20, 20); light->SetRotation(35, 35, 0); light->SetColor(3); //Create scene //auto ground = CreateBox(world, 10, 1, 10); //ground->SetPosition(0, -0.5, 0); //ground->SetColor(0, 1, 0); //auto wall = CreateBox(world, 1, 2, 4); float w = 10, h = 1, d = 10; auto brush = CreateBrush(world); //Add brush vertices brush->AddVertex(w * 0.5, 0, d * 0.5); brush->AddVertex(-w * 0.5, 0, d * 0.5); brush->AddVertex(-w * 0.5, 0, -d * 0.5); brush->AddVertex(w * 0.5, 0, -d * 0.5); brush->AddVertex(w * 0.5, -h, d * 0.5); brush->AddVertex(-w * 0.5, -h, d * 0.5); brush->AddVertex(-w * 0.5, -h, -d * 0.5); brush->AddVertex(w * 0.5, -h, -d * 0.5); //Add faces auto face = brush->AddFace(); face->AddIndice(0); face->AddIndice(1); face->AddIndice(2); face->AddIndice(3); 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); brush->Build(); //Create navmesh auto navmesh = CreateNavMesh(world, 10, 5, 10, 4, 4); navmesh->SetDebugging(true); navmesh->Build(); //Create player auto player = CreateCylinder(world, 0.4, 1.8); player->SetColor(0, 0, 1); auto agent = CreateNavAgent(navmesh); player->Attach(agent); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->MouseHit(MOUSE_LEFT)) { auto mousepos = window->GetMousePosition(); auto rayinfo = camera->Pick(framebuffer, mousepos.x, mousepos.y); if (rayinfo.success) { agent->Navigate(rayinfo.position); } } world->Update(); world->Render(framebuffer); } return 0; }
  24. For few outline colors at same time all elements should be recreated? I mean maybe camera can be seted for few render layers or something like that. I think i might need 4 color at same time
  25. Solved thickness issue. Made a dedicated .bat for outline shader and this time a shader was recompiled. In Outline.frag m var defines pixel thickness for outline.
×
×
  • Create New...