-
Posts
24,637 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Josh
-
Fixed. Cameras bounds will be treated as a single point for this functionality.
-
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; }
-
When Terrain is selected the editor is painfully slow
Josh replied to klepto2's topic in Bug Reports
bump... -
Bumping this to top of list...
-
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 } ]
-
LOD 1 and 2 load fine, although they are missing DDS textures...
-
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; }
-
Full update with recent bug fixes. Added Camera::SetSweptCulling:
-
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; }
-
I was able to integrate the convex hull solver from the Bullet Physics library and it seems to work okay. Testing...
-
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...
-
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; }
-
I will try this if you provide the model.
-
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; }
-
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.
-
I can probably fix this in the skybox shader just by multiplying the vertex position ....
-
There is a bug where a brush will crash in its UpdateBounds routine if it has no vertices. I am fixing it now...
- 1 reply
-
- 1
-
Okay, fixed.
-
Package::LoadDir("") returns nothing on large package
Josh replied to SpiderPig's topic in Bug Reports
Apparently this version of minizip would maybe work, as long as you have less than 65536 files: https://github.com/zlib-ng/minizip-ng However, adoption of Zip64 appears to be almost non-existent in the real world. Writing a new archive format isn't exactly difficult, and may be less work than implementing another library, then dealing with all the bad design decisions a programmer who isn't me will invariably make. If I were to make an encryption format, I would include: unsigned 64-bit integers for everything so we don't have this stupid size limitation bullshit file table would be at the end of the file file removal without shifting all other files Maybe for really big archives we should be looking at something like that. The advantage would be that you can upload a new version of the archive on Steam and it would only upload the sections that changed, because each build would not shift the entire contents around. I think Valve did something like this with their packages files, which is why they have a defragment feature. In the immediate term, I recommend splitting your data up into multiple zip archives.