mirror of
https://github.com/Relintai/mesh_utils.git
synced 2025-02-04 16:05:55 +01:00
Added the MeshUtils singleton.
This commit is contained in:
parent
5f8f4ab2d7
commit
060f0723d0
2
SCsub
2
SCsub
@ -11,7 +11,7 @@ module_env = env.Clone()
|
|||||||
sources = [
|
sources = [
|
||||||
|
|
||||||
"register_types.cpp",
|
"register_types.cpp",
|
||||||
|
"mesh_utils.cpp",
|
||||||
"fast_quadratic_mesh_simplifier.cpp",
|
"fast_quadratic_mesh_simplifier.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
40
mesh_utils.cpp
Normal file
40
mesh_utils.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2020 Péter Magyar
|
||||||
|
|
||||||
|
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, EXPRMeshUtils OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNMeshUtils 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 "mesh_utils.h"
|
||||||
|
|
||||||
|
MeshUtils *MeshUtils::_instance;
|
||||||
|
|
||||||
|
MeshUtils *MeshUtils::get_singleton() {
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
MeshUtils::MeshUtils() {
|
||||||
|
_instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
MeshUtils::~MeshUtils() {
|
||||||
|
_instance = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MeshUtils::_bind_methods() {
|
||||||
|
}
|
44
mesh_utils.h
Normal file
44
mesh_utils.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019-2020 Péter Magyar
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MESH_UTILS_H
|
||||||
|
#define MESH_UTILS_H
|
||||||
|
|
||||||
|
#include "core/object.h"
|
||||||
|
|
||||||
|
class MeshUtils : public Object {
|
||||||
|
GDCLASS(MeshUtils, Object);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static MeshUtils *get_singleton();
|
||||||
|
|
||||||
|
MeshUtils();
|
||||||
|
~MeshUtils();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static MeshUtils *_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,7 +1,3 @@
|
|||||||
#include "register_types.h"
|
|
||||||
|
|
||||||
#include "fast_quadratic_mesh_simplifier.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2020 Péter Magyar
|
Copyright (c) 2020 Péter Magyar
|
||||||
@ -26,9 +22,24 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "register_types.h"
|
||||||
|
|
||||||
|
#include "core/engine.h"
|
||||||
|
#include "fast_quadratic_mesh_simplifier.h"
|
||||||
|
#include "mesh_utils.h"
|
||||||
|
|
||||||
|
static MeshUtils *mesh_utils = NULL;
|
||||||
|
|
||||||
void register_mesh_utils_types() {
|
void register_mesh_utils_types() {
|
||||||
ClassDB::register_class<FastQuadraticMeshSimplifier>();
|
ClassDB::register_class<FastQuadraticMeshSimplifier>();
|
||||||
|
|
||||||
|
mesh_utils = memnew(MeshUtils);
|
||||||
|
ClassDB::register_class<MeshUtils>();
|
||||||
|
Engine::get_singleton()->add_singleton(Engine::Singleton("MeshUtils", MeshUtils::get_singleton()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregister_mesh_utils_types() {
|
void unregister_mesh_utils_types() {
|
||||||
|
if (mesh_utils) {
|
||||||
|
memdelete(mesh_utils);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user