❄️🎁⛄ The Winter Games Tournament is Live! 🎄🎅❄️
Jump to content

Josh

Staff
  • Posts

    26,805
  • Joined

  • Last visited

Profile Information

  • Location
    USA

Recent Profile Visitors

1,527,129 profile views

Josh's Achievements

Grand Master

Grand Master (14/14)

  • Well Followed
  • Dedicated
  • Conversation Starter
  • Reacting Well
  • Problem Solver

Recent Badges

17.2k

Reputation

1.2k

Community Answers

  1. I'll have some more stuff for you after Christmas. I did some work on the timing and found a way to run the logic and rendering thread in sync at any frequency. It feels like playing new Doom games at 200 FPS. I think you will like it.
  2. @vega I have added an experimental mouse look feature in 5.0.2 on the beta branch that gets run in the rendering thread. This operates in a manner similar to how the VR headset orientation updates, right before a frame is rendered: https://www.leadwerks.com/community/topic/61318-release-notes/page/37/#findComment-320702 This will provide very low-latency mouse input controls.
  3. What GPU do you have?
  4. 5.0.2 beta Added experimental Camera:SetMouseLook command. This handles mouse looking in the rendering thread, right before a frame is drawn, in the same way that our VR orientation updating code operates. This will provide you with very low-latency mouse feedback, ideal for fast-paced games. The arguments are mode, speed, and smoothness and it should be called like this: camera:SetMouseLook(true, 0.1, 0.5)-- 0.1 degree / pixel moved, 0.5 smoothness Speed (second value) should be greater than zero. Smoothness (last value) should be less than 1.0, 0.0 for no smoothing. You only need to call this command once. You should not mix this with your own mouse look code. The camera rotation will be retrieved back from the rendering thread automatically. Note this does not yet handle objects parented to the camera, like a weapon view model. Here is a version of the CameraControls.lua script, adjusted to use this feature. Since the looking behavior is controlled in the rendering thread, you need to disable it before switching to the menu, or is it keep control of the mouse. Hit Alt + F4 to close the window if you get stuck. ---@class CameraControls : Entity CameraControls = {} CameraControls.mousesmoothing = 0.5--"Mouse smoothing" CameraControls.mouselookspeed = 1.0--"Look speed" CameraControls.movespeed = 4.0--"Move speed" ---@param self CameraControls function CameraControls:Start() local camera = Camera(self) if camera ~= nil then camera:SetMouseLook(true, self.mouselookspeed * 0.1, self.mousesmoothing) end self:ListenEvent(EVENT_WORLDPAUSE, self.world) self:ListenEvent(EVENT_WORLDRESUME, self.world) end ---@param self CameraControls ---@param event Event function CameraControls:ProcessEvent(event) local camera = Camera(self) if event.id == EVENT_WORLDPAUSE then if camera ~= nil then camera:SetMouseLook(false, self.mouselookspeed * 0.1, self.mousesmoothing) end elseif event.id == EVENT_WORLDRESUME then if camera ~= nil then camera:SetMouseLook(true, self.mouselookspeed * 0.1, self.mousesmoothing) end end end ---@param self CameraControls function CameraControls:Update() local window = ActiveWindow() if window == nil then return end local speed = self.movespeed / 60.0 if window:KeyDown(KEY_SHIFT) then speed = speed * 10.0 elseif window:KeyDown(KEY_CONTROL) then speed = speed * 0.25 end if window:KeyDown(KEY_E) then self:Translate(0, speed, 0) end if window:KeyDown(KEY_Q) then self:Translate(0, -speed, 0) end if window:KeyDown(KEY_D) then self:Move(speed, 0, 0) end if window:KeyDown(KEY_A) then self:Move(-speed, 0, 0) end if window:KeyDown(KEY_W) then self:Move(0, 0, speed) end if window:KeyDown(KEY_S) then self:Move(0, 0, -speed) end end
  5. Is this still occuring? Can it be reproduced reliably?
  6. @Vladimir Sabantsev I really appreciate your in-depth feedback. I am planning to fix all bugs that can be fixed right now (a few things depend on internal refactoring) before I proceed with a new deep dive into modifications to the renderer for 5.1. The plan is to move lighting shader code into a deferred step (as Leadwerks 4 does) which I think will probably provide better optimization for low-end hardware and simpler shader code.
  7. Carving a 32-sided cylinder out of another one, at a 90 degree angle...this may be as good as it gets. Every other CSG program I've ever seen has simi;ar issues when the geometry gets complex. The crash is fixed on the beta branch, so I will call this finished for now.
  8. 5.0.2 beta Several bugs fixed.
  9. 6 should work just fine. 1 is not very deep. Is it possible to upload your project so I can try it out? Maybe it is somehow going into an infinite loop, although I don't think that is possible?
  10. Set the debug levels to something like 6. 16 is very high and it might just be taking a long time to iterate through the stack.
  11. That's just the result of slicing objects to make multiple convex shapes. Brushes must be convex, so concave shapes are made out of multiple convex shapes.
  12. In the next build, tags will automatically get converted to lower-case.
  13. Will be fixed in tomorrow's update.
  14. Docs updated: https://github.com/Leadwerks/Documentation/blob/master/Lua/CreateInterface.md#remarks https://github.com/Leadwerks/Documentation/blob/master/Lua/CreateTile.md#remarks
  15. Okay, there's probably no bug but the documentation could use some extra explaination. You can create a tile or an Interface from both a single camera or a world. If it is created on a camera it will be drawn at the end of the camera render routine. If it is created on the world, it will just get drawn last, after all cameras have drawn. You had one object being created on a camera and one on the world, so it switched the drawing order around. Additionally, when you position a tile you can just provide two coordinates (x and y) unless you are using Z to sort the order. #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Leadwerks", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_TITLEBAR | WINDOW_CENTER); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->SetClearColor(Vec4(0.125f, 0.125f, 0.125f, 1)); //Load a font auto font = LoadFont("Fonts/arial.ttf"); //Create user interface auto ui = CreateInterface(camera, font, framebuffer->size); ui->background->SetColor(0,0,0,0);// make background transparent //Create widget iVec2 sz = ui->background->ClientSize(); auto button = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->background); auto tile = CreateTile(camera, 100, 100); tile->SetColor(0, 1, 0); float x = framebuffer->size.x / 2 - tile->size.x / 2; float y = framebuffer->size.y / 2 - tile->size.y / 2; auto target = Vec2(x, y); while (!window->KeyDown(KEY_ESCAPE) && !window->Closed()) { while (PeekEvent()) { const Event event = WaitEvent(); switch (event.id) { case EVENT_KEYDOWN: if (event.data == KEY_RIGHT) { target.x = x + tile->size.x; } else if (event.data == KEY_LEFT) { target.x = x - tile->size.y; } else if (event.data == KEY_UP) { target.y = y - tile->size.y; } else if (event.data == KEY_DOWN) { target.y = y + tile->size.y; } break; default: ui->ProcessEvent(event); break; } } x = Mix(x, target.x, 0.05f); y = Mix(y, target.y, 0.05f); if (abs(x - target.x) < 0.1f) x = target.x; if (abs(y - target.y) < 0.1f) y = target.y; tile->SetPosition(x, y); world->Update(); world->Render(framebuffer, true); } return 0; }
×
×
  • Create New...