Josh Posted September 14, 2017 Share Posted September 14, 2017 Here's an example program in Leadwerks 4: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); World* world = World::Create(); Camera* camera = Camera::Create(); camera->Move(0,0,-3); Light* light = DirectionalLight::Create(); light->SetRotation(35,35,0); Model* model = Model::Box(); model->SetColor(0.0,0.0,1.0); while (true) { if (window->Closed() || window->KeyDown(Key::Escape)) return false; model->Turn(0,Leadwerks::Time::GetSpeed(),0); Leadwerks::Time::Update(); world->Update(); world->Render(); context->Sync(true); } return 0; } And here is the same code in Leadwerks 5: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { auto window = CreateWindow(); auto context = CreateContext(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0,0,-3); auto light = CreateDirectionalLight(world); light->SetRotation(35,35,0); auto model = CreateBoxModel(world); model->SetColor(0.0,0.0,1.0); while (true) { if (window->Closed() or window->KeyDown(EscapeKey)) return false; model->Turn(0,world->GetSpeed(),0); world->Update(); world->Render(context,true); } return 0; } And in Lua: local window = CreateWindow() local context = CreateContext(window) local world = CreateWorld() local camera = CreateCamera(world) camera:Move(0,0,-3) local light = CreateDirectionalLight(world) light:SetRotation(35,35,0) local model = CreateBoxModel(world) model:SetColor(0.0,0.0,1.0) while true do if window:Closed() or window:KeyDown(EscapeKey) then return end model:Turn(0,world:GetSpeed(),0) world:Update() world:Render(context,true) end 1 1 3 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 14, 2017 Share Posted September 14, 2017 looks at lot cleaner. Quote Link to comment Share on other sites More sharing options...
Josh Posted September 14, 2017 Author Share Posted September 14, 2017 I'm considering the removal of all static functions and constants. A global function is faster to type and looks nicer. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
cassius Posted September 14, 2017 Share Posted September 14, 2017 I am a somewhat shaky c++ coder but that looks simple enough even to me. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Roland Posted September 14, 2017 Share Posted September 14, 2017 Looks good to me Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Josh Posted September 15, 2017 Author Share Posted September 15, 2017 Note there is no call the context::Sync because once you start the world render, it goes off on a separate thread and goes out all the way to the monitor. There are no drawing commands you can call after that. I think we're going to have a system of persistent 2D sprites you create, rather than drawing commands you call. The Render command itself only passes any changed positions to the culling thread and returns to your program, so there is really nothing to slow your game code down and if the timing isn't limited it will execute at like 1000 updates per second. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Ma-Shell Posted September 15, 2017 Share Posted September 15, 2017 It might be a good idea to allow us to register a callback before the context-sync is executed, so we can put other drawing stuff there. Quote Link to comment Share on other sites More sharing options...
Josh Posted September 15, 2017 Author Share Posted September 15, 2017 51 minutes ago, Ma-Shell said: It might be a good idea to allow us to register a callback before the context-sync is executed, so we can put other drawing stuff there. I guess if your callback was thread safe it would work. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted September 15, 2017 Author Share Posted September 15, 2017 Here's the first Leadwerks 5 program ever run: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { auto window = CreateWindow(); auto context = CreateContext(window); auto world = CreateWorld(); auto camera = CreateCamera(world); camera->Move(0, 0, -3); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); auto model = CreateBoxModel(world); model->SetColor(0,0,255); while (not window->Closed()) { model->Turn(0, 1, 0); world->Update(); world->Render(context); } return 0; } 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Roland Posted September 15, 2017 Share Posted September 15, 2017 while (not window->Closed() 'not' Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Josh Posted September 15, 2017 Author Share Posted September 15, 2017 26 minutes ago, Roland said: while (not window->Closed() 'not' It's standard C++. There's a header you have to include for VS support, but 'not', 'or', and 'and' are standard. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted September 15, 2017 Share Posted September 15, 2017 15 hours ago, Josh said: Note there is no call the context::Sync because once you start the world render, it goes off on a separate thread and goes out all the way to the monitor. There are no drawing commands you can call after that. I think we're going to have a system of persistent 2D sprites you create, rather than drawing commands you call. The Render command itself only passes any changed positions to the culling thread and returns to your program, so there is really nothing to slow your game code down and if the timing isn't limited it will execute at like 1000 updates per second. er - what? you need then to give access to the render thread so we can use drawing commands. All custom post-process and geometry shaders would be affected by this, would they not? A 2D sprite doesnt isnt quite the same. So you are saying GUI's now will all be sprites? 2 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Josh Posted September 16, 2017 Author Share Posted September 16, 2017 7 hours ago, macklebee said: er - what? you need then to give access to the render thread so we can use drawing commands. All custom post-process and geometry shaders would be affected by this, would they not? A 2D sprite doesnt isnt quite the same. So you are saying GUI's now will all be sprites? Custom post-process effects are attached to a camera. I do not understand how a geometry shader relates to this. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Roland Posted September 16, 2017 Share Posted September 16, 2017 20 hours ago, Josh said: It's standard C++. There's a header you have to include for VS support, but 'not', 'or', and 'and' are standard. Cool.. didn't 'not' know that Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
macklebee Posted September 16, 2017 Share Posted September 16, 2017 12 hours ago, Josh said: Custom post-process effects are attached to a camera. I do not understand how a geometry shader relates to this. Thats because my custom geometry shaders use Draw()-related commands. So you are saying something as simple as text now will require a sprite? Sounds very counter-intuitive. How will custom buffers be supported? Or are they going to be officially supported finally in LE5? 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.