Jump to content

Josh

Staff
  • Posts

    24,629
  • Joined

  • Last visited

Everything posted by Josh

  1. This feature is removed for now. Terrain has a per-layer scale setting.
  2. 1. Added Fill() method as a convenience function. 2. Set/get layer scale are now public (in update later today) 3. These methods are now public. I think that addresses everything in this thread.
  3. When I comment out the base material, the correct behavior is displayed. The SetLayerWeight command by default normalizes the weights, so each tile receives 100% weighting, since there is no other material present: Even if the normalize parameter is set to false (after the update coming later today) there will be no support for blending a material on top of the untextured terrain. There's an intermediate step that normalizes the weights again.
  4. I think the project creation / selection feature is going to be removed from the client app. The editor now includes this functionality (File > Project Manager) and I don't want to have redundant ways of doing things.
  5. I can't tell what you are trying to do. When you call SetParent with the last parameter set to true (the default), the entity's global orientation is preserved.
  6. Ultra uses one big vertex buffer and one big 32-bit unsigned int indice buffer. I am not ready to comment on the rest because I need to re-read it and think about it.
  7. I suppose you could create a second camera and another directional light, but the performance will probably not be good. Maybe use a single box light instead. A baked lightmap for distance terrain shadows is something I have thought about.
  8. I uploaded the fix for the property name issue a couple hours ago.
  9. 1.0.3 Removed internal directional light print command that was being called. Fixed positioning of player physics objects.
  10. You are correct, this is a bug. I am compiling a new build for you now...
  11. 1.0.3 Fixed editor bug where component properties were being saved with the label instead of the property name (the displayed label and internal name can be different). Updated C++ library with numerous fixes, see my recent comments in the bug reports forum.
  12. It's also possible that the first frame might take a long time to render, maybe? Try setting it so world:Update only gets called if a key is down.
  13. I tried loading a map with a Mover component, and although the rotation value I set was not being loaded, the Update method was being called correctly.
  14. In code the component works. Do you have a JSON file and a map that uses it? #include "UltraEngine.h" #include "Components/Player/FPSCamera.hpp" 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,1); //Entity component system auto component = box->AddComponent<FPSCamera>(); //component->rotationspeed.y = 45; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  15. This example will work as expected in the next build.
  16. Yes, you can wait until the EVENT_STARTRENDERER event occurs before calling World::Update.
  17. I think this is due to the fact that Vulkan takes a while to initialize, and the physics simulation is running updates many times before the first frame is rendered.
  18. At 1036 I think the whole scene intersects the far clipping plane...
  19. Here is my modified version. At around height 361, it looks like the box is intersecting the light's near clipping plane... #include "UltraEngine.h" using namespace UltraEngine; Vec3 mousepos = Vec3(0.0f); float move_adjustment = 0.1f; float move_speed = 1.0f; float lookspeed = 0.1f; float looksmoothing = 0.5f; int main(int argc, const char* argv[]) { const float dist = 100; 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,0,1,1); camera->SetFov(70); camera->SetPosition(3, 2, 0); camera->SetRotation(45, 90, 0); auto light = CreateDirectionalLight(world); light->SetRotation(35, 35, 0); auto box = CreateBox(world); box->SetPosition(10.0f, dist + 1.0f, 10.0f); auto custom_model = CreateModel(world); auto mesh = custom_model->AddMesh(); int size = 256, index = 0; for (int z = 0; z < size; z++) { for (int x = 0; x < size; x++) { mesh->AddVertex(x, 0.0f, z, 0.0f, 1.0f, 0.0f); if (x != 0 && x != size - 1 && z != 0 && z != size - 1) { mesh->AddPrimitive(index, index - size - 1, index - 1); mesh->AddPrimitive(index, index - size, index - size - 1); } index++; } } custom_model->UpdateBounds(); custom_model->SetPosition(0.0f, dist, 0.0f); camera->SetPosition(0.0f, dist + 1.0f, 0.0f); while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { window->SetText(box->position.y); if (window->KeyDown(KEY_UP)) { box->Translate(0, 1, 0); custom_model->Translate(0, 1, 0); camera->Translate(0, 1, 0); } if (window->KeyDown(KEY_DOWN)) { box->Translate(0, -1, 0); custom_model->Translate(0, -1, 0); camera->Translate(0, -1, 0); } if (window->KeyHit(KEY_F2) == true) { camera->SetWireframe(!camera->GetWireframe()); } auto _displaySize = window->GetSize(); float cx = Round((float)_displaySize.x / 2.0f); float cy = Round((float)_displaySize.y / 2.0f); auto mpos = Vec3(window->GetMousePosition().x, window->GetMousePosition().y, window->GetMousePosition().z); window->SetMousePosition(cx, cy); mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing); auto dx = (mpos.x - cx) * lookspeed; auto dy = (mpos.y - cy) * lookspeed; auto camrot = camera->GetRotation(); camrot.x += dy; camrot.y += dx; camera->SetRotation(camrot); mousepos = mpos; auto speed = 0.1f; if (window->KeyDown(KEY_SHIFT) == true) { speed = speed * 10.0f; } if (window->KeyDown(KEY_W) == true) { camera->Move(0, 0, speed); } else if (window->KeyDown(KEY_S) == true) { camera->Move(0, 0, -speed); } if (window->KeyDown(KEY_A) == true) { camera->Move(-speed, 0, 0); } else if (window->KeyDown(KEY_D) == true) { camera->Move(speed, 0, 0); } world->Update(); world->Render(framebuffer); } return 0; }
  20. I have simplified your example a bit: #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 framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.8); camera->Turn(35, 0, 0); camera->Move(0, 0, -2); camera->SetDebugPhysicsMode(true); //Create light auto light = CreateBoxLight(world); light->SetRange(-20, 20); light->SetArea(20, 20); light->SetRotation(35, 35, 0); auto unlitMaterial = CreateMaterial(); auto unlitShader = LoadShaderFamily("Shaders/Unlit.json"); unlitMaterial->SetShaderFamily(unlitShader); int width = 2, height = 1, length = 3; auto model = CreateModel(world); auto mesh = model->AddMesh(); mesh->AddVertex(0, 0, 0); //S mesh->AddVertex(-width * 0.5, -height * 0.5, length);//NW mesh->AddVertex(width * 0.5, -height * 0.5, length);//NE mesh->AddPrimitive(2, 1, 0);//S , NW, NE mesh->AddVertex(-width * 0.5, height * 0.5, length);//NW h mesh->AddVertex(width * 0.5, height * 0.5, length);//NE h mesh->AddPrimitive(0, 3, 4);//S , NW h, NE h mesh->AddPrimitive(0, 1, 3);//left mesh->AddPrimitive(4, 3, 1); //"face" mesh->AddPrimitive(2, 4, 1); //"face" mesh->AddPrimitive(0, 4, 2); //"right" auto& mat = unlitMaterial; mat->SetTransparent(true); model->SetMaterial(mat); model->SetColor(0.5f, 0.8f, 0, 0.25f); model->SetPosition(0, 0, 0); auto collider = CreateConvexHullCollider(mesh); model->SetCollider(collider); Vec3 targetPos(2, 0, 0); auto box = CreateBox(world, 0.1f); box->SetPosition(targetPos); //auto component = model->AddComponent<Mover>(); //component->rotationspeed.y = 45; model->Turn(0, 90, 0); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { auto newTargetPos = TransformPoint(targetPos, NULL, model); newTargetPos = Vec3(0, 0, 2); //auto newTargetPos = TransformPoint(targetPos, Mat4(), model->GetMatrix()); bool isInside = model->GetCollider()->IntersectsPoint(newTargetPos); if (isInside) { model->SetColor(0, 1, 0, 1); } else { model->SetColor(1, 0, 0, 1); } world->Update(); world->Render(framebuffer); } return 0; }
  21. Sometimes it works in release and sometimes it does not. This is evidence that an unintialized boolean value might be somewhere in that routine's code....
×
×
  • Create New...