libCIrrlicht_la_LDFLAGS = -version-info 0:1
pkginclude_HEADERS = \
include/aabbox3d.h \
+ include/CIrrCompileConfig.h \
include/cirrlicht.h \
include/dimension2d.h \
include/EDriverTypes.h \
include/EMaterialFlags.h \
+ include/EMaterialTypes.h \
include/EPrimitiveTypes.h \
include/IAnimatedMesh.h \
include/IAnimatedMeshMD2.h \
include/IMeshSceneNode.h \
include/IReferenceCounted.h \
include/IrrlichtDevice.h \
+ include/irrMath.h \
include/irrTypes.h \
include/ISceneManager.h \
include/ISceneNode.h \
include/SExposedVideoData.h \
include/SKeyMap.h \
include/SMaterial.h \
+ include/SMaterialLayer.h \
include/SVertexIndex.h \
include/vector2d.h \
include/vector3d.h
irr_scene_addCameraSceneNode(smgr, NULL, &position, &lookat, -1, true);
// create our custom scene node
- irr_scene_ISceneNode *myNode;
+ irr_scene_ISceneNode* myNode;
irr_core_aabbox3d_f32 box;
irr_video_S3DVertex vertices[] =
{
{ {0, 20, 0}, {0, 1, 1}, {255, 255, 255, 0}, {1, 0} },
{ {-10, 0, -10}, {0, 0, 1}, {255, 0, 255, 0}, {0, 0} }
};
- irr_video_SMaterial material = {false, false};
+ irr_video_SMaterial material = S_MATERIAL_DEFAULT;
+ material.wireframe = false;
+ material.lighting = false;
- irr_core_aabbox3d_reset(box, vertices[0].pos);
+ irr_core_aabbox3d_reset(&box, &vertices[0].pos);
for (int i=1; i<4; i++)
{
- irr_core_aabbox3d_addInternalPoint(box, vertices[i].pos);
+ irr_core_aabbox3d_addInternalPoint(&box, &vertices[i].pos);
}
void customRender()
{
uint16_t indices[] = {0, 2, 3, 2, 1, 3, 1, 0, 3, 2, 0, 1};
- irr_video_setMaterial(driver, material);
+ irr_video_setMaterial(driver, &material);
irr_video_setTransform(driver,
irr_video_ETS_WORLD,
irr_scene_getAbsoluteTransformation(myNode));
if (anim)
{
irr_scene_addAnimator(myNode, anim);
+ irr_drop(anim);
+ anim = NULL;
}
// loop
--- /dev/null
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+ Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+ 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
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __C_IRR_COMPILE_CONFIG_H_INCLUDED__
+#define __C_IRR_COMPILE_CONFIG_H_INCLUDED__
+
+//! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
+#define _IRR_MATERIAL_MAX_TEXTURES_ 4
+
+#endif
--- /dev/null
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+ Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+ 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
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __C_E_MATERIAL_TYPES_H_INCLUDED__
+#define __C_E_MATERIAL_TYPES_H_INCLUDED__
+
+typedef enum
+ {
+ irr_video_EMT_SOLID = 0,
+ irr_video_EMT_SOLID_2_LAYER,
+ irr_video_EMT_LIGHTMAP,
+ irr_video_EMT_LIGHTMAP_ADD,
+ irr_video_EMT_LIGHTMAP_M2,
+ irr_video_EMT_LIGHTMAP_M4,
+ irr_video_EMT_LIGHTMAP_LIGHTING,
+ irr_video_EMT_LIGHTMAP_LIGHTING_M2,
+ irr_video_EMT_LIGHTMAP_LIGHTING_M4,
+ irr_video_EMT_DETAIL_MAP,
+ irr_video_EMT_SPHERE_MAP,
+ irr_video_EMT_REFLECTION_2_LAYER,
+ irr_video_EMT_TRANSPARENT_ADD_COLOR,
+ irr_video_EMT_TRANSPARENT_ALPHA_CHANNEL,
+ irr_video_EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
+ irr_video_EMT_TRANSPARENT_VERTEX_ALPHA,
+ irr_video_EMT_TRANSPARENT_REFLECTION_2_LAYER,
+ irr_video_EMT_NORMAL_MAP_SOLID,
+ irr_video_EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR,
+ irr_video_EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA,
+ irr_video_EMT_PARALLAX_MAP_SOLID,
+ irr_video_EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR,
+ irr_video_EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA,
+ irr_video_EMT_ONETEXTURE_BLEND,
+ irr_video_EMT_FORCE_32BIT = 0x7fffffff
+ } irr_video_E_MATERIAL_TYPE;
+
+#endif
void
irr_video_setMaterial(irr_video_IVideoDriver* driver,
- const irr_video_SMaterial material);
+ irr_video_SMaterial* material);
void
irr_video_setTransform(irr_video_IVideoDriver* driver,
typedef struct
{
- uint32_t a;
- uint32_t r;
- uint32_t g;
- uint32_t b;
+ uint8_t a;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
} irr_video_SColor;
#endif
#ifndef __C_IRR_S_MATERIAL_H_INCLUDED__
#define __C_IRR_S_MATERIAL_H_INCLUDED__
+#include <inttypes.h>
+#include <math.h>
#include <stdbool.h>
+#include "EMaterialTypes.h"
+#include "irrMath.h"
+#include "SColor.h"
+#include "SMaterialLayer.h"
+
+#define MATERIAL_MAX_TEXTURES _IRR_MATERIAL_MAX_TEXTURES_
+
+typedef enum
+ {
+ irr_video_EBO_NONE = 0,
+ irr_video_EBO_ADD,
+ irr_video_EBO_SUBTRACT,
+ irr_video_EBO_REVSUBTRACT,
+ irr_video_EBO_MIN,
+ irr_video_EBO_MAX,
+ irr_video_EBO_MIN_FACTOR,
+ irr_video_EBO_MAX_FACTOR,
+ irr_video_EBO_MIN_ALPHA,
+ irr_video_EBO_MAX_ALPHA
+ } irr_video_E_BLEND_OPERATION;
+
+typedef enum
+ {
+ irr_video_ECFN_NEVER = 0,
+ irr_video_ECFN_LESSEQUAL = 1,
+ irr_video_ECFN_EQUAL = 2,
+ irr_video_ECFN_LESS,
+ irr_video_ECFN_NOTEQUAL,
+ irr_video_ECFN_GREATEREQUAL,
+ irr_video_ECFN_GREATER,
+ irr_video_ECFN_ALWAYS
+ } irr_video_E_COMPARISON_FUNC;
+
+typedef enum
+ {
+ irr_video_ECP_NONE = 0,
+ irr_video_ECP_ALPHA = 1,
+ irr_video_ECP_RED = 2,
+ irr_video_ECP_GREEN = 4,
+ irr_video_ECP_BLUE = 8,
+ irr_video_ECP_RGB = 14,
+ irr_video_ECP_ALL = 15
+ } irr_video_E_COLOR_PLANE;
+
+typedef enum
+ {
+ irr_video_EAAM_OFF = 0,
+ irr_video_EAAM_SIMPLE = 1,
+ irr_video_EAAM_QUALITY = 3,
+ irr_video_EAAM_LINE_SMOOTH = 4,
+ irr_video_EAAM_POINT_SMOOTH = 8,
+ irr_video_EAAM_FULL_BASIC = 15,
+ irr_video_EAAM_ALPHA_TO_COVERAGE = 16
+ } irr_video_E_ANTI_ALIASING_MODE;
+
+typedef enum
+ {
+ irr_video_ECM_NONE = 0,
+ irr_video_ECM_DIFFUSE,
+ irr_video_ECM_AMBIENT,
+ irr_video_ECM_EMISSIVE,
+ irr_video_ECM_SPECULAR,
+ irr_video_ECM_DIFFUSE_AND_AMBIENT
+ } irr_video_E_COLOR_MATERIAL;
+
+typedef enum
+ {
+ irr_video_EPO_BACK = 0,
+ irr_video_EPO_FRONT = 1
+ } irr_video_E_POLYGON_OFFSET;
+
typedef struct
{
- bool wireframe;
- bool lighting;
+ irr_video_SMaterialLayer textureLayer[MATERIAL_MAX_TEXTURES];
+ irr_video_E_MATERIAL_TYPE materialType;
+ irr_video_SColor ambientColor;
+ irr_video_SColor diffuseColor;
+ irr_video_SColor emissiveColor;
+ irr_video_SColor specularColor;
+ float_t shininess;
+ float_t materialTypeParam;
+ float_t materialTypeParam2;
+ float_t thickness;
+ uint8_t zBuffer;
+ uint8_t antiAliasing;
+ uint8_t colorMask:4;
+ uint8_t colorMaterial:3;
+ irr_video_E_BLEND_OPERATION blendOperation:4;
+ uint8_t polygonOffsetFactor:3;
+ irr_video_E_POLYGON_OFFSET polygonOffsetDirection:1;
+ bool wireframe:1;
+ bool pointCloud:1;
+ bool gouraudShading:1;
+ bool lighting:1;
+ bool zWriteEnable:1;
+ bool backfaceCulling:1;
+ bool frontfaceCulling:1;
+ bool fogEnable:1;
+ bool normalizeNormals:1;
+ bool useMipMaps:1;
} irr_video_SMaterial;
+#define S_MATERIAL_DEFAULT \
+{ \
+ .materialType = irr_video_EMT_SOLID, \
+ .ambientColor = {255, 255, 255, 255}, \
+ .diffuseColor = {255, 255, 255, 255}, \
+ .emissiveColor = {0, 0, 0, 0}, \
+ .specularColor = {255, 255, 255, 255}, \
+ .shininess = 0, \
+ .materialTypeParam = 0, \
+ .materialTypeParam2 = 0, \
+ .thickness = 1, \
+ .zBuffer = irr_video_ECFN_LESSEQUAL, \
+ .antiAliasing = irr_video_EAAM_SIMPLE, \
+ .colorMask = irr_video_ECP_ALL, \
+ .colorMaterial = irr_video_ECM_DIFFUSE, \
+ .blendOperation = irr_video_EBO_NONE, \
+ .polygonOffsetFactor = 0, \
+ .polygonOffsetDirection = irr_video_EPO_FRONT, \
+ .wireframe = false, \
+ .pointCloud = false, \
+ .gouraudShading = true, \
+ .lighting = true, \
+ .zWriteEnable = true, \
+ .backfaceCulling = true, \
+ .frontfaceCulling = false, \
+ .fogEnable = false, \
+ .normalizeNormals = false, \
+ .useMipMaps = true \
+}
+
#endif
--- /dev/null
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+ Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+ 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
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __C_IRR_S_MATERIAL_LAYER_H_INCLUDED__
+#define __C_IRR_S_MATERIAL_LAYER_H_INCLUDED__
+
+#include <inttypes.h>
+#include <stdbool.h>
+#include "ITexture.h"
+#include "matrix4.h"
+
+typedef struct
+{
+ irr_video_ITexture* texture;
+ uint8_t textureWrapU;
+ uint8_t textureWrapV;
+ bool bilinearFilter;
+ bool trilinearFilter;
+ uint8_t anisotropicFilter;
+ int8_t LODBias;
+ // private
+ // Do not access to these elements
+ irr_core_matrix4* matrixAllocator;
+ irr_core_matrix4* textureMatrix;
+} irr_video_SMaterialLayer;
+
+#endif
#endif
void
- irr_core_aabbox3d_addInternalPoint(irr_core_aabbox3d_f32 box,
- irr_core_vector3df p);
+ irr_core_aabbox3d_addInternalPoint(irr_core_aabbox3d_f32* box,
+ irr_core_vector3df* p);
void
- irr_core_aabbox3d_reset(irr_core_aabbox3d_f32 box,
- irr_core_vector3df initValue);
+ irr_core_aabbox3d_reset(irr_core_aabbox3d_f32* box,
+ irr_core_vector3df* initValue);
#ifdef __cplusplus
}
#include <stdbool.h>
#include "aabbox3d.h"
+#include "CIrrCompileConfig.h"
#include "dimension2d.h"
#include "EDriverTypes.h"
#include "EMaterialFlags.h"
+#include "EMaterialTypes.h"
#include "EPrimitiveTypes.h"
#include "IAnimatedMeshMD2.h"
#include "IAnimatedMeshSceneNode.h"
#include "IMeshSceneNode.h"
#include "IReferenceCounted.h"
#include "IrrlichtDevice.h"
+#include "irrMath.h"
#include "irrTypes.h"
#include "ISceneManager.h"
#include "ISceneNode.h"
#include "SExposedVideoData.h"
#include "SKeyMap.h"
#include "SMaterial.h"
+#include "SMaterialLayer.h"
#include "SVertexIndex.h"
#include "vector2d.h"
#include "vector3d.h"
--- /dev/null
+/* c-irrlicht --- C bindings for Irrlicht Engine
+
+ Copyright (C) 2019 Javier Sancho <jsf@jsancho.org>
+
+ 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
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __C_IRR_MATH_H_INCLUDED__
+#define __C_IRR_MATH_H_INCLUDED__
+
+// TODO
+
+#endif
bool stencilbuffer,
bool vsync)
{
- irr::core::dimension2d<irr::u32> wsize =
- irr::core::dimension2d<irr::u32>(windowSize->width,
- windowSize->height);
irr::IrrlichtDevice *device =
irr::createDevice((irr::video::E_DRIVER_TYPE)deviceType,
- wsize, bits, fullscreen, stencilbuffer,
- vsync);
+ *(irr::core::dimension2d<irr::u32>*)windowSize,
+ bits, fullscreen, stencilbuffer, vsync);
return (irr_IrrlichtDevice*)device;
}
}
virtual const irr::core::aabbox3d<irr::f32>& getBoundingBox() const
{
- irr_core_aabbox3d_f32* box = GetBoundingBox();
- irr::core::aabbox3d<irr::f32>* irrBox = new irr::core::aabbox3d<irr::f32>();
- return *irrBox;
+ return *(irr::core::aabbox3d<irr::f32>*)GetBoundingBox();
}
virtual irr::u32 getMaterialCount() const
virtual irr::video::SMaterial& getMaterial(irr::u32 i)
{
- irr_video_SMaterial* material = GetMaterial(i);
- irr::video::SMaterial* irrMaterial = new irr::video::SMaterial();
- irrMaterial->Wireframe = material->wireframe;
- irrMaterial->Lighting = material->lighting;
- return *irrMaterial;
+ return *(irr::video::SMaterial*)GetMaterial(i);
}
};
void
irr_video_setMaterial(irr_video_IVideoDriver* driver,
- const irr_video_SMaterial material)
+ irr_video_SMaterial* material)
{
- irr::video::SMaterial irrMaterial = irr::video::SMaterial();
- irrMaterial.Lighting = material.lighting;
- irrMaterial.Wireframe = material.wireframe;
-
- ((irr::video::IVideoDriver*)driver)->setMaterial(irrMaterial);
+ ((irr::video::IVideoDriver*)driver)->setMaterial(*(irr::video::SMaterial*)material);
}
void
<http://www.gnu.org/licenses/>.
*/
+#include <irrlicht/irrlicht.h>
#include "aabbox3d.h"
extern "C" {
void
- irr_core_aabbox3d_addInternalPoint(irr_core_aabbox3d_f32 box,
- irr_core_vector3df p)
+ irr_core_aabbox3d_addInternalPoint(irr_core_aabbox3d_f32* box,
+ irr_core_vector3df* p)
{
- if (p.x > box.maxEdge.x) box.maxEdge.x = p.x;
- if (p.y > box.maxEdge.y) box.maxEdge.y = p.y;
- if (p.z > box.maxEdge.z) box.maxEdge.z = p.z;
-
- if (p.x < box.minEdge.x) box.minEdge.x = p.x;
- if (p.y < box.minEdge.y) box.minEdge.y = p.y;
- if (p.z < box.minEdge.z) box.minEdge.z = p.z;
+ ((irr::core::aabbox3d<irr::f32>*)box)
+ ->addInternalPoint(*(irr::core::vector3df*)p);
}
void
- irr_core_aabbox3d_reset(irr_core_aabbox3d_f32 box,
- irr_core_vector3df initValue)
+ irr_core_aabbox3d_reset(irr_core_aabbox3d_f32* box,
+ irr_core_vector3df* initValue)
{
- box.minEdge = initValue;
- box.maxEdge = initValue;
+ ((irr::core::aabbox3d<irr::f32>*)box)
+ ->reset(*(irr::core::vector3df*)initValue);
}
}