xatlas: Revert to unmodified upstream code, add to COPYRIGHT

Imported by @reduz from b8ec29b6b6
Custom changes will be remade properly in the next commit.
This commit is contained in:
Rémi Verschelde 2019-04-19 12:03:12 +02:00
parent 1b3ea697c5
commit 1e39fee140
6 changed files with 1398 additions and 1018 deletions

View File

@ -391,6 +391,13 @@ Copyright: 2011, Khaled Mamou
2003-2009, Erwin Coumans 2003-2009, Erwin Coumans
License: BSD-3-clause License: BSD-3-clause
Files: ./thirdparty/xatlas/
Comment: xatlas
Copyright: 2018, Jonathan Young
2013, Thekla, Inc
2006, NVIDIA Corporation, Ignacio Castano
License: Expat
Files: ./thirdparty/zlib/ Files: ./thirdparty/zlib/
Comment: zlib Comment: zlib
Copyright: 1995-2017, Jean-loup Gailly and Mark Adler Copyright: 1995-2017, Jean-loup Gailly and Mark Adler

View File

@ -1,5 +1,4 @@
def can_build(env, platform): def can_build(env, platform):
#return False #xatlas is buggy
return (env['tools'] and platform not in ["android", "ios"]) return (env['tools'] and platform not in ["android", "ios"])
def configure(env): def configure(env):

14
thirdparty/README.md vendored
View File

@ -545,6 +545,20 @@ They can be reapplied using the patches included in the `vhacd`
folder. folder.
## xatlas
- Upstream: https://github.com/jpcy/xatlas
- Version: git (b8ec29b, 2018)
- License: MIT
Files extracted from upstream source:
- `xatlas.{cpp,h}`
Note: License is marked as Public Domain in the files, but it was
later clarified upstream to MIT license.
## zlib ## zlib
- Upstream: http://www.zlib.net - Upstream: http://www.zlib.net

14
thirdparty/xatlas/LICENSE vendored Normal file
View File

@ -0,0 +1,14 @@
xatlas
https://github.com/jpcy/xatlas
Copyright (c) 2018 Jonathan Young
thekla_atlas
https://github.com/Thekla/thekla_atlas
Copyright (c) 2013 Thekla, Inc
Copyright NVIDIA Corporation 2006 -- Ignacio Castano <icastano@nvidia.com>
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.

File diff suppressed because it is too large Load Diff

View File

@ -3,15 +3,15 @@
#ifndef XATLAS_H #ifndef XATLAS_H
#define XATLAS_H #define XATLAS_H
#include <float.h> // FLT_MAX #include <float.h> // FLT_MAX
#include <limits.h>
#include <stdint.h>
namespace xatlas { namespace xatlas {
typedef void (*PrintFunc)(const char *, ...); typedef void (*PrintFunc)(const char *, ...);
struct Atlas; struct Atlas;
struct CharterOptions { struct CharterOptions
{
float proxyFitMetricWeight; float proxyFitMetricWeight;
float roundnessMetricWeight; float roundnessMetricWeight;
float straightnessMetricWeight; float straightnessMetricWeight;
@ -20,7 +20,8 @@ struct CharterOptions {
float maxChartArea; float maxChartArea;
float maxBoundaryLength; float maxBoundaryLength;
CharterOptions() { CharterOptions()
{
// These are the default values we use on The Witness. // These are the default values we use on The Witness.
proxyFitMetricWeight = 2.0f; proxyFitMetricWeight = 2.0f;
roundnessMetricWeight = 0.01f; roundnessMetricWeight = 0.01f;
@ -39,15 +40,18 @@ struct CharterOptions {
} }
}; };
struct PackMethod { struct PackMethod
enum Enum { {
enum Enum
{
TexelArea, // texel_area determines resolution TexelArea, // texel_area determines resolution
ApproximateResolution, // guess texel_area to approximately match desired resolution ApproximateResolution, // guess texel_area to approximately match desired resolution
ExactResolution // run the packer multiple times to exactly match the desired resolution (slow) ExactResolution // run the packer multiple times to exactly match the desired resolution (slow)
}; };
}; };
struct PackerOptions { struct PackerOptions
{
PackMethod::Enum method; PackMethod::Enum method;
// 0 - brute force // 0 - brute force
@ -65,7 +69,8 @@ struct PackerOptions {
bool conservative; // Pack charts with extra padding. bool conservative; // Pack charts with extra padding.
int padding; int padding;
PackerOptions() { PackerOptions()
{
method = PackMethod::ApproximateResolution; method = PackMethod::ApproximateResolution;
quality = 1; quality = 1;
texelArea = 8; texelArea = 8;
@ -76,8 +81,10 @@ struct PackerOptions {
} }
}; };
struct AddMeshErrorCode { struct AddMeshErrorCode
enum Enum { {
enum Enum
{
Success, Success,
AlreadyAddedEdge, // index0 and index1 are the edge indices AlreadyAddedEdge, // index0 and index1 are the edge indices
DegenerateColocalEdge, // index0 and index1 are the edge indices DegenerateColocalEdge, // index0 and index1 are the edge indices
@ -90,20 +97,24 @@ struct AddMeshErrorCode {
}; };
}; };
struct AddMeshError { struct AddMeshError
{
AddMeshErrorCode::Enum code; AddMeshErrorCode::Enum code;
uint32_t face; uint32_t face;
uint32_t index0, index1; uint32_t index0, index1;
}; };
struct IndexFormat { struct IndexFormat
enum Enum { {
enum Enum
{
HalfFloat, HalfFloat,
Float Float
}; };
}; };
struct InputMesh { struct InputMesh
{
uint32_t vertexCount; uint32_t vertexCount;
const void *vertexPositionData; const void *vertexPositionData;
uint32_t vertexPositionStride; uint32_t vertexPositionStride;
@ -124,17 +135,20 @@ struct InputMesh {
const uint16_t *faceMaterialData; const uint16_t *faceMaterialData;
}; };
struct OutputChart { struct OutputChart
{
uint32_t *indexArray; uint32_t *indexArray;
uint32_t indexCount; uint32_t indexCount;
}; };
struct OutputVertex { struct OutputVertex
{
float uv[2]; float uv[2];
uint32_t xref; // Index of input vertex from which this output vertex originated. uint32_t xref; // Index of input vertex from which this output vertex originated.
}; };
struct OutputMesh { struct OutputMesh
{
OutputChart *chartArray; OutputChart *chartArray;
uint32_t chartCount; uint32_t chartCount;
uint32_t *indexArray; uint32_t *indexArray;
@ -152,7 +166,7 @@ void Generate(Atlas *atlas, CharterOptions charterOptions = CharterOptions(), Pa
uint32_t GetWidth(const Atlas *atlas); uint32_t GetWidth(const Atlas *atlas);
uint32_t GetHeight(const Atlas *atlas); uint32_t GetHeight(const Atlas *atlas);
uint32_t GetNumCharts(const Atlas *atlas); uint32_t GetNumCharts(const Atlas *atlas);
const OutputMesh *const *GetOutputMeshes(const Atlas *atlas); const OutputMesh * const *GetOutputMeshes(const Atlas *atlas);
const char *StringForEnum(AddMeshErrorCode::Enum error); const char *StringForEnum(AddMeshErrorCode::Enum error);
} // namespace xatlas } // namespace xatlas