Jump to content

Dreikblack

Members
  • Posts

    295
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. Press space to add text for left button. Right button have a several lines initially but looks as should be. #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(); //Create main camera auto camera = CreateCamera(world); camera->SetPosition(0, 0, -3); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface with a semi-transparent background auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0.5); //Create widget iVec2 sz = ui->background->ClientSize(); auto button = CreateButton("Button", 100, 200, 150, 30, ui->background); auto button2 = CreateButton("Button2", 500, 200, 150, 30, ui->background); for (int i = 0; i < 5; i++) { button2->AddText("\ntest"); } //Create camera auto orthocamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); orthocamera->SetClearMode(CLEAR_DEPTH); orthocamera->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0); //UI will only appear in orthographic camera orthocamera->SetRenderLayers(2); ui->SetRenderLayers(2); while (true) { if (window->KeyHit(KEY_SPACE)) { button->AddText("\ntest"); } 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; }
  2. Maybe it's only with Cyrillic not sure #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, 800, 600, displays[0]); //Create User Interface auto ui = CreateInterface(window); //Create widget auto label1 = CreateLabel("Test", 20, 20, 120, 30, ui->root); auto label2 = CreateLabel("Тест", 20, 50, 120, 30, ui->root, LABEL_BORDER | LABEL_CENTER | LABEL_MIDDLE); while (window->Closed() == false) { WaitEvent(); } return 0; }
  3. Made own icon for Quake Tactics.exe: New weapon - Laser rifle. Long range, special piercing shot damage all units in the shot line New enemy - Enforcer. Slow but fully armored and has a laser rifle as a long range weapon. Enforcer can be now blew up by attacking his back (orange bar shows HP for backpack) Changed area weapon trigger zone shape a bit for better detection Bot’s unit can now keep its turn if detect something if bot team turn was not ended yet Grunts will shoot if can’t came close enough for point blank Now weapon distance is also shown with a circle when action dialog is up Arrow under units to show in which way they will be pushed and potential damage in unit bars from bump damage Fixed outlines A lot of fixes for GUI and controls
  4. It's from my example in my first post. And i already explained what it means... Outline color is darker than should be. Changed a code to make it even more obvious #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(1, 0, -2); //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); Vec4 color(0, 1, 0, 1); //Create a box auto box = CreateBox(world); //Render to texture box->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/Outline.fx")); cam2->SetUniform(0, "Thickness", 50); 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(color); 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); auto box2 = CreateBox(world); box2->SetPosition(2, 0, 0); box2->SetColor(color); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  5. I'm not sure what new changes in Outline shader in last update supposed to fix but colors seems to be off again (shape at right side have same color in a code as outline at left)
  6. Fxied MultipleOutlines.frag: #version 450 #extension GL_ARB_separate_shader_objects : enable layout(binding = 0) uniform sampler2DMS DepthBuffer; layout(binding = 1) uniform sampler2D ColorBuffer; uniform int Thickness = 5; #include "../Base/CameraInfo.glsl" #include "../Utilities/Dither.glsl" #include "../Utilities/DepthFunctions.glsl" layout(location = 0) out vec4 outColor; void main() { ivec2 coord = ivec2(gl_FragCoord.x, gl_FragCoord.y); outColor = vec4(0.0f); int count = textureSamples(DepthBuffer); float depth; //Handle selected objects for (int n = 0; n < count; ++n) { depth = texelFetch(DepthBuffer, coord, n).r; if (depth < 1.0f) { const int m = max(0, (Thickness - 1) / 2); vec2 pixelsize = vec2(1.0f) / BufferSize; for (int x = -m; x <= m; ++x) { for (int y = -m; y <= m; ++y) { if (x == 0 && y == 0) continue; float neighbour = texelFetch(DepthBuffer, coord + ivec2(x, y), n).r; if (neighbour == 1.0f) { outColor += texelFetch(ColorBuffer, coord, gl_SampleID); break; } } } } } outColor /= float(count); }
  7. It was just showing a visual issues. Anyway these issues seems to be resolved. I even managed to fix my multi outlines shader as well by researching a delta in usual outline shader
  8. Was it supposed to be included in last update? Because it's not a case for me
  9. With last update without assimp issue still there
  10. #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto package = LoadPackage("Data.zip"); if (package == nullptr) { Notify("No Package Found"); } package->FileType(""); auto plugin = LoadPlugin("Plugin\\FITextureLoader"); if (!plugin) Notify("No plugin Found"); else Notify("Plugin Found"); auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 500, 500, displays[0], WINDOW_DEFAULT); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, font, framebuffer->GetSize()); ui->SetRenderLayers(2); auto uiCamera = CreateCamera(world, 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->LoadColorScheme("Style.json"); auto btn = CreateButton("TEST", 10, 10, 100, 100, ui->root); auto dir = LoadDir("Ru"); for (WString localFile : dir) { btn->SetText(localFile); Print(localFile); } //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; } Data.zip
  11. After one of last updates outline shader got couple bugs: 1. Color is darker than should be 2. Outline not match model edge fully 3. Also for some reason it's looks thinner (1 pixel) than should be with same value of Thickness (3) #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(1, 0, -2); //Create a light auto light = CreateBoxLight(world); light->SetRotation(35, 45, 0); light->SetRange(-10, 10); Vec4 color(0, 1, 0, 1); //Create a box auto box = CreateBox(world); //Render to texture box->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/Outline.fx")); 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(color); 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); auto box2 = CreateBox(world); box2->SetPosition(1, 0, 0); box2->SetColor(color); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  12. 1) entity.name = "name" 2) Only in maps - map.entities. For World only tagged and in area 3) Just set an integer bigger than 6 with Entity:SetCollisionType. btw @Josh CollisionType enum seems being not exposed in LUA local NEW_COLLISION = 7 box1:SetCollisionType(NEW_COLLISION) https://www.ultraengine.com/learn/Entity_SetCollisionType?lang=lua https://www.ultraengine.com/learn/World_SetCollisionResponse?lang=lua 4) No GetTag() atm but it should be possible to iterate entity.tags but in my test example it return nil so probably not exposed in LUA @Josh 5) Not sure what you mean Maybe you want that: for n, entity in pairs(world:GetTaggedEntities("tag")) do local entity = Entity(entity) Print(entity.name) end
  13. Also GetFont() method would be nice to have for Interface #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(); //Create main camera auto camera = CreateCamera(world); camera->SetPosition(0, 0, -3); auto font = LoadFont("Fonts/arial.ttf"); //Create user interface with a semi-transparent background auto ui = CreateInterface(world, font, framebuffer->size); ui->background->SetColor(0, 0, 0, 0.5); //Create widget iVec2 sz = ui->background->ClientSize(); auto button = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->background); //Create camera auto orthocamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); orthocamera->SetClearMode(CLEAR_DEPTH); orthocamera->SetPosition(float(framebuffer->size.x) * 0.5f, float(framebuffer->size.y) * 0.5f, 0); //UI will only appear in orthographic camera orthocamera->SetRenderLayers(2); ui->SetRenderLayers(2); if (!button->GetFont()) Notify("Font is null"); else { Notify("Font is not null"); } while (true) { world->Update(); world->Render(framebuffer); } return 0; }
  14. No problems in C++ version but in LUA i have same issue with this code
  15. I thought i got answer in discord already. SetParent(nil) and widgetVar = nil, if you kept it somewhere
  16. Something wrong in latest beta updates again. Color is black instead of entity color: Also strange bottom edge, same with usual outline (color works tho for usual outline) Definitely used to work at 17 March but idk which exactly update changed it. Felt something wrong in my game last few days but noticed only now what's wrong. #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, 1200, 800, 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); box->SetColor(1, 0, 0); auto outlineBox = CreateBox(world); outlineBox->SetColor(0, 1, 0); auto material = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); 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.fam"); 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/MultipleOutlines.fx")); 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; } MultipleOutlines.frag: #version 450 #extension GL_ARB_separate_shader_objects : enable #define UNIFORMSTARTINDEX 1 #include "../Base/CameraInfo.glsl" #include "../Utilities/Dither.glsl" #include "../Utilities/DepthFunctions.glsl" layout(location = 0) out vec4 outColor; // Uniforms layout(location = 20, binding = 0) uniform sampler2DMS DepthBuffer; layout(location = 24) uniform int Thickness = 3; // should be an odd number layout(binding = 1) uniform sampler2DMS ColorBuffer; void main() { ivec2 coord = ivec2(gl_FragCoord.x, gl_FragCoord.y); outColor = texelFetch(ColorBuffer, coord, gl_SampleID); outColor.a = 0.0f; float depth = texelFetch(DepthBuffer, coord, gl_SampleID).r; //Handle selected objects if (depth < 1.0f) { const int m = max(0, (Thickness - 1) / 2); vec2 pixelsize = vec2(1.0f) / BufferSize; for (int x = -m; x <= m; ++x) { for (int y = -m; y <= m; ++y) { if (x == 0 && y == 0) continue; float neighbour = texelFetch(DepthBuffer, coord + ivec2(x, y), gl_SampleID).r; if (neighbour == 1.0f) { outColor = texelFetch(ColorBuffer, coord, gl_SampleID); return; } } } } } MultipleOutlines.fx { "posteffect": { "buffers": [ { "size": [ 0.25, 0.25 ] } ], "subpasses": [ { "samplers": [ "DEPTH", "PREVPASS" ], "shader": { "float32": { "fragment": "Shaders/PostEffects/MultipleOutlines.frag" } } } ] } }
  17. - Changed font to OpenSans with my capital letters that looks Quakish - Perception system for AI - bots can now see (in 180 degrees at front if they did not detect enemies yet) , smell (in full circle), hear - When bots spot enemies via this way perception icon appears above unit for a sec - Spotted enemies bots keep in memory with last known positions. This memory is used if no enemies can be seen - In such cases ! icon will be visible until bot find enemy - If no enemies spotted but a bot still active ! icon appears. Crossed eye when becomes passive after 3 rounds - Using a zip archive now for files that can be loaded in this way atm Link to last build: https://drive.google.com/drive/folders/1d5QKGvv0ikCDG9Pe1gIS8sg0hhkbybn_?usp=sharing
  18. Also LoadCursorFromFileW() does not load an icon from zip. But it's WinUser class tho.
  19. What about issue with Style.json not being loaded from archive?
  20. I would say brush should share shape, size, materials and uv/texture mapping. idk yet if it should otherwise in some cases.
  21. Style should make UI looks brown (to check if it's loaded correctly) Also file name is looks wrong if it's not Latin symbolsData.zip #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { auto package = LoadPackage("Data.zip"); if (package == nullptr) { Notify("No Package Found"); } package->FileType(""); auto plugin = LoadPlugin("Plugin\\FITextureLoader"); if (!plugin) Notify("No plugin Found"); else Notify("Plugin Found"); auto displays = GetDisplays(); auto window = CreateWindow("Ultra Engine", 0, 0, 500, 500, displays[0], WINDOW_DEFAULT); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto font = LoadFont("Fonts\\arial.ttf"); auto ui = CreateInterface(world, font, framebuffer->GetSize()); ui->SetRenderLayers(2); auto uiCamera = CreateCamera(world, 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->LoadColorScheme("Style.json"); auto btn = CreateButton("TEST", 10, 10, 100, 100, ui->root); auto dir = LoadDir("Ru"); for (WString localFile : dir) { btn->SetText(localFile); Print(localFile); } //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  22. Still not working after latest update
×
×
  • Create New...