Added the MMAlgos class (and binding) to the build. Also set up it's singleton.

This commit is contained in:
Relintai 2022-06-06 18:44:51 +02:00
parent 2c3d7cecff
commit df9099e0ed
5 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,17 @@
import os
Import('env')
module_env = env.Clone()
sources = [
"register_types.cpp",
"algos/mm_algos.cpp",
"algos/mm_algos_bind.cpp",
]
module_env.add_source_files(env.modules_sources, sources)

View File

@ -1,6 +1,7 @@
#include "mm_algos_bind.h"
#include "core/method_bind_ext.gen.inc"
#include "mm_algos.h"
Vector3 _MMAlgos::clampv3(const Vector3 &v, const Vector3 &mi, const Vector3 &ma) {

View File

@ -0,0 +1,18 @@
def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return [
"MMAlgos",
]
def get_doc_path():
return "doc_classes"

View File

@ -0,0 +1,43 @@
/*
Copyright (c) 2022 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.
*/
#include "register_types.h"
#include "core/engine.h"
#include "algos/mm_algos.h"
#include "algos/mm_algos_bind.h"
static _MMAlgos *_mm_algos_singleton = nullptr;
void register_material_maker_types() {
ClassDB::register_class<_MMAlgos>();
_mm_algos_singleton = memnew(_MMAlgos);
Engine::get_singleton()->add_singleton(Engine::Singleton("MMAlgos", _MMAlgos::get_singleton()));
}
void unregister_material_maker_types() {
if (_mm_algos_singleton) {
memdelete(_mm_algos_singleton);
}
}

View File

@ -0,0 +1,24 @@
/*
Copyright (c) 2022 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.
*/
void register_material_maker_types();
void unregister_material_maker_types();