summaryrefslogtreecommitdiff
path: root/modules/thekla_unwrap
diff options
context:
space:
mode:
Diffstat (limited to 'modules/thekla_unwrap')
-rw-r--r--modules/thekla_unwrap/SCsub85
-rw-r--r--modules/thekla_unwrap/config.py6
-rw-r--r--modules/thekla_unwrap/register_types.cpp124
-rw-r--r--modules/thekla_unwrap/register_types.h32
4 files changed, 0 insertions, 247 deletions
diff --git a/modules/thekla_unwrap/SCsub b/modules/thekla_unwrap/SCsub
deleted file mode 100644
index c47c760d5f..0000000000
--- a/modules/thekla_unwrap/SCsub
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-
-import platform
-
-Import('env')
-Import('env_modules')
-
-env_thekla_unwrap = env_modules.Clone()
-
-# Thirdparty source files
-if env['builtin_thekla_atlas']:
- thirdparty_dir = "#thirdparty/thekla_atlas/"
- thirdparty_sources = [
- "nvcore/Memory.cpp",
- "nvcore/Debug.cpp",
- "nvcore/StrLib.cpp",
- "nvcore/FileSystem.cpp",
- "nvcore/RadixSort.cpp",
- "nvmath/Basis.cpp",
- "nvmath/ConvexHull.cpp",
- "nvmath/Fitting.cpp",
- "nvmath/Plane.cpp",
- "nvmath/ProximityGrid.cpp",
- "nvmath/Random.cpp",
- "nvmath/Solver.cpp",
- "nvmath/Sparse.cpp",
- "nvmath/TypeSerialization.cpp",
- "poshlib/posh.c",
- "nvimage/BitMap.cpp",
- "nvimage/Image.cpp",
- "nvmesh/BaseMesh.cpp",
- "nvmesh/MeshBuilder.cpp",
- "nvmesh/TriMesh.cpp",
- "nvmesh/QuadTriMesh.cpp",
- "nvmesh/MeshTopology.cpp",
- "nvmesh/halfedge/Edge.cpp",
- "nvmesh/halfedge/Mesh.cpp",
- "nvmesh/halfedge/Face.cpp",
- "nvmesh/halfedge/Vertex.cpp",
- "nvmesh/geometry/Bounds.cpp",
- "nvmesh/geometry/Measurements.cpp",
- "nvmesh/raster/Raster.cpp",
- "nvmesh/param/Atlas.cpp",
- "nvmesh/param/AtlasBuilder.cpp",
- "nvmesh/param/AtlasPacker.cpp",
- "nvmesh/param/LeastSquaresConformalMap.cpp",
- "nvmesh/param/OrthogonalProjectionMap.cpp",
- "nvmesh/param/ParameterizationQuality.cpp",
- "nvmesh/param/SingleFaceMap.cpp",
- "nvmesh/param/Util.cpp",
- "nvmesh/weld/VertexWeld.cpp",
- "nvmesh/weld/Snap.cpp",
- "thekla/thekla_atlas.cpp"
- ]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-
- env_thekla_unwrap.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "poshlib", thirdparty_dir + "nvcore", thirdparty_dir + "nvmesh"])
-
- # upstream uses c++11
- if (not env.msvc):
- env_thekla_unwrap.Append(CXXFLAGS="-std=c++11")
-
- if env["platform"] == 'x11':
- # if not specifically one of the *BSD, then use LINUX as default
- if platform.system() == "FreeBSD":
- env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_FREEBSD", "-DPOSH_COMPILER_GCC"])
- elif platform.system() == "OpenBSD":
- env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_OPENBSD", "-DPOSH_COMPILER_GCC"])
- else:
- env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_LINUX", "-DPOSH_COMPILER_GCC"])
- elif env["platform"] == 'osx':
- env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_DARWIN", "-DPOSH_COMPILER_GCC"])
- elif env["platform"] == 'windows':
- if env.msvc:
- env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_WIN32", "-DNV_CC_MSVC", "-DPOSH_COMPILER_MSVC" ])
- else:
- env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_MINGW", "-DNV_CC_GNUC", "-DPOSH_COMPILER_GCC", "-U__STRICT_ANSI__"])
- env.Append(LIBS=["dbghelp"])
-
- env_thirdparty = env_thekla_unwrap.Clone()
- env_thirdparty.disable_warnings()
- env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
-
-# Godot source files
-env_thekla_unwrap.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/thekla_unwrap/config.py b/modules/thekla_unwrap/config.py
deleted file mode 100644
index fad6095064..0000000000
--- a/modules/thekla_unwrap/config.py
+++ /dev/null
@@ -1,6 +0,0 @@
-def can_build(env, platform):
- #return (env['tools'] and platform not in ["android", "ios"])
- return False
-
-def configure(env):
- pass
diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp
deleted file mode 100644
index 2c35adfb83..0000000000
--- a/modules/thekla_unwrap/register_types.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*************************************************************************/
-/* register_types.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "register_types.h"
-#include "core/error_macros.h"
-#include "thirdparty/thekla_atlas/thekla/thekla_atlas.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-extern bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y);
-
-bool thekla_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) {
-
- //set up input mesh
- Thekla::Atlas_Input_Mesh input_mesh;
- input_mesh.face_array = new Thekla::Atlas_Input_Face[p_index_count / 3];
- for (int i = 0; i < p_index_count / 3; i++) {
- input_mesh.face_array[i].vertex_index[0] = p_indices[i * 3 + 0];
- input_mesh.face_array[i].vertex_index[1] = p_indices[i * 3 + 1];
- input_mesh.face_array[i].vertex_index[2] = p_indices[i * 3 + 2];
- //printf("face %i - %i, %i, %i - mat %i\n", i, input_mesh.face_array[i].vertex_index[0], input_mesh.face_array[i].vertex_index[1], input_mesh.face_array[i].vertex_index[2], p_face_materials[i]);
- input_mesh.face_array[i].material_index = p_face_materials[i];
- }
- input_mesh.vertex_array = new Thekla::Atlas_Input_Vertex[p_vertex_count];
- for (int i = 0; i < p_vertex_count; i++) {
- input_mesh.vertex_array[i].first_colocal = i; //wtf
- for (int j = 0; j < 3; j++) {
- input_mesh.vertex_array[i].position[j] = p_vertices[i * 3 + j];
- input_mesh.vertex_array[i].normal[j] = p_normals[i * 3 + j];
- }
- input_mesh.vertex_array[i].uv[0] = 0;
- input_mesh.vertex_array[i].uv[1] = 0;
- //printf("vertex %i - %f, %f, %f\n", i, input_mesh.vertex_array[i].position[0], input_mesh.vertex_array[i].position[1], input_mesh.vertex_array[i].position[2]);
- //printf("normal %i - %f, %f, %f\n", i, input_mesh.vertex_array[i].normal[0], input_mesh.vertex_array[i].normal[1], input_mesh.vertex_array[i].normal[2]);
- }
- input_mesh.face_count = p_index_count / 3;
- input_mesh.vertex_count = p_vertex_count;
-
- //set up options
- Thekla::Atlas_Options options;
- Thekla::atlas_set_default_options(&options);
- options.packer_options.witness.packing_quality = 1;
- options.packer_options.witness.texel_area = 1.0 / p_texel_size;
- options.packer_options.witness.conservative = false;
-
- //generate
- Thekla::Atlas_Error err;
- Thekla::Atlas_Output_Mesh *output = atlas_generate(&input_mesh, &options, &err);
-
- delete[] input_mesh.face_array;
- delete[] input_mesh.vertex_array;
-
- if (output == NULL) {
- ERR_PRINT("could not generate atlas output mesh");
- return false;
- }
-
- if (err != Thekla::Atlas_Error_Success) {
- printf("error with atlas\n");
- } else {
- *r_vertex = (int *)malloc(sizeof(int) * output->vertex_count);
- *r_uv = (float *)malloc(sizeof(float) * output->vertex_count * 3);
- *r_index = (int *)malloc(sizeof(int) * output->index_count);
-
- // printf("w: %i, h: %i\n", output->atlas_width, output->atlas_height);
- for (int i = 0; i < output->vertex_count; i++) {
- (*r_vertex)[i] = output->vertex_array[i].xref;
- (*r_uv)[i * 2 + 0] = output->vertex_array[i].uv[0] / output->atlas_width;
- (*r_uv)[i * 2 + 1] = output->vertex_array[i].uv[1] / output->atlas_height;
- // printf("uv: %f,%f\n", (*r_uv)[i * 2 + 0], (*r_uv)[i * 2 + 1]);
- }
- *r_vertex_count = output->vertex_count;
-
- for (int i = 0; i < output->index_count; i++) {
- (*r_index)[i] = output->index_array[i];
- }
-
- *r_index_count = output->index_count;
-
- *r_size_hint_x = output->atlas_height;
- *r_size_hint_y = output->atlas_width;
- }
-
- if (output) {
- atlas_free(output);
- }
-
- return err == Thekla::Atlas_Error_Success;
-}
-
-void register_thekla_unwrap_types() {
-
- array_mesh_lightmap_unwrap_callback = thekla_mesh_lightmap_unwrap_callback;
-}
-
-void unregister_thekla_unwrap_types() {
-}
diff --git a/modules/thekla_unwrap/register_types.h b/modules/thekla_unwrap/register_types.h
deleted file mode 100644
index b911eed622..0000000000
--- a/modules/thekla_unwrap/register_types.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*************************************************************************/
-/* register_types.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-void register_thekla_unwrap_types();
-void unregister_thekla_unwrap_types();