From 29e2baf09b55c8d338ddd68a7b79586945675710 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sun, 13 Oct 2019 15:30:13 +0200 Subject: [PATCH] ICameraSceneNode and addCameraSceneNode --- Makefile.am | 1 + include/ICameraSceneNode.h | 27 +++++++++++++++++++++++++++ include/ISceneManager.h | 9 +++++++++ include/cirrlicht.h | 1 + src/ISceneManager.cpp | 22 ++++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 include/ICameraSceneNode.h diff --git a/Makefile.am b/Makefile.am index 45b7bdb..63eccfe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,7 @@ include_HEADERS = \ include/EMaterialFlags.h \ include/IAnimatedMeshMD2.h \ include/IAnimatedMeshSceneNode.h \ + include/ICameraSceneNode.h \ include/IGUIElement.h \ include/IGUIEnvironment.h \ include/IGUIStaticText.h \ diff --git a/include/ICameraSceneNode.h b/include/ICameraSceneNode.h new file mode 100644 index 0000000..2793124 --- /dev/null +++ b/include/ICameraSceneNode.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_CAMERA_SCENE_NODE_H_INCLUDED__ +#define __C_I_CAMERA_SCENE_NODE_H_INCLUDED__ + +typedef void irr_scene_ICameraSceneNode; + +#endif diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 728c607..d3ee3ae 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -23,6 +23,7 @@ #define __C_SCENE_MANAGER_H_INCLUDED__ #include "IAnimatedMeshSceneNode.h" +#include "ICameraSceneNode.h" #include "vector3d.h" typedef void irr_scene_IAnimatedMesh; @@ -43,6 +44,14 @@ extern "C" { irr_core_vector3df* scale, bool alsoAddIfMeshPointerZero); + irr_scene_ICameraSceneNode* + addCameraSceneNode(irr_scene_ISceneManager* smgr, + irr_scene_ISceneNode* parent, + irr_core_vector3df* position, + irr_core_vector3df* lookat, + int32_t id, + bool makeActive); + irr_scene_IAnimatedMesh* irr_scene_ISceneManager_getMesh(irr_scene_ISceneManager* smgr, const char* filename); diff --git a/include/cirrlicht.h b/include/cirrlicht.h index a091b5f..8faa0e3 100644 --- a/include/cirrlicht.h +++ b/include/cirrlicht.h @@ -27,6 +27,7 @@ #include "EMaterialFlags.h" #include "IAnimatedMeshMD2.h" #include "IAnimatedMeshSceneNode.h" +#include "ICameraSceneNode.h" #include "IGUIEnvironment.h" #include "IGUIElement.h" #include "IGUIStaticText.h" diff --git a/src/ISceneManager.cpp b/src/ISceneManager.cpp index 83dcda1..230a3ea 100644 --- a/src/ISceneManager.cpp +++ b/src/ISceneManager.cpp @@ -52,6 +52,28 @@ extern "C" { alsoAddIfMeshPointerZero); } + irr_scene_ICameraSceneNode* + addCameraSceneNode(irr_scene_ISceneManager* smgr, + irr_scene_ISceneNode* parent, + irr_core_vector3df* position, + irr_core_vector3df* lookat, + int32_t id, + bool makeActive) + { + const irr::core::vector3df& iPosition = irr::core::vector3df(position->x, + position->y, + position->z); + const irr::core::vector3df& iLookat = irr::core::vector3df(lookat->x, + lookat->y, + lookat->z); + return (irr_scene_ICameraSceneNode*) + ((irr::scene::ISceneManager*)smgr)->addCameraSceneNode((irr::scene::ISceneNode*)parent, + iPosition, + iLookat, + id, + makeActive); + } + irr_scene_IAnimatedMesh* irr_scene_ISceneManager_getMesh(irr_scene_ISceneManager* smgr, const char* filename) -- 2.39.2