-
Posts
664 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Dreikblack
-
You need to add navmesh in the Editor and get it in load function like that: if #scene.navmeshes > 0 then self.navmesh = scene.navmeshes[self.navmeshindex] end
-
You need to delete all strong references to an entity to do it. To remove entity that was added in the Editor usually enough just to remove it from scene: scene->RemoveEntity(entity);
-
You can play sound like that without Entity::EmitSound https://www.ultraengine.com/learn/CreateSpeaker?lang=cpp Another option i think is speaker->SetSpatialization(false);
-
Tried to reproduce it in FPS template. For some reason loading background is not stuck as in my game, but rendering in general breaks in strange ways after 20-30 loads: Just replace main in FPS template project and keep hitting F9 after load until you get you similar result: #include "Leadwerks.h" #include "ComponentSystem.h" #include "Encryption.h" using namespace Leadwerks; shared_ptr<Scene> scene; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> world; shared_ptr<World> loadingWorld; shared_ptr<Interface> ui; shared_ptr<Font> font; iVec2 framebufferSize; shared_ptr<Widget> btn; shared_ptr<Sprite> loadingBackground; shared_ptr<Camera> loadingCamera; void initScene() { loadingWorld->Render(framebuffer); world = CreateWorld(); WString mapname = "Maps/start.map"; scene = LoadScene(world, mapname); for (auto const& entity : world->GetEntities()) { auto camera = entity->As<Camera>(); if (camera) { ui = CreateInterface(camera, font, framebufferSize); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); btn = CreateButton("Test",100, 100, 100, 100, ui->root); break; } } } int main(int argc, const char* argv[]) { RegisterComponents(); auto displays = GetDisplays(); auto window = CreateWindow("Leadwerks", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); framebuffer = CreateFramebuffer(window); font = LoadFont("Fonts/arial.ttf"); framebufferSize = framebuffer->GetSize(); loadingWorld = CreateWorld(); loadingBackground = CreateSprite(loadingWorld, framebuffer->size.width, framebuffer->size.height); loadingBackground->SetColor(0.3f, 0.2f, 0.2f); loadingCamera = CreateCamera(loadingWorld, PROJECTION_ORTHOGRAPHIC); loadingCamera->SetPosition(framebufferSize.x * 0.5f, framebufferSize.y * 0.5f, 0); initScene(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyDown(KEY_F9)) { initScene(); } world->Update(); world->Render(framebuffer); } return 0; }
-
afaik override works same as virtual except it prevents mistakes if base method interface was changed or overriding method have wrong one. Anyway it was about KeyFilter return value which should false to pass key to KeyDown.
-
Ah, wait. KeyFilter should return false to make it work.
-
Sorry, checked only now. Does not work for me: #include "Leadwerks.h" using namespace UltraEngine; class CustomWidget : public Panel { CustomWidget::CustomWidget() { cornerradius = 8; } protected: virtual bool Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { return Widget::Initialize(text, x, y, width, height, parent, style); } void KeyUp(const KeyCode key) override { if (key == KEY_TAB) Print("TAB UP"); } bool KeyDown(const KeyCode key) override { if (key == KEY_TAB) Print("TAB DOWN"); return true; } bool KeyFilter(const KeyCode key) override { switch (key) { case KEY_ESCAPE: case KEY_ENTER: case KEY_TAB: return true; break; } return true; } public: static shared_ptr<CustomWidget> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { struct Struct : public CustomWidget { }; auto instance = std::make_shared<Struct>(); instance->Initialize(x, y, width, height, parent); return instance; } }; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<CustomWidget> customWidget; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); 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); ui = CreateInterface(uiCamera, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(1.0f, 1.0f, 1.0f, 1.0f); customWidget = CustomWidget::create(10, 10, 500, 120, ui->root); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 500, 300, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); //Create a framebuffer framebuffer = CreateFramebuffer(window); initGui(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { const auto event = WaitEvent(); ui->ProcessEvent(event); menuWold->Update(); menuWold->Render(framebuffer); } return 0; }
-
Shaders are in a Project folder. You can find it in the Editor in Templates\Common\Shaders if you need for manual copy-pasting to project
-
I have main input camera with render target to main sprite. Also i have extra input camera for transparent object that should looks same when they overlapping, targets to extra sprite. This sprite above main sprite. Both sprites are rendered to orthographic projection camera. Issue is that extra sprite (red rectangles) is not visible if i apply PostEffect or MSAA to main input camera. Tried apply MSAA to overlay camera - no MSAA effect then. Without MSAA: With it: #include "UltraEngine.h" #include "ComponentSystem.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 sz = framebuffer->GetSize(); int MAIN_LAYER = 1, OUTPUT_LAYER = 2, EXTRA_LAYER = 4; auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); auto backBox = CreateBox(world, 5); backBox->SetPosition(0, 0, 7); backBox->SetColor(0, 1, 0, 1); auto betweenBox = CreateBox(world); betweenBox->SetRenderLayers(EXTRA_LAYER); betweenBox->SetColor(1, 0, 0, 1); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); auto boxMat = CreateMaterial(); boxMat->SetShaderFamily(unlitShader); betweenBox->SetMaterial(boxMat); auto betweenBox2 = CreateBox(world); betweenBox2->SetPosition(0.5, 0.5, 0); betweenBox2->SetRenderLayers(EXTRA_LAYER); betweenBox2->SetColor(1, 0, 0, 1); betweenBox2->SetMaterial(boxMat); auto frontBox = CreateBox(world, 1); frontBox->SetPosition(-0.5, 0, -0.5); frontBox->SetColor(1, 1, 0, 1); auto mainCameraInput = CreateCamera(world); mainCameraInput->SetPosition(0, 0, -3); mainCameraInput->SetRenderLayers(MAIN_LAYER); auto mainTextureBuffer = CreateTextureBuffer(sz.x, sz.y); mainCameraInput->SetRenderTarget(mainTextureBuffer); mainCameraInput->SetMsaa(2); auto mainSprite = CreateSprite(world, sz.x, sz.y); mainSprite->SetRenderLayers(OUTPUT_LAYER); auto mainMaterial = CreateMaterial(); mainMaterial->SetShaderFamily(unlitShader); mainMaterial->SetTexture(mainTextureBuffer->GetColorAttachment()); mainSprite->SetMaterial(mainMaterial); auto mainCameraOutput = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); mainCameraOutput->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); mainCameraOutput->SetRenderLayers(OUTPUT_LAYER); mainCameraOutput->SetLighting(false); mainCameraOutput->SetClearMode(CLEAR_DEPTH); //red transporent boxes render part auto extraCameraInput = CreateCamera(world); extraCameraInput->SetPosition(0, 0, -3); extraCameraInput->SetRenderLayers(EXTRA_LAYER); extraCameraInput->SetMatrix(mainCameraInput->matrix); extraCameraInput->SetClearMode(CLEAR_COLOR); extraCameraInput->SetLighting(false); extraCameraInput->SetFogColor(0, 0, 0, 1); extraCameraInput->SetFogAngle(90, 91); extraCameraInput->SetFog(true); auto range = extraCameraInput->GetRange().y; extraCameraInput->SetFogRange(range * 0.98, range * 0.99); auto extraTextureBuffer = CreateTextureBuffer(sz.x, sz.y); extraTextureBuffer->SetDepthAttachment(mainTextureBuffer->GetDepthAttachment()); extraCameraInput->SetRenderTarget(extraTextureBuffer); auto extraSprite = CreateSprite(world, sz.x, sz.y); extraSprite->SetPosition(0, 0, -0.00001); extraSprite->SetRenderLayers(OUTPUT_LAYER); extraSprite->SetShadows(false); auto extraMaterial = CreateMaterial(); extraMaterial->SetShaderFamily(unlitShader); extraMaterial->SetTransparent(true); extraMaterial->SetTexture(extraTextureBuffer->GetColorAttachment()); extraMaterial->SetColor(1, 1, 1, 0.5); extraSprite->SetMaterial(extraMaterial); extraSprite->SetHidden(false); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
-
1. Open some project initially. 2. Open another project - Recent Files shows files/maps for 1st prject 3. Only after opening a map via Open in 2nd project Recent Files showing correct files
-
LoadMap does not load saved in program code map and even remove light
Dreikblack replied to Dreikblack's topic in Bug Reports
In terms of bugs, i think so -
Now can't reproduce as well
-
LoadMap does not load saved in program code map and even remove light
Dreikblack replied to Dreikblack's topic in Bug Reports
Reload on R. Load on Space. But now in this example scene can't be loaded from saved file O_o In console "Error: Failed to load scene..." -
Have a crash without errors on map load in lua version in fast debug
Dreikblack replied to Dreikblack's topic in Bug Reports
No crash now. Have a strange visual circle effect on brush now tho. Both in menu and game. LuaExample2.zip -
Component of prefab uses prefab's scene in Load
Dreikblack replied to Dreikblack's topic in Bug Reports
It's most clear approach if anything for this case and just one of many uses of scene. Another often case is getting navemesh. It's done to temporally save pivot until scene will be deleted. Camera have to be parented to this pivot so camera component can't have strong reference to the pivot to avoid circular references. The only another way to do it would be making extra component for a pivot which is already worse approach. And no, it will not work if i will use pivot instead of camera and spawn camera with component because it would be require a LOT of extra stuff to make it work (pivot should be on the ground, so it could not be placed in the Editor like camera in air etc.). -
Tried in debug with Easy map - render broke on 11th reload (only HUD visible, like in 2nd post). No errors in console. btw memory usage keep increasing a bit with load, was something like 2 GB when issue appeared.
-
Yes. Now it's takes twice longer and before it happens another render bug happens: 1. Random visual artifacts - black strip, cubes. Visible only at some angles. 2. No outlines. 3. No sprites. 4. No brush circles under characters.
-
Space between lines is too short after UI update
Dreikblack replied to Dreikblack's topic in Bug Reports
Would not be some digit more reliable then? But i'm not if digits always have same height as upper letters tho. -
Space between lines is too short after UI update
Dreikblack replied to Dreikblack's topic in Bug Reports
Was it uploaded yet? I have new line space - looks nice now. But offset still old for me. -
Is panel hidden (it would hide kids)? Also make sure it's full sized - kids uses local coordinates and can't be visible beside parent borders
-
Space between lines is too short after UI update
Dreikblack replied to Dreikblack's topic in Bug Reports
Vertical offset is still feels off and i'm not sure if it's intended. It's okayish with big scale, but for digits or upper letters on low font scale looks off. #include "UltraEngine.h" using namespace UltraEngine; class CustomWidget : public Panel { protected: virtual bool Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { blocks.resize(2); return Widget::Initialize(text, x, y, width, height, parent, style); } void Draw(const int x, const int y, const int width, const int height) { blocks[0].color = Vec4(0.8, 0.8, 0.8); blocks[0].wireframe = false; blocks[0].position = iVec2(0); blocks[0].size = size; blocks[0].hidden = false; blocks[1].hidden = false; blocks[1].position = iVec2(0, 0); blocks[1].size = iVec2(width, height); blocks[1].SetText(text); blocks[1].textalignment = TEXT_MIDDLE; } public: static shared_ptr<CustomWidget> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { struct Struct : public CustomWidget { }; auto instance = std::make_shared<Struct>(); instance->Initialize(x, y, width, height, parent); return instance; } }; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<CustomWidget> customWidget; void initGui() { 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); auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(uiCamera, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); float scale = 1.0f; customWidget = CustomWidget::create(10, 10, 800, 14 * scale, ui->root); customWidget->SetText("ESCpppp123"); customWidget->SetFontScale(scale); } int main(int argc, const char* argv[]) { auto displays = GetDisplays(); window = CreateWindow("Ultra Engine", 0, 0, 800, 250, displays[0], WINDOW_DEFAULT); menuWold = CreateWorld(); framebuffer = CreateFramebuffer(window); initGui(); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { menuWold->Update(); menuWold->Render(framebuffer); } return 0; } -
Space between lines is too short after UI update
Dreikblack replied to Dreikblack's topic in Bug Reports
#include "UltraEngine.h" using namespace UltraEngine; class CustomWidget : public Panel { CustomWidget::CustomWidget() { blocks.resize(1); } protected: virtual bool Initialize(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { return Widget::Initialize(text, x, y, width, height, parent, style); } void Draw(const int x, const int y, const int width, const int height) { blocks[0].hidden = false; blocks[0].position = iVec2(0, 0); blocks[0].size = iVec2(width , height); blocks[0].SetText(text); blocks[0].textalignment = TEXT_LEFT; } public: static shared_ptr<CustomWidget> create(const int x, const int y, const int width, const int height, shared_ptr<Widget> parent) { struct Struct : public CustomWidget { }; auto instance = std::make_shared<Struct>(); instance->Initialize(x, y, width, height, parent); return instance; } }; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<CustomWidget> customWidget; void initGui() { 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); auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(uiCamera, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); customWidget = CustomWidget::create(10, 10, 800, 250, ui->root); customWidget->SetText("Enemy in full armored biosuit which can be penetrate only with nails.\nBalloon at the back can be destroyed and it will cause an explosion.\nHis laser rifle shoots at long range and charged shot can hit few units in the shot line."); customWidget->SetFontScale(2.0f); } int main(int argc, const char* argv[]) { auto displays = GetDisplays(); window = CreateWindow("Ultra Engine", 0, 0, 800, 250, displays[0], WINDOW_DEFAULT); menuWold = CreateWorld(); framebuffer = CreateFramebuffer(window); initGui(); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { menuWold->Update(); menuWold->Render(framebuffer); } return 0; }