From 3d1b30dedaaf3587f8b6d8a12d33db7d448fa866 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 18 Nov 2021 18:09:56 -0800 Subject: [PATCH] Removes Triangulate from Code/Editor Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Util/Triangulate.cpp | 69 ------------------------------ Code/Editor/Util/Triangulate.h | 26 ----------- Code/Editor/editor_lib_files.cmake | 2 - 3 files changed, 97 deletions(-) delete mode 100644 Code/Editor/Util/Triangulate.cpp delete mode 100644 Code/Editor/Util/Triangulate.h diff --git a/Code/Editor/Util/Triangulate.cpp b/Code/Editor/Util/Triangulate.cpp deleted file mode 100644 index c8160a375a..0000000000 --- a/Code/Editor/Util/Triangulate.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#include "EditorDefs.h" - -#include "Triangulate.h" - -// this file is essentially a wrapper for a portion of the MIT-licenced -// ConvexDecomposition library by John W. Ratcliff mailto:jratcliffscarab@gmail.com. -// it contains no code from that library, it just provides it with the required types, then includes the -// portion we need. - -static const float TRIANGULATION_EPSILON = 0.0000000001f; - -#define MEMALLOC_MALLOC malloc -#define MEMALLOC_FREE free - -namespace TriInternal -{ - class TVec; - typedef double NxF64; - typedef float NxF32; - typedef unsigned char NxU8; - typedef unsigned int NxU32; - typedef int NxI32; - typedef unsigned int TU32; - - typedef std::vector< TVec > TVecVector; - typedef std::vector< NxU32 > TU32Vector; - #include "Contrib/NvFloatMath.inl" -} - -#undef MEMALLOC_MALLOC -#undef MEMALLOC_FREE - -namespace Triangulator -{ - // given the contour of a triangle, triangulate it, and return the result - // as a set of triangles - // return false if you fail to triangulate it. - bool Triangulate(const VectorOfVectors& contour, VectorOfVectors& result) - { - TriInternal::CTriangulator tri; - for (auto pt : contour) - { - tri.addPoint(pt.x, pt.y, pt.z); - } - TriInternal::NxU32 tricount = 0; - TriInternal::NxU32* indices = tri.triangulate(tricount, TRIANGULATION_EPSILON); - if (!indices) - { - return false; - } - - for (TriInternal::NxU32 currentIdx = 0; currentIdx < tricount * 3; ++currentIdx) - { - TriInternal::NxU32 indexValue = *indices++; - result.push_back(contour[indexValue]); - } - - return result.size() > 2; - } -} diff --git a/Code/Editor/Util/Triangulate.h b/Code/Editor/Util/Triangulate.h deleted file mode 100644 index dad3a14de1..0000000000 --- a/Code/Editor/Util/Triangulate.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#ifndef CRYINCLUDE_EDITOR_UTIL_TRIANGULATE_H -#define CRYINCLUDE_EDITOR_UTIL_TRIANGULATE_H -#pragma once - -#include -#include "Cry_Vector3.h" - -// you pass in a vector of vec3 (the contour of a shape) and it outputs a vector of vec3 (being the triangles) - -namespace Triangulator -{ - typedef std::vector< Vec3 > VectorOfVectors; - bool Triangulate(const VectorOfVectors& contour, VectorOfVectors& result); -}; - - -#endif diff --git a/Code/Editor/editor_lib_files.cmake b/Code/Editor/editor_lib_files.cmake index 28950c9fa9..d1c903eb72 100644 --- a/Code/Editor/editor_lib_files.cmake +++ b/Code/Editor/editor_lib_files.cmake @@ -648,8 +648,6 @@ set(FILES Util/PredefinedAspectRatios.h Util/StringHelpers.cpp Util/StringHelpers.h - Util/Triangulate.cpp - Util/Triangulate.h Util/Util.h Util/XmlArchive.cpp Util/XmlArchive.h