Jump to content

Josh

Staff
  • Posts

    23,143
  • Joined

  • Last visited

Everything posted by Josh

  1. Just use the correct camera and the correct render buffer, and everything works out: auto screen_pos = cam3->Project(box->position, buffer);
  2. These widgets do not emit mouse events.
  3. Update Fixed transparency problems
  4. Thanks for the example, I just had to move the pre-multiply alpha multiplication to come after the dither step.
  5. You can see the transparency issue a bit more clearly like this: #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(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(0, 0, 8); //Entity component system auto actor = CreateActor(box); auto component = actor->AddComponent<Mover>(); component->rotation.y = 45; auto material = CreateMaterial(); material->SetTransparent(true); auto s1 = CreateSphere(world); s1->SetPosition(-0.5f, 0.0f, -1.0f); s1->SetMaterial(material); s1->SetColor(1.0f, 0.0f, 0.0f, 0.5f); auto s2 = CreateSphere(world); s2->SetPosition(0.5f, 0.0f, -1.0f); s2->SetMaterial(material); s2->SetColor(0.0f, 0.0f, 0.0f, 1.0f); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  6. This indicates a serious problem, but I am unable to produce any error with this code: #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 camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); vector<shared_ptr<Entity>> entities; Vec3 offset = Vec3(10.0f, 1.0f, 5.0f); float scale = 2.0f; for (int z = 0; z < 10; z++) { for (int x = 0; x < 10; x++) { auto e = CreateSphere(world); e->SetColor(Random(), Random(), Random()); e->SetPosition(Vec3((float)x * scale + Random() - 0.5f, 0.0f, (float)z * scale + Random() - 0.5f) + offset, true); e->SetMass(1.0f); entities.push_back(e); } } while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  7. Update Fixed pixmap not appearing in 3D GUI Fixed MOUSEENTER events not occurring Entity::GetValue<T> changed to GetField<T>, but you should not use this anyway RENDERLAYER_N constants are removed. You can declare your own if you want to use these: enum RenderLayer { RENDERLAYER_NONE = 0, RENDERLAYER_0 = 1, RENDERLAYER_1 = 2, RENDERLAYER_2 = 4, RENDERLAYER_3 = 8, RENDERLAYER_4 = 16, RENDERLAYER_5 = 32, RENDERLAYER_6 = 64, RENDERLAYER_7 = 128, RENDERLAYER_ALL = 255 }; inline RenderLayer operator|(RenderLayer a, RenderLayer b) { return static_cast<RenderLayer>(static_cast<int>(a) | static_cast<int>(b)); };
  8. It doesn't work recursively. You need to listen for each widget.
  9. Josh

    ChatGPT

    It's very obvious that websites that rely on free user-generated content are all going away, soon, like maybe within 12 months. Social media, news websites, general-purpose forums, are all going to be flooded with AI-generated text. I can generate 10 creepy pastas and post them in a few minutes with this. It's not much of a stretch to set up a system that generates videos and uploads them to YouTube automatically. I mean, once it was set up, I could upload 100,000 videos a day to 1000 different accounts without much trouble.
  10. Josh

    Asset Editor WIP

    I like this layout better. I think the properties can be fit into the lower-left corner under the hierarchy tree.
  11. When a new font size is used, every character in the font gets rasterized to an image. However, probably 99% of those characters are never used. It would make sense to only rasterize them as they are used, but it will make things a bit more complicated and require a lot of testing before it works perfectly. Maybe I can add this in a future update?
  12. Well, the first step was to add an annual pricing option, because no one will want to manually pay a bill each month, and cypto does not have any way of making automatic monthly payments.
  13. Heightfield colliders only handle flat terrain. There is also a dynamic collider that generates collision dynamically in a function. This is what the Leadwerks Game Engine vegetation system uses, and why collision gets very slow in the vegetation system if you accidentally use a detailed model for the collision shape. For voxel terrain I would recommend the normal mesh collider.
  14. Josh

    Ref to Self

    Also, never never never call Self or As in a constructor or destructor.
  15. Josh

    Ref to Self

    The base object class or derived from the shared_from_this class: https://www.ultraengine.com/learn/Object_Self?lang=cpp https://www.ultraengine.com/learn/Object_As?lang=cpp I don’t think you need to store a weak pointer to itself
  16. Josh

    Terrain002

    Lovely 😊
  17. Are you calling any engine commands on a separate thread?
  18. It works really well. You can even switch between monthly and annual billing, and everything syncs up very nicely.
  19. Upload your images to the gallery and they will appear on your profile: https://www.ultraengine.com/community/gallery/category/1-screenshots/#
  20. Happily, I was able to add a second option for an annual purchase.
  21. I was thinking about doing something like this, for adding mod folders. I want to be cautious with the file system though.
  22. Josh

    ChatGPT

    It seems to be really really good at creative writing. Just enter your own half-formed ideas and tell it to finish the story. It's incredible.
  23. This is just a note to myself. Newton heightfield colliders don't support terrain holes and the heightfield needs to be replaced with a custom collider. Example: #include "UltraEngine.h" #include "Components/CameraControls.hpp" using namespace UltraEngine; const WString remotepath = "https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets"; int main(int argc, const char* argv[]) { //Get the display list auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Terrain Cut", 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->SetFov(70); camera->SetPosition(0, 100, -100); camera->SetRotation(45, 0, 0); camera->SetClearColor(0.125); //Sunlight auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); //Create terrain auto terrain = CreateTerrain(world, 512); terrain->LoadHeightmap(remotepath + "/Terrain/512.r16"); terrain->SetScale(1, 100, 1); //Create base material auto ground = CreateMaterial(); auto diffusemap = LoadTexture(remotepath + "/Materials/Ground/river_small_rocks_diff_4k.dds"); auto normalmap = LoadTexture(remotepath + "/Materials/Ground/river_small_rocks_nor_gl_4k.dds"); ground->SetTexture(diffusemap, TEXTURE_DIFFUSE); ground->SetTexture(normalmap, TEXTURE_NORMAL); terrain->SetMaterial(ground); //Camera controls camera->AddComponent<CameraControls>(); shared_ptr<Entity> ball; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->MouseHit(MOUSE_RIGHT)) { ball = CreateSphere(world); ball->SetMass(10); ball->SetPosition(camera->position); } if (window->MouseDown(MOUSE_LEFT)) { auto mousepos = window->GetMousePosition(); auto pickinfo = camera->Pick(framebuffer, mousepos.x, mousepos.y); if (pickinfo.success) { if (pickinfo.entity == terrain) { iVec2 pos; pos.x = Round(pickinfo.position.x) + terrain->resolution.x / 2; pos.y = Round(pickinfo.position.z) + terrain->resolution.y / 2; int radius = 10; for (int x = pos.x - radius; x < pos.x + radius; ++x) { for (int y = pos.y - radius; y < pos.y + radius; ++y) { terrain->SetTileHidden(x, y, not window->KeyDown(KEY_CONTROL)); } } } } } world->Update(); world->Render(framebuffer); } return 0; }
×
×
  • Create New...