From: Javier Sancho Date: Thu, 5 Dec 2019 12:21:18 +0000 (+0100) Subject: Scene node animator X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=962438a61115ccca58ef96a91504ff10bc61c36f;p=c-irrlicht.git Scene node animator --- diff --git a/Makefile.am b/Makefile.am index f136bcb..641b6d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,6 +35,7 @@ pkginclude_HEADERS = \ include/irrTypes.h \ include/ISceneManager.h \ include/ISceneNode.h \ + include/ISceneNodeAnimator.h \ include/ITexture.h \ include/IVideoDriver.h \ include/matrix4.h \ diff --git a/include/IFileSystem.h b/include/IFileSystem.h index 26ab0f3..e1942a3 100644 --- a/include/IFileSystem.h +++ b/include/IFileSystem.h @@ -31,13 +31,14 @@ typedef void irr_io_IFileSystem; extern "C" { #endif - int irr_io_addFileArchive(irr_io_IFileSystem* filesystem, - const char* filename, - bool ignoreCase, - bool ignorePaths, - irr_io_E_FILE_ARCHIVE_TYPE archiveType, - const char* password, - irr_io_IFileArchive** retArchive); + int + irr_io_addFileArchive(irr_io_IFileSystem* filesystem, + const char* filename, + bool ignoreCase, + bool ignorePaths, + irr_io_E_FILE_ARCHIVE_TYPE archiveType, + const char* password, + irr_io_IFileArchive** retArchive); #ifdef __cplusplus } diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 3074f57..4e27686 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -32,6 +32,7 @@ #include "ICameraSceneNode.h" #include "IMeshSceneNode.h" #include "ISceneNode.h" +#include "ISceneNodeAnimator.h" #include "SKeyMap.h" #include "SMaterial.h" #include "vector3d.h" @@ -93,6 +94,10 @@ extern "C" { int32_t minimalPolysPerNode, bool alsoAddIfMeshPointerZero); + irr_scene_ISceneNodeAnimator* + irr_scene_createRotationAnimator(irr_scene_ISceneManager* smgr, + irr_core_vector3df* rotationSpeed); + void irr_scene_drawAll(irr_scene_ISceneManager* smgr); diff --git a/include/ISceneNode.h b/include/ISceneNode.h index c7b1916..27a63f0 100644 --- a/include/ISceneNode.h +++ b/include/ISceneNode.h @@ -26,6 +26,7 @@ #include #include "EMaterialFlags.h" +#include "ISceneNodeAnimator.h" #include "ITexture.h" #include "matrix4.h" #include "vector3d.h" @@ -36,6 +37,10 @@ typedef void irr_scene_ISceneNode; extern "C" { #endif + void + irr_scene_addAnimator(irr_scene_ISceneNode* node, + irr_scene_ISceneNodeAnimator* animator); + irr_core_matrix4* irr_scene_getAbsoluteTransformation(irr_scene_ISceneNode* node); diff --git a/include/ISceneNodeAnimator.h b/include/ISceneNodeAnimator.h new file mode 100644 index 0000000..227dd70 --- /dev/null +++ b/include/ISceneNodeAnimator.h @@ -0,0 +1,27 @@ +/* c-irrlicht --- C bindings for Irrlicht Engine + + Copyright (C) 2019 Javier Sancho + + This file is part of c-irrlicht. + + c-irrlicht is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + c-irrlicht is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with guile-irrlicht. If not, see + . +*/ + +#ifndef __C_I_SCENE_NODE_ANIMATOR_H_INCLUDED__ +#define __C_I_SCENE_NODE_ANIMATOR_H_INCLUDED__ + +typedef void irr_scene_ISceneNodeAnimator; + +#endif diff --git a/include/cirrlicht.h b/include/cirrlicht.h index 8841fe4..828a892 100644 --- a/include/cirrlicht.h +++ b/include/cirrlicht.h @@ -44,6 +44,7 @@ #include "irrTypes.h" #include "ISceneManager.h" #include "ISceneNode.h" +#include "ISceneNodeAnimator.h" #include "ITexture.h" #include "IVideoDriver.h" #include "matrix4.h" diff --git a/src/IFileSystem.cpp b/src/IFileSystem.cpp index 42ff300..4ed4917 100644 --- a/src/IFileSystem.cpp +++ b/src/IFileSystem.cpp @@ -23,13 +23,14 @@ #include "IFileSystem.h" extern "C" { - int irr_io_addFileArchive(irr_io_IFileSystem* filesystem, - const char* filename, - bool ignoreCase, - bool ignorePaths, - irr_io_E_FILE_ARCHIVE_TYPE archiveType, - const char* password, - irr_io_IFileArchive** retArchive) + int + irr_io_addFileArchive(irr_io_IFileSystem* filesystem, + const char* filename, + bool ignoreCase, + bool ignorePaths, + irr_io_E_FILE_ARCHIVE_TYPE archiveType, + const char* password, + irr_io_IFileArchive** retArchive) { return ((irr::io::IFileSystem*)filesystem) ->addFileArchive(filename, diff --git a/src/ISceneManager.cpp b/src/ISceneManager.cpp index f4f2c87..e7cefb8 100644 --- a/src/ISceneManager.cpp +++ b/src/ISceneManager.cpp @@ -236,6 +236,17 @@ extern "C" { alsoAddIfMeshPointerZero); } + irr_scene_ISceneNodeAnimator* + irr_scene_createRotationAnimator(irr_scene_ISceneManager* smgr, + irr_core_vector3df* rotationSpeed) + { + const irr::core::vector3df& irrRotationSpeed = + irr::core::vector3df(rotationSpeed->x, rotationSpeed->y, rotationSpeed->z); + + return ((irr::scene::ISceneManager*)smgr) + ->createRotationAnimator(irrRotationSpeed); + } + void irr_scene_drawAll(irr_scene_ISceneManager* smgr) { diff --git a/src/ISceneNode.cpp b/src/ISceneNode.cpp index 57273ab..a2c90a7 100644 --- a/src/ISceneNode.cpp +++ b/src/ISceneNode.cpp @@ -23,6 +23,14 @@ #include "ISceneNode.h" extern "C" { + void + irr_scene_addAnimator(irr_scene_ISceneNode* node, + irr_scene_ISceneNodeAnimator* animator) + { + ((irr::scene::ISceneNode*)node) + ->addAnimator((irr::scene::ISceneNodeAnimator*)animator); + } + irr_core_matrix4* irr_scene_getAbsoluteTransformation(irr_scene_ISceneNode* node) {