Jump to content

Dreikblack

Members
  • Posts

    315
  • Joined

  • Last visited

Everything posted by Dreikblack

  1. Even with fullscreen cursor going out of window which can be annoying for moving camera by putting cursor near screen border in tactic and strategy games, I want to have it as an option game settings.
  2. Code snippet how i manage to do in in OpenGL loop if (hwnd == GetActiveWindow()) { static RECT oldRect; RECT newRect; GetWindowRect(hwnd, &newRect); if (memcmp(&oldRect, &newRect, sizeof(RECT)) == 0) { ClipCursor(&newRect); } oldRect = newRect; }
  3. Ah thats what you meant. I did it intentionally to be able to do stuff on other windows. btw current full screen in Ultra behaves as borderless window - is there a way to make it true fullscreen? Then mouse would inside window and panning would always work until alt-tab.
  4. Did you click something on other screen? Panning works only if game window is active which can be made by scroll button or RBM for avoiding doing any actions. btw main way to move camera are WASD (or anything else if you want to change it in settings).
  5. What do you mean by pan? I think i found right translation for this world by i still have no idea what exactly it means in this context
  6. Steam version will be found automatically but if you have Quake that updated to rerelease/remaster from other place (GOG/ EGS etc.) you can point to its folder manually when you open Quake Tactics first time
  7. btw did you try to run app on dev PC in other folder? I mean if you run it from project folder it will load files from usual folders.
  8. After recent update material for skybox can't be loaded from zip package 1. Make Materials.zip with Materials folder inside 2. Rename usual Materials folder to exclude loading from non-package Standard start.ultra map #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { RegisterComponents(); auto cl = ParseCommandLine(argc, argv); //Load FreeImage plugin (optional) auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); auto package = LoadPackage("Materials.zip"); package->FileType(""); //Load the map WString mapname = "Maps/start.ultra"; if (cl["map"].is_string()) mapname = std::string(cl["map"]); auto scene = LoadMap(world, mapname); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  9. After one of last updates Entity::Copy() started copy original entity tags. I don't know if it's intended but it was not a case before and took me a while to discover exact issue, #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 world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -4); //Create a light auto light = CreateBoxLight(world); light->SetRotation(45, 35, 0); light->SetRange(-10, 10); light->SetColor(2); //Create a model auto model = CreateBox(world); model->SetColor(0, 0, 1); model->AddTag("Test"); auto model2 = model->Copy(world); int tagCount = world->GetTaggedEntities("Test").size(); Print(tagCount); window->SetText("tag count " + WString(tagCount)); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  10. I'm using LoadPackage for Quake pak and zip, you can check if it's also does not work on that PC https://drive.google.com/drive/folders/1d5QKGvv0ikCDG9Pe1gIS8sg0hhkbybn_ You will need installed Quake tho
  11. Thanks! Updated loops as it was in Outline.frag and now it works. I did not that before because it looked wrong but with unlit sprite now it's looks as should be. Updated shader code: #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() { vec2 BufferSize = vec2(DrawViewport.z, DrawViewport.w); ivec2 coord = ivec2(gl_FragCoord.x, gl_FragCoord.y); outColor = vec4(0.0f); int count = textureSamples(DepthBuffer); const int m = max(0, (Thickness - 1) / 2); float depth; //Handle selected objects for (int n = 0; n < count; ++n) { bool done = false; depth = texelFetch(DepthBuffer, coord, n).r; if (depth < 1.0f) { 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); done = true; break; } } if (done) break; } } } outColor /= float(count); } Updated example: #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(); world->RecordStats(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(50); camera->SetPosition(0, 0, -3); //Create a light auto light = CreateDirectionalLight(world); light->SetColor(1); //Create a box auto box = CreateBox(world); box->SetColor(1, 0, 0); auto outlineBox = CreateBox(world); outlineBox->SetColor(0, 1, 0); box->SetPosition(-1, 0, 0); auto material = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); material->SetShaderFamily(unlitShader); outlineBox->SetMaterial(material); outlineBox->SetPosition(box->GetPosition()); outlineBox->SetParent(box); //Create a box2 auto box2 = CreateBox(world); box2->SetColor(1, 0, 0); auto outlineBox2 = CreateBox(world); outlineBox2->SetColor(0, 0, 1); auto material2 = CreateMaterial(); material2->SetShaderFamily(unlitShader); outlineBox2->SetMaterial(material); box2->SetPosition(1, 0, 0); outlineBox2->SetPosition(1, 0, 0); outlineBox2->SetParent(box2); //Entity component system auto component = box->AddComponent<Mover>(); component->rotationspeed.y = 45; auto component2 = box2->AddComponent<Mover>(); component2->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")); cam2->SetLighting(false); cam2->SetUniform(0, "Thickness", 10); auto sz = framebuffer->GetSize(); auto texbuffer = CreateTextureBuffer(sz.x, sz.y); auto pixels = CreatePixmap(sz.x, sz.y, TEXTURE_RGBA); auto tex = CreateTexture(TEXTURE_2D, sz.x, sz.y, pixels->format, { pixels }, 1, TEXTURE_DEFAULT, TEXTUREFILTER_NEAREST); texbuffer->SetColorAttachment(tex); cam2->SetRenderTarget(texbuffer); ////Display overlay auto sprite = CreateSprite(world, sz.x, sz.y); sprite->SetRenderLayers(4); auto mtl = CreateMaterial(); mtl->SetShaderFamily(unlitShader); mtl->SetTransparent(true); mtl->SetTexture(texbuffer->GetColorAttachment()); sprite->SetMaterial(mtl); auto cam3 = CreateCamera(world, PROJECTION_ORTHOGRAPHIC); cam3->SetClearMode(CLEAR_DEPTH); cam3->SetRenderLayers(4); cam3->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); cam3->SetLighting(false); //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false); window->SetText(world->renderstats.framerate); } return 0; }
  12. Almost there - colors still a little bit off: I use different colors, not only full red/green etc. so it's not an option for me i guess. I will try to experiment a bit with a shader code now.
  13. Or probably it's another issue that just appears with big thickness. Then i still idk what am i missing With closes look i noticed that in the game outline have right color in closest to model 1-3 pixels and surround by white pixels beyond them. Still have no idea why it's not same for example.
  14. Manage partially reproduce an issue in text example Without unlit sprite: With unlit sprite (white color in outlines): Code: #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(); world->RecordStats(); //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); //Set environment maps const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets"; auto specmap = LoadTexture(remotepath + "/Materials/Environment/Storm/specular.dds"); auto diffmap = LoadTexture(remotepath + "/Materials/Environment/Storm/diffuse.dds"); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_BACKGROUND); world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR); world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE); //Create a light //auto light = CreateBoxLight(world); //light->SetRotation(35, 45, 0); //light->SetRange(-10, 10); auto light = CreateDirectionalLight(world); light->SetColor(2); camera->SetFog(true); camera->SetFogColor(0.5, 0.5, 0.5f, 1); //Create a box auto box = CreateBox(world); box->SetColor(1, 0, 0); auto outlineBox = CreateBox(world); outlineBox->SetColor(0, 1, 0); box->SetPosition(-1, 0, 0); auto material = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); material->SetShaderFamily(unlitShader); outlineBox->SetMaterial(material); outlineBox->SetPosition(box->GetPosition()); outlineBox->SetParent(box); //Create a box2 auto box2 = CreateBox(world); box2->SetColor(1, 0, 0); auto outlineBox2 = CreateBox(world); outlineBox2->SetColor(0, 0, 1); auto material2 = CreateMaterial(); material2->SetShaderFamily(unlitShader); outlineBox2->SetMaterial(material); box2->SetPosition(1, 0, 0); outlineBox2->SetPosition(1, 0, 0); outlineBox2->SetParent(box2); //Entity component system auto component = box->AddComponent<Mover>(); component->rotationspeed.y = 45; auto component2 = box2->AddComponent<Mover>(); component2->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")); cam2->SetLighting(false); cam2->SetUniform(0, "Thickness", 20); 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(); mtl->SetShaderFamily(unlitShader); 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); cam3->SetLighting(false); //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer, false); window->SetText(world->renderstats.framerate); } return 0; }
  15. Snippet from the game code: just in case if it will help to notice what i may miss: outlineCamera = CreateCamera(gameWorld); outlineCamera->SetClearColor(0, 0, 0, 0); outlineCamera->SetRenderLayers(OUTLINE_RENDER_LAYER); outlineCamera->SetFov(gameCamera->GetFov()); outlineCamera->SetMatrix(gameCamera->matrix); outlineCamera->AddPostEffect(LoadPostEffect(AppDir() + "/Shaders/MultipleOutlines.fx")); outlineCamera->SetPosition(gameCamera->GetPosition(true)); outlineCamera->SetRotation(gameCamera->GetRotation(true)); outlineCamera->SetParent(gameCamera); outlineCamera->SetLighting(false); auto texbuffer = CreateTextureBuffer(sz.x, sz.y); outlineCamera->SetRenderTarget(texbuffer); auto tacticCamera = gameCamera->GetComponent<TacticCamera>(); tacticCamera->outlineCamera = outlineCamera; displayOverlaySprite = CreateSprite(gameWorld, sz.x, sz.y); displayOverlaySprite->SetRenderLayers(OUTLINE_OVERLAY_LAYER); auto displayOverlayMaterial = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.fam"); displayOverlayMaterial->SetShaderFamily(unlitShader); displayOverlayMaterial->SetTransparent(true); displayOverlayMaterial->SetTexture(texbuffer->GetColorAttachment()); displayOverlaySprite->SetMaterial(displayOverlayMaterial); displayOverlaySprite->SetShadows(false); overlayCamera = CreateCamera(gameWorld, PROJECTION_ORTHOGRAPHIC); overlayCamera->SetClearMode(CLEAR_DEPTH); overlayCamera->SetRenderLayers(OUTLINE_OVERLAY_LAYER); overlayCamera->SetPosition(sz.x * 0.5f, sz.y * 0.5f, 0); overlayCamera->SetLighting(false);
  16. Well, with unlit on overlay sprite colors now are not black but somehow still not correct at all - a lot of extra white color where it should just solid green or yellow on the pic Somehow simple test example still have no such visual artifacts. In the game fps increase now 80% tho.
  17. For some reason in my game outlines became black when i do it for overlay camera. In test example it works fine tho. In both cases i do use unlit shader for mat of outline models. Any idea what might cause it? Btw fps increases is around 10% with that.
  18. Is there any way to optimize multiply outlines? It's still reducing fps twice which is bigger problem now after switching to OpenGL. Shader itself does not seems to be a problem and stays FPS is same i don't apply shader. FPS is increases if i hide extra cameras or change SetRenderLayers.
  19. 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; }
  20. 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; }
  21. 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
  22. 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; }
  23. 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)
×
×
  • Create New...