1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

New lightmapper

-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
This commit is contained in:
Juan Linietsky
2020-05-01 09:34:23 -03:00
parent 6a0473bcc2
commit 1bea8e1eac
434 changed files with 126122 additions and 3384 deletions

View File

@@ -32,8 +32,10 @@
#include "core/math/basis.h"
#include "core/math/camera_matrix.h"
#include "core/math/delaunay_3d.h"
#include "core/math/math_funcs.h"
#include "core/math/transform.h"
#include "core/method_ptrcall.h"
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
@@ -45,8 +47,6 @@
#include "scene/resources/texture.h"
#include "servers/rendering/shader_language.h"
#include "core/method_ptrcall.h"
namespace TestMath {
class GetClassAndNamespace {
@@ -414,6 +414,55 @@ uint32_t ihash3(uint32_t a) {
MainLoop *test() {
{
Vector<Vector3> points;
points.push_back(Vector3(0, 0, 0));
points.push_back(Vector3(0, 0, 1));
points.push_back(Vector3(0, 1, 0));
points.push_back(Vector3(0, 1, 1));
points.push_back(Vector3(1, 1, 0));
points.push_back(Vector3(1, 0, 0));
points.push_back(Vector3(1, 0, 1));
points.push_back(Vector3(1, 1, 1));
for (int i = 0; i < 800; i++) {
points.push_back(Vector3(Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0, Math::randf() * 2.0 - 1.0) * Vector3(25, 30, 33));
}
Vector<Delaunay3D::OutputSimplex> os = Delaunay3D::tetrahedralize(points);
print_line("simplices in the end: " + itos(os.size()));
for (int i = 0; i < os.size(); i++) {
print_line("Simplex " + itos(i) + ": ");
print_line(points[os[i].points[0]]);
print_line(points[os[i].points[1]]);
print_line(points[os[i].points[2]]);
print_line(points[os[i].points[3]]);
}
{
FileAccessRef f = FileAccess::open("res://bsp.obj", FileAccess::WRITE);
for (int i = 0; i < os.size(); i++) {
f->store_line("o Simplex" + itos(i));
for (int j = 0; j < 4; j++) {
f->store_line(vformat("v %f %f %f", points[os[i].points[j]].x, points[os[i].points[j]].y, points[os[i].points[j]].z));
}
static const int face_order[4][3] = {
{ 1, 2, 3 },
{ 1, 3, 4 },
{ 1, 2, 4 },
{ 2, 3, 4 }
};
for (int j = 0; j < 4; j++) {
f->store_line(vformat("f %d %d %d", 4 * i + face_order[j][0], 4 * i + face_order[j][1], 4 * i + face_order[j][2]));
}
}
f->close();
}
return nullptr;
}
{
float r = 1;
float g = 0.5;