-
Posts
24,627 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Josh
-
Some code I used to resize a cubemap. I think the mipmaps might not be correct, but that's okay: Pasting here in case I need it again auto plug = LoadPlugin("Plugins/ISPCTexComp.dll"); auto tex = LoadTexture(GetPath(PATH_DESKTOP) + "/diffuse.dds", LOAD_MIPCHAIN); auto mipchain = tex->mipchain; std::vector<shared_ptr<Pixmap> > chain2; for (auto p : mipchain) { { p = p->Convert(TEXTURE_RGBA16); p = p->Resize(256, 256); p = p->Convert(TEXTURE_BC6H); chain2.push_back(p); } } SaveTexture(GetPath(PATH_DESKTOP) + "/thumbnail_diffuse.dds", TEXTURE_CUBE, chain2, 6); return 0;
-
Here is some code that uses it, but I just can't seem to get it to work right. I don't think there is an error in my code. I had to fix this file for C++17. Maybe that is causing it? I do not understand these functions: misc.h int VertMap(const std::vector<int>& collapse_map, int a, int mx) { if (mx <= 0) return 0; while (a >= mx) { a = collapse_map[a]; } return a; } std::vector<linalg::aliases::float3> vert; std::vector<tridata> tri; std::vector<int> collapse_map; std::vector<int> permutation; tridata t; for (const auto& v : mesh->vertices) { vert.push_back(linalg::aliases::float3(v.position.x, v.position.y, v.position.z)); } for (int n = 0; n < mesh->CountPrimitives(); ++n) { t.v[0] = mesh->GetPrimitiveVertex(n, 0); t.v[1] = mesh->GetPrimitiveVertex(n, 1); t.v[2] = mesh->GetPrimitiveVertex(n, 2); tri.push_back(t); } //----------------------------- // Reduce the mesh //----------------------------- ProgressiveMesh(vert, tri, collapse_map, permutation); //----------------------------- // PermuteVertices //----------------------------- // rearrange the vertex Array std::vector<float3> temp_Array; unsigned int i; assert(permutation.size() == vert.size()); for (i = 0; i < vert.size(); i++) { temp_Array.push_back(vert[i]); } for (i = 0; i < vert.size(); i++) { vert[permutation[i]] = temp_Array[i]; } // update the changes in the entries in the triangle Array for (i = 0; i < tri.size(); i++) { for (int j = 0; j < 3; j++) { tri[i].v[j] = permutation[tri[i].v[j]]; } } //----------------------------- // Build new mesh //----------------------------- model->Clear(); mesh->extra = nullptr; mesh = model->AddMesh(); std::vector<int> newvertex(vert.size()); std::fill(newvertex.begin(), newvertex.end(), -1); //Add triangles int a, b, c, p0, p1, p2; int render_num = vert.size() * 0.5; for (unsigned int i = 0; i < tri.size(); i++) { p0 = VertMap(collapse_map, tri[i].v[0], render_num); p1 = VertMap(collapse_map, tri[i].v[1], render_num); p2 = VertMap(collapse_map, tri[i].v[2], render_num); if (p0 == p1 or p1 == p2 or p2 == p0) continue; a = newvertex[p0]; if (a == -1) { a = mesh->AddVertex(vert[p0].x, vert[p0].y, vert[p0].z); newvertex[p0] = a; } b = newvertex[p1]; if (b == -1) { b = mesh->AddVertex(vert[p1].x, vert[p1].y, vert[p1].z); newvertex[p1] = b; } c = newvertex[p2]; if (c == -1) { c = mesh->AddVertex(vert[p2].x, vert[p2].y, vert[p2].z); newvertex[p2] = c; } //int a = mesh->AddVertex(vert[p0].x, vert[p0].y, vert[p0].z); //int b = mesh->AddVertex(vert[p1].x, vert[p1].y, vert[p1].z); //int c = mesh->AddVertex(vert[p2].x, vert[p2].y, vert[p2].z); mesh->AddPrimitive(a, b, c); } mesh->UpdateBounds(); model->UpdateBounds();
-
I believe this is fixed now.
-
Changed the way the preview server works. I think this will be more reliable. Currently it is rather slow to generate new thumbnails but I think it will get faster.
-
Asset browser search bar now acts as a filter, includes a drop-down box with some pre-defined file types. Removed grab-object-to-rotate behavior.
-
Fixed Camera::SetUniform texture overload. Added Camera::SetUniform material overload. Added Camera::SetUniform entity overload.
-
"No source file found" just means the original image file the file was converted from does not exist, or might not be included. Leadwerks does not save image files, it just converts images into the custom texture format. Ultra can actually load Leadwerks .tex files and save in different image formats.
-
0.9.6 In this build the terrain creation works more like Leadwerks, where it is created by first selecting the terrain tool. You don't have to worry about selecting the terrain to edit it, it just works. Try it and let me know what you think. The way it is stored in the map file has not changed. LOD for orthographic cameras is fixed.
-
Leadwerks does not work with non-western characters in the project path. You must select a folder with only "normal" characters in the path. (Ultra does support unicode).
-
I would actually like do make a modern version of our old tropical island from LW2
-
What matters is, what is best for us?
-
This change would allow us to get vegetation working sooner, with fewer bugs and ongoing problems.
-
0.9.6 Added right-click on file "Convert File to XXX..." menu item for all converters in asset browser. Added right-click on folder "Batch Conversion" menu item in asset browser.
-
Yeah, I am actually looking into some stuff like that now...
-
Doing that would require two things. With really big worlds, you need a terrain system that recursively subdivides, because normal terrain LOD isn't big enough. With a normal terrain LOD system where the terrain is divided into patches, eventually you can zoom out so far that each patch is just one pixel big. So you need a different way of handling that. You also need a way to warp the terrain to a sphere, and have it affect physics, raycasting, culling, as well as the rendering. I plan on doing stuff like this in the future, but not with our standard terrain system.
-
Yeah, but that will require an entirely separate terrain system, and it's not something important to worry about right now.
-
How do terrains make a sphere anyways?
-
I am considering moving terrain back to work the way it did in Leadwerks, where it was always centered around the origin and did not respond to rotation or positioning. This would simplify vegetation system quite a lot because I can handle all coordinates in world space. Otherwise, you have to do a lot of transformations and it is hard to get things to line up correctly. I think it also makes a better experience in the editor. Movable terrains can be prone to accidental movements, and having them selectable degrades the performance because the outline effect is quite expensive since it requires rendering the object twice.
-
Can you get the local rotation as a quaternion? You might look at the old Leadwerks exporter and see what the author did there.
-
Temporarily removed drag to select area, since it was interfering with some mouse tools. Added terrain texture size field in creation parameters box
-
There is nothing like bone.local_position or bone.position?
-
So blender only gives you a bone's orientation in global space? You have to multiply that by the inverse of the parent's 4x4 matrix to get the local orientation.
-
-
This extension can help eliminate the planar appearance of a lot of trees and plants. You can adjust the minimum Y normal to get the effect you want. Foliage Normals.lua Tested with this model: https://www.turbosquid.com/3d-models/tree_057-519628 Before: After:
- 1 reply
-
- 2
-
Can you post a screenshot that shows the error you are getting or the problem, please?