Jump to content

Josh

Staff
  • Posts

    24,638
  • Joined

  • Last visited

Everything posted by Josh

  1. I made a demo, using the current code from Github. That's all I can do for now.
  2. Fixed. Cameras bounds will be treated as a single point for this functionality.
  3. Created a thread here: https://newtondynamics.com/forum/viewtopic.php?f=9&t=9832&p=67985#p67985 Perhaps related: http://newtondynamics.com/forum/viewtopic.php?f=12&t=9305&p=62960&hilit=NewtonCollisionPointDistance#p62960 I need to redownload Newton and see if my version matches the repo.
  4. This example better demonstrates the problem: #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 framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.8); camera->Move(3, 0, -2); camera->SetDebugPhysicsMode(true); camera->AddComponent<CameraControls>(); 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" world->SetAmbientLight(1); //auto& mat = unlitMaterial; auto mat = CreateMaterial(); 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(-1, 0, 0); auto box = CreateBox(world, 0.1f); box->SetPosition(targetPos); auto mover = box->AddComponent<Mover>(); //mover->movementspeed.x = 0.2; model->Turn(0, 90, 0); auto ball = CreateSphere(world, 0.055); ball->SetColor(1, 0, 0); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { targetPos = box->GetPosition(); auto newTargetPos = TransformPoint(targetPos, nullptr, model); if (window->KeyDown(KEY_RIGHT)) box->Move(0.02, 0, 0); if (window->KeyDown(KEY_LEFT)) box->Move(-0.02, 0, 0); if (window->KeyDown(KEY_UP)) box->Move(0,0.02, 0); if (window->KeyDown(KEY_DOWN)) box->Move(0,-0.02, 0); auto p = model->GetCollider()->ClosestPoint(newTargetPos); p = TransformPoint(p, model, nullptr); ball->SetPosition(p); bool isInside = model->GetCollider()->IntersectsPoint(newTargetPos); if (isInside) { model->SetColor(0, 0.5, 0, 0.5); } else { model->SetColor(0.5, 0.5, 0.5, 0.5); } world->Update(); world->Render(framebuffer); } return 0; }
  5. Bumping this to top of list...
  6. It looks like the image indexes aren't correct and this is not a valid glTF file. I added some checks to prevent crashing, but the image indexes are wrong. It would appear this indicates an error in the Ultra glTF saver. If you can provide the original file, before it was saved from Ultra, I will test with that. The images section only contains four images: "images": [ { "uri": "PineLeaves_DIFF.png" }, { "uri": "PineLeaves_NORM.png" }, { "uri": "PineTrunk_DIFF.png" }, { "uri": "PineTrunk_NORM.png" } ], But the textures section is referencing images greater than 3: "textures": [ { "extensions": { "MSFT_texture_dds": { "source": 1 } }, "source": 0 }, { "extensions": { "MSFT_texture_dds": { "source": 3 } }, "source": 2 }, { "extensions": { "MSFT_texture_dds": { "source": 5 } }, "source": 4 }, { "extensions": { "MSFT_texture_dds": { "source": 7 } }, "source": 6 } ]
  7. LOD 1 and 2 load fine, although they are missing DDS textures...
  8. Easy fix. #include "UltraEngine.h" #include "ComponentSystem.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the display list 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(); world->SetAmbientLight(0); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetFov(70); camera->SetPosition(0, 50, 0); camera->SetRotation(45, 0, 0); camera->SetClearColor(0.125); camera->SetSweptCulling(true); //Sunlight auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); //Create terrain auto terrain = CreateTerrain(world, 512); terrain->LoadHeightmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Terrain/512.r16"); terrain->SetScale(1, 100, 1); //Create base material auto ground = CreateMaterial(); auto diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_diff_4k.dds"); auto normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/river_small_rocks_nor_gl_4k.dds"); ground->SetTexture(diffusemap, TEXTURE_BASE); ground->SetTexture(normalmap, TEXTURE_NORMAL); terrain->SetMaterial(ground); //Create paint material auto rocks = CreateMaterial(); diffusemap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k.dds"); normalmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_dot3.dds"); auto dispmap = LoadTexture("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Ground/Rocks_Dirt_Ground_2k_disp.dds"); rocks->SetTexture(diffusemap, TEXTURE_BASE); rocks->SetTexture(normalmap, TEXTURE_NORMAL); rocks->SetTexture(dispmap, TEXTURE_DISPLACEMENT); int rocklayer = terrain->AddLayer(rocks); //Apply material based on terrain slope for (int x = 0; x < terrain->resolution.x; ++x) { for (int y = 0; y < terrain->resolution.y; ++y) { float slope = terrain->GetSlope(x, y); if (slope > 15.0f) { float wt = Min((slope - 15.0f) / 10.0f, 1.0f); terrain->SetLayerWeight(rocklayer, x, y, wt); } } } //Camera controls camera->AddComponent<CameraControls>(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { world->Update(); world->Render(framebuffer); } return 0; }
  9. Full update with recent bug fixes. Added Camera::SetSweptCulling:
  10. I am going to close this because there is no way for me to investigate this further. Please let me know if any new information arises.
  11. Implemented Camera:SetSweptCulling and it works nicely. Will be in next build. #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*2, 720*2, 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); camera->AddComponent<CameraControls>(); bool swept = true; camera->SetSweptCulling(true); window->SetText("Swept culling enabled"); //Create a light auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); std::vector<shared_ptr<Entity> > boxes; //Create a model auto model = CreateBox(world); for (int x = 0; x < 100; ++x) { for (int y = 0; y < 5; ++y) { auto inst = model->Instantiate(world); inst->SetPosition(x * 2 - 100, y * 2 - 4, 8); boxes.push_back(inst); } } model = nullptr; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { swept = not swept; camera->SetSweptCulling(swept); if (swept) { window->SetText("Swept culling enabled"); } else { window->SetText("Swept culling disabled"); } } world->Update(); world->Render(framebuffer); } return 0; }
  12. I was able to integrate the convex hull solver from the Bullet Physics library and it seems to work okay. Testing...
  13. I am having trouble finding a convex hull implementation that doesn't triangulate the results. Could write my own but it might take a couple of days to get right...
  14. I am unable to produce an error where the GUI does not appear correct on a second display, using two monitors.
  15. Can confirm: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the display auto displays = GetDisplays(); //Create a window auto style = WINDOW_FULLSCREEN; auto window = CreateWindow("Example", displays[1]->position.x, 0, displays[1]->size.x, displays[1]->size.y, displays[1], style); auto ui = CreateInterface(window); //Main loop while (window->Closed() == false) { if (window->KeyDown(KEY_ESCAPE)) break; } return 0; }
  16. I will try this if you provide the model.
  17. Easy shader fix in Sky.vert void main() { texCoords = normalize(VertexPosition.xyz); mat4 cameraMatrix = ExtractEntityMatrix(CameraID); vec4 pos = VertexPosition; pos.xyz *= CameraRange.x + (CameraRange.y - CameraRange.x) * 0.5f; pos.xyz += cameraMatrix[3].xyz; gl_Position = CameraProjectionViewMatrix * pos; gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5f; }
  18. Not exactly...Player physics and navigation are two completely separate things. If a character is using physics the navmesh will have no effect on them. If a character is using a navmesh, they won't go over an edge, and they will just stay on the surface. The outline of the navmesh is the volume for which the navmesh is calculated. Everything in that volume will be considered when building the navigation data. Navmeshes are not infinite, they need a defined volume.
  19. I can probably fix this in the skybox shader just by multiplying the vertex position ....
  20. There is a bug where a brush will crash in its UpdateBounds routine if it has no vertices. I am fixing it now...
×
×
  • Create New...