]> git.jsancho.org Git - c-irrlicht.git/blob - src/ISceneManager.cpp
irr_scene_ISceneManager_addCameraSceneNode
[c-irrlicht.git] / src / ISceneManager.cpp
1 /* c-irrlicht --- C bindings for Irrlicht Engine
2
3    Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
4
5    This file is part of c-irrlicht.
6
7    c-irrlicht is free software; you can redistribute it and/or modify
8    it under the terms of the GNU Lesser General Public License as
9    published by the Free Software Foundation; either version 3 of the
10    License, or (at your option) any later version.
11
12    c-irrlicht is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16
17    You should have received a copy of the GNU Lesser General Public
18    License along with guile-irrlicht.  If not, see
19    <http://www.gnu.org/licenses/>.
20 */
21
22 #include <irrlicht/irrlicht.h>
23 #include "ISceneManager.h"
24
25 extern "C" {
26   irr_scene_IAnimatedMeshSceneNode*
27   irr_scene_ISceneManager_addAnimatedMeshSceneNode(irr_scene_ISceneManager* smgr,
28                                                    irr_scene_IAnimatedMesh* mesh,
29                                                    irr_scene_ISceneNode* parent,
30                                                    int32_t id,
31                                                    irr_core_vector3df* position,
32                                                    irr_core_vector3df* rotation,
33                                                    irr_core_vector3df* scale,
34                                                    bool alsoAddIfMeshPointerZero)
35   {
36     const irr::core::vector3df& iPosition = irr::core::vector3df(position->x,
37                                                                  position->y,
38                                                                  position->z);
39     const irr::core::vector3df& iRotation = irr::core::vector3df(rotation->x,
40                                                                  rotation->y,
41                                                                  rotation->z);
42     const irr::core::vector3df& iScale = irr::core::vector3df(scale->x,
43                                                               scale->y,
44                                                               scale->z);
45     return (irr_scene_IAnimatedMeshSceneNode*)
46       ((irr::scene::ISceneManager*)smgr)->addAnimatedMeshSceneNode((irr::scene::IAnimatedMesh*)mesh,
47                                                                    (irr::scene::ISceneNode*)parent,
48                                                                    id,
49                                                                    iPosition,
50                                                                    iRotation,
51                                                                    iScale,
52                                                                    alsoAddIfMeshPointerZero);
53   }
54
55   irr_scene_ICameraSceneNode*
56   irr_scene_ISceneManager_addCameraSceneNode(irr_scene_ISceneManager* smgr,
57                                              irr_scene_ISceneNode* parent,
58                                              irr_core_vector3df* position,
59                                              irr_core_vector3df* lookat,
60                                              int32_t id,
61                                              bool makeActive)
62   {
63     const irr::core::vector3df& iPosition = irr::core::vector3df(position->x,
64                                                                  position->y,
65                                                                  position->z);
66     const irr::core::vector3df& iLookat = irr::core::vector3df(lookat->x,
67                                                                lookat->y,
68                                                                lookat->z);
69     return (irr_scene_ICameraSceneNode*)
70       ((irr::scene::ISceneManager*)smgr)->addCameraSceneNode((irr::scene::ISceneNode*)parent,
71                                                              iPosition,
72                                                              iLookat,
73                                                              id,
74                                                              makeActive);
75   }
76
77   irr_scene_IAnimatedMesh*
78   irr_scene_ISceneManager_getMesh(irr_scene_ISceneManager* smgr,
79                                   const char* filename)
80   {
81     return (irr_scene_IAnimatedMesh*)
82       ((irr::scene::ISceneManager*)smgr)->getMesh(filename);
83   }
84 }