├── .editorconfig ├── .github └── workflows │ └── build.yml ├── .gitignore ├── CMakeLists.txt ├── Config.cmake.in ├── LICENSE ├── README.md ├── cmake └── FindOpenGLES2.cmake ├── examples ├── AutomatedTest │ ├── main.cpp │ ├── test_array.cpp │ ├── test_helper.h │ └── test_string.cpp └── CMakeLists.txt ├── include ├── CMeshBuffer.h ├── EAttributes.h ├── ECullingTypes.h ├── EDebugSceneTypes.h ├── EDeviceTypes.h ├── EDriverFeatures.h ├── EDriverTypes.h ├── EFocusFlags.h ├── EGUIAlignment.h ├── EGUIElementTypes.h ├── EHardwareBufferFlags.h ├── EMaterialProps.h ├── EMaterialTypes.h ├── EPrimitiveTypes.h ├── EReadFileType.h ├── ESceneNodeTypes.h ├── EShaderTypes.h ├── EVertexAttributes.h ├── IAnimatedMesh.h ├── IAnimatedMeshSceneNode.h ├── IAttributes.h ├── IBillboardSceneNode.h ├── IBoneSceneNode.h ├── ICameraSceneNode.h ├── IContextManager.h ├── ICursorControl.h ├── IDummyTransformationSceneNode.h ├── IEventReceiver.h ├── IFileArchive.h ├── IFileList.h ├── IFileSystem.h ├── IGPUProgrammingServices.h ├── IGUIButton.h ├── IGUICheckBox.h ├── IGUIComboBox.h ├── IGUIEditBox.h ├── IGUIElement.h ├── IGUIEnvironment.h ├── IGUIFileOpenDialog.h ├── IGUIFont.h ├── IGUIFontBitmap.h ├── IGUIImage.h ├── IGUIImageList.h ├── IGUIListBox.h ├── IGUIScrollBar.h ├── IGUISkin.h ├── IGUISpriteBank.h ├── IGUIStaticText.h ├── IGUITabControl.h ├── IGUIToolbar.h ├── IImage.h ├── IImageLoader.h ├── IImageWriter.h ├── IIndexBuffer.h ├── ILogger.h ├── IMaterialRenderer.h ├── IMaterialRendererServices.h ├── IMemoryReadFile.h ├── IMesh.h ├── IMeshBuffer.h ├── IMeshCache.h ├── IMeshLoader.h ├── IMeshManipulator.h ├── IMeshSceneNode.h ├── IOSOperator.h ├── IReadFile.h ├── IReferenceCounted.h ├── IRenderTarget.h ├── ISceneCollisionManager.h ├── ISceneManager.h ├── ISceneNode.h ├── IShaderConstantSetCallBack.h ├── ISkinnedMesh.h ├── ITexture.h ├── ITimer.h ├── IVertexBuffer.h ├── IVideoDriver.h ├── IWriteFile.h ├── IrrCompileConfig.h ├── IrrlichtDevice.h ├── Keycodes.h ├── S3DVertex.h ├── SAnimatedMesh.h ├── SColor.h ├── SExposedVideoData.h ├── SIrrCreationParameters.h ├── SMaterial.h ├── SMaterialLayer.h ├── SMesh.h ├── SMeshBuffer.h ├── SOverrideMaterial.h ├── SSkinMeshBuffer.h ├── SVertexIndex.h ├── SVertexManipulator.h ├── SViewFrustum.h ├── SceneParameters.h ├── aabbox3d.h ├── coreutil.h ├── dimension2d.h ├── exampleHelper.h ├── fast_atof.h ├── irrArray.h ├── irrMath.h ├── irrString.h ├── irrTypes.h ├── irrlicht.h ├── irrpack.h ├── irrunpack.h ├── line2d.h ├── line3d.h ├── matrix4.h ├── mt_opengl.h ├── path.h ├── plane3d.h ├── position2d.h ├── quaternion.h ├── rect.h ├── vector2d.h └── vector3d.h ├── media ├── Shaders │ ├── OneTextureBlend.fsh │ ├── Renderer2D.fsh │ ├── Renderer2D.vsh │ ├── Renderer2D_noTex.fsh │ ├── Solid.fsh │ ├── Solid.vsh │ ├── TransparentAlphaChannel.fsh │ ├── TransparentAlphaChannelRef.fsh │ └── TransparentVertexAlpha.fsh ├── coolguy_opt.x └── cooltexture.png ├── scripts ├── BindingGenerator.lua ├── ci-build-android.sh ├── ci-build-mingw.sh ├── ci-get-mingw.sh └── sha256sums.txt ├── src ├── Android │ ├── CAndroidAssetFileArchive.cpp │ ├── CAndroidAssetFileArchive.h │ ├── CAndroidAssetReader.cpp │ ├── CAndroidAssetReader.h │ ├── CIrrDeviceAndroid.cpp │ ├── CIrrDeviceAndroid.h │ ├── CKeyEventWrapper.cpp │ └── CKeyEventWrapper.h ├── BuiltInFont.h ├── CAnimatedMeshSceneNode.cpp ├── CAnimatedMeshSceneNode.h ├── CAttributeImpl.h ├── CAttributes.cpp ├── CAttributes.h ├── CB3DMeshFileLoader.cpp ├── CB3DMeshFileLoader.h ├── CBillboardSceneNode.cpp ├── CBillboardSceneNode.h ├── CBlit.h ├── CBoneSceneNode.cpp ├── CBoneSceneNode.h ├── CCameraSceneNode.cpp ├── CCameraSceneNode.h ├── CColorConverter.cpp ├── CColorConverter.h ├── CDummyTransformationSceneNode.cpp ├── CDummyTransformationSceneNode.h ├── CEGLManager.cpp ├── CEGLManager.h ├── CEmptySceneNode.cpp ├── CEmptySceneNode.h ├── CFPSCounter.cpp ├── CFPSCounter.h ├── CFileList.cpp ├── CFileList.h ├── CFileSystem.cpp ├── CFileSystem.h ├── CGLXManager.cpp ├── CGLXManager.h ├── CGUIButton.cpp ├── CGUIButton.h ├── CGUICheckBox.cpp ├── CGUICheckBox.h ├── CGUIComboBox.cpp ├── CGUIComboBox.h ├── CGUIEditBox.cpp ├── CGUIEditBox.h ├── CGUIEnvironment.cpp ├── CGUIEnvironment.h ├── CGUIFileOpenDialog.cpp ├── CGUIFileOpenDialog.h ├── CGUIFont.cpp ├── CGUIFont.h ├── CGUIImage.cpp ├── CGUIImage.h ├── CGUIImageList.cpp ├── CGUIImageList.h ├── CGUIListBox.cpp ├── CGUIListBox.h ├── CGUIScrollBar.cpp ├── CGUIScrollBar.h ├── CGUISkin.cpp ├── CGUISkin.h ├── CGUISpriteBank.cpp ├── CGUISpriteBank.h ├── CGUIStaticText.cpp ├── CGUIStaticText.h ├── CGUITabControl.cpp ├── CGUITabControl.h ├── CImage.cpp ├── CImage.h ├── CImageLoaderBMP.cpp ├── CImageLoaderBMP.h ├── CImageLoaderJPG.cpp ├── CImageLoaderJPG.h ├── CImageLoaderPNG.cpp ├── CImageLoaderPNG.h ├── CImageLoaderTGA.cpp ├── CImageLoaderTGA.h ├── CImageWriterJPG.cpp ├── CImageWriterJPG.h ├── CImageWriterPNG.cpp ├── CImageWriterPNG.h ├── CIrrDeviceLinux.cpp ├── CIrrDeviceLinux.h ├── CIrrDeviceOSX.h ├── CIrrDeviceOSX.mm ├── CIrrDeviceSDL.cpp ├── CIrrDeviceSDL.h ├── CIrrDeviceStub.cpp ├── CIrrDeviceStub.h ├── CIrrDeviceWin32.cpp ├── CIrrDeviceWin32.h ├── CLimitReadFile.cpp ├── CLimitReadFile.h ├── CLogger.cpp ├── CLogger.h ├── CMakeLists.txt ├── CMemoryFile.cpp ├── CMemoryFile.h ├── CMeshCache.cpp ├── CMeshCache.h ├── CMeshManipulator.cpp ├── CMeshManipulator.h ├── CMeshSceneNode.cpp ├── CMeshSceneNode.h ├── CNSOGLManager.h ├── CNSOGLManager.mm ├── CNullDriver.cpp ├── CNullDriver.h ├── COBJMeshFileLoader.cpp ├── COBJMeshFileLoader.h ├── COGLESCommon.h ├── COGLESCoreExtensionHandler.h ├── COGLESDriver.cpp ├── COGLESDriver.h ├── COGLESExtensionHandler.cpp ├── COGLESExtensionHandler.h ├── COGLESMaterialRenderer.h ├── COSOperator.cpp ├── COSOperator.h ├── COpenGLCacheHandler.cpp ├── COpenGLCacheHandler.h ├── COpenGLCommon.h ├── COpenGLCoreCacheHandler.h ├── COpenGLCoreFeature.h ├── COpenGLCoreRenderTarget.h ├── COpenGLCoreTexture.h ├── COpenGLDriver.cpp ├── COpenGLDriver.h ├── COpenGLExtensionHandler.cpp ├── COpenGLExtensionHandler.h ├── COpenGLMaterialRenderer.h ├── COpenGLSLMaterialRenderer.cpp ├── COpenGLSLMaterialRenderer.h ├── CReadFile.cpp ├── CReadFile.h ├── CSDLManager.cpp ├── CSDLManager.h ├── CSceneCollisionManager.cpp ├── CSceneCollisionManager.h ├── CSceneManager.cpp ├── CSceneManager.h ├── CSkinnedMesh.cpp ├── CSkinnedMesh.h ├── CTimer.h ├── CWGLManager.cpp ├── CWGLManager.h ├── CWriteFile.cpp ├── CWriteFile.h ├── CXMeshFileLoader.cpp ├── CXMeshFileLoader.h ├── CZipReader.cpp ├── CZipReader.h ├── IAttribute.h ├── Irrlicht.cpp ├── KHR │ └── khrplatform.h ├── OpenGL │ ├── Common.h │ ├── Driver.cpp │ ├── Driver.h │ ├── ExtensionHandler.cpp │ ├── ExtensionHandler.h │ ├── FixedPipelineRenderer.cpp │ ├── FixedPipelineRenderer.h │ ├── MaterialRenderer.cpp │ ├── MaterialRenderer.h │ ├── Renderer2D.cpp │ └── Renderer2D.h ├── OpenGL3 │ ├── Driver.cpp │ └── Driver.h ├── OpenGLES2 │ ├── Driver.cpp │ └── Driver.h ├── SB3DStructs.h ├── SoftwareDriver2_helper.h ├── builtInFont.png ├── mt_opengl_loader.cpp ├── os.cpp ├── os.h └── vendor │ ├── gl.h │ └── glext.h └── test ├── CMakeLists.txt ├── data ├── sample_16bpp_v3.bmp ├── sample_16bpp_v7.bmp ├── sample_24bpp.png ├── sample_24bpp_down.tga ├── sample_24bpp_rle_down.tga ├── sample_24bpp_rle_up.tga ├── sample_24bpp_up.tga ├── sample_24bpp_v3.bmp ├── sample_24bpp_v7.bmp ├── sample_4bpp_v3.bmp ├── sample_8bpp.png ├── sample_8bpp_down.tga ├── sample_8bpp_rle_down.tga ├── sample_8bpp_rle_up.tga ├── sample_8bpp_up.tga ├── sample_8bpp_v3.bmp ├── sample_8bpp_v3_rle.bmp ├── sample_8bpp_v7.bmp └── sample_8bpp_v7_rle.bmp └── image_loader_test.cpp /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | 6 | [*.{cpp,h,txt,cmake,fsh,vsh}] 7 | indent_size = 4 8 | indent_style = tab 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeFiles 2 | CMakeCache.txt 3 | cmake_install.cmake 4 | install_manifest.txt 5 | IrrlichtMtConfig.cmake 6 | IrrlichtMtConfigVersion.cmake 7 | IrrlichtMtTargets.cmake 8 | CTestTestfile.cmake 9 | Makefile 10 | libs/* 11 | *.so* 12 | *.a 13 | *.exe 14 | *.dll 15 | bin/Linux 16 | scripts/gl2ext.h 17 | scripts/glcorearb.h 18 | scripts/glext.h 19 | *.vcxproj* 20 | *.dir/ 21 | *.sln 22 | *visualstudio/ 23 | 24 | # vscode cmake plugin 25 | build/* 26 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | 3 | set(IRRLICHTMT_REVISION 15) 4 | 5 | project(Irrlicht 6 | VERSION 1.9.0.${IRRLICHTMT_REVISION} 7 | LANGUAGES CXX 8 | ) 9 | 10 | message(STATUS "*** Building IrrlichtMt ${PROJECT_VERSION} ***") 11 | 12 | set(CMAKE_CXX_STANDARD 17) 13 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 14 | 15 | include(GNUInstallDirs) 16 | 17 | if(ANDROID) 18 | set(sysname Android) 19 | elseif(APPLE) 20 | set(sysname OSX) 21 | elseif(MSVC) 22 | set(sysname Win32-VisualStudio) 23 | elseif(WIN32) 24 | set(sysname Win32-gcc) 25 | else() 26 | set(sysname Linux) 27 | endif() 28 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/${sysname}) 29 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) 30 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/${sysname}) 31 | 32 | if(NOT CMAKE_BUILD_TYPE) 33 | set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE) 34 | endif() 35 | 36 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 37 | enable_testing() 38 | add_subdirectory(src) 39 | add_subdirectory(test) 40 | 41 | option(BUILD_EXAMPLES "Build example applications" FALSE) 42 | if(BUILD_EXAMPLES) 43 | add_subdirectory(examples) 44 | endif() 45 | 46 | # Export a file that describes the targets that IrrlichtMt creates. 47 | # The file is placed in the location FILE points to, where CMake can easily 48 | # locate it by pointing CMAKE_PREFIX_PATH to this project root. 49 | export(EXPORT IrrlichtMt-export 50 | FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtTargets.cmake" 51 | NAMESPACE IrrlichtMt:: 52 | ) 53 | 54 | # Installation of headers. 55 | install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" 56 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrlichtmt" 57 | ) 58 | 59 | # Installation of CMake target and configuration files. 60 | install(EXPORT IrrlichtMt-export 61 | FILE IrrlichtMtTargets.cmake 62 | NAMESPACE IrrlichtMt:: 63 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt" 64 | ) 65 | 66 | include(CMakePackageConfigHelpers) 67 | configure_package_config_file("${PROJECT_SOURCE_DIR}/Config.cmake.in" 68 | "${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfig.cmake" 69 | INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt" 70 | NO_SET_AND_CHECK_MACRO 71 | NO_CHECK_REQUIRED_COMPONENTS_MACRO 72 | ) 73 | write_basic_package_version_file( 74 | "${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfigVersion.cmake" 75 | COMPATIBILITY AnyNewerVersion 76 | ) 77 | 78 | install(FILES 79 | "${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfig.cmake" 80 | "${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfigVersion.cmake" 81 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt" 82 | ) 83 | -------------------------------------------------------------------------------- /Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include(CMakeFindDependencyMacro) 4 | 5 | if(NOT TARGET IrrlichtMt::IrrlichtMt) 6 | # private dependency only explicitly needed with static libs 7 | if(@USE_SDL2@ AND NOT @BUILD_SHARED_LIBS@) 8 | find_dependency(SDL2) 9 | endif() 10 | include("${CMAKE_CURRENT_LIST_DIR}/IrrlichtMtTargets.cmake") 11 | endif() 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | Please note that the Irrlicht Engine is based in part on the work of the 20 | Independent JPEG Group, the zlib, libPng and aesGladman. This means that if you use 21 | the Irrlicht Engine in your product, you must acknowledge somewhere in your 22 | documentation that you've used the IJPG code. It would also be nice to mention 23 | that you use the Irrlicht Engine, the zlib, libPng and aesGladman. See the 24 | corresponding license files for further informations. It is also possible to disable 25 | usage of those additional libraries by defines in the IrrCompileConfig.h header and 26 | recompiling the engine. 27 | -------------------------------------------------------------------------------- /cmake/FindOpenGLES2.cmake: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------- 2 | # The contents of this file are placed in the public domain. Feel 3 | # free to make use of it in any way you like. 4 | #------------------------------------------------------------------- 5 | 6 | # Try to find OpenGL ES 2 and EGL 7 | 8 | if(WIN32) 9 | find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h) 10 | find_library(OPENGLES2_LIBRARY libGLESv2) 11 | elseif(APPLE) 12 | find_library(OPENGLES2_LIBRARY OpenGLES REQUIRED) # framework 13 | else() 14 | # Unix 15 | find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h 16 | PATHS /usr/X11R6/include /usr/include 17 | ) 18 | find_library(OPENGLES2_LIBRARY 19 | NAMES GLESv2 20 | PATHS /usr/X11R6/lib /usr/lib 21 | ) 22 | 23 | include(FindPackageHandleStandardArgs) 24 | find_package_handle_standard_args(OpenGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR) 25 | 26 | find_path(EGL_INCLUDE_DIR EGL/egl.h 27 | PATHS /usr/X11R6/include /usr/include 28 | ) 29 | find_library(EGL_LIBRARY 30 | NAMES EGL 31 | PATHS /usr/X11R6/lib /usr/lib 32 | ) 33 | 34 | include(FindPackageHandleStandardArgs) 35 | find_package_handle_standard_args(EGL REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR NAME_MISMATCHED) 36 | endif() 37 | 38 | set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${EGL_LIBRARY}) 39 | -------------------------------------------------------------------------------- /examples/AutomatedTest/test_helper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class TestFailedException : public std::exception 7 | { 8 | }; 9 | 10 | // Asserts the comparison specified by CMP is true, or fails the current unit test 11 | #define UASSERTCMP(CMP, actual, expected) \ 12 | do { \ 13 | const auto &a = (actual); \ 14 | const auto &e = (expected); \ 15 | if (!CMP(a, e)) { \ 16 | std::cout \ 17 | << "Test assertion failed: " << #actual << " " << #CMP << " " \ 18 | << #expected << std::endl \ 19 | << " at " << __FILE__ << ":" << __LINE__ << std::endl \ 20 | << " actual: " << a << std::endl \ 21 | << " expected: " \ 22 | << e << std::endl; \ 23 | throw TestFailedException(); \ 24 | } \ 25 | } while (0) 26 | 27 | #define CMPEQ(a, e) (a == e) 28 | #define CMPTRUE(a, e) (a) 29 | #define CMPNE(a, e) (a != e) 30 | 31 | #define UASSERTEQ(actual, expected) UASSERTCMP(CMPEQ, actual, expected) 32 | #define UASSERTNE(actual, nexpected) UASSERTCMP(CMPNE, actual, nexpected) 33 | #define UASSERT(actual) UASSERTCMP(CMPTRUE, actual, true) 34 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(IRREXAMPLES 2 | # removed 3 | ) 4 | if(UNIX) 5 | list(APPEND IRREXAMPLES AutomatedTest) 6 | endif() 7 | 8 | foreach(exname IN ITEMS ${IRREXAMPLES}) 9 | file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/${exname}/*.cpp") 10 | add_executable(${exname} ${sources}) 11 | 12 | target_include_directories(${exname} PRIVATE 13 | ${CMAKE_SOURCE_DIR}/include 14 | ${CMAKE_CURRENT_SOURCE_DIR}/${exname} 15 | ) 16 | target_link_libraries(${exname} IrrlichtMt) 17 | endforeach() 18 | -------------------------------------------------------------------------------- /include/EAttributes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | namespace irr 8 | { 9 | namespace io 10 | { 11 | 12 | //! Types of attributes available for IAttributes 13 | enum E_ATTRIBUTE_TYPE 14 | { 15 | // integer attribute 16 | EAT_INT = 0, 17 | 18 | // float attribute 19 | EAT_FLOAT, 20 | 21 | // boolean attribute 22 | EAT_BOOL, 23 | 24 | // known attribute type count 25 | EAT_COUNT, 26 | 27 | // unknown attribute 28 | EAT_UNKNOWN 29 | }; 30 | 31 | } // end namespace io 32 | } // end namespace irr 33 | -------------------------------------------------------------------------------- /include/ECullingTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | //! An enumeration for all types of automatic culling for built-in scene nodes 15 | enum E_CULLING_TYPE 16 | { 17 | EAC_OFF = 0, 18 | EAC_BOX = 1, 19 | EAC_FRUSTUM_BOX = 2, 20 | EAC_FRUSTUM_SPHERE = 4, 21 | EAC_OCC_QUERY = 8 22 | }; 23 | 24 | //! Names for culling type 25 | const c8 *const AutomaticCullingNames[] = { 26 | "false", 27 | "box", // camera box against node box 28 | "frustum_box", // camera frustum against node box 29 | "frustum_sphere", // camera frustum against node sphere 30 | "occ_query", // occlusion query 31 | 0, 32 | }; 33 | 34 | } // end namespace scene 35 | } // end namespace irr 36 | -------------------------------------------------------------------------------- /include/EDebugSceneTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | namespace irr 8 | { 9 | namespace scene 10 | { 11 | 12 | //! An enumeration for all types of debug data for built-in scene nodes (flags) 13 | enum E_DEBUG_SCENE_TYPE 14 | { 15 | //! No Debug Data ( Default ) 16 | EDS_OFF = 0, 17 | 18 | //! Show Bounding Boxes of SceneNode 19 | EDS_BBOX = 1, 20 | 21 | //! Show Vertex Normals 22 | EDS_NORMALS = 2, 23 | 24 | //! Shows Skeleton/Tags 25 | EDS_SKELETON = 4, 26 | 27 | //! Overlays Mesh Wireframe 28 | EDS_MESH_WIRE_OVERLAY = 8, 29 | 30 | //! Show Bounding Boxes of all MeshBuffers 31 | EDS_BBOX_BUFFERS = 32, 32 | 33 | //! EDS_BBOX | EDS_BBOX_BUFFERS 34 | EDS_BBOX_ALL = EDS_BBOX | EDS_BBOX_BUFFERS, 35 | 36 | //! Show all debug infos 37 | EDS_FULL = 0xffffffff 38 | }; 39 | 40 | } // end namespace scene 41 | } // end namespace irr 42 | -------------------------------------------------------------------------------- /include/EDeviceTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | namespace irr 8 | { 9 | 10 | //! An enum for the different device types supported by the Irrlicht Engine. 11 | enum E_DEVICE_TYPE 12 | { 13 | 14 | //! A device native to Microsoft Windows 15 | /** This device uses the Win32 API and works in all versions of Windows. */ 16 | EIDT_WIN32, 17 | 18 | //! A device native to Unix style operating systems. 19 | /** This device uses the X11 windowing system and works in Linux, Solaris, FreeBSD, OSX and 20 | other operating systems which support X11. */ 21 | EIDT_X11, 22 | 23 | //! A device native to Mac OSX 24 | /** This device uses Apple's Cocoa API and works in Mac OSX 10.2 and above. */ 25 | EIDT_OSX, 26 | 27 | //! A device which uses Simple DirectMedia Layer 28 | /** The SDL device works under all platforms supported by SDL but first must be compiled 29 | in by setting the USE_SDL2 CMake option to ON */ 30 | EIDT_SDL, 31 | 32 | //! This selection allows Irrlicht to choose the best device from the ones available. 33 | /** If this selection is chosen then Irrlicht will try to use the IrrlichtDevice native 34 | to your operating system. If this is unavailable then the X11, SDL and then console device 35 | will be tried. This ensures that Irrlicht will run even if your platform is unsupported, 36 | although it may not be able to render anything. */ 37 | EIDT_BEST, 38 | 39 | //! A device for Android platforms 40 | /** Best used with embedded devices and mobile systems. 41 | Does not need X11 or other graphical subsystems. 42 | May support hw-acceleration via OpenGL-ES */ 43 | EIDT_ANDROID, 44 | }; 45 | 46 | } // end namespace irr 47 | -------------------------------------------------------------------------------- /include/EDriverTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | //! An enum for all types of drivers the Irrlicht Engine supports. 15 | enum E_DRIVER_TYPE 16 | { 17 | //! Null driver, useful for applications to run the engine without visualization. 18 | /** The null device is able to load textures, but does not 19 | render and display any graphics. */ 20 | EDT_NULL, 21 | 22 | //! OpenGL device, available on most platforms. 23 | /** Performs hardware accelerated rendering of 3D and 2D 24 | primitives. */ 25 | EDT_OPENGL, 26 | 27 | //! OpenGL-ES 1.x driver, for embedded and mobile systems 28 | EDT_OGLES1, 29 | 30 | //! OpenGL-ES 2.x driver, for embedded and mobile systems 31 | /** Supports shaders etc. */ 32 | EDT_OGLES2, 33 | 34 | //! WebGL1 friendly subset of OpenGL-ES 2.x driver for Emscripten 35 | EDT_WEBGL1, 36 | 37 | EDT_OPENGL3, 38 | 39 | //! No driver, just for counting the elements 40 | EDT_COUNT 41 | }; 42 | 43 | } // end namespace video 44 | } // end namespace irr 45 | -------------------------------------------------------------------------------- /include/EFocusFlags.h: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // For conditions of distribution and use, see copyright notice in irrlicht.h 3 | 4 | #pragma once 5 | 6 | namespace irr 7 | { 8 | namespace gui 9 | { 10 | 11 | //! Bitflags for defining the the focus behavior of the gui 12 | // (all names start with SET as we might add REMOVE flags later to control that behavior as well) 13 | enum EFOCUS_FLAG 14 | { 15 | //! When set the focus changes when the left mouse-button got clicked while over an element 16 | EFF_SET_ON_LMOUSE_DOWN = 0x1, 17 | 18 | //! When set the focus changes when the right mouse-button got clicked while over an element 19 | //! Note that elements usually don't care about right-click and that won't change with this flag 20 | //! This is mostly to allow taking away focus from elements with right-mouse additionally. 21 | EFF_SET_ON_RMOUSE_DOWN = 0x2, 22 | 23 | //! When set the focus changes when the mouse-cursor is over an element 24 | EFF_SET_ON_MOUSE_OVER = 0x4, 25 | 26 | //! When set the focus can be changed with TAB-key combinations. 27 | EFF_SET_ON_TAB = 0x8, 28 | 29 | //! When set it's possible to set the focus to disabled elements. 30 | EFF_CAN_FOCUS_DISABLED = 0x16 31 | }; 32 | 33 | } // namespace gui 34 | } // namespace irr 35 | -------------------------------------------------------------------------------- /include/EGUIAlignment.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace gui 12 | { 13 | enum EGUI_ALIGNMENT 14 | { 15 | //! Aligned to parent's top or left side (default) 16 | EGUIA_UPPERLEFT = 0, 17 | //! Aligned to parent's bottom or right side 18 | EGUIA_LOWERRIGHT, 19 | //! Aligned to the center of parent 20 | EGUIA_CENTER, 21 | //! Stretched to fit parent 22 | EGUIA_SCALE 23 | }; 24 | 25 | //! Names for alignments 26 | const c8 *const GUIAlignmentNames[] = { 27 | "upperLeft", 28 | "lowerRight", 29 | "center", 30 | "scale", 31 | 0, 32 | }; 33 | 34 | } // namespace gui 35 | } // namespace irr 36 | -------------------------------------------------------------------------------- /include/EHardwareBufferFlags.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | namespace irr 8 | { 9 | namespace scene 10 | { 11 | 12 | enum E_HARDWARE_MAPPING 13 | { 14 | //! Don't store on the hardware 15 | EHM_NEVER = 0, 16 | 17 | //! Rarely changed, usually stored completely on the hardware 18 | EHM_STATIC, 19 | 20 | //! Sometimes changed, driver optimized placement 21 | EHM_DYNAMIC, 22 | 23 | //! Always changed, cache optimizing on the GPU 24 | EHM_STREAM 25 | }; 26 | 27 | enum E_BUFFER_TYPE 28 | { 29 | //! Does not change anything 30 | EBT_NONE = 0, 31 | //! Change the vertex mapping 32 | EBT_VERTEX, 33 | //! Change the index mapping 34 | EBT_INDEX, 35 | //! Change both vertex and index mapping to the same value 36 | EBT_VERTEX_AND_INDEX 37 | }; 38 | 39 | } // end namespace scene 40 | } // end namespace irr 41 | -------------------------------------------------------------------------------- /include/EMaterialProps.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | namespace irr 8 | { 9 | namespace video 10 | { 11 | 12 | //! Material properties 13 | enum E_MATERIAL_PROP 14 | { 15 | //! Corresponds to SMaterial::Wireframe. 16 | EMP_WIREFRAME = 0x1, 17 | 18 | //! Corresponds to SMaterial::PointCloud. 19 | EMP_POINTCLOUD = 0x2, 20 | 21 | //! Corresponds to SMaterial::GouraudShading. 22 | EMP_GOURAUD_SHADING = 0x4, 23 | 24 | //! Corresponds to SMaterial::Lighting. 25 | EMP_LIGHTING = 0x8, 26 | 27 | //! Corresponds to SMaterial::ZBuffer. 28 | EMP_ZBUFFER = 0x10, 29 | 30 | //! Corresponds to SMaterial::ZWriteEnable. 31 | EMP_ZWRITE_ENABLE = 0x20, 32 | 33 | //! Corresponds to SMaterial::BackfaceCulling. 34 | EMP_BACK_FACE_CULLING = 0x40, 35 | 36 | //! Corresponds to SMaterial::FrontfaceCulling. 37 | EMP_FRONT_FACE_CULLING = 0x80, 38 | 39 | //! Corresponds to SMaterialLayer::MinFilter. 40 | EMP_MIN_FILTER = 0x100, 41 | 42 | //! Corresponds to SMaterialLayer::MagFilter. 43 | EMP_MAG_FILTER = 0x200, 44 | 45 | //! Corresponds to SMaterialLayer::AnisotropicFilter. 46 | EMP_ANISOTROPIC_FILTER = 0x400, 47 | 48 | //! Corresponds to SMaterial::FogEnable. 49 | EMP_FOG_ENABLE = 0x800, 50 | 51 | //! Corresponds to SMaterial::NormalizeNormals. 52 | EMP_NORMALIZE_NORMALS = 0x1000, 53 | 54 | //! Corresponds to SMaterialLayer::TextureWrapU, TextureWrapV and 55 | //! TextureWrapW. 56 | EMP_TEXTURE_WRAP = 0x2000, 57 | 58 | //! Corresponds to SMaterial::AntiAliasing. 59 | EMP_ANTI_ALIASING = 0x4000, 60 | 61 | //! Corresponds to SMaterial::ColorMask. 62 | EMP_COLOR_MASK = 0x8000, 63 | 64 | //! Corresponds to SMaterial::ColorMaterial. 65 | EMP_COLOR_MATERIAL = 0x10000, 66 | 67 | //! Corresponds to SMaterial::UseMipMaps. 68 | EMP_USE_MIP_MAPS = 0x20000, 69 | 70 | //! Corresponds to SMaterial::BlendOperation. 71 | EMP_BLEND_OPERATION = 0x40000, 72 | 73 | //! Corresponds to SMaterial::PolygonOffsetFactor, PolygonOffsetDirection, 74 | //! PolygonOffsetDepthBias and PolygonOffsetSlopeScale. 75 | EMP_POLYGON_OFFSET = 0x80000, 76 | 77 | //! Corresponds to SMaterial::BlendFactor. 78 | EMP_BLEND_FACTOR = 0x100000, 79 | }; 80 | 81 | } // end namespace video 82 | } // end namespace irr 83 | -------------------------------------------------------------------------------- /include/EMaterialTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | //! Abstracted and easy to use fixed function/programmable pipeline material modes. 15 | enum E_MATERIAL_TYPE 16 | { 17 | //! Standard solid material. 18 | /** Only first texture is used, which is supposed to be the 19 | diffuse material. */ 20 | EMT_SOLID = 0, 21 | 22 | //! Makes the material transparent based on the texture alpha channel. 23 | /** The final color is blended together from the destination 24 | color and the texture color, using the alpha channel value as 25 | blend factor. Only first texture is used. If you are using 26 | this material with small textures, it is a good idea to load 27 | the texture in 32 bit mode 28 | (video::IVideoDriver::setTextureCreationFlag()). Also, an alpha 29 | ref is used, which can be manipulated using 30 | SMaterial::MaterialTypeParam. This value controls how sharp the 31 | edges become when going from a transparent to a solid spot on 32 | the texture. */ 33 | EMT_TRANSPARENT_ALPHA_CHANNEL, 34 | 35 | //! Makes the material transparent based on the texture alpha channel. 36 | /** If the alpha channel value is greater than 127, a 37 | pixel is written to the target, otherwise not. This 38 | material does not use alpha blending and is a lot faster 39 | than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing 40 | stuff like leaves of plants, because the borders are not 41 | blurry but sharp. Only first texture is used. If you are 42 | using this material with small textures and 3d object, it 43 | is a good idea to load the texture in 32 bit mode 44 | (video::IVideoDriver::setTextureCreationFlag()). */ 45 | EMT_TRANSPARENT_ALPHA_CHANNEL_REF, 46 | 47 | //! Makes the material transparent based on the vertex alpha value. 48 | EMT_TRANSPARENT_VERTEX_ALPHA, 49 | 50 | //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) 51 | /** Using only first texture. Generic blending method. 52 | The blend function is set to SMaterial::MaterialTypeParam with 53 | pack_textureBlendFunc (for 2D) or pack_textureBlendFuncSeparate (for 3D). */ 54 | EMT_ONETEXTURE_BLEND, 55 | 56 | //! This value is not used. It only forces this enumeration to compile to 32 bit. 57 | EMT_FORCE_32BIT = 0x7fffffff 58 | }; 59 | 60 | //! Array holding the built in material type names 61 | const char *const sBuiltInMaterialTypeNames[] = { 62 | "solid", 63 | "trans_alphach", 64 | "trans_alphach_ref", 65 | "trans_vertex_alpha", 66 | "onetexture_blend", 67 | 0, 68 | }; 69 | 70 | constexpr u32 numBuiltInMaterials = 71 | sizeof(sBuiltInMaterialTypeNames) / sizeof(char *) - 1; 72 | 73 | } // end namespace video 74 | } // end namespace irr 75 | -------------------------------------------------------------------------------- /include/EPrimitiveTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | namespace irr 8 | { 9 | namespace scene 10 | { 11 | 12 | //! Enumeration for all primitive types there are. 13 | enum E_PRIMITIVE_TYPE 14 | { 15 | //! All vertices are non-connected points. 16 | EPT_POINTS = 0, 17 | 18 | //! All vertices form a single connected line. 19 | EPT_LINE_STRIP, 20 | 21 | //! Just as LINE_STRIP, but the last and the first vertex is also connected. 22 | EPT_LINE_LOOP, 23 | 24 | //! Every two vertices are connected creating n/2 lines. 25 | EPT_LINES, 26 | 27 | //! After the first two vertices each vertex defines a new triangle. 28 | //! Always the two last and the new one form a new triangle. 29 | EPT_TRIANGLE_STRIP, 30 | 31 | //! After the first two vertices each vertex defines a new triangle. 32 | //! All around the common first vertex. 33 | EPT_TRIANGLE_FAN, 34 | 35 | //! Explicitly set all vertices for each triangle. 36 | EPT_TRIANGLES, 37 | 38 | //! The single vertices are expanded to quad billboards on the GPU. 39 | EPT_POINT_SPRITES 40 | }; 41 | 42 | } // end namespace scene 43 | } // end namespace irr 44 | -------------------------------------------------------------------------------- /include/EReadFileType.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) Michael Zeilfelder 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace io 12 | { 13 | 14 | //! An enumeration for different class types implementing IReadFile 15 | enum EREAD_FILE_TYPE 16 | { 17 | //! CReadFile 18 | ERFT_READ_FILE = MAKE_IRR_ID('r', 'e', 'a', 'd'), 19 | 20 | //! CMemoryReadFile 21 | ERFT_MEMORY_READ_FILE = MAKE_IRR_ID('r', 'm', 'e', 'm'), 22 | 23 | //! CLimitReadFile 24 | ERFT_LIMIT_READ_FILE = MAKE_IRR_ID('r', 'l', 'i', 'm'), 25 | 26 | //! Unknown type 27 | EFIT_UNKNOWN = MAKE_IRR_ID('u', 'n', 'k', 'n') 28 | }; 29 | } // end namespace io 30 | } // end namespace irr 31 | -------------------------------------------------------------------------------- /include/ESceneNodeTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | //! An enumeration for all types of built-in scene nodes 15 | /** A scene node type is represented by a four character code 16 | such as 'cube' or 'mesh' instead of simple numbers, to avoid 17 | name clashes with external scene nodes.*/ 18 | enum ESCENE_NODE_TYPE 19 | { 20 | //! of type CSceneManager (note that ISceneManager is not(!) an ISceneNode) 21 | ESNT_SCENE_MANAGER = MAKE_IRR_ID('s', 'm', 'n', 'g'), 22 | 23 | //! Mesh Scene Node 24 | ESNT_MESH = MAKE_IRR_ID('m', 'e', 's', 'h'), 25 | 26 | //! Empty Scene Node 27 | ESNT_EMPTY = MAKE_IRR_ID('e', 'm', 't', 'y'), 28 | 29 | //! Dummy Transformation Scene Node 30 | ESNT_DUMMY_TRANSFORMATION = MAKE_IRR_ID('d', 'm', 'm', 'y'), 31 | 32 | //! Camera Scene Node 33 | ESNT_CAMERA = MAKE_IRR_ID('c', 'a', 'm', '_'), 34 | 35 | //! Billboard Scene Node 36 | ESNT_BILLBOARD = MAKE_IRR_ID('b', 'i', 'l', 'l'), 37 | 38 | //! Animated Mesh Scene Node 39 | ESNT_ANIMATED_MESH = MAKE_IRR_ID('a', 'm', 's', 'h'), 40 | 41 | //! Unknown scene node 42 | ESNT_UNKNOWN = MAKE_IRR_ID('u', 'n', 'k', 'n'), 43 | 44 | //! Will match with any scene node when checking types 45 | ESNT_ANY = MAKE_IRR_ID('a', 'n', 'y', '_') 46 | }; 47 | 48 | } // end namespace scene 49 | } // end namespace irr 50 | -------------------------------------------------------------------------------- /include/EShaderTypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "irrTypes.h" 4 | 5 | namespace irr 6 | { 7 | namespace video 8 | { 9 | 10 | //! Compile target enumeration for the addHighLevelShaderMaterial() method. 11 | enum E_VERTEX_SHADER_TYPE 12 | { 13 | EVST_VS_1_1 = 0, 14 | EVST_VS_2_0, 15 | EVST_VS_2_a, 16 | EVST_VS_3_0, 17 | EVST_VS_4_0, 18 | EVST_VS_4_1, 19 | EVST_VS_5_0, 20 | 21 | //! This is not a type, but a value indicating how much types there are. 22 | EVST_COUNT 23 | }; 24 | 25 | //! Names for all vertex shader types, each entry corresponds to a E_VERTEX_SHADER_TYPE entry. 26 | const c8 *const VERTEX_SHADER_TYPE_NAMES[] = { 27 | "vs_1_1", 28 | "vs_2_0", 29 | "vs_2_a", 30 | "vs_3_0", 31 | "vs_4_0", 32 | "vs_4_1", 33 | "vs_5_0", 34 | 0}; 35 | 36 | //! Compile target enumeration for the addHighLevelShaderMaterial() method. 37 | enum E_PIXEL_SHADER_TYPE 38 | { 39 | EPST_PS_1_1 = 0, 40 | EPST_PS_1_2, 41 | EPST_PS_1_3, 42 | EPST_PS_1_4, 43 | EPST_PS_2_0, 44 | EPST_PS_2_a, 45 | EPST_PS_2_b, 46 | EPST_PS_3_0, 47 | EPST_PS_4_0, 48 | EPST_PS_4_1, 49 | EPST_PS_5_0, 50 | 51 | //! This is not a type, but a value indicating how much types there are. 52 | EPST_COUNT 53 | }; 54 | 55 | //! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry. 56 | const c8 *const PIXEL_SHADER_TYPE_NAMES[] = { 57 | "ps_1_1", 58 | "ps_1_2", 59 | "ps_1_3", 60 | "ps_1_4", 61 | "ps_2_0", 62 | "ps_2_a", 63 | "ps_2_b", 64 | "ps_3_0", 65 | "ps_4_0", 66 | "ps_4_1", 67 | "ps_5_0", 68 | 0}; 69 | 70 | //! Enum for supported geometry shader types 71 | enum E_GEOMETRY_SHADER_TYPE 72 | { 73 | EGST_GS_4_0 = 0, 74 | 75 | //! This is not a type, but a value indicating how much types there are. 76 | EGST_COUNT 77 | }; 78 | 79 | //! String names for supported geometry shader types 80 | const c8 *const GEOMETRY_SHADER_TYPE_NAMES[] = { 81 | "gs_4_0", 82 | 0}; 83 | 84 | } // end namespace video 85 | } // end namespace irr 86 | -------------------------------------------------------------------------------- /include/EVertexAttributes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace irr 4 | { 5 | namespace video 6 | { 7 | 8 | //! Enumeration for all vertex attributes there are. 9 | enum E_VERTEX_ATTRIBUTES 10 | { 11 | EVA_POSITION = 0, 12 | EVA_NORMAL, 13 | EVA_COLOR, 14 | EVA_TCOORD0, 15 | EVA_TCOORD1, 16 | EVA_TANGENT, 17 | EVA_BINORMAL, 18 | EVA_COUNT 19 | }; 20 | 21 | //! Array holding the built in vertex attribute names 22 | const char *const sBuiltInVertexAttributeNames[] = { 23 | "inVertexPosition", 24 | "inVertexNormal", 25 | "inVertexColor", 26 | "inTexCoord0", 27 | "inTexCoord1", 28 | "inVertexTangent", 29 | "inVertexBinormal", 30 | 0, 31 | }; 32 | 33 | } // end namespace video 34 | } // end namespace irr 35 | -------------------------------------------------------------------------------- /include/IAnimatedMesh.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "aabbox3d.h" 8 | #include "IMesh.h" 9 | 10 | namespace irr 11 | { 12 | namespace scene 13 | { 14 | //! Interface for an animated mesh. 15 | /** There are already simple implementations of this interface available so 16 | you don't have to implement this interface on your own if you need to: 17 | You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh, 18 | irr::scene::SMeshBuffer etc. */ 19 | class IAnimatedMesh : public IMesh 20 | { 21 | public: 22 | //! Gets the frame count of the animated mesh. 23 | /** Note that the play-time is usually getFrameCount()-1 as it stops as soon as the last frame-key is reached. 24 | \return The amount of frames. If the amount is 1, 25 | it is a static, non animated mesh. */ 26 | virtual u32 getFrameCount() const = 0; 27 | 28 | //! Gets the animation speed of the animated mesh. 29 | /** \return The number of frames per second to play the 30 | animation with by default. If the amount is 0, 31 | it is a static, non animated mesh. */ 32 | virtual f32 getAnimationSpeed() const = 0; 33 | 34 | //! Sets the animation speed of the animated mesh. 35 | /** \param fps Number of frames per second to play the 36 | animation with by default. If the amount is 0, 37 | it is not animated. The actual speed is set in the 38 | scene node the mesh is instantiated in.*/ 39 | virtual void setAnimationSpeed(f32 fps) = 0; 40 | 41 | //! Returns the IMesh interface for a frame. 42 | /** \param frame: Frame number as zero based index. The maximum 43 | frame number is getFrameCount() - 1; 44 | \param detailLevel: Level of detail. 0 is the lowest, 255 the 45 | highest level of detail. Most meshes will ignore the detail level. 46 | \param startFrameLoop: Because some animated meshes (.MD2) are 47 | blended between 2 static frames, and maybe animated in a loop, 48 | the startFrameLoop and the endFrameLoop have to be defined, to 49 | prevent the animation to be blended between frames which are 50 | outside of this loop. 51 | If startFrameLoop and endFrameLoop are both -1, they are ignored. 52 | \param endFrameLoop: see startFrameLoop. 53 | \return Returns the animated mesh based on a detail level. */ 54 | virtual IMesh *getMesh(s32 frame, s32 detailLevel = 255, s32 startFrameLoop = -1, s32 endFrameLoop = -1) = 0; 55 | 56 | //! Returns the type of the animated mesh. 57 | /** In most cases it is not necessary to use this method. 58 | This is useful for making a safe downcast. For example, 59 | if getMeshType() returns EAMT_MD2 it's safe to cast the 60 | IAnimatedMesh to IAnimatedMeshMD2. 61 | \returns Type of the mesh. */ 62 | E_ANIMATED_MESH_TYPE getMeshType() const override 63 | { 64 | return EAMT_UNKNOWN; 65 | } 66 | }; 67 | 68 | } // end namespace scene 69 | } // end namespace irr 70 | -------------------------------------------------------------------------------- /include/IBoneSceneNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "ISceneNode.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | //! Enumeration for different bone animation modes 15 | enum E_BONE_ANIMATION_MODE 16 | { 17 | //! The bone is usually animated, unless it's parent is not animated 18 | EBAM_AUTOMATIC = 0, 19 | 20 | //! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward 21 | EBAM_ANIMATED, 22 | 23 | //! The bone is not animated by the skin 24 | EBAM_UNANIMATED, 25 | 26 | //! Not an animation mode, just here to count the available modes 27 | EBAM_COUNT 28 | 29 | }; 30 | 31 | enum E_BONE_SKINNING_SPACE 32 | { 33 | //! local skinning, standard 34 | EBSS_LOCAL = 0, 35 | 36 | //! global skinning 37 | EBSS_GLOBAL, 38 | 39 | EBSS_COUNT 40 | }; 41 | 42 | //! Names for bone animation modes 43 | const c8 *const BoneAnimationModeNames[] = { 44 | "automatic", 45 | "animated", 46 | "unanimated", 47 | 0, 48 | }; 49 | 50 | //! Interface for bones used for skeletal animation. 51 | /** Used with ISkinnedMesh and IAnimatedMeshSceneNode. */ 52 | class IBoneSceneNode : public ISceneNode 53 | { 54 | public: 55 | IBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id = -1) : 56 | ISceneNode(parent, mgr, id), positionHint(-1), scaleHint(-1), rotationHint(-1) {} 57 | 58 | //! Get the index of the bone 59 | virtual u32 getBoneIndex() const = 0; 60 | 61 | //! Sets the animation mode of the bone. 62 | /** \return True if successful. (Unused) */ 63 | virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0; 64 | 65 | //! Gets the current animation mode of the bone 66 | virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0; 67 | 68 | //! Get the axis aligned bounding box of this node 69 | const core::aabbox3d &getBoundingBox() const override = 0; 70 | 71 | //! Returns the relative transformation of the scene node. 72 | // virtual core::matrix4 getRelativeTransformation() const = 0; 73 | 74 | //! The animation method. 75 | void OnAnimate(u32 timeMs) override = 0; 76 | 77 | //! The render method. 78 | /** Does nothing as bones are not visible. */ 79 | void render() override {} 80 | 81 | //! How the relative transformation of the bone is used 82 | virtual void setSkinningSpace(E_BONE_SKINNING_SPACE space) = 0; 83 | 84 | //! How the relative transformation of the bone is used 85 | virtual E_BONE_SKINNING_SPACE getSkinningSpace() const = 0; 86 | 87 | //! Updates the absolute position based on the relative and the parents position 88 | virtual void updateAbsolutePositionOfAllChildren() = 0; 89 | 90 | s32 positionHint; 91 | s32 scaleHint; 92 | s32 rotationHint; 93 | }; 94 | 95 | } // end namespace scene 96 | } // end namespace irr 97 | -------------------------------------------------------------------------------- /include/IContextManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013-2015 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "SExposedVideoData.h" 8 | #include "SIrrCreationParameters.h" 9 | #include 10 | 11 | namespace irr 12 | { 13 | namespace video 14 | { 15 | // For system specific window contexts (used for OpenGL) 16 | class IContextManager : public virtual IReferenceCounted 17 | { 18 | public: 19 | //! Initialize manager with device creation parameters and device window (passed as exposed video data) 20 | virtual bool initialize(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &data) = 0; 21 | 22 | //! Terminate manager, any cleanup that is left over. Manager needs a new initialize to be usable again 23 | virtual void terminate() = 0; 24 | 25 | //! Create surface based on current window set 26 | virtual bool generateSurface() = 0; 27 | 28 | //! Destroy current surface 29 | virtual void destroySurface() = 0; 30 | 31 | //! Create context based on current surface 32 | virtual bool generateContext() = 0; 33 | 34 | //! Destroy current context 35 | virtual void destroyContext() = 0; 36 | 37 | //! Get current context 38 | virtual const SExposedVideoData &getContext() const = 0; 39 | 40 | //! Change render context, disable old and activate new defined by videoData 41 | //\param restorePrimaryOnZero When true: restore original driver context when videoData is set to 0 values. 42 | // When false: resets the context when videoData is set to 0 values. 43 | /** This is mostly used internally by IVideoDriver::beginScene(). 44 | But if you want to switch threads which access your OpenGL driver you will have to 45 | call this function as follows: 46 | Old thread gives up context with: activateContext(irr::video::SExposedVideoData()); 47 | New thread takes over context with: activateContext(videoDriver->getExposedVideoData()); 48 | Note that only 1 thread at a time may access an OpenGL context. */ 49 | virtual bool activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero = false) = 0; 50 | 51 | //! Get the address of any OpenGL procedure (including core procedures). 52 | virtual void *getProcAddress(const std::string &procName) = 0; 53 | 54 | //! Swap buffers. 55 | virtual bool swapBuffers() = 0; 56 | }; 57 | 58 | } // end namespace video 59 | } // end namespace irr 60 | -------------------------------------------------------------------------------- /include/IDummyTransformationSceneNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "ISceneNode.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | //! Dummy scene node for adding additional transformations to the scene graph. 15 | /** This scene node does not render itself, and does not respond to set/getPosition, 16 | set/getRotation and set/getScale. Its just a simple scene node that takes a 17 | matrix as relative transformation, making it possible to insert any transformation 18 | anywhere into the scene graph. 19 | This scene node is for example used by the IAnimatedMeshSceneNode for emulating 20 | joint scene nodes when playing skeletal animations. 21 | */ 22 | class IDummyTransformationSceneNode : public ISceneNode 23 | { 24 | public: 25 | //! Constructor 26 | IDummyTransformationSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id) : 27 | ISceneNode(parent, mgr, id) {} 28 | 29 | //! Returns a reference to the current relative transformation matrix. 30 | /** This is the matrix, this scene node uses instead of scale, translation 31 | and rotation. */ 32 | virtual core::matrix4 &getRelativeTransformationMatrix() = 0; 33 | }; 34 | 35 | } // end namespace scene 36 | } // end namespace irr 37 | -------------------------------------------------------------------------------- /include/IGUICheckBox.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIElement.h" 8 | 9 | namespace irr 10 | { 11 | namespace gui 12 | { 13 | 14 | //! GUI Check box interface. 15 | /** \par This element can create the following events of type EGUI_EVENT_TYPE: 16 | \li EGET_CHECKBOX_CHANGED 17 | */ 18 | class IGUICheckBox : public IGUIElement 19 | { 20 | public: 21 | //! constructor 22 | IGUICheckBox(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect rectangle) : 23 | IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {} 24 | 25 | //! Set if box is checked. 26 | virtual void setChecked(bool checked) = 0; 27 | 28 | //! Returns true if box is checked. 29 | virtual bool isChecked() const = 0; 30 | 31 | //! Sets whether to draw the background 32 | virtual void setDrawBackground(bool draw) = 0; 33 | 34 | //! Checks if background drawing is enabled 35 | /** \return true if background drawing is enabled, false otherwise */ 36 | virtual bool isDrawBackgroundEnabled() const = 0; 37 | 38 | //! Sets whether to draw the border 39 | virtual void setDrawBorder(bool draw) = 0; 40 | 41 | //! Checks if border drawing is enabled 42 | /** \return true if border drawing is enabled, false otherwise */ 43 | virtual bool isDrawBorderEnabled() const = 0; 44 | }; 45 | 46 | } // end namespace gui 47 | } // end namespace irr 48 | -------------------------------------------------------------------------------- /include/IGUIComboBox.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIElement.h" 8 | 9 | namespace irr 10 | { 11 | namespace gui 12 | { 13 | 14 | //! Combobox widget 15 | /** \par This element can create the following events of type EGUI_EVENT_TYPE: 16 | \li EGET_COMBO_BOX_CHANGED 17 | */ 18 | class IGUIComboBox : public IGUIElement 19 | { 20 | public: 21 | //! constructor 22 | IGUIComboBox(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect rectangle) : 23 | IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {} 24 | 25 | //! Returns amount of items in box 26 | virtual u32 getItemCount() const = 0; 27 | 28 | //! Returns string of an item. the idx may be a value from 0 to itemCount-1 29 | virtual const wchar_t *getItem(u32 idx) const = 0; 30 | 31 | //! Returns item data of an item. the idx may be a value from 0 to itemCount-1 32 | virtual u32 getItemData(u32 idx) const = 0; 33 | 34 | //! Returns index based on item data 35 | virtual s32 getIndexForItemData(u32 data) const = 0; 36 | 37 | //! Adds an item and returns the index of it 38 | virtual u32 addItem(const wchar_t *text, u32 data = 0) = 0; 39 | 40 | //! Removes an item from the combo box. 41 | /** Warning. This will change the index of all following items */ 42 | virtual void removeItem(u32 idx) = 0; 43 | 44 | //! Deletes all items in the combo box 45 | virtual void clear() = 0; 46 | 47 | //! Returns id of selected item. returns -1 if no item is selected. 48 | virtual s32 getSelected() const = 0; 49 | 50 | //! Sets the selected item. Set this to -1 if no item should be selected 51 | virtual void setSelected(s32 idx) = 0; 52 | 53 | //! Sets the selected item and emits a change event. 54 | /** Set this to -1 if no item should be selected */ 55 | virtual void setAndSendSelected(s32 idx) = 0; 56 | 57 | //! Sets text justification of the text area 58 | /** \param horizontal: EGUIA_UPPERLEFT for left justified (default), 59 | EGUIA_LOWERRIGHT for right justified, or EGUIA_CENTER for centered text. 60 | \param vertical: EGUIA_UPPERLEFT to align with top edge, 61 | EGUIA_LOWERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ 62 | virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0; 63 | 64 | //! Set the maximal number of rows for the selection listbox 65 | virtual void setMaxSelectionRows(u32 max) = 0; 66 | 67 | //! Get the maximal number of rows for the selection listbox 68 | virtual u32 getMaxSelectionRows() const = 0; 69 | }; 70 | 71 | } // end namespace gui 72 | } // end namespace irr 73 | -------------------------------------------------------------------------------- /include/IGUIFileOpenDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIElement.h" 8 | #include "path.h" 9 | 10 | namespace irr 11 | { 12 | namespace gui 13 | { 14 | 15 | //! Standard file chooser dialog. 16 | /** \warning When the user selects a folder this does change the current working directory 17 | 18 | \par This element can create the following events of type EGUI_EVENT_TYPE: 19 | \li EGET_DIRECTORY_SELECTED 20 | \li EGET_FILE_SELECTED 21 | \li EGET_FILE_CHOOSE_DIALOG_CANCELLED 22 | */ 23 | class IGUIFileOpenDialog : public IGUIElement 24 | { 25 | public: 26 | //! constructor 27 | IGUIFileOpenDialog(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect rectangle) : 28 | IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {} 29 | 30 | //! Returns the filename of the selected file converted to wide characters. Returns NULL if no file was selected. 31 | virtual const wchar_t *getFileName() const = 0; 32 | 33 | //! Returns the filename of the selected file. Is empty if no file was selected. 34 | virtual const io::path &getFileNameP() const = 0; 35 | 36 | //! Returns the directory of the selected file. Empty if no directory was selected. 37 | virtual const io::path &getDirectoryName() const = 0; 38 | 39 | //! Returns the directory of the selected file converted to wide characters. Returns NULL if no directory was selected. 40 | virtual const wchar_t *getDirectoryNameW() const = 0; 41 | }; 42 | 43 | } // end namespace gui 44 | } // end namespace irr 45 | -------------------------------------------------------------------------------- /include/IGUIFontBitmap.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIFont.h" 8 | 9 | namespace irr 10 | { 11 | namespace gui 12 | { 13 | class IGUISpriteBank; 14 | 15 | //! Font interface. 16 | class IGUIFontBitmap : public IGUIFont 17 | { 18 | public: 19 | //! Returns the type of this font 20 | EGUI_FONT_TYPE getType() const override { return EGFT_BITMAP; } 21 | 22 | //! returns the parsed Symbol Information 23 | virtual IGUISpriteBank *getSpriteBank() const = 0; 24 | 25 | //! returns the sprite number from a given character 26 | virtual u32 getSpriteNoFromChar(const wchar_t *c) const = 0; 27 | 28 | //! Gets kerning values (distance between letters) for the font. If no parameters are provided, 29 | /** the global kerning distance is returned. 30 | \param thisLetter: If this parameter is provided, the left side kerning for this letter is added 31 | to the global kerning value. For example, a space might only be one pixel wide, but it may 32 | be displayed as several pixels. 33 | \param previousLetter: If provided, kerning is calculated for both letters and added to the global 34 | kerning value. For example, EGFT_BITMAP will add the right kerning value of previousLetter to the 35 | left side kerning value of thisLetter, then add the global value. 36 | */ 37 | s32 getKerningWidth(const wchar_t *thisLetter = 0, const wchar_t *previousLetter = 0) const override = 0; 38 | }; 39 | 40 | } // end namespace gui 41 | } // end namespace irr 42 | -------------------------------------------------------------------------------- /include/IGUIImageList.h: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de 3 | 4 | #pragma once 5 | 6 | #include "IGUIElement.h" 7 | #include "rect.h" 8 | #include "irrTypes.h" 9 | 10 | namespace irr 11 | { 12 | namespace gui 13 | { 14 | 15 | //! Font interface. 16 | class IGUIImageList : public virtual IReferenceCounted 17 | { 18 | public: 19 | //! Destructor 20 | virtual ~IGUIImageList(){}; 21 | 22 | //! Draws an image and clips it to the specified rectangle if wanted 23 | //! \param index: Index of the image 24 | //! \param destPos: Position of the image to draw 25 | //! \param clip: Optional pointer to a rectangle against which the text will be clipped. 26 | //! If the pointer is null, no clipping will be done. 27 | virtual void draw(s32 index, const core::position2d &destPos, 28 | const core::rect *clip = 0) = 0; 29 | 30 | //! Returns the count of Images in the list. 31 | //! \return Returns the count of Images in the list. 32 | virtual s32 getImageCount() const = 0; 33 | 34 | //! Returns the size of the images in the list. 35 | //! \return Returns the size of the images in the list. 36 | virtual core::dimension2d getImageSize() const = 0; 37 | }; 38 | 39 | } // end namespace gui 40 | } // end namespace irr 41 | -------------------------------------------------------------------------------- /include/IGUIScrollBar.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIElement.h" 8 | 9 | namespace irr 10 | { 11 | namespace gui 12 | { 13 | 14 | //! Default scroll bar GUI element. 15 | /** \par This element can create the following events of type EGUI_EVENT_TYPE: 16 | \li EGET_SCROLL_BAR_CHANGED 17 | */ 18 | class IGUIScrollBar : public IGUIElement 19 | { 20 | public: 21 | //! constructor 22 | IGUIScrollBar(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect rectangle) : 23 | IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {} 24 | 25 | //! sets the maximum value of the scrollbar. 26 | virtual void setMax(s32 max) = 0; 27 | //! gets the maximum value of the scrollbar. 28 | virtual s32 getMax() const = 0; 29 | 30 | //! sets the minimum value of the scrollbar. 31 | virtual void setMin(s32 min) = 0; 32 | //! gets the minimum value of the scrollbar. 33 | virtual s32 getMin() const = 0; 34 | 35 | //! gets the small step value 36 | virtual s32 getSmallStep() const = 0; 37 | 38 | //! Sets the small step 39 | /** That is the amount that the value changes by when clicking 40 | on the buttons or using the cursor keys. */ 41 | virtual void setSmallStep(s32 step) = 0; 42 | 43 | //! gets the large step value 44 | virtual s32 getLargeStep() const = 0; 45 | 46 | //! Sets the large step 47 | /** That is the amount that the value changes by when clicking 48 | in the tray, or using the page up and page down keys. */ 49 | virtual void setLargeStep(s32 step) = 0; 50 | 51 | //! gets the current position of the scrollbar 52 | virtual s32 getPos() const = 0; 53 | 54 | //! sets the current position of the scrollbar 55 | virtual void setPos(s32 pos) = 0; 56 | }; 57 | 58 | } // end namespace gui 59 | } // end namespace irr 60 | -------------------------------------------------------------------------------- /include/IGUIToolbar.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIElement.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | class ITexture; 14 | } // end namespace video 15 | namespace gui 16 | { 17 | class IGUIButton; 18 | 19 | //! Stays at the top of its parent like the menu bar and contains tool buttons 20 | class IGUIToolBar : public IGUIElement 21 | { 22 | public: 23 | //! constructor 24 | IGUIToolBar(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect rectangle) : 25 | IGUIElement(EGUIET_TOOL_BAR, environment, parent, id, rectangle) {} 26 | 27 | //! Adds a button to the tool bar 28 | virtual IGUIButton *addButton(s32 id = -1, const wchar_t *text = 0, const wchar_t *tooltiptext = 0, 29 | video::ITexture *img = 0, video::ITexture *pressedimg = 0, 30 | bool isPushButton = false, bool useAlphaChannel = false) = 0; 31 | }; 32 | 33 | } // end namespace gui 34 | } // end namespace irr 35 | -------------------------------------------------------------------------------- /include/IImageLoader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "IImage.h" 9 | #include "ITexture.h" 10 | #include "path.h" 11 | #include "irrArray.h" 12 | 13 | namespace irr 14 | { 15 | namespace io 16 | { 17 | class IReadFile; 18 | } // end namespace io 19 | namespace video 20 | { 21 | 22 | //! Class which is able to create a image from a file. 23 | /** If you want the Irrlicht Engine be able to load textures of 24 | currently unsupported file formats (e.g .gif), then implement 25 | this and add your new Surface loader with 26 | IVideoDriver::addExternalImageLoader() to the engine. */ 27 | class IImageLoader : public virtual IReferenceCounted 28 | { 29 | public: 30 | //! Check if the file might be loaded by this class 31 | /** Check is based on the file extension (e.g. ".tga") 32 | \param filename Name of file to check. 33 | \return True if file seems to be loadable. */ 34 | virtual bool isALoadableFileExtension(const io::path &filename) const = 0; 35 | 36 | //! Check if the file might be loaded by this class 37 | /** Check might look into the file. 38 | \param file File handle to check. 39 | \return True if file seems to be loadable. */ 40 | virtual bool isALoadableFileFormat(io::IReadFile *file) const = 0; 41 | 42 | //! Creates a surface from the file 43 | /** \param file File handle to check. 44 | \return Pointer to newly created image, or 0 upon error. */ 45 | virtual IImage *loadImage(io::IReadFile *file) const = 0; 46 | }; 47 | 48 | } // end namespace video 49 | } // end namespace irr 50 | -------------------------------------------------------------------------------- /include/IImageWriter.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "irrString.h" 9 | #include "coreutil.h" 10 | 11 | namespace irr 12 | { 13 | namespace io 14 | { 15 | class IWriteFile; 16 | } // end namespace io 17 | 18 | namespace video 19 | { 20 | class IImage; 21 | 22 | //! Interface for writing software image data. 23 | class IImageWriter : public IReferenceCounted 24 | { 25 | public: 26 | //! Check if this writer can write a file with the given extension 27 | /** \param filename Name of the file to check. 28 | \return True if file extension specifies a writable type. */ 29 | virtual bool isAWriteableFileExtension(const io::path &filename) const = 0; 30 | 31 | //! Write image to file 32 | /** \param file File handle to write to. 33 | \param image Image to write into file. 34 | \param param Writer specific parameter, influencing e.g. quality. 35 | \return True if image was successfully written. */ 36 | virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) const = 0; 37 | }; 38 | 39 | } // namespace video 40 | } // namespace irr 41 | -------------------------------------------------------------------------------- /include/IIndexBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2008-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "irrArray.h" 9 | #include "EHardwareBufferFlags.h" 10 | #include "SVertexIndex.h" 11 | 12 | namespace irr 13 | { 14 | 15 | namespace video 16 | { 17 | 18 | } 19 | 20 | namespace scene 21 | { 22 | 23 | class IIndexBuffer : public virtual IReferenceCounted 24 | { 25 | public: 26 | virtual void *getData() = 0; 27 | 28 | virtual video::E_INDEX_TYPE getType() const = 0; 29 | virtual void setType(video::E_INDEX_TYPE IndexType) = 0; 30 | 31 | virtual u32 stride() const = 0; 32 | 33 | virtual u32 size() const = 0; 34 | virtual void push_back(const u32 &element) = 0; 35 | virtual u32 operator[](u32 index) const = 0; 36 | virtual u32 getLast() = 0; 37 | virtual void setValue(u32 index, u32 value) = 0; 38 | virtual void set_used(u32 usedNow) = 0; 39 | virtual void reallocate(u32 new_size) = 0; 40 | virtual u32 allocated_size() const = 0; 41 | 42 | virtual void *pointer() = 0; 43 | 44 | //! get the current hardware mapping hint 45 | virtual E_HARDWARE_MAPPING getHardwareMappingHint() const = 0; 46 | 47 | //! set the hardware mapping hint, for driver 48 | virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint) = 0; 49 | 50 | //! flags the meshbuffer as changed, reloads hardware buffers 51 | virtual void setDirty() = 0; 52 | 53 | //! Get the currently used ID for identification of changes. 54 | /** This shouldn't be used for anything outside the VideoDriver. */ 55 | virtual u32 getChangedID() const = 0; 56 | }; 57 | 58 | } // end namespace scene 59 | } // end namespace irr 60 | -------------------------------------------------------------------------------- /include/ILogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | 9 | namespace irr 10 | { 11 | 12 | //! Possible log levels. 13 | //! When used has filter ELL_DEBUG means => log everything and ELL_NONE means => log (nearly) nothing. 14 | //! When used to print logging information ELL_DEBUG will have lowest priority while ELL_NONE 15 | //! messages are never filtered and always printed. 16 | enum ELOG_LEVEL 17 | { 18 | //! Used for printing information helpful in debugging 19 | ELL_DEBUG, 20 | 21 | //! Useful information to print. For example hardware info or something started/stopped. 22 | ELL_INFORMATION, 23 | 24 | //! Warnings that something isn't as expected and can cause oddities 25 | ELL_WARNING, 26 | 27 | //! Something did go wrong. 28 | ELL_ERROR, 29 | 30 | //! Logs with ELL_NONE will never be filtered. 31 | //! And used as filter it will remove all logging except ELL_NONE messages. 32 | ELL_NONE 33 | }; 34 | 35 | //! Interface for logging messages, warnings and errors 36 | class ILogger : public virtual IReferenceCounted 37 | { 38 | public: 39 | //! Destructor 40 | virtual ~ILogger() {} 41 | 42 | //! Returns the current set log level. 43 | virtual ELOG_LEVEL getLogLevel() const = 0; 44 | 45 | //! Sets a new log level. 46 | /** With this value, texts which are sent to the logger are filtered 47 | out. For example setting this value to ELL_WARNING, only warnings and 48 | errors are printed out. Setting it to ELL_INFORMATION, which is the 49 | default setting, warnings, errors and informational texts are printed 50 | out. 51 | \param ll: new log level filter value. */ 52 | virtual void setLogLevel(ELOG_LEVEL ll) = 0; 53 | 54 | //! Prints out a text into the log 55 | /** \param text: Text to print out. 56 | \param ll: Log level of the text. If the text is an error, set 57 | it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it 58 | is just an informational text, set it to ELL_INFORMATION. Texts are 59 | filtered with these levels. If you want to be a text displayed, 60 | independent on what level filter is set, use ELL_NONE. */ 61 | virtual void log(const c8 *text, ELOG_LEVEL ll = ELL_INFORMATION) = 0; 62 | 63 | //! Prints out a text into the log 64 | /** \param text: Text to print out. 65 | \param hint: Additional info. This string is added after a " :" to the 66 | string. 67 | \param ll: Log level of the text. If the text is an error, set 68 | it to ELL_ERROR, if it is warning set it to ELL_WARNING, and if it 69 | is just an informational text, set it to ELL_INFORMATION. Texts are 70 | filtered with these levels. If you want to be a text displayed, 71 | independent on what level filter is set, use ELL_NONE. */ 72 | virtual void log(const c8 *text, const c8 *hint, ELOG_LEVEL ll = ELL_INFORMATION) = 0; 73 | }; 74 | 75 | } // end namespace 76 | -------------------------------------------------------------------------------- /include/IMemoryReadFile.h: -------------------------------------------------------------------------------- 1 | // Copyright Michael Zeilfelder 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReadFile.h" 8 | 9 | namespace irr 10 | { 11 | namespace io 12 | { 13 | 14 | //! Interface providing read access to a memory read file. 15 | class IMemoryReadFile : public IReadFile 16 | { 17 | public: 18 | //! Get direct access to internal buffer of memory block used as file. 19 | /** It's usually better to use the IReadFile functions to access 20 | the file content. But as that buffer exist over the full life-time 21 | of a CMemoryReadFile, it's sometimes nice to avoid the additional 22 | data-copy which read() needs. 23 | */ 24 | virtual const void *getBuffer() const = 0; 25 | }; 26 | } // end namespace io 27 | } // end namespace irr 28 | -------------------------------------------------------------------------------- /include/IMeshLoader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "path.h" 9 | 10 | namespace irr 11 | { 12 | namespace io 13 | { 14 | class IReadFile; 15 | } // end namespace io 16 | namespace scene 17 | { 18 | class IAnimatedMesh; 19 | 20 | //! Class which is able to load an animated mesh from a file. 21 | /** If you want Irrlicht be able to load meshes of 22 | currently unsupported file formats (e.g. .cob), then implement 23 | this and add your new Meshloader with 24 | ISceneManager::addExternalMeshLoader() to the engine. */ 25 | class IMeshLoader : public virtual IReferenceCounted 26 | { 27 | public: 28 | //! Constructor 29 | IMeshLoader() {} 30 | 31 | //! Destructor 32 | virtual ~IMeshLoader() {} 33 | 34 | //! Returns true if the file might be loaded by this class. 35 | /** This decision should be based on the file extension (e.g. ".cob") 36 | only. 37 | \param filename Name of the file to test. 38 | \return True if the file might be loaded by this class. */ 39 | virtual bool isALoadableFileExtension(const io::path &filename) const = 0; 40 | 41 | //! Creates/loads an animated mesh from the file. 42 | /** \param file File handler to load the file from. 43 | \return Pointer to the created mesh. Returns 0 if loading failed. 44 | If you no longer need the mesh, you should call IAnimatedMesh::drop(). 45 | See IReferenceCounted::drop() for more information. */ 46 | virtual IAnimatedMesh *createMesh(io::IReadFile *file) = 0; 47 | }; 48 | 49 | } // end namespace scene 50 | } // end namespace irr 51 | -------------------------------------------------------------------------------- /include/IMeshSceneNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "ISceneNode.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | class IMesh; 15 | 16 | //! A scene node displaying a static mesh 17 | class IMeshSceneNode : public ISceneNode 18 | { 19 | public: 20 | //! Constructor 21 | /** Use setMesh() to set the mesh to display. 22 | */ 23 | IMeshSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id, 24 | const core::vector3df &position = core::vector3df(0, 0, 0), 25 | const core::vector3df &rotation = core::vector3df(0, 0, 0), 26 | const core::vector3df &scale = core::vector3df(1, 1, 1)) : 27 | ISceneNode(parent, mgr, id, position, rotation, scale) {} 28 | 29 | //! Sets a new mesh to display 30 | /** \param mesh Mesh to display. */ 31 | virtual void setMesh(IMesh *mesh) = 0; 32 | 33 | //! Get the currently defined mesh for display. 34 | /** \return Pointer to mesh which is displayed by this node. */ 35 | virtual IMesh *getMesh(void) = 0; 36 | 37 | //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style. 38 | /** In this way it is possible to change the materials of a mesh 39 | causing all mesh scene nodes referencing this mesh to change, too. 40 | \param readonly Flag if the materials shall be read-only. */ 41 | virtual void setReadOnlyMaterials(bool readonly) = 0; 42 | 43 | //! Check if the scene node should not copy the materials of the mesh but use them in a read only style 44 | /** This flag can be set by setReadOnlyMaterials(). 45 | \return Whether the materials are read-only. */ 46 | virtual bool isReadOnlyMaterials() const = 0; 47 | }; 48 | 49 | } // end namespace scene 50 | } // end namespace irr 51 | -------------------------------------------------------------------------------- /include/IOSOperator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "irrString.h" 9 | 10 | namespace irr 11 | { 12 | 13 | //! The OSOperator provides OS-specific methods and information. 14 | class IOSOperator : public virtual IReferenceCounted 15 | { 16 | public: 17 | //! Get the current OS version as string. 18 | virtual const core::stringc &getOperatingSystemVersion() const = 0; 19 | 20 | //! Copies text to the clipboard 21 | //! \param text: text in utf-8 22 | virtual void copyToClipboard(const c8 *text) const = 0; 23 | 24 | //! Copies text to the primary selection 25 | //! This is a no-op on some platforms. 26 | //! \param text: text in utf-8 27 | virtual void copyToPrimarySelection(const c8 *text) const = 0; 28 | 29 | //! Get text from the clipboard 30 | //! \return Returns 0 if no string is in there, otherwise an utf-8 string. 31 | virtual const c8 *getTextFromClipboard() const = 0; 32 | 33 | //! Get text from the primary selection 34 | //! This is a no-op on some platforms. 35 | //! \return Returns 0 if no string is in there, otherwise an utf-8 string. 36 | virtual const c8 *getTextFromPrimarySelection() const = 0; 37 | 38 | //! Get the total and available system RAM 39 | /** \param totalBytes: will contain the total system memory in Kilobytes (1024 B) 40 | \param availableBytes: will contain the available memory in Kilobytes (1024 B) 41 | \return True if successful, false if not */ 42 | virtual bool getSystemMemory(u32 *totalBytes, u32 *availableBytes) const = 0; 43 | }; 44 | 45 | } // end namespace 46 | -------------------------------------------------------------------------------- /include/IReadFile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "coreutil.h" 9 | #include "EReadFileType.h" 10 | 11 | namespace irr 12 | { 13 | namespace io 14 | { 15 | 16 | //! Interface providing read access to a file. 17 | class IReadFile : public virtual IReferenceCounted 18 | { 19 | public: 20 | //! Reads an amount of bytes from the file. 21 | /** \param buffer Pointer to buffer where read bytes are written to. 22 | \param sizeToRead Amount of bytes to read from the file. 23 | \return How many bytes were read. */ 24 | virtual size_t read(void *buffer, size_t sizeToRead) = 0; 25 | 26 | //! Changes position in file 27 | /** \param finalPos Destination position in the file. 28 | \param relativeMovement If set to true, the position in the file is 29 | changed relative to current position. Otherwise the position is changed 30 | from beginning of file. 31 | \return True if successful, otherwise false. */ 32 | virtual bool seek(long finalPos, bool relativeMovement = false) = 0; 33 | 34 | //! Get size of file. 35 | /** \return Size of the file in bytes. */ 36 | virtual long getSize() const = 0; 37 | 38 | //! Get the current position in the file. 39 | /** \return Current position in the file in bytes on success or -1L on failure. */ 40 | virtual long getPos() const = 0; 41 | 42 | //! Get name of file. 43 | /** \return File name as zero terminated character string. */ 44 | virtual const io::path &getFileName() const = 0; 45 | 46 | //! Get the type of the class implementing this interface 47 | virtual EREAD_FILE_TYPE getType() const 48 | { 49 | return EFIT_UNKNOWN; 50 | } 51 | }; 52 | 53 | //! Internal function, please do not use. 54 | IReadFile *createLimitReadFile(const io::path &fileName, IReadFile *alreadyOpenedFile, long pos, long areaSize); 55 | 56 | } // end namespace io 57 | } // end namespace irr 58 | -------------------------------------------------------------------------------- /include/ISceneCollisionManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "position2d.h" 9 | #include "line3d.h" 10 | 11 | namespace irr 12 | { 13 | 14 | namespace scene 15 | { 16 | class ICameraSceneNode; 17 | 18 | class ISceneCollisionManager : public virtual IReferenceCounted 19 | { 20 | public: 21 | //! Returns a 3d ray which would go through the 2d screen coordinates. 22 | /** \param pos: Screen coordinates in pixels. 23 | \param camera: Camera from which the ray starts. If null, the 24 | active camera is used. 25 | \return Ray starting from the position of the camera and ending 26 | at a length of the far value of the camera at a position which 27 | would be behind the 2d screen coordinates. */ 28 | virtual core::line3d getRayFromScreenCoordinates( 29 | const core::position2d &pos, const ICameraSceneNode *camera = 0) = 0; 30 | }; 31 | 32 | } // end namespace scene 33 | } // end namespace irr 34 | -------------------------------------------------------------------------------- /include/ITimer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | 9 | namespace irr 10 | { 11 | 12 | //! Interface for getting and manipulating the virtual time 13 | class ITimer : public virtual IReferenceCounted 14 | { 15 | public: 16 | //! Returns current real time in milliseconds of the system. 17 | /** This value does not start with 0 when the application starts. 18 | For example in one implementation the value returned could be the 19 | amount of milliseconds which have elapsed since the system was started. 20 | */ 21 | virtual u32 getRealTime() const = 0; 22 | 23 | //! Returns current virtual time in milliseconds. 24 | /** This value starts with 0 and can be manipulated using setTime(), 25 | stopTimer(), startTimer(), etc. This value depends on the set speed of 26 | the timer if the timer is stopped, etc. If you need the system time, 27 | use getRealTime() */ 28 | virtual u32 getTime() const = 0; 29 | 30 | //! sets current virtual time 31 | virtual void setTime(u32 time) = 0; 32 | 33 | //! Stops the virtual timer. 34 | /** The timer is reference counted, which means everything which calls 35 | stop() will also have to call start(), otherwise the timer may not 36 | start/stop correctly again. */ 37 | virtual void stop() = 0; 38 | 39 | //! Starts the virtual timer. 40 | /** The timer is reference counted, which means everything which calls 41 | stop() will also have to call start(), otherwise the timer may not 42 | start/stop correctly again. */ 43 | virtual void start() = 0; 44 | 45 | //! Sets the speed of the timer 46 | /** The speed is the factor with which the time is running faster or 47 | slower then the real system time. */ 48 | virtual void setSpeed(f32 speed = 1.0f) = 0; 49 | 50 | //! Returns current speed of the timer 51 | /** The speed is the factor with which the time is running faster or 52 | slower then the real system time. */ 53 | virtual f32 getSpeed() const = 0; 54 | 55 | //! Returns if the virtual timer is currently stopped 56 | virtual bool isStopped() const = 0; 57 | 58 | //! Advances the virtual time 59 | /** Makes the virtual timer update the time value based on the real 60 | time. This is called automatically when calling IrrlichtDevice::run(), 61 | but you can call it manually if you don't use this method. */ 62 | virtual void tick() = 0; 63 | }; 64 | 65 | } // end namespace irr 66 | -------------------------------------------------------------------------------- /include/IVertexBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2008-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "irrArray.h" 9 | #include "EHardwareBufferFlags.h" 10 | #include "S3DVertex.h" 11 | 12 | namespace irr 13 | { 14 | namespace scene 15 | { 16 | 17 | class IVertexBuffer : public virtual IReferenceCounted 18 | { 19 | public: 20 | virtual void *getData() = 0; 21 | virtual video::E_VERTEX_TYPE getType() const = 0; 22 | virtual void setType(video::E_VERTEX_TYPE vertexType) = 0; 23 | virtual u32 stride() const = 0; 24 | virtual u32 size() const = 0; 25 | virtual void push_back(const video::S3DVertex &element) = 0; 26 | virtual video::S3DVertex &operator[](const u32 index) const = 0; 27 | virtual video::S3DVertex &getLast() = 0; 28 | virtual void set_used(u32 usedNow) = 0; 29 | virtual void reallocate(u32 new_size) = 0; 30 | virtual u32 allocated_size() const = 0; 31 | virtual video::S3DVertex *pointer() = 0; 32 | 33 | //! get the current hardware mapping hint 34 | virtual E_HARDWARE_MAPPING getHardwareMappingHint() const = 0; 35 | 36 | //! set the hardware mapping hint, for driver 37 | virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint) = 0; 38 | 39 | //! flags the meshbuffer as changed, reloads hardware buffers 40 | virtual void setDirty() = 0; 41 | 42 | //! Get the currently used ID for identification of changes. 43 | /** This shouldn't be used for anything outside the VideoDriver. */ 44 | virtual u32 getChangedID() const = 0; 45 | }; 46 | 47 | } // end namespace scene 48 | } // end namespace irr 49 | -------------------------------------------------------------------------------- /include/IWriteFile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "path.h" 9 | 10 | namespace irr 11 | { 12 | namespace io 13 | { 14 | 15 | //! Interface providing write access to a file. 16 | class IWriteFile : public virtual IReferenceCounted 17 | { 18 | public: 19 | //! Writes an amount of bytes to the file. 20 | /** \param buffer Pointer to buffer of bytes to write. 21 | \param sizeToWrite Amount of bytes to write to the file. 22 | \return How much bytes were written. */ 23 | virtual size_t write(const void *buffer, size_t sizeToWrite) = 0; 24 | 25 | //! Changes position in file 26 | /** \param finalPos Destination position in the file. 27 | \param relativeMovement If set to true, the position in the file is 28 | changed relative to current position. Otherwise the position is changed 29 | from begin of file. 30 | \return True if successful, otherwise false. */ 31 | virtual bool seek(long finalPos, bool relativeMovement = false) = 0; 32 | 33 | //! Get the current position in the file. 34 | /** \return Current position in the file in bytes on success or -1L on failure */ 35 | virtual long getPos() const = 0; 36 | 37 | //! Get name of file. 38 | /** \return File name as zero terminated character string. */ 39 | virtual const path &getFileName() const = 0; 40 | 41 | //! Flush the content of the buffer in the file 42 | /** \return True if successful, otherwise false. */ 43 | virtual bool flush() = 0; 44 | }; 45 | 46 | } // end namespace io 47 | } // end namespace irr 48 | -------------------------------------------------------------------------------- /include/IrrCompileConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | //! Identifies the IrrlichtMt fork customized for the Minetest engine 8 | #define IRRLICHT_VERSION_MT_REVISION 15 9 | #define IRRLICHT_VERSION_MT "mt15" 10 | 11 | //! Irrlicht SDK Version 12 | #define IRRLICHT_VERSION_MAJOR 1 13 | #define IRRLICHT_VERSION_MINOR 9 14 | #define IRRLICHT_VERSION_REVISION 0 15 | // This flag will be defined only in SVN, the official release code will have 16 | // it undefined 17 | #define IRRLICHT_VERSION_SVN alpha 18 | #define IRRLICHT_SDK_VERSION "1.9.0" IRRLICHT_VERSION_MT 19 | 20 | #ifdef _WIN32 21 | #define IRRCALLCONV __stdcall 22 | #else 23 | #define IRRCALLCONV 24 | #endif 25 | 26 | #ifndef IRRLICHT_API 27 | #define IRRLICHT_API 28 | #endif 29 | -------------------------------------------------------------------------------- /include/SExposedVideoData.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | namespace irr 8 | { 9 | namespace video 10 | { 11 | 12 | //! structure for holding data describing a driver and operating system specific data. 13 | /** This data can be retrieved by IVideoDriver::getExposedVideoData(). Use this with caution. 14 | This only should be used to make it possible to extend the engine easily without 15 | modification of its source. Note that this structure does not contain any valid data, if 16 | you are using the software or the null device. 17 | */ 18 | struct SExposedVideoData 19 | { 20 | SExposedVideoData() 21 | { 22 | OpenGLWin32.HDc = 0; 23 | OpenGLWin32.HRc = 0; 24 | OpenGLWin32.HWnd = 0; 25 | } 26 | explicit SExposedVideoData(void *Window) 27 | { 28 | OpenGLWin32.HDc = 0; 29 | OpenGLWin32.HRc = 0; 30 | OpenGLWin32.HWnd = Window; 31 | } 32 | 33 | struct SOpenGLWin32 34 | { 35 | //! Private GDI Device Context. 36 | /** Get if for example with: HDC h = reinterpret_cast(exposedData.OpenGLWin32.HDc) */ 37 | void *HDc; 38 | 39 | //! Permanent Rendering Context. 40 | /** Get if for example with: HGLRC h = reinterpret_cast(exposedData.OpenGLWin32.HRc) */ 41 | void *HRc; 42 | 43 | //! Window handle. 44 | /** Get with for example with: HWND h = reinterpret_cast(exposedData.OpenGLWin32.HWnd) */ 45 | void *HWnd; 46 | }; 47 | 48 | struct SOpenGLLinux 49 | { 50 | // XWindow handles 51 | void *X11Display; 52 | void *X11Context; 53 | unsigned long X11Window; 54 | unsigned long GLXWindow; 55 | }; 56 | 57 | struct SOpenGLOSX 58 | { 59 | //! The NSOpenGLContext object. 60 | void *Context; 61 | 62 | //! The NSWindow object. 63 | void *Window; 64 | }; 65 | 66 | struct SOpenGLFB 67 | { 68 | //! The EGLNativeWindowType object. 69 | void *Window; 70 | }; 71 | 72 | struct SOGLESAndroid 73 | { 74 | //! The ANativeWindow object. 75 | void *Window; 76 | }; 77 | 78 | union 79 | { 80 | SOpenGLWin32 OpenGLWin32; 81 | SOpenGLLinux OpenGLLinux; 82 | SOpenGLOSX OpenGLOSX; 83 | SOpenGLFB OpenGLFB; 84 | SOGLESAndroid OGLESAndroid; 85 | }; 86 | }; 87 | 88 | } // end namespace video 89 | } // end namespace irr 90 | -------------------------------------------------------------------------------- /include/SMeshBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | // replaced by template 6 | #include "CMeshBuffer.h" 7 | -------------------------------------------------------------------------------- /include/SVertexIndex.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2008-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | enum E_INDEX_TYPE 14 | { 15 | EIT_16BIT = 0, 16 | EIT_32BIT 17 | }; 18 | 19 | } // end namespace video 20 | } // end namespace irr 21 | -------------------------------------------------------------------------------- /include/SVertexManipulator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2009-2012 Christian Stehno 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "matrix4.h" 8 | #include "S3DVertex.h" 9 | #include "SColor.h" 10 | 11 | namespace irr 12 | { 13 | namespace scene 14 | { 15 | 16 | class IMesh; 17 | class IMeshBuffer; 18 | struct SMesh; 19 | 20 | //! Interface for vertex manipulators. 21 | /** You should derive your manipulator from this class if it shall be called for every vertex, getting as parameter just the vertex. 22 | */ 23 | struct IVertexManipulator 24 | { 25 | }; 26 | 27 | //! Vertex manipulator which scales the position of the vertex 28 | class SVertexPositionScaleManipulator : public IVertexManipulator 29 | { 30 | public: 31 | SVertexPositionScaleManipulator(const core::vector3df &factor) : 32 | Factor(factor) {} 33 | template 34 | void operator()(VType &vertex) const 35 | { 36 | vertex.Pos *= Factor; 37 | } 38 | 39 | private: 40 | core::vector3df Factor; 41 | }; 42 | 43 | } // end namespace scene 44 | } // end namespace irr 45 | -------------------------------------------------------------------------------- /include/SceneParameters.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | /*! \file SceneParameters.h 10 | \brief Header file containing all scene parameters for modifying mesh loading etc. 11 | 12 | This file includes all parameter names which can be set using ISceneManager::getParameters() 13 | to modify the behavior of plugins and mesh loaders. 14 | */ 15 | 16 | namespace irr 17 | { 18 | namespace scene 19 | { 20 | //! Name of the parameter for changing how Irrlicht handles the ZWrite flag for transparent (blending) materials 21 | /** The default behavior in Irrlicht is to disable writing to the 22 | z-buffer for all really transparent, i.e. blending materials. This 23 | avoids problems with intersecting faces, but can also break renderings. 24 | If transparent materials should use the SMaterial flag for ZWriteEnable 25 | just as other material types use this attribute. 26 | Use it like this: 27 | \code 28 | SceneManager->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); 29 | \endcode 30 | **/ 31 | const c8 *const ALLOW_ZWRITE_ON_TRANSPARENT = "Allow_ZWrite_On_Transparent"; 32 | 33 | //! Flag to avoid loading group structures in .obj files 34 | /** Use it like this: 35 | \code 36 | SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_GROUPS, true); 37 | \endcode 38 | **/ 39 | const c8 *const OBJ_LOADER_IGNORE_GROUPS = "OBJ_IgnoreGroups"; 40 | 41 | //! Flag to avoid loading material .mtl file for .obj files 42 | /** Use it like this: 43 | \code 44 | SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_MATERIAL_FILES, true); 45 | \endcode 46 | **/ 47 | const c8 *const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles"; 48 | 49 | } // end namespace scene 50 | } // end namespace irr 51 | -------------------------------------------------------------------------------- /include/exampleHelper.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "path.h" 8 | 9 | namespace irr 10 | { 11 | 12 | static io::path getExampleMediaPath() 13 | { 14 | #ifdef IRR_MOBILE_PATHS 15 | return io::path("media/"); 16 | #else 17 | return io::path("../../media/"); 18 | #endif 19 | } 20 | 21 | } // end namespace irr 22 | -------------------------------------------------------------------------------- /include/irrTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | namespace irr 10 | { 11 | 12 | //! 8 bit unsigned variable. 13 | typedef uint8_t u8; 14 | 15 | //! 8 bit signed variable. 16 | typedef int8_t s8; 17 | 18 | //! 8 bit character variable. 19 | /** This is a typedef for char, it ensures portability of the engine. */ 20 | typedef char c8; 21 | 22 | //! 16 bit unsigned variable. 23 | typedef uint16_t u16; 24 | 25 | //! 16 bit signed variable. 26 | typedef int16_t s16; 27 | 28 | //! 32 bit unsigned variable. 29 | typedef uint32_t u32; 30 | 31 | //! 32 bit signed variable. 32 | typedef int32_t s32; 33 | 34 | //! 64 bit unsigned variable. 35 | typedef uint64_t u64; 36 | 37 | //! 64 bit signed variable. 38 | typedef int64_t s64; 39 | 40 | //! 32 bit floating point variable. 41 | /** This is a typedef for float, it ensures portability of the engine. */ 42 | typedef float f32; 43 | 44 | //! 64 bit floating point variable. 45 | /** This is a typedef for double, it ensures portability of the engine. */ 46 | typedef double f64; 47 | 48 | } // end namespace irr 49 | 50 | //! Defines for snprintf_irr because snprintf method does not match the ISO C 51 | //! standard on Windows platforms. 52 | //! We want int snprintf_irr(char *str, size_t size, const char *format, ...); 53 | #if defined(_MSC_VER) 54 | #define snprintf_irr sprintf_s 55 | #else 56 | #define snprintf_irr snprintf 57 | #endif // _MSC_VER 58 | 59 | namespace irr 60 | { 61 | 62 | //! Type name for character type used by the file system (legacy). 63 | typedef char fschar_t; 64 | #define _IRR_TEXT(X) X 65 | 66 | } // end namespace irr 67 | 68 | //! define a break macro for debugging. 69 | #if defined(_DEBUG) 70 | #if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) 71 | #include 72 | #define _IRR_DEBUG_BREAK_IF(_CONDITION_) \ 73 | if (_CONDITION_) { \ 74 | _CrtDbgBreak(); \ 75 | } 76 | #else 77 | #include 78 | #define _IRR_DEBUG_BREAK_IF(_CONDITION_) assert(!(_CONDITION_)); 79 | #endif 80 | #else 81 | #define _IRR_DEBUG_BREAK_IF(_CONDITION_) 82 | #endif 83 | 84 | //! deprecated macro for virtual function override 85 | /** prefer to use the override keyword for new code */ 86 | #define _IRR_OVERRIDE_ override 87 | 88 | //! creates four CC codes used in Irrlicht for simple ids 89 | /** some compilers can create those by directly writing the 90 | code like 'code', but some generate warnings so we use this macro here */ 91 | #define MAKE_IRR_ID(c0, c1, c2, c3) \ 92 | ((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \ 93 | ((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24)) 94 | -------------------------------------------------------------------------------- /include/irrpack.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | // include this file right before the data structures to be 1-aligned 6 | // and add to each structure the PACK_STRUCT define just like this: 7 | // struct mystruct 8 | // { 9 | // ... 10 | // } PACK_STRUCT; 11 | // Always include the irrunpack.h file right after the last type declared 12 | // like this, and do not put any other types with different alignment 13 | // in between! 14 | 15 | // byte-align structures 16 | #if defined(_MSC_VER) 17 | #pragma warning(disable : 4103) 18 | #pragma pack(push, packing) 19 | #pragma pack(1) 20 | #define PACK_STRUCT 21 | #elif defined(__GNUC__) 22 | #define PACK_STRUCT __attribute__((packed)) 23 | #else 24 | #error compiler not supported 25 | #endif 26 | -------------------------------------------------------------------------------- /include/irrunpack.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | // include this file to switch back to default alignment 6 | // file belongs to irrpack.h, see there for more info 7 | 8 | // Default alignment 9 | #if defined(_MSC_VER) 10 | #pragma pack(pop, packing) 11 | #endif 12 | 13 | #undef PACK_STRUCT 14 | -------------------------------------------------------------------------------- /include/path.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine" and the "irrXML" project. 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrString.h" 8 | 9 | namespace irr 10 | { 11 | namespace io 12 | { 13 | 14 | //! Type used for all file system related strings. 15 | /** This type will transparently handle different file system encodings. 16 | NOTE: For historical reasons the tool-functions using io::path are all in coreutil.h 17 | */ 18 | typedef core::string path; 19 | 20 | // Type only exists for historcal reasons, paths are always char now. 21 | static_assert(sizeof(fschar_t) == sizeof(char)); 22 | 23 | //! Used in places where we identify objects by a filename, but don't actually work with the real filename 24 | /** Irrlicht is internally not case-sensitive when it comes to names. 25 | Also this class is a first step towards support for correctly serializing renamed objects. 26 | */ 27 | struct SNamedPath 28 | { 29 | //! Constructor 30 | SNamedPath() {} 31 | 32 | //! Constructor 33 | SNamedPath(const path &p) : 34 | Path(p), InternalName(PathToName(p)) 35 | { 36 | } 37 | 38 | //! Is smaller comparator 39 | bool operator<(const SNamedPath &other) const 40 | { 41 | return InternalName < other.InternalName; 42 | } 43 | 44 | //! Set the path. 45 | void setPath(const path &p) 46 | { 47 | Path = p; 48 | InternalName = PathToName(p); 49 | } 50 | 51 | //! Get the path. 52 | const path &getPath() const 53 | { 54 | return Path; 55 | }; 56 | 57 | //! Get the name which is used to identify the file. 58 | //! This string is similar to the names and filenames used before Irrlicht 1.7 59 | const path &getInternalName() const 60 | { 61 | return InternalName; 62 | } 63 | 64 | //! Implicit cast to io::path 65 | operator core::stringc() const 66 | { 67 | return core::stringc(getPath()); 68 | } 69 | 70 | protected: 71 | // convert the given path string to a name string. 72 | path PathToName(const path &p) const 73 | { 74 | path name(p); 75 | name.replace('\\', '/'); 76 | name.make_lower(); 77 | return name; 78 | } 79 | 80 | private: 81 | path Path; 82 | path InternalName; 83 | }; 84 | 85 | } // io 86 | } // irr 87 | -------------------------------------------------------------------------------- /include/position2d.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | //! As of Irrlicht 1.6, position2d is a synonym for vector2d. 6 | /** You should consider position2d to be deprecated, and use vector2d by preference. */ 7 | 8 | #pragma once 9 | 10 | #include "vector2d.h" 11 | 12 | namespace irr 13 | { 14 | namespace core 15 | { 16 | 17 | // Use typedefs where possible as they are more explicit... 18 | 19 | //! \deprecated position2d is now a synonym for vector2d, but vector2d should be used directly. 20 | typedef vector2d position2df; 21 | 22 | //! \deprecated position2d is now a synonym for vector2d, but vector2d should be used directly. 23 | typedef vector2d position2di; 24 | } // namespace core 25 | } // namespace irr 26 | 27 | // ...and use a #define to catch the rest, for (e.g.) position2d 28 | #define position2d vector2d 29 | -------------------------------------------------------------------------------- /media/Shaders/OneTextureBlend.fsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | 5 | /* Uniforms */ 6 | 7 | uniform int uTextureUsage0; 8 | uniform sampler2D uTextureUnit0; 9 | uniform int uBlendType; 10 | uniform int uFogEnable; 11 | uniform int uFogType; 12 | uniform vec4 uFogColor; 13 | uniform float uFogStart; 14 | uniform float uFogEnd; 15 | uniform float uFogDensity; 16 | 17 | /* Varyings */ 18 | 19 | varying vec2 vTextureCoord0; 20 | varying vec4 vVertexColor; 21 | varying float vFogCoord; 22 | 23 | float computeFog() 24 | { 25 | const float LOG2 = 1.442695; 26 | float FogFactor = 0.0; 27 | 28 | if (uFogType == 0) // Exp 29 | { 30 | FogFactor = exp2(-uFogDensity * vFogCoord * LOG2); 31 | } 32 | else if (uFogType == 1) // Linear 33 | { 34 | float Scale = 1.0 / (uFogEnd - uFogStart); 35 | FogFactor = (uFogEnd - vFogCoord) * Scale; 36 | } 37 | else if (uFogType == 2) // Exp2 38 | { 39 | FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2); 40 | } 41 | 42 | FogFactor = clamp(FogFactor, 0.0, 1.0); 43 | 44 | return FogFactor; 45 | } 46 | 47 | void main() 48 | { 49 | vec4 Color0 = vVertexColor; 50 | vec4 Color1 = vec4(1.0, 1.0, 1.0, 1.0); 51 | 52 | if (bool(uTextureUsage0)) 53 | Color1 = texture2D(uTextureUnit0, vTextureCoord0); 54 | 55 | vec4 FinalColor = Color0 * Color1; 56 | 57 | if (uBlendType == 1) 58 | { 59 | FinalColor.w = Color0.w; 60 | } 61 | else if (uBlendType == 2) 62 | { 63 | FinalColor.w = Color1.w; 64 | } 65 | 66 | if (bool(uFogEnable)) 67 | { 68 | float FogFactor = computeFog(); 69 | vec4 FogColor = uFogColor; 70 | FogColor.a = 1.0; 71 | FinalColor = mix(FogColor, FinalColor, FogFactor); 72 | } 73 | 74 | gl_FragColor = FinalColor; 75 | } 76 | -------------------------------------------------------------------------------- /media/Shaders/Renderer2D.fsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | 5 | /* Uniforms */ 6 | 7 | uniform int uTextureUsage; 8 | uniform sampler2D uTextureUnit; 9 | 10 | /* Varyings */ 11 | 12 | varying vec2 vTextureCoord; 13 | varying vec4 vVertexColor; 14 | 15 | void main() 16 | { 17 | vec4 Color = vVertexColor; 18 | 19 | if (bool(uTextureUsage)) 20 | Color *= texture2D(uTextureUnit, vTextureCoord); 21 | 22 | gl_FragColor = Color; 23 | } 24 | -------------------------------------------------------------------------------- /media/Shaders/Renderer2D.vsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | /* Attributes */ 4 | 5 | attribute vec4 inVertexPosition; 6 | attribute vec4 inVertexColor; 7 | attribute vec2 inTexCoord0; 8 | 9 | /* Uniforms */ 10 | 11 | uniform float uThickness; 12 | 13 | /* Varyings */ 14 | 15 | varying vec2 vTextureCoord; 16 | varying vec4 vVertexColor; 17 | 18 | void main() 19 | { 20 | gl_Position = inVertexPosition; 21 | gl_PointSize = uThickness; 22 | vTextureCoord = inTexCoord0; 23 | vVertexColor = inVertexColor.bgra; 24 | } 25 | -------------------------------------------------------------------------------- /media/Shaders/Renderer2D_noTex.fsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | 5 | /* Varyings */ 6 | varying vec4 vVertexColor; 7 | 8 | void main() 9 | { 10 | gl_FragColor = vVertexColor; 11 | } 12 | -------------------------------------------------------------------------------- /media/Shaders/Solid.fsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | 5 | /* Uniforms */ 6 | 7 | uniform int uTextureUsage0; 8 | uniform sampler2D uTextureUnit0; 9 | uniform int uFogEnable; 10 | uniform int uFogType; 11 | uniform vec4 uFogColor; 12 | uniform float uFogStart; 13 | uniform float uFogEnd; 14 | uniform float uFogDensity; 15 | 16 | /* Varyings */ 17 | 18 | varying vec2 vTextureCoord0; 19 | varying vec4 vVertexColor; 20 | varying float vFogCoord; 21 | 22 | float computeFog() 23 | { 24 | const float LOG2 = 1.442695; 25 | float FogFactor = 0.0; 26 | 27 | if (uFogType == 0) // Exp 28 | { 29 | FogFactor = exp2(-uFogDensity * vFogCoord * LOG2); 30 | } 31 | else if (uFogType == 1) // Linear 32 | { 33 | float Scale = 1.0 / (uFogEnd - uFogStart); 34 | FogFactor = (uFogEnd - vFogCoord) * Scale; 35 | } 36 | else if (uFogType == 2) // Exp2 37 | { 38 | FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2); 39 | } 40 | 41 | FogFactor = clamp(FogFactor, 0.0, 1.0); 42 | 43 | return FogFactor; 44 | } 45 | 46 | void main() 47 | { 48 | vec4 Color = vVertexColor; 49 | 50 | if (bool(uTextureUsage0)) 51 | Color *= texture2D(uTextureUnit0, vTextureCoord0); 52 | 53 | if (bool(uFogEnable)) 54 | { 55 | float FogFactor = computeFog(); 56 | vec4 FogColor = uFogColor; 57 | FogColor.a = 1.0; 58 | Color = mix(FogColor, Color, FogFactor); 59 | } 60 | 61 | gl_FragColor = Color; 62 | } 63 | -------------------------------------------------------------------------------- /media/Shaders/Solid.vsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | /* Attributes */ 4 | 5 | attribute vec3 inVertexPosition; 6 | attribute vec3 inVertexNormal; 7 | attribute vec4 inVertexColor; 8 | attribute vec2 inTexCoord0; 9 | 10 | /* Uniforms */ 11 | 12 | uniform mat4 uWVPMatrix; 13 | uniform mat4 uWVMatrix; 14 | uniform mat4 uNMatrix; 15 | uniform mat4 uTMatrix0; 16 | 17 | uniform float uThickness; 18 | 19 | /* Varyings */ 20 | 21 | varying vec2 vTextureCoord0; 22 | varying vec4 vVertexColor; 23 | varying float vFogCoord; 24 | 25 | void main() 26 | { 27 | gl_Position = uWVPMatrix * vec4(inVertexPosition, 1.0); 28 | gl_PointSize = uThickness; 29 | 30 | vec4 TextureCoord0 = vec4(inTexCoord0.x, inTexCoord0.y, 1.0, 1.0); 31 | vTextureCoord0 = vec4(uTMatrix0 * TextureCoord0).xy; 32 | 33 | vVertexColor = inVertexColor.bgra; 34 | 35 | vec3 Position = (uWVMatrix * vec4(inVertexPosition, 1.0)).xyz; 36 | 37 | vFogCoord = length(Position); 38 | } 39 | -------------------------------------------------------------------------------- /media/Shaders/TransparentAlphaChannel.fsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | 5 | /* Uniforms */ 6 | 7 | uniform float uAlphaRef; 8 | uniform int uTextureUsage0; 9 | uniform sampler2D uTextureUnit0; 10 | uniform int uFogEnable; 11 | uniform int uFogType; 12 | uniform vec4 uFogColor; 13 | uniform float uFogStart; 14 | uniform float uFogEnd; 15 | uniform float uFogDensity; 16 | 17 | /* Varyings */ 18 | 19 | varying vec2 vTextureCoord0; 20 | varying vec4 vVertexColor; 21 | varying float vFogCoord; 22 | 23 | float computeFog() 24 | { 25 | const float LOG2 = 1.442695; 26 | float FogFactor = 0.0; 27 | 28 | if (uFogType == 0) // Exp 29 | { 30 | FogFactor = exp2(-uFogDensity * vFogCoord * LOG2); 31 | } 32 | else if (uFogType == 1) // Linear 33 | { 34 | float Scale = 1.0 / (uFogEnd - uFogStart); 35 | FogFactor = (uFogEnd - vFogCoord) * Scale; 36 | } 37 | else if (uFogType == 2) // Exp2 38 | { 39 | FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2); 40 | } 41 | 42 | FogFactor = clamp(FogFactor, 0.0, 1.0); 43 | 44 | return FogFactor; 45 | } 46 | 47 | void main() 48 | { 49 | vec4 Color = vVertexColor; 50 | 51 | if (bool(uTextureUsage0)) 52 | { 53 | Color *= texture2D(uTextureUnit0, vTextureCoord0); 54 | 55 | // TODO: uAlphaRef should rather control sharpness of alpha, don't know how to do that right now and this works in most cases. 56 | if (Color.a < uAlphaRef) 57 | discard; 58 | } 59 | 60 | if (bool(uFogEnable)) 61 | { 62 | float FogFactor = computeFog(); 63 | vec4 FogColor = uFogColor; 64 | FogColor.a = 1.0; 65 | Color = mix(FogColor, Color, FogFactor); 66 | } 67 | 68 | gl_FragColor = Color; 69 | } 70 | -------------------------------------------------------------------------------- /media/Shaders/TransparentAlphaChannelRef.fsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | 5 | /* Uniforms */ 6 | 7 | uniform float uAlphaRef; 8 | uniform int uTextureUsage0; 9 | uniform sampler2D uTextureUnit0; 10 | uniform int uFogEnable; 11 | uniform int uFogType; 12 | uniform vec4 uFogColor; 13 | uniform float uFogStart; 14 | uniform float uFogEnd; 15 | uniform float uFogDensity; 16 | 17 | /* Varyings */ 18 | 19 | varying vec2 vTextureCoord0; 20 | varying vec4 vVertexColor; 21 | varying float vFogCoord; 22 | 23 | float computeFog() 24 | { 25 | const float LOG2 = 1.442695; 26 | float FogFactor = 0.0; 27 | 28 | if (uFogType == 0) // Exp 29 | { 30 | FogFactor = exp2(-uFogDensity * vFogCoord * LOG2); 31 | } 32 | else if (uFogType == 1) // Linear 33 | { 34 | float Scale = 1.0 / (uFogEnd - uFogStart); 35 | FogFactor = (uFogEnd - vFogCoord) * Scale; 36 | } 37 | else if (uFogType == 2) // Exp2 38 | { 39 | FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2); 40 | } 41 | 42 | FogFactor = clamp(FogFactor, 0.0, 1.0); 43 | 44 | return FogFactor; 45 | } 46 | 47 | void main() 48 | { 49 | vec4 Color = vVertexColor; 50 | 51 | if (bool(uTextureUsage0)) 52 | Color *= texture2D(uTextureUnit0, vTextureCoord0); 53 | 54 | if (Color.a < uAlphaRef) 55 | discard; 56 | 57 | if (bool(uFogEnable)) 58 | { 59 | float FogFactor = computeFog(); 60 | vec4 FogColor = uFogColor; 61 | FogColor.a = 1.0; 62 | Color = mix(FogColor, Color, FogFactor); 63 | } 64 | 65 | gl_FragColor = Color; 66 | } 67 | -------------------------------------------------------------------------------- /media/Shaders/TransparentVertexAlpha.fsh: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision mediump float; 4 | 5 | /* Uniforms */ 6 | 7 | uniform int uTextureUsage0; 8 | uniform sampler2D uTextureUnit0; 9 | uniform int uFogEnable; 10 | uniform int uFogType; 11 | uniform vec4 uFogColor; 12 | uniform float uFogStart; 13 | uniform float uFogEnd; 14 | uniform float uFogDensity; 15 | 16 | /* Varyings */ 17 | 18 | varying vec2 vTextureCoord0; 19 | varying vec4 vVertexColor; 20 | varying float vFogCoord; 21 | 22 | float computeFog() 23 | { 24 | const float LOG2 = 1.442695; 25 | float FogFactor = 0.0; 26 | 27 | if (uFogType == 0) // Exp 28 | { 29 | FogFactor = exp2(-uFogDensity * vFogCoord * LOG2); 30 | } 31 | else if (uFogType == 1) // Linear 32 | { 33 | float Scale = 1.0 / (uFogEnd - uFogStart); 34 | FogFactor = (uFogEnd - vFogCoord) * Scale; 35 | } 36 | else if (uFogType == 2) // Exp2 37 | { 38 | FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2); 39 | } 40 | 41 | FogFactor = clamp(FogFactor, 0.0, 1.0); 42 | 43 | return FogFactor; 44 | } 45 | 46 | void main() 47 | { 48 | vec4 Color = vVertexColor; 49 | 50 | if (bool(uTextureUsage0)) 51 | Color *= texture2D(uTextureUnit0, vTextureCoord0); 52 | 53 | if (bool(uFogEnable)) 54 | { 55 | float FogFactor = computeFog(); 56 | vec4 FogColor = uFogColor; 57 | FogColor.a = 1.0; 58 | Color = mix(FogColor, Color, FogFactor); 59 | } 60 | 61 | gl_FragColor = Color; 62 | } 63 | -------------------------------------------------------------------------------- /media/cooltexture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/media/cooltexture.png -------------------------------------------------------------------------------- /scripts/ci-build-mingw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | 4 | [[ -z "$CC" || -z "$CXX" ]] && exit 255 5 | variant=win32 6 | [[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64 7 | with_sdl=0 8 | [[ "$extras" == *"-sdl"* ]] && with_sdl=1 9 | #with_gl3=0 10 | #[[ "$extras" == *"-gl3"* ]] && with_gl3=1 11 | 12 | libjpeg_version=3.0.1 13 | libpng_version=1.6.40 14 | sdl2_version=2.28.5 15 | zlib_version=1.3.1 16 | 17 | download () { 18 | local url=$1 19 | local filename=${url##*/} 20 | local foldername=${filename%%[.-]*} 21 | 22 | [ -d "./$foldername" ] && return 0 23 | [ -e "$filename" ] || wget "$url" -O "$filename" 24 | sha256sum -w -c <(grep -F "$filename" "$topdir/sha256sums.txt") 25 | unzip -o "$filename" -d "$foldername" 26 | } 27 | 28 | libs=$PWD/libs 29 | mkdir -p libs 30 | pushd libs 31 | libhost="http://minetest.kitsunemimi.pw" 32 | download "$libhost/llvm/libjpeg-$libjpeg_version-$variant.zip" 33 | download "$libhost/llvm/libpng-$libpng_version-$variant.zip" 34 | [ $with_sdl -eq 1 ] && download "$libhost/llvm/sdl2-$sdl2_version-$variant.zip" 35 | download "$libhost/llvm/zlib-$zlib_version-$variant.zip" 36 | popd 37 | 38 | tmp=( 39 | -DCMAKE_SYSTEM_NAME=Windows \ 40 | -DPNG_LIBRARY=$libs/libpng/lib/libpng.dll.a \ 41 | -DPNG_PNG_INCLUDE_DIR=$libs/libpng/include \ 42 | -DJPEG_LIBRARY=$libs/libjpeg/lib/libjpeg.dll.a \ 43 | -DJPEG_INCLUDE_DIR=$libs/libjpeg/include \ 44 | -DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \ 45 | -DZLIB_INCLUDE_DIR=$libs/zlib/include 46 | ) 47 | if [ $with_sdl -eq 1 ]; then 48 | tmp+=( 49 | -DUSE_SDL2=ON 50 | -DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake 51 | ) 52 | else 53 | tmp+=(-DUSE_SDL2=OFF) 54 | fi 55 | #[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON) 56 | 57 | cmake . "${tmp[@]}" 58 | make -j$(nproc) 59 | 60 | if [ "$1" = "package" ]; then 61 | make DESTDIR=$PWD/_install install 62 | # strip library 63 | "${CXX%-*}-strip" --strip-unneeded _install/usr/local/lib/*.dll 64 | # bundle the DLLs that are specific to Irrlicht (kind of a hack) 65 | shopt -s nullglob 66 | cp -p $libs/*/bin/{libjpeg,libpng,SDL}*.dll _install/usr/local/lib/ 67 | # create a ZIP 68 | (cd _install/usr/local; zip -9r "$OLDPWD/irrlicht-$variant$extras.zip" -- *) 69 | fi 70 | exit 0 71 | -------------------------------------------------------------------------------- /scripts/ci-get-mingw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | 5 | name=llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz 6 | wget "https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/$name" -O "$name" 7 | sha256sum -w -c <(grep -F "$name" "$topdir/sha256sums.txt") 8 | sudo tar -xaf "$name" -C /usr --strip-components=1 9 | rm -f "$name" 10 | -------------------------------------------------------------------------------- /scripts/sha256sums.txt: -------------------------------------------------------------------------------- 1 | 0f21ff3be90311092fe32e0e30878ef3ae9d9437b8d9ac25ef279e0d84e9bb8e llvm-mingw-20231128-ucrt-ubuntu-20.04-x86_64.tar.xz 2 | 53dfd31285f470fcf0dca88217c5cf9c557729af6d103afae5936e72ddc38d3c libjpeg-3.0.1-win32.zip 3 | 3d44e0740914e6878300e30653aad39e974821b5d7f6c2567e246b4eb04a5324 libjpeg-3.0.1-win64.zip 4 | 6baf4e819bfb3573760524b5dc9a04b5e479090d6d2046b86cf39a3107c0071f libpng-1.6.40-win32.zip 5 | c02e029f01fce44baea7f4aecfd2564bd8a03507c0c6af8b03339ae0452c8b7d libpng-1.6.40-win64.zip 6 | f9f890af960e92fd3f532f2e9ac00681c33bc67a722e000dfdaeb41b0064f1a0 sdl2-2.28.5-win32.zip 7 | 8dde2c6963544b7d8a2e87c128ebbdf51ad0e70c7e2df986ff4e963ce9996d9b sdl2-2.28.5-win64.zip 8 | 8af10515d57dbfee5d2106cd66cafa2adeb4270d4c6047ccbf7e8b5d2d50681c zlib-1.3.1-win32.zip 9 | ad43f5d23052590c65633530743e5d622cc76b33c109072e6fd7b487aff56bca zlib-1.3.1-win64.zip 10 | -------------------------------------------------------------------------------- /src/Android/CAndroidAssetFileArchive.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Joerg Henrichs 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReadFile.h" 8 | #include "IFileArchive.h" 9 | #include "CFileList.h" 10 | 11 | #include 12 | 13 | namespace irr 14 | { 15 | namespace io 16 | { 17 | 18 | /*! 19 | Android asset file system written August 2012 by J.Henrichs (later reworked by others). 20 | */ 21 | class CAndroidAssetFileArchive : public virtual IFileArchive, 22 | virtual CFileList 23 | { 24 | public: 25 | //! constructor 26 | CAndroidAssetFileArchive(AAssetManager *assetManager, bool ignoreCase, bool ignorePaths); 27 | 28 | //! destructor 29 | virtual ~CAndroidAssetFileArchive(); 30 | 31 | //! opens a file by file name 32 | virtual IReadFile *createAndOpenFile(const io::path &filename); 33 | 34 | //! opens a file by index 35 | virtual IReadFile *createAndOpenFile(u32 index); 36 | 37 | //! returns the list of files 38 | virtual const IFileList *getFileList() const; 39 | 40 | //! get the archive type 41 | virtual E_FILE_ARCHIVE_TYPE getType() const; 42 | 43 | //! Add a directory to read files from. Since the Android 44 | //! API does not return names of directories, they need to 45 | //! be added manually. 46 | virtual void addDirectoryToFileList(const io::path &filename); 47 | 48 | //! return the name (id) of the file Archive 49 | const io::path &getArchiveName() const override { return Path; } 50 | 51 | protected: 52 | //! Android's asset manager 53 | AAssetManager *AssetManager; 54 | 55 | }; // CAndroidAssetFileArchive 56 | 57 | } // end namespace io 58 | } // end namespace irr 59 | -------------------------------------------------------------------------------- /src/Android/CAndroidAssetReader.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2011 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CAndroidAssetReader.h" 6 | 7 | #include "CReadFile.h" 8 | #include "coreutil.h" 9 | #include "CAndroidAssetReader.h" 10 | #include "CIrrDeviceAndroid.h" 11 | 12 | #include 13 | #include 14 | 15 | namespace irr 16 | { 17 | namespace io 18 | { 19 | 20 | CAndroidAssetReader::CAndroidAssetReader(AAssetManager *assetManager, const io::path &filename) : 21 | AssetManager(assetManager), Filename(filename) 22 | { 23 | Asset = AAssetManager_open(AssetManager, 24 | core::stringc(filename).c_str(), 25 | AASSET_MODE_RANDOM); 26 | } 27 | 28 | CAndroidAssetReader::~CAndroidAssetReader() 29 | { 30 | if (Asset) 31 | AAsset_close(Asset); 32 | } 33 | 34 | size_t CAndroidAssetReader::read(void *buffer, size_t sizeToRead) 35 | { 36 | int readBytes = AAsset_read(Asset, buffer, sizeToRead); 37 | if (readBytes >= 0) 38 | return size_t(readBytes); 39 | return 0; // direct fd access is not possible (for example, if the asset is compressed). 40 | } 41 | 42 | bool CAndroidAssetReader::seek(long finalPos, bool relativeMovement) 43 | { 44 | off_t status = AAsset_seek(Asset, finalPos, relativeMovement ? SEEK_CUR : SEEK_SET); 45 | 46 | return status + 1; 47 | } 48 | 49 | long CAndroidAssetReader::getSize() const 50 | { 51 | return AAsset_getLength(Asset); 52 | } 53 | 54 | long CAndroidAssetReader::getPos() const 55 | { 56 | return AAsset_getLength(Asset) - AAsset_getRemainingLength(Asset); 57 | } 58 | 59 | const io::path &CAndroidAssetReader::getFileName() const 60 | { 61 | return Filename; 62 | } 63 | 64 | } // end namespace io 65 | } // end namespace irr 66 | -------------------------------------------------------------------------------- /src/Android/CAndroidAssetReader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Joerg Henrichs 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReadFile.h" 8 | 9 | struct AAssetManager; 10 | struct AAsset; 11 | struct ANativeActivity; 12 | 13 | namespace irr 14 | { 15 | namespace io 16 | { 17 | 18 | class CAndroidAssetReader : public virtual IReadFile 19 | { 20 | public: 21 | CAndroidAssetReader(AAssetManager *assetManager, const io::path &filename); 22 | 23 | virtual ~CAndroidAssetReader(); 24 | 25 | //! Reads an amount of bytes from the file. 26 | /** \param buffer Pointer to buffer where read bytes are written to. 27 | \param sizeToRead Amount of bytes to read from the file. 28 | \return How many bytes were read. */ 29 | virtual size_t read(void *buffer, size_t sizeToRead); 30 | 31 | //! Changes position in file 32 | /** \param finalPos Destination position in the file. 33 | \param relativeMovement If set to true, the position in the file is 34 | changed relative to current position. Otherwise the position is changed 35 | from beginning of file. 36 | \return True if successful, otherwise false. */ 37 | virtual bool seek(long finalPos, bool relativeMovement = false); 38 | 39 | //! Get size of file. 40 | /** \return Size of the file in bytes. */ 41 | virtual long getSize() const; 42 | 43 | //! Get the current position in the file. 44 | /** \return Current position in the file in bytes. */ 45 | virtual long getPos() const; 46 | 47 | //! Get name of file. 48 | /** \return File name as zero terminated character string. */ 49 | virtual const io::path &getFileName() const; 50 | 51 | /** Return true if the file could be opened. */ 52 | bool isOpen() const { return Asset != NULL; } 53 | 54 | private: 55 | //! Android's asset manager 56 | AAssetManager *AssetManager; 57 | 58 | // An asset, i.e. file 59 | AAsset *Asset; 60 | path Filename; 61 | }; 62 | 63 | } // end namespace io 64 | } // end namespace irr 65 | -------------------------------------------------------------------------------- /src/Android/CIrrDeviceAndroid.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2011 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "CIrrDeviceStub.h" 8 | #include "IrrlichtDevice.h" 9 | #include "ICursorControl.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace irr 15 | { 16 | class CIrrDeviceAndroid : public CIrrDeviceStub 17 | { 18 | public: 19 | CIrrDeviceAndroid(const SIrrlichtCreationParameters ¶m); 20 | 21 | virtual ~CIrrDeviceAndroid(); 22 | 23 | virtual bool run(); 24 | 25 | virtual void yield(); 26 | 27 | virtual void sleep(u32 timeMs, bool pauseTimer = false); 28 | 29 | virtual void setWindowCaption(const wchar_t *text); 30 | 31 | virtual bool isWindowActive() const; 32 | 33 | virtual bool isWindowFocused() const; 34 | 35 | virtual bool isWindowMinimized() const; 36 | 37 | virtual bool isWindowVisible() const; 38 | 39 | virtual void closeDevice(); 40 | 41 | virtual void setResizable(bool resize = false); 42 | 43 | virtual void minimizeWindow(); 44 | 45 | virtual void maximizeWindow(); 46 | 47 | virtual void restoreWindow(); 48 | 49 | virtual core::position2di getWindowPosition(); 50 | 51 | virtual E_DEVICE_TYPE getType() const; 52 | 53 | virtual bool activateAccelerometer(float updateInterval); 54 | 55 | virtual bool deactivateAccelerometer(); 56 | 57 | virtual bool isAccelerometerActive(); 58 | 59 | virtual bool isAccelerometerAvailable(); 60 | 61 | virtual bool activateGyroscope(float updateInterval); 62 | 63 | virtual bool deactivateGyroscope(); 64 | 65 | virtual bool isGyroscopeActive(); 66 | 67 | virtual bool isGyroscopeAvailable(); 68 | 69 | private: 70 | static void handleAndroidCommand(android_app *app, int32_t cmd); 71 | 72 | static s32 handleInput(android_app *app, AInputEvent *event); 73 | 74 | void createDriver(); 75 | 76 | void createKeyMap(); 77 | 78 | video::SExposedVideoData &getExposedVideoData(); 79 | 80 | android_app *Android; 81 | ASensorManager *SensorManager; 82 | ASensorEventQueue *SensorEventQueue; 83 | const ASensor *Accelerometer; 84 | const ASensor *Gyroscope; 85 | 86 | bool Initialized; 87 | bool Stopped; 88 | bool Paused; 89 | bool Focused; 90 | 91 | JNIEnv *JNIEnvAttachedToVM; 92 | 93 | video::SExposedVideoData ExposedVideoData; 94 | 95 | core::array KeyMap; 96 | }; 97 | 98 | } // end namespace irr 99 | -------------------------------------------------------------------------------- /src/Android/CKeyEventWrapper.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // For conditions of distribution and use, see copyright notice in irrlicht.h 3 | 4 | #include "CKeyEventWrapper.h" 5 | 6 | #include "os.h" 7 | 8 | namespace irr 9 | { 10 | namespace jni 11 | { 12 | 13 | jclass CKeyEventWrapper::Class_KeyEvent = 0; 14 | jmethodID CKeyEventWrapper::Method_constructor = 0; 15 | jmethodID CKeyEventWrapper::Method_getUnicodeChar = 0; 16 | 17 | CKeyEventWrapper::CKeyEventWrapper(JNIEnv *jniEnv, int action, int code) : 18 | JniEnv(jniEnv), JniKeyEvent(0) 19 | { 20 | if (JniEnv) { 21 | if (!Class_KeyEvent) { 22 | // Find java classes & functions on first call 23 | os::Printer::log("CKeyEventWrapper first initialize", ELL_DEBUG); 24 | jclass localClass = JniEnv->FindClass("android/view/KeyEvent"); 25 | if (localClass) { 26 | Class_KeyEvent = reinterpret_cast(JniEnv->NewGlobalRef(localClass)); 27 | } 28 | 29 | Method_constructor = JniEnv->GetMethodID(Class_KeyEvent, "", "(II)V"); 30 | Method_getUnicodeChar = JniEnv->GetMethodID(Class_KeyEvent, "getUnicodeChar", "(I)I"); 31 | } 32 | 33 | if (Class_KeyEvent && Method_constructor) { 34 | JniKeyEvent = JniEnv->NewObject(Class_KeyEvent, Method_constructor, action, code); 35 | } else { 36 | os::Printer::log("CKeyEventWrapper didn't find JNI classes/methods", ELL_WARNING); 37 | } 38 | } 39 | } 40 | 41 | CKeyEventWrapper::~CKeyEventWrapper() 42 | { 43 | JniEnv->DeleteLocalRef(JniKeyEvent); 44 | } 45 | 46 | int CKeyEventWrapper::getUnicodeChar(int metaState) 47 | { 48 | return JniEnv->CallIntMethod(JniKeyEvent, Method_getUnicodeChar, metaState); 49 | } 50 | 51 | } // namespace jni 52 | } // namespace irr 53 | -------------------------------------------------------------------------------- /src/Android/CKeyEventWrapper.h: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // For conditions of distribution and use, see copyright notice in irrlicht.h 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | struct android_app; 9 | 10 | namespace irr 11 | { 12 | namespace jni 13 | { 14 | 15 | //! Minimal JNI wrapper class around android.view.KeyEvent 16 | //! NOTE: Only functions we actually use in the engine are wrapped 17 | //! This is currently not written to support multithreading - meaning threads are not attached/detached to the Java VM (to be discussed) 18 | class CKeyEventWrapper 19 | { 20 | public: 21 | CKeyEventWrapper(JNIEnv *jniEnv, int action, int code); 22 | ~CKeyEventWrapper(); 23 | 24 | int getUnicodeChar(int metaState); 25 | 26 | private: 27 | static jclass Class_KeyEvent; 28 | static jmethodID Method_getUnicodeChar; 29 | static jmethodID Method_constructor; 30 | JNIEnv *JniEnv; 31 | jobject JniKeyEvent; // this object in java 32 | }; 33 | 34 | } // namespace jni 35 | } // namespace irr 36 | -------------------------------------------------------------------------------- /src/CAttributeImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CAttributes.h" 6 | #include "fast_atof.h" 7 | #include "ITexture.h" 8 | #include "IVideoDriver.h" 9 | 10 | namespace irr 11 | { 12 | namespace io 13 | { 14 | 15 | /* 16 | Basic types, check documentation in IAttribute.h to see how they generally work. 17 | */ 18 | 19 | // Attribute implemented for boolean values 20 | class CBoolAttribute : public IAttribute 21 | { 22 | public: 23 | CBoolAttribute(const char *name, bool value) 24 | { 25 | Name = name; 26 | setBool(value); 27 | } 28 | 29 | s32 getInt() const override 30 | { 31 | return BoolValue ? 1 : 0; 32 | } 33 | 34 | f32 getFloat() const override 35 | { 36 | return BoolValue ? 1.0f : 0.0f; 37 | } 38 | 39 | bool getBool() const override 40 | { 41 | return BoolValue; 42 | } 43 | 44 | void setInt(s32 intValue) override 45 | { 46 | BoolValue = (intValue != 0); 47 | } 48 | 49 | void setFloat(f32 floatValue) override 50 | { 51 | BoolValue = (floatValue != 0); 52 | } 53 | 54 | void setBool(bool boolValue) override 55 | { 56 | BoolValue = boolValue; 57 | } 58 | 59 | E_ATTRIBUTE_TYPE getType() const override 60 | { 61 | return EAT_BOOL; 62 | } 63 | 64 | bool BoolValue; 65 | }; 66 | 67 | // Attribute implemented for integers 68 | class CIntAttribute : public IAttribute 69 | { 70 | public: 71 | CIntAttribute(const char *name, s32 value) 72 | { 73 | Name = name; 74 | setInt(value); 75 | } 76 | 77 | s32 getInt() const override 78 | { 79 | return Value; 80 | } 81 | 82 | f32 getFloat() const override 83 | { 84 | return (f32)Value; 85 | } 86 | 87 | void setInt(s32 intValue) override 88 | { 89 | Value = intValue; 90 | } 91 | 92 | void setFloat(f32 floatValue) override 93 | { 94 | Value = (s32)floatValue; 95 | }; 96 | 97 | E_ATTRIBUTE_TYPE getType() const override 98 | { 99 | return EAT_INT; 100 | } 101 | 102 | s32 Value; 103 | }; 104 | 105 | // Attribute implemented for floats 106 | class CFloatAttribute : public IAttribute 107 | { 108 | public: 109 | CFloatAttribute(const char *name, f32 value) 110 | { 111 | Name = name; 112 | setFloat(value); 113 | } 114 | 115 | s32 getInt() const override 116 | { 117 | return (s32)Value; 118 | } 119 | 120 | f32 getFloat() const override 121 | { 122 | return Value; 123 | } 124 | 125 | void setInt(s32 intValue) override 126 | { 127 | Value = (f32)intValue; 128 | } 129 | 130 | void setFloat(f32 floatValue) override 131 | { 132 | Value = floatValue; 133 | } 134 | 135 | E_ATTRIBUTE_TYPE getType() const override 136 | { 137 | return EAT_FLOAT; 138 | } 139 | 140 | f32 Value; 141 | }; 142 | 143 | } // end namespace io 144 | } // end namespace irr 145 | -------------------------------------------------------------------------------- /src/CB3DMeshFileLoader.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2012 Luke Hoschke 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | // B3D Mesh loader 6 | // File format designed by Mark Sibly for the Blitz3D engine and has been 7 | // declared public domain 8 | 9 | #pragma once 10 | 11 | #include "IMeshLoader.h" 12 | #include "ISceneManager.h" 13 | #include "CSkinnedMesh.h" 14 | #include "SB3DStructs.h" 15 | #include "IReadFile.h" 16 | 17 | namespace irr 18 | { 19 | 20 | namespace scene 21 | { 22 | 23 | //! Meshloader for B3D format 24 | class CB3DMeshFileLoader : public IMeshLoader 25 | { 26 | public: 27 | //! Constructor 28 | CB3DMeshFileLoader(scene::ISceneManager *smgr); 29 | 30 | //! returns true if the file maybe is able to be loaded by this class 31 | //! based on the file extension (e.g. ".bsp") 32 | bool isALoadableFileExtension(const io::path &filename) const override; 33 | 34 | //! creates/loads an animated mesh from the file. 35 | //! \return Pointer to the created mesh. Returns 0 if loading failed. 36 | //! If you no longer need the mesh, you should call IAnimatedMesh::drop(). 37 | //! See IReferenceCounted::drop() for more information. 38 | IAnimatedMesh *createMesh(io::IReadFile *file) override; 39 | 40 | private: 41 | bool load(); 42 | bool readChunkNODE(CSkinnedMesh::SJoint *InJoint); 43 | bool readChunkMESH(CSkinnedMesh::SJoint *InJoint); 44 | bool readChunkVRTS(CSkinnedMesh::SJoint *InJoint); 45 | bool readChunkTRIS(scene::SSkinMeshBuffer *MeshBuffer, u32 MeshBufferID, s32 Vertices_Start); 46 | bool readChunkBONE(CSkinnedMesh::SJoint *InJoint); 47 | bool readChunkKEYS(CSkinnedMesh::SJoint *InJoint); 48 | bool readChunkANIM(); 49 | bool readChunkTEXS(); 50 | bool readChunkBRUS(); 51 | 52 | std::string readString(); 53 | void readFloats(f32 *vec, u32 count); 54 | 55 | core::array B3dStack; 56 | 57 | core::array Materials; 58 | core::array Textures; 59 | 60 | core::array AnimatedVertices_VertexID; 61 | 62 | core::array AnimatedVertices_BufferID; 63 | 64 | core::array BaseVertices; 65 | 66 | CSkinnedMesh *AnimatedMesh; 67 | io::IReadFile *B3DFile; 68 | 69 | // B3Ds have Vertex ID's local within the mesh I don't want this 70 | // Variable needs to be class member due to recursion in calls 71 | u32 VerticesStart; 72 | 73 | bool NormalsInFile; 74 | bool HasVertexColors; 75 | bool ShowWarning; 76 | }; 77 | 78 | } // end namespace scene 79 | } // end namespace irr 80 | -------------------------------------------------------------------------------- /src/CBoneSceneNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CBoneSceneNode.h" 6 | 7 | #include 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | //! constructor 15 | CBoneSceneNode::CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id, 16 | u32 boneIndex, const std::optional &boneName) : 17 | IBoneSceneNode(parent, mgr, id), 18 | BoneIndex(boneIndex), 19 | AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL) 20 | { 21 | #ifdef _DEBUG 22 | setDebugName("CBoneSceneNode"); 23 | #endif 24 | setName(boneName); 25 | } 26 | 27 | //! Returns the index of the bone 28 | u32 CBoneSceneNode::getBoneIndex() const 29 | { 30 | return BoneIndex; 31 | } 32 | 33 | //! Sets the animation mode of the bone. Returns true if successful. 34 | bool CBoneSceneNode::setAnimationMode(E_BONE_ANIMATION_MODE mode) 35 | { 36 | AnimationMode = mode; 37 | return true; 38 | } 39 | 40 | //! Gets the current animation mode of the bone 41 | E_BONE_ANIMATION_MODE CBoneSceneNode::getAnimationMode() const 42 | { 43 | return AnimationMode; 44 | } 45 | 46 | //! returns the axis aligned bounding box of this node 47 | const core::aabbox3d &CBoneSceneNode::getBoundingBox() const 48 | { 49 | return Box; 50 | } 51 | 52 | /* 53 | //! Returns the relative transformation of the scene node. 54 | core::matrix4 CBoneSceneNode::getRelativeTransformation() const 55 | { 56 | return core::matrix4(); // RelativeTransformation; 57 | } 58 | */ 59 | 60 | void CBoneSceneNode::OnAnimate(u32 timeMs) 61 | { 62 | if (IsVisible) { 63 | // update absolute position 64 | // updateAbsolutePosition(); 65 | 66 | // perform the post render process on all children 67 | ISceneNodeList::iterator it = Children.begin(); 68 | for (; it != Children.end(); ++it) 69 | (*it)->OnAnimate(timeMs); 70 | } 71 | } 72 | 73 | void CBoneSceneNode::helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node) 74 | { 75 | Node->updateAbsolutePosition(); 76 | 77 | ISceneNodeList::const_iterator it = Node->getChildren().begin(); 78 | for (; it != Node->getChildren().end(); ++it) { 79 | helper_updateAbsolutePositionOfAllChildren((*it)); 80 | } 81 | } 82 | 83 | void CBoneSceneNode::updateAbsolutePositionOfAllChildren() 84 | { 85 | helper_updateAbsolutePositionOfAllChildren(this); 86 | } 87 | 88 | } // namespace scene 89 | } // namespace irr 90 | -------------------------------------------------------------------------------- /src/CBoneSceneNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | // Used with SkinnedMesh and IAnimatedMeshSceneNode, for boned meshes 8 | 9 | #include "IBoneSceneNode.h" 10 | 11 | #include 12 | 13 | namespace irr 14 | { 15 | namespace scene 16 | { 17 | 18 | class CBoneSceneNode : public IBoneSceneNode 19 | { 20 | public: 21 | //! constructor 22 | CBoneSceneNode(ISceneNode *parent, ISceneManager *mgr, 23 | s32 id = -1, u32 boneIndex = 0, 24 | const std::optional &boneName = std::nullopt); 25 | 26 | //! Returns the index of the bone 27 | u32 getBoneIndex() const override; 28 | 29 | //! Sets the animation mode of the bone. Returns true if successful. 30 | bool setAnimationMode(E_BONE_ANIMATION_MODE mode) override; 31 | 32 | //! Gets the current animation mode of the bone 33 | E_BONE_ANIMATION_MODE getAnimationMode() const override; 34 | 35 | //! returns the axis aligned bounding box of this node 36 | const core::aabbox3d &getBoundingBox() const override; 37 | 38 | /* 39 | //! Returns the relative transformation of the scene node. 40 | //core::matrix4 getRelativeTransformation() const override; 41 | */ 42 | 43 | void OnAnimate(u32 timeMs) override; 44 | 45 | void updateAbsolutePositionOfAllChildren() override; 46 | 47 | //! How the relative transformation of the bone is used 48 | void setSkinningSpace(E_BONE_SKINNING_SPACE space) override 49 | { 50 | SkinningSpace = space; 51 | } 52 | 53 | E_BONE_SKINNING_SPACE getSkinningSpace() const override 54 | { 55 | return SkinningSpace; 56 | } 57 | 58 | private: 59 | void helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node); 60 | 61 | u32 BoneIndex; 62 | 63 | core::aabbox3d Box; 64 | 65 | E_BONE_ANIMATION_MODE AnimationMode; 66 | E_BONE_SKINNING_SPACE SkinningSpace; 67 | }; 68 | 69 | } // end namespace scene 70 | } // end namespace irr 71 | -------------------------------------------------------------------------------- /src/CDummyTransformationSceneNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IDummyTransformationSceneNode.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | class CDummyTransformationSceneNode : public IDummyTransformationSceneNode 15 | { 16 | public: 17 | //! constructor 18 | CDummyTransformationSceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id); 19 | 20 | //! returns the axis aligned bounding box of this node 21 | const core::aabbox3d &getBoundingBox() const override; 22 | 23 | //! Returns a reference to the current relative transformation matrix. 24 | //! This is the matrix, this scene node uses instead of scale, translation 25 | //! and rotation. 26 | core::matrix4 &getRelativeTransformationMatrix() override; 27 | 28 | //! Returns the relative transformation of the scene node. 29 | core::matrix4 getRelativeTransformation() const override; 30 | 31 | //! does nothing. 32 | void render() override {} 33 | 34 | //! Returns type of the scene node 35 | ESCENE_NODE_TYPE getType() const override { return ESNT_DUMMY_TRANSFORMATION; } 36 | 37 | //! Creates a clone of this scene node and its children. 38 | ISceneNode *clone(ISceneNode *newParent = 0, ISceneManager *newManager = 0) override; 39 | 40 | private: 41 | // TODO: We can add least add some warnings to find troubles faster until we have 42 | // fixed bug id 2318691. 43 | const core::vector3df &getScale() const override; 44 | void setScale(const core::vector3df &scale) override; 45 | const core::vector3df &getRotation() const override; 46 | void setRotation(const core::vector3df &rotation) override; 47 | const core::vector3df &getPosition() const override; 48 | void setPosition(const core::vector3df &newpos) override; 49 | 50 | core::matrix4 RelativeTransformationMatrix; 51 | core::aabbox3d Box; 52 | }; 53 | 54 | } // end namespace scene 55 | } // end namespace irr 56 | -------------------------------------------------------------------------------- /src/CEmptySceneNode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CEmptySceneNode.h" 6 | #include "ISceneManager.h" 7 | 8 | namespace irr 9 | { 10 | namespace scene 11 | { 12 | 13 | //! constructor 14 | CEmptySceneNode::CEmptySceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id) : 15 | ISceneNode(parent, mgr, id) 16 | { 17 | #ifdef _DEBUG 18 | setDebugName("CEmptySceneNode"); 19 | #endif 20 | 21 | setAutomaticCulling(scene::EAC_OFF); 22 | } 23 | 24 | //! pre render event 25 | void CEmptySceneNode::OnRegisterSceneNode() 26 | { 27 | if (IsVisible) 28 | SceneManager->registerNodeForRendering(this); 29 | 30 | ISceneNode::OnRegisterSceneNode(); 31 | } 32 | 33 | //! render 34 | void CEmptySceneNode::render() 35 | { 36 | // do nothing 37 | } 38 | 39 | //! returns the axis aligned bounding box of this node 40 | const core::aabbox3d &CEmptySceneNode::getBoundingBox() const 41 | { 42 | return Box; 43 | } 44 | 45 | //! Creates a clone of this scene node and its children. 46 | ISceneNode *CEmptySceneNode::clone(ISceneNode *newParent, ISceneManager *newManager) 47 | { 48 | if (!newParent) 49 | newParent = Parent; 50 | if (!newManager) 51 | newManager = SceneManager; 52 | 53 | CEmptySceneNode *nb = new CEmptySceneNode(newParent, 54 | newManager, ID); 55 | 56 | nb->cloneMembers(this, newManager); 57 | nb->Box = Box; 58 | 59 | if (newParent) 60 | nb->drop(); 61 | return nb; 62 | } 63 | 64 | } // end namespace scene 65 | } // end namespace irr 66 | -------------------------------------------------------------------------------- /src/CEmptySceneNode.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "ISceneNode.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | class CEmptySceneNode : public ISceneNode 15 | { 16 | public: 17 | //! constructor 18 | CEmptySceneNode(ISceneNode *parent, ISceneManager *mgr, s32 id); 19 | 20 | //! returns the axis aligned bounding box of this node 21 | const core::aabbox3d &getBoundingBox() const override; 22 | 23 | //! This method is called just before the rendering process of the whole scene. 24 | void OnRegisterSceneNode() override; 25 | 26 | //! does nothing. 27 | void render() override; 28 | 29 | //! Returns type of the scene node 30 | ESCENE_NODE_TYPE getType() const override { return ESNT_EMPTY; } 31 | 32 | //! Creates a clone of this scene node and its children. 33 | ISceneNode *clone(ISceneNode *newParent = 0, ISceneManager *newManager = 0) override; 34 | 35 | private: 36 | core::aabbox3d Box; 37 | }; 38 | 39 | } // end namespace scene 40 | } // end namespace irr 41 | -------------------------------------------------------------------------------- /src/CFPSCounter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CFPSCounter.h" 6 | #include "irrMath.h" 7 | 8 | namespace irr 9 | { 10 | namespace video 11 | { 12 | 13 | CFPSCounter::CFPSCounter() : 14 | FPS(60), Primitive(0), StartTime(0), FramesCounted(0), 15 | PrimitivesCounted(0), PrimitiveAverage(0), PrimitiveTotal(0) 16 | { 17 | } 18 | 19 | //! returns current fps 20 | s32 CFPSCounter::getFPS() const 21 | { 22 | return FPS; 23 | } 24 | 25 | //! returns current primitive count 26 | u32 CFPSCounter::getPrimitive() const 27 | { 28 | return Primitive; 29 | } 30 | 31 | //! returns average primitive count of last period 32 | u32 CFPSCounter::getPrimitiveAverage() const 33 | { 34 | return PrimitiveAverage; 35 | } 36 | 37 | //! returns accumulated primitive count since start 38 | u32 CFPSCounter::getPrimitiveTotal() const 39 | { 40 | return PrimitiveTotal; 41 | } 42 | 43 | //! to be called every frame 44 | void CFPSCounter::registerFrame(u32 now, u32 primitivesDrawn) 45 | { 46 | ++FramesCounted; 47 | PrimitiveTotal += primitivesDrawn; 48 | PrimitivesCounted += primitivesDrawn; 49 | Primitive = primitivesDrawn; 50 | 51 | const u32 milliseconds = now - StartTime; 52 | 53 | if (milliseconds >= 1500) { 54 | const f32 invMilli = core::reciprocal((f32)milliseconds); 55 | 56 | FPS = core::ceil32((1000 * FramesCounted) * invMilli); 57 | PrimitiveAverage = core::ceil32((1000 * PrimitivesCounted) * invMilli); 58 | 59 | FramesCounted = 0; 60 | PrimitivesCounted = 0; 61 | StartTime = now; 62 | } 63 | } 64 | 65 | } // end namespace video 66 | } // end namespace irr 67 | -------------------------------------------------------------------------------- /src/CFPSCounter.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | class CFPSCounter 15 | { 16 | public: 17 | CFPSCounter(); 18 | 19 | //! returns current fps 20 | s32 getFPS() const; 21 | 22 | //! returns primitive count 23 | u32 getPrimitive() const; 24 | 25 | //! returns average primitive count of last period 26 | u32 getPrimitiveAverage() const; 27 | 28 | //! returns accumulated primitive count since start 29 | u32 getPrimitiveTotal() const; 30 | 31 | //! to be called every frame 32 | void registerFrame(u32 now, u32 primitive); 33 | 34 | private: 35 | s32 FPS; 36 | u32 Primitive; 37 | u32 StartTime; 38 | 39 | u32 FramesCounted; 40 | u32 PrimitivesCounted; 41 | u32 PrimitiveAverage; 42 | u32 PrimitiveTotal; 43 | }; 44 | 45 | } // end namespace video 46 | } // end namespace irr 47 | -------------------------------------------------------------------------------- /src/CGLXManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Christian Stehno 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | 7 | #ifdef _IRR_COMPILE_WITH_GLX_MANAGER_ 8 | 9 | #include "SIrrCreationParameters.h" 10 | #include "SExposedVideoData.h" 11 | #include "IContextManager.h" 12 | #include "SColor.h" 13 | #include 14 | #include 15 | 16 | // we can't include glx.h here, because gl.h has incompatible types with ogl es headers and it 17 | // cause redefinition errors, thats why we use ugly trick with void* types and casts. 18 | 19 | namespace irr 20 | { 21 | namespace video 22 | { 23 | // GLX manager. 24 | class CGLXManager : public IContextManager 25 | { 26 | public: 27 | //! Constructor. 28 | CGLXManager(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &videodata, int screennr); 29 | 30 | //! Destructor 31 | ~CGLXManager(); 32 | 33 | // Initialize 34 | bool initialize(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &data) override; 35 | 36 | // Terminate 37 | void terminate() override; 38 | 39 | // Create surface. 40 | bool generateSurface() override; 41 | 42 | // Destroy surface. 43 | void destroySurface() override; 44 | 45 | // Create context. 46 | bool generateContext() override; 47 | 48 | // Destroy context. 49 | void destroyContext() override; 50 | 51 | //! Get current context 52 | const SExposedVideoData &getContext() const override; 53 | 54 | //! Change render context, disable old and activate new defined by videoData 55 | bool activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero) override; 56 | 57 | // Get procedure address. 58 | void *getProcAddress(const std::string &procName) override; 59 | 60 | // Swap buffers. 61 | bool swapBuffers() override; 62 | 63 | XVisualInfo *getVisual() const { return VisualInfo; } // return XVisualInfo 64 | 65 | private: 66 | SIrrlichtCreationParameters Params; 67 | SExposedVideoData PrimaryContext; 68 | SExposedVideoData CurrentContext; 69 | XVisualInfo *VisualInfo; 70 | void *glxFBConfig; // GLXFBConfig 71 | XID GlxWin; // GLXWindow 72 | }; 73 | } 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/CGUICheckBox.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUICheckBox.h" 8 | 9 | namespace irr 10 | { 11 | namespace gui 12 | { 13 | 14 | class CGUICheckBox : public IGUICheckBox 15 | { 16 | public: 17 | //! constructor 18 | CGUICheckBox(bool checked, IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect rectangle); 19 | 20 | //! set if box is checked 21 | void setChecked(bool checked) override; 22 | 23 | //! returns if box is checked 24 | bool isChecked() const override; 25 | 26 | //! Sets whether to draw the background 27 | void setDrawBackground(bool draw) override; 28 | 29 | //! Checks if background drawing is enabled 30 | /** \return true if background drawing is enabled, false otherwise */ 31 | bool isDrawBackgroundEnabled() const override; 32 | 33 | //! Sets whether to draw the border 34 | void setDrawBorder(bool draw) override; 35 | 36 | //! Checks if border drawing is enabled 37 | /** \return true if border drawing is enabled, false otherwise */ 38 | bool isDrawBorderEnabled() const override; 39 | 40 | //! called if an event happened. 41 | bool OnEvent(const SEvent &event) override; 42 | 43 | //! draws the element and its children 44 | void draw() override; 45 | 46 | private: 47 | u32 CheckTime; 48 | bool Pressed; 49 | bool Checked; 50 | bool Border; 51 | bool Background; 52 | }; 53 | 54 | } // end namespace gui 55 | } // end namespace irr 56 | -------------------------------------------------------------------------------- /src/CGUIFileOpenDialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIFileOpenDialog.h" 8 | #include "IGUIButton.h" 9 | #include "IGUIListBox.h" 10 | #include "IGUIEditBox.h" 11 | #include "IFileSystem.h" 12 | 13 | namespace irr 14 | { 15 | namespace gui 16 | { 17 | 18 | class CGUIFileOpenDialog : public IGUIFileOpenDialog 19 | { 20 | public: 21 | //! constructor 22 | CGUIFileOpenDialog(const wchar_t *title, IGUIEnvironment *environment, 23 | IGUIElement *parent, s32 id, bool restoreCWD = false, 24 | io::path::char_type *startDir = 0); 25 | 26 | //! destructor 27 | virtual ~CGUIFileOpenDialog(); 28 | 29 | //! returns the filename of the selected file. Returns NULL, if no file was selected. 30 | const wchar_t *getFileName() const override; 31 | 32 | //! Returns the filename of the selected file. Is empty if no file was selected. 33 | const io::path &getFileNameP() const override; 34 | 35 | //! Returns the directory of the selected file. Returns NULL, if no directory was selected. 36 | const io::path &getDirectoryName() const override; 37 | 38 | //! Returns the directory of the selected file converted to wide characters. Returns NULL if no directory was selected. 39 | const wchar_t *getDirectoryNameW() const override; 40 | 41 | //! called if an event happened. 42 | bool OnEvent(const SEvent &event) override; 43 | 44 | //! draws the element and its children 45 | void draw() override; 46 | 47 | protected: 48 | void setFileName(const irr::io::path &name); 49 | void setDirectoryName(const irr::io::path &name); 50 | 51 | //! Ensure filenames are converted correct depending on wide-char settings 52 | void pathToStringW(irr::core::stringw &result, const irr::io::path &p); 53 | 54 | //! fills the listbox with files. 55 | void fillListBox(); 56 | 57 | //! sends the event that the file has been selected. 58 | void sendSelectedEvent(EGUI_EVENT_TYPE type); 59 | 60 | //! sends the event that the file choose process has been canceld 61 | void sendCancelEvent(); 62 | 63 | core::position2d DragStart; 64 | io::path FileName; 65 | core::stringw FileNameW; 66 | io::path FileDirectory; 67 | io::path FileDirectoryFlat; 68 | core::stringw FileDirectoryFlatW; 69 | io::path RestoreDirectory; 70 | io::path StartDirectory; 71 | 72 | IGUIButton *CloseButton; 73 | IGUIButton *OKButton; 74 | IGUIButton *CancelButton; 75 | IGUIListBox *FileBox; 76 | IGUIEditBox *FileNameText; 77 | IGUIElement *EventParent; 78 | io::IFileSystem *FileSystem; 79 | io::IFileList *FileList; 80 | bool Dragging; 81 | }; 82 | 83 | } // end namespace gui 84 | } // end namespace irr 85 | -------------------------------------------------------------------------------- /src/CGUIImageList.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de 3 | // modified by Thomas Alten 4 | 5 | #include "CGUIImageList.h" 6 | 7 | namespace irr 8 | { 9 | namespace gui 10 | { 11 | 12 | //! constructor 13 | CGUIImageList::CGUIImageList(video::IVideoDriver *driver) : 14 | Driver(driver), 15 | Texture(0), 16 | ImageCount(0), 17 | ImageSize(0, 0), 18 | ImagesPerRow(0), 19 | UseAlphaChannel(false) 20 | { 21 | #ifdef _DEBUG 22 | setDebugName("CGUIImageList"); 23 | #endif 24 | 25 | if (Driver) { 26 | Driver->grab(); 27 | } 28 | } 29 | 30 | //! destructor 31 | CGUIImageList::~CGUIImageList() 32 | { 33 | if (Driver) { 34 | Driver->drop(); 35 | } 36 | 37 | if (Texture) { 38 | Texture->drop(); 39 | } 40 | } 41 | 42 | //! Creates the image list from texture. 43 | bool CGUIImageList::createImageList(video::ITexture *texture, 44 | core::dimension2d imageSize, 45 | bool useAlphaChannel) 46 | { 47 | if (!texture) { 48 | return false; 49 | } 50 | 51 | Texture = texture; 52 | Texture->grab(); 53 | 54 | ImageSize = imageSize; 55 | 56 | ImagesPerRow = Texture->getSize().Width / ImageSize.Width; 57 | ImageCount = ImagesPerRow * Texture->getSize().Height / ImageSize.Height; 58 | 59 | UseAlphaChannel = useAlphaChannel; 60 | 61 | return true; 62 | } 63 | 64 | //! Draws an image and clips it to the specified rectangle if wanted 65 | void CGUIImageList::draw(s32 index, const core::position2d &destPos, 66 | const core::rect *clip /*= 0*/) 67 | { 68 | core::rect sourceRect; 69 | 70 | if (!Driver || index < 0 || index >= ImageCount) { 71 | return; 72 | } 73 | 74 | sourceRect.UpperLeftCorner.X = (index % ImagesPerRow) * ImageSize.Width; 75 | sourceRect.UpperLeftCorner.Y = (index / ImagesPerRow) * ImageSize.Height; 76 | sourceRect.LowerRightCorner.X = sourceRect.UpperLeftCorner.X + ImageSize.Width; 77 | sourceRect.LowerRightCorner.Y = sourceRect.UpperLeftCorner.Y + ImageSize.Height; 78 | 79 | Driver->draw2DImage(Texture, destPos, sourceRect, clip, 80 | video::SColor(255, 255, 255, 255), UseAlphaChannel); 81 | } 82 | 83 | } // end namespace gui 84 | } // end namespace irr 85 | -------------------------------------------------------------------------------- /src/CGUIImageList.h: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de 3 | 4 | #pragma once 5 | 6 | #include "IGUIImageList.h" 7 | #include "IVideoDriver.h" 8 | 9 | namespace irr 10 | { 11 | namespace gui 12 | { 13 | 14 | class CGUIImageList : public IGUIImageList 15 | { 16 | public: 17 | //! constructor 18 | CGUIImageList(video::IVideoDriver *Driver); 19 | 20 | //! destructor 21 | virtual ~CGUIImageList(); 22 | 23 | //! Creates the image list from texture. 24 | //! \param texture: The texture to use 25 | //! \param imageSize: Size of a single image 26 | //! \param useAlphaChannel: true if the alpha channel from the texture should be used 27 | //! \return 28 | //! true if the image list was created 29 | bool createImageList(video::ITexture *texture, 30 | core::dimension2d imageSize, 31 | bool useAlphaChannel); 32 | 33 | //! Draws an image and clips it to the specified rectangle if wanted 34 | //! \param index: Index of the image 35 | //! \param destPos: Position of the image to draw 36 | //! \param clip: Optional pointer to a rectangle against which the text will be clipped. 37 | //! If the pointer is null, no clipping will be done. 38 | virtual void draw(s32 index, const core::position2d &destPos, 39 | const core::rect *clip = 0) override; 40 | 41 | //! Returns the count of Images in the list. 42 | //! \return Returns the count of Images in the list. 43 | s32 getImageCount() const override 44 | { 45 | return ImageCount; 46 | } 47 | 48 | //! Returns the size of the images in the list. 49 | //! \return Returns the size of the images in the list. 50 | core::dimension2d getImageSize() const override 51 | { 52 | return ImageSize; 53 | } 54 | 55 | private: 56 | video::IVideoDriver *Driver; 57 | video::ITexture *Texture; 58 | s32 ImageCount; 59 | core::dimension2d ImageSize; 60 | s32 ImagesPerRow; 61 | bool UseAlphaChannel; 62 | }; 63 | 64 | } // end namespace gui 65 | } // end namespace irr 66 | -------------------------------------------------------------------------------- /src/CGUIScrollBar.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUIScrollBar.h" 8 | #include "IGUIButton.h" 9 | 10 | namespace irr 11 | { 12 | namespace gui 13 | { 14 | 15 | class CGUIScrollBar : public IGUIScrollBar 16 | { 17 | public: 18 | //! constructor 19 | CGUIScrollBar(bool horizontal, IGUIEnvironment *environment, 20 | IGUIElement *parent, s32 id, core::rect rectangle, 21 | bool noclip = false); 22 | 23 | //! destructor 24 | virtual ~CGUIScrollBar(); 25 | 26 | //! called if an event happened. 27 | bool OnEvent(const SEvent &event) override; 28 | 29 | //! draws the element and its children 30 | void draw() override; 31 | 32 | void OnPostRender(u32 timeMs) override; 33 | 34 | //! gets the maximum value of the scrollbar. 35 | s32 getMax() const override; 36 | 37 | //! sets the maximum value of the scrollbar. 38 | void setMax(s32 max) override; 39 | 40 | //! gets the minimum value of the scrollbar. 41 | s32 getMin() const override; 42 | 43 | //! sets the minimum value of the scrollbar. 44 | void setMin(s32 min) override; 45 | 46 | //! gets the small step value 47 | s32 getSmallStep() const override; 48 | 49 | //! sets the small step value 50 | void setSmallStep(s32 step) override; 51 | 52 | //! gets the large step value 53 | s32 getLargeStep() const override; 54 | 55 | //! sets the large step value 56 | void setLargeStep(s32 step) override; 57 | 58 | //! gets the current position of the scrollbar 59 | s32 getPos() const override; 60 | 61 | //! sets the position of the scrollbar 62 | void setPos(s32 pos) override; 63 | 64 | //! updates the rectangle 65 | void updateAbsolutePosition() override; 66 | 67 | private: 68 | void refreshControls(); 69 | s32 getPosFromMousePos(const core::position2di &p) const; 70 | 71 | IGUIButton *UpButton; 72 | IGUIButton *DownButton; 73 | 74 | core::rect SliderRect; 75 | 76 | bool Dragging; 77 | bool Horizontal; 78 | bool DraggedBySlider; 79 | bool TrayClick; 80 | s32 Pos; 81 | s32 DrawPos; 82 | s32 DrawHeight; 83 | s32 Min; 84 | s32 Max; 85 | s32 SmallStep; 86 | s32 LargeStep; 87 | s32 DesiredPos; 88 | u32 LastChange; 89 | video::SColor CurrentIconColor; 90 | 91 | f32 range() const { return (f32)(Max - Min); } 92 | }; 93 | 94 | } // end namespace gui 95 | } // end namespace irr 96 | -------------------------------------------------------------------------------- /src/CGUISpriteBank.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IGUISpriteBank.h" 8 | 9 | namespace irr 10 | { 11 | 12 | namespace video 13 | { 14 | class IVideoDriver; 15 | class ITexture; 16 | } 17 | 18 | namespace gui 19 | { 20 | 21 | class IGUIEnvironment; 22 | 23 | //! Sprite bank interface. 24 | class CGUISpriteBank : public IGUISpriteBank 25 | { 26 | public: 27 | CGUISpriteBank(IGUIEnvironment *env); 28 | virtual ~CGUISpriteBank(); 29 | 30 | core::array> &getPositions() override; 31 | core::array &getSprites() override; 32 | 33 | u32 getTextureCount() const override; 34 | video::ITexture *getTexture(u32 index) const override; 35 | void addTexture(video::ITexture *texture) override; 36 | void setTexture(u32 index, video::ITexture *texture) override; 37 | 38 | //! Add the texture and use it for a single non-animated sprite. 39 | s32 addTextureAsSprite(video::ITexture *texture) override; 40 | 41 | //! clears sprites, rectangles and textures 42 | void clear() override; 43 | 44 | //! Draws a sprite in 2d with position and color 45 | virtual void draw2DSprite(u32 index, const core::position2di &pos, const core::rect *clip = 0, 46 | const video::SColor &color = video::SColor(255, 255, 255, 255), 47 | u32 starttime = 0, u32 currenttime = 0, bool loop = true, bool center = false) override; 48 | 49 | //! Draws a sprite in 2d with destination rectangle and colors 50 | virtual void draw2DSprite(u32 index, const core::rect &destRect, 51 | const core::rect *clip = 0, 52 | const video::SColor *const colors = 0, 53 | u32 timeTicks = 0, 54 | bool loop = true) override; 55 | 56 | //! Draws a sprite batch in 2d using an array of positions and a color 57 | virtual void draw2DSpriteBatch(const core::array &indices, const core::array &pos, 58 | const core::rect *clip = 0, 59 | const video::SColor &color = video::SColor(255, 255, 255, 255), 60 | u32 starttime = 0, u32 currenttime = 0, 61 | bool loop = true, bool center = false) override; 62 | 63 | protected: 64 | bool getFrameNr(u32 &frameNr, u32 index, u32 time, bool loop) const; 65 | 66 | struct SDrawBatch 67 | { 68 | core::array positions; 69 | core::array sourceRects; 70 | u32 textureNumber; 71 | }; 72 | 73 | core::array Sprites; 74 | core::array> Rectangles; 75 | core::array Textures; 76 | IGUIEnvironment *Environment; 77 | video::IVideoDriver *Driver; 78 | }; 79 | 80 | } // end namespace gui 81 | } // end namespace irr 82 | -------------------------------------------------------------------------------- /src/CImageLoaderBMP.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IImageLoader.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | // byte-align structures 15 | #include "irrpack.h" 16 | 17 | struct SBMPHeader 18 | { 19 | u16 Id; // BM - Windows 3.1x, 95, NT, 98, 2000, ME, XP 20 | // BA - OS/2 Bitmap Array 21 | // CI - OS/2 Color Icon 22 | // CP - OS/2 Color Pointer 23 | // IC - OS/2 Icon 24 | // PT - OS/2 Pointer 25 | u32 FileSize; 26 | u32 Reserved; 27 | u32 BitmapDataOffset; 28 | u32 BitmapHeaderSize; // should be 28h for windows bitmaps or 29 | // 0Ch for OS/2 1.x or F0h for OS/2 2.x 30 | u32 Width; 31 | u32 Height; 32 | u16 Planes; 33 | u16 BPP; // 1: Monochrome bitmap 34 | // 4: 16 color bitmap 35 | // 8: 256 color bitmap 36 | // 16: 16bit (high color) bitmap 37 | // 24: 24bit (true color) bitmap 38 | // 32: 32bit (true color) bitmap 39 | 40 | u32 Compression; // 0: none (Also identified by BI_RGB) 41 | // 1: RLE 8-bit / pixel (Also identified by BI_RLE4) 42 | // 2: RLE 4-bit / pixel (Also identified by BI_RLE8) 43 | // 3: Bitfields (Also identified by BI_BITFIELDS) 44 | 45 | u32 BitmapDataSize; // Size of the bitmap data in bytes. This number must be rounded to the next 4 byte boundary. 46 | u32 PixelPerMeterX; 47 | u32 PixelPerMeterY; 48 | u32 Colors; 49 | u32 ImportantColors; 50 | } PACK_STRUCT; 51 | 52 | // Default alignment 53 | #include "irrunpack.h" 54 | 55 | /*! 56 | Surface Loader for Windows bitmaps 57 | */ 58 | class CImageLoaderBMP : public IImageLoader 59 | { 60 | public: 61 | //! constructor 62 | CImageLoaderBMP(); 63 | 64 | //! returns true if the file maybe is able to be loaded by this class 65 | //! based on the file extension (e.g. ".tga") 66 | bool isALoadableFileExtension(const io::path &filename) const override; 67 | 68 | //! returns true if the file maybe is able to be loaded by this class 69 | bool isALoadableFileFormat(io::IReadFile *file) const override; 70 | 71 | //! creates a surface from the file 72 | IImage *loadImage(io::IReadFile *file) const override; 73 | 74 | private: 75 | void decompress8BitRLE(u8 *&BmpData, s32 size, s32 width, s32 height, s32 pitch) const; 76 | 77 | void decompress4BitRLE(u8 *&BmpData, s32 size, s32 width, s32 height, s32 pitch) const; 78 | }; 79 | 80 | } // end namespace video 81 | } // end namespace irr 82 | -------------------------------------------------------------------------------- /src/CImageLoaderPNG.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | // this file was created by rt (www.tomkorp.com), based on ttk's png-reader 6 | // i wanted to be able to read in PNG images with irrlicht :) 7 | // why? lossless compression with 8-bit alpha channel! 8 | 9 | #pragma once 10 | 11 | #include "IImageLoader.h" 12 | 13 | namespace irr 14 | { 15 | namespace video 16 | { 17 | 18 | //! Surface Loader for PNG files 19 | class CImageLoaderPng : public IImageLoader 20 | { 21 | public: 22 | //! returns true if the file maybe is able to be loaded by this class 23 | //! based on the file extension (e.g. ".png") 24 | bool isALoadableFileExtension(const io::path &filename) const override; 25 | 26 | //! returns true if the file maybe is able to be loaded by this class 27 | bool isALoadableFileFormat(io::IReadFile *file) const override; 28 | 29 | //! creates a surface from the file 30 | IImage *loadImage(io::IReadFile *file) const override; 31 | }; 32 | 33 | } // end namespace video 34 | } // end namespace irr 35 | -------------------------------------------------------------------------------- /src/CImageLoaderTGA.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IImageLoader.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | // byte-align structures 15 | #include "irrpack.h" 16 | 17 | // these structs are also used in the TGA writer 18 | struct STGAHeader 19 | { 20 | u8 IdLength; 21 | u8 ColorMapType; 22 | u8 ImageType; 23 | u8 FirstEntryIndex[2]; 24 | u16 ColorMapLength; 25 | u8 ColorMapEntrySize; 26 | u8 XOrigin[2]; 27 | u8 YOrigin[2]; 28 | u16 ImageWidth; 29 | u16 ImageHeight; 30 | u8 PixelDepth; 31 | u8 ImageDescriptor; 32 | } PACK_STRUCT; 33 | 34 | struct STGAFooter 35 | { 36 | u32 ExtensionOffset; 37 | u32 DeveloperOffset; 38 | c8 Signature[18]; 39 | } PACK_STRUCT; 40 | 41 | // Default alignment 42 | #include "irrunpack.h" 43 | 44 | /*! 45 | Surface Loader for targa images 46 | */ 47 | class CImageLoaderTGA : public IImageLoader 48 | { 49 | public: 50 | //! returns true if the file maybe is able to be loaded by this class 51 | //! based on the file extension (e.g. ".tga") 52 | bool isALoadableFileExtension(const io::path &filename) const override; 53 | 54 | //! returns true if the file maybe is able to be loaded by this class 55 | bool isALoadableFileFormat(io::IReadFile *file) const override; 56 | 57 | //! creates a surface from the file 58 | IImage *loadImage(io::IReadFile *file) const override; 59 | 60 | private: 61 | //! loads a compressed tga. Was written and sent in by Jon Pry, thank you very much! 62 | u8 *loadCompressedImage(io::IReadFile *file, const STGAHeader &header) const; 63 | }; 64 | 65 | } // end namespace video 66 | } // end namespace irr 67 | -------------------------------------------------------------------------------- /src/CImageWriterJPG.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IImageWriter.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | class CImageWriterJPG : public IImageWriter 15 | { 16 | public: 17 | //! constructor 18 | CImageWriterJPG(); 19 | 20 | //! return true if this writer can write a file with the given extension 21 | bool isAWriteableFileExtension(const io::path &filename) const override; 22 | 23 | //! write image to file 24 | bool writeImage(io::IWriteFile *file, IImage *image, u32 param) const override; 25 | }; 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/CImageWriterPNG.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IImageWriter.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | class CImageWriterPNG : public IImageWriter 15 | { 16 | public: 17 | //! constructor 18 | CImageWriterPNG(); 19 | 20 | //! return true if this writer can write a file with the given extension 21 | bool isAWriteableFileExtension(const io::path &filename) const override; 22 | 23 | //! write image to file 24 | bool writeImage(io::IWriteFile *file, IImage *image, u32 param) const override; 25 | }; 26 | 27 | } // namespace video 28 | } // namespace irr 29 | -------------------------------------------------------------------------------- /src/CLimitReadFile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CLimitReadFile.h" 6 | #include "irrMath.h" 7 | #include "irrString.h" 8 | 9 | namespace irr 10 | { 11 | namespace io 12 | { 13 | 14 | CLimitReadFile::CLimitReadFile(IReadFile *alreadyOpenedFile, long pos, 15 | long areaSize, const io::path &name) : 16 | Filename(name), 17 | AreaStart(0), AreaEnd(0), Pos(0), 18 | File(alreadyOpenedFile) 19 | { 20 | #ifdef _DEBUG 21 | setDebugName("CLimitReadFile"); 22 | #endif 23 | 24 | if (File) { 25 | File->grab(); 26 | AreaStart = pos; 27 | AreaEnd = AreaStart + areaSize; 28 | } 29 | } 30 | 31 | CLimitReadFile::~CLimitReadFile() 32 | { 33 | if (File) 34 | File->drop(); 35 | } 36 | 37 | //! returns how much was read 38 | size_t CLimitReadFile::read(void *buffer, size_t sizeToRead) 39 | { 40 | if (0 == File) 41 | return 0; 42 | 43 | #if 1 44 | long r = AreaStart + Pos; 45 | long toRead = core::min_(AreaEnd, r + (long)sizeToRead) - core::max_(AreaStart, r); 46 | if (toRead < 0) 47 | return 0; 48 | File->seek(r); 49 | r = (long)File->read(buffer, toRead); 50 | Pos += r; 51 | return r; 52 | #else 53 | const long pos = File->getPos(); 54 | 55 | if (pos >= AreaEnd) 56 | return 0; 57 | 58 | if (pos + (long)sizeToRead >= AreaEnd) 59 | sizeToRead = AreaEnd - pos; 60 | 61 | return File->read(buffer, sizeToRead); 62 | #endif 63 | } 64 | 65 | //! changes position in file, returns true if successful 66 | bool CLimitReadFile::seek(long finalPos, bool relativeMovement) 67 | { 68 | #if 1 69 | Pos = core::s32_clamp(finalPos + (relativeMovement ? Pos : 0), 0, AreaEnd - AreaStart); 70 | return true; 71 | #else 72 | const long pos = File->getPos(); 73 | 74 | if (relativeMovement) { 75 | if (pos + finalPos > AreaEnd) 76 | finalPos = AreaEnd - pos; 77 | } else { 78 | finalPos += AreaStart; 79 | if (finalPos > AreaEnd) 80 | return false; 81 | } 82 | 83 | return File->seek(finalPos, relativeMovement); 84 | #endif 85 | } 86 | 87 | //! returns size of file 88 | long CLimitReadFile::getSize() const 89 | { 90 | return AreaEnd - AreaStart; 91 | } 92 | 93 | //! returns where in the file we are. 94 | long CLimitReadFile::getPos() const 95 | { 96 | #if 1 97 | return Pos; 98 | #else 99 | return File->getPos() - AreaStart; 100 | #endif 101 | } 102 | 103 | //! returns name of file 104 | const io::path &CLimitReadFile::getFileName() const 105 | { 106 | return Filename; 107 | } 108 | 109 | IReadFile *createLimitReadFile(const io::path &fileName, IReadFile *alreadyOpenedFile, long pos, long areaSize) 110 | { 111 | return new CLimitReadFile(alreadyOpenedFile, pos, areaSize, fileName); 112 | } 113 | 114 | } // end namespace io 115 | } // end namespace irr 116 | -------------------------------------------------------------------------------- /src/CLimitReadFile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReadFile.h" 8 | #include "irrString.h" 9 | 10 | namespace irr 11 | { 12 | class CUnicodeConverter; 13 | 14 | namespace io 15 | { 16 | 17 | /*! this is a read file, which is limited to some boundaries, 18 | so that it may only start from a certain file position 19 | and may only read until a certain file position. 20 | This can be useful, for example for reading uncompressed files 21 | in an archive (zip, tar). 22 | !*/ 23 | class CLimitReadFile : public IReadFile 24 | { 25 | public: 26 | CLimitReadFile(IReadFile *alreadyOpenedFile, long pos, long areaSize, const io::path &name); 27 | 28 | virtual ~CLimitReadFile(); 29 | 30 | //! returns how much was read 31 | size_t read(void *buffer, size_t sizeToRead) override; 32 | 33 | //! changes position in file, returns true if successful 34 | //! if relativeMovement==true, the pos is changed relative to current pos, 35 | //! otherwise from begin of file 36 | bool seek(long finalPos, bool relativeMovement = false) override; 37 | 38 | //! returns size of file 39 | long getSize() const override; 40 | 41 | //! returns where in the file we are. 42 | long getPos() const override; 43 | 44 | //! returns name of file 45 | const io::path &getFileName() const override; 46 | 47 | //! Get the type of the class implementing this interface 48 | EREAD_FILE_TYPE getType() const override 49 | { 50 | return ERFT_LIMIT_READ_FILE; 51 | } 52 | 53 | private: 54 | io::path Filename; 55 | long AreaStart; 56 | long AreaEnd; 57 | long Pos; 58 | IReadFile *File; 59 | }; 60 | 61 | } // end namespace io 62 | } // end namespace irr 63 | -------------------------------------------------------------------------------- /src/CLogger.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CLogger.h" 6 | 7 | namespace irr 8 | { 9 | 10 | CLogger::CLogger(IEventReceiver *r) : 11 | LogLevel(ELL_INFORMATION), Receiver(r) 12 | { 13 | #ifdef _DEBUG 14 | setDebugName("CLogger"); 15 | #endif 16 | } 17 | 18 | //! Returns the current set log level. 19 | ELOG_LEVEL CLogger::getLogLevel() const 20 | { 21 | return LogLevel; 22 | } 23 | 24 | //! Sets a new log level. 25 | void CLogger::setLogLevel(ELOG_LEVEL ll) 26 | { 27 | LogLevel = ll; 28 | } 29 | 30 | //! Prints out a text into the log 31 | void CLogger::log(const c8 *text, ELOG_LEVEL ll) 32 | { 33 | if (ll < LogLevel) 34 | return; 35 | 36 | if (Receiver) { 37 | SEvent event; 38 | event.EventType = EET_LOG_TEXT_EVENT; 39 | event.LogEvent.Text = text; 40 | event.LogEvent.Level = ll; 41 | if (Receiver->OnEvent(event)) 42 | return; 43 | } 44 | 45 | os::Printer::print(text); 46 | } 47 | 48 | //! Prints out a text into the log 49 | void CLogger::log(const c8 *text, const c8 *hint, ELOG_LEVEL ll) 50 | { 51 | if (ll < LogLevel) 52 | return; 53 | 54 | core::stringc s = text; 55 | s += ": "; 56 | s += hint; 57 | log(s.c_str(), ll); 58 | } 59 | 60 | //! Sets a new event receiver 61 | void CLogger::setReceiver(IEventReceiver *r) 62 | { 63 | Receiver = r; 64 | } 65 | 66 | } // end namespace irr 67 | -------------------------------------------------------------------------------- /src/CLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "ILogger.h" 8 | #include "os.h" 9 | #include "irrString.h" 10 | #include "IEventReceiver.h" 11 | 12 | namespace irr 13 | { 14 | 15 | //! Class for logging messages, warnings and errors to stdout 16 | class CLogger : public ILogger 17 | { 18 | public: 19 | CLogger(IEventReceiver *r); 20 | 21 | //! Returns the current set log level. 22 | ELOG_LEVEL getLogLevel() const override; 23 | 24 | //! Sets a new log level. void setLogLevel(ELOG_LEVEL ll) override; 25 | void setLogLevel(ELOG_LEVEL ll) override; 26 | 27 | //! Prints out a text into the log 28 | void log(const c8 *text, ELOG_LEVEL ll = ELL_INFORMATION) override; 29 | 30 | //! Prints out a text into the log 31 | void log(const c8 *text, const c8 *hint, ELOG_LEVEL ll = ELL_INFORMATION) override; 32 | 33 | //! Sets a new event receiver 34 | void setReceiver(IEventReceiver *r); 35 | 36 | private: 37 | ELOG_LEVEL LogLevel; 38 | IEventReceiver *Receiver; 39 | }; 40 | 41 | } // end namespace 42 | -------------------------------------------------------------------------------- /src/CMemoryFile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IMemoryReadFile.h" 8 | #include "IWriteFile.h" 9 | #include "irrString.h" 10 | 11 | namespace irr 12 | { 13 | 14 | namespace io 15 | { 16 | 17 | /*! 18 | Class for reading from memory. 19 | */ 20 | class CMemoryReadFile : public IMemoryReadFile 21 | { 22 | public: 23 | //! Constructor 24 | CMemoryReadFile(const void *memory, long len, const io::path &fileName, bool deleteMemoryWhenDropped); 25 | 26 | //! Destructor 27 | virtual ~CMemoryReadFile(); 28 | 29 | //! returns how much was read 30 | size_t read(void *buffer, size_t sizeToRead) override; 31 | 32 | //! changes position in file, returns true if successful 33 | bool seek(long finalPos, bool relativeMovement = false) override; 34 | 35 | //! returns size of file 36 | long getSize() const override; 37 | 38 | //! returns where in the file we are. 39 | long getPos() const override; 40 | 41 | //! returns name of file 42 | const io::path &getFileName() const override; 43 | 44 | //! Get the type of the class implementing this interface 45 | EREAD_FILE_TYPE getType() const override 46 | { 47 | return ERFT_MEMORY_READ_FILE; 48 | } 49 | 50 | //! Get direct access to internal buffer 51 | const void *getBuffer() const override 52 | { 53 | return Buffer; 54 | } 55 | 56 | private: 57 | const void *Buffer; 58 | long Len; 59 | long Pos; 60 | io::path Filename; 61 | bool deleteMemoryWhenDropped; 62 | }; 63 | 64 | /*! 65 | Class for writing to memory. 66 | */ 67 | class CMemoryWriteFile : public IWriteFile 68 | { 69 | public: 70 | //! Constructor 71 | CMemoryWriteFile(void *memory, long len, const io::path &fileName, bool deleteMemoryWhenDropped); 72 | 73 | //! Destructor 74 | virtual ~CMemoryWriteFile(); 75 | 76 | //! returns how much was written 77 | size_t write(const void *buffer, size_t sizeToWrite) override; 78 | 79 | //! changes position in file, returns true if successful 80 | bool seek(long finalPos, bool relativeMovement = false) override; 81 | 82 | //! returns where in the file we are. 83 | long getPos() const override; 84 | 85 | //! returns name of file 86 | const io::path &getFileName() const override; 87 | 88 | bool flush() override; 89 | 90 | private: 91 | void *Buffer; 92 | long Len; 93 | long Pos; 94 | io::path Filename; 95 | bool deleteMemoryWhenDropped; 96 | }; 97 | 98 | } // end namespace io 99 | } // end namespace irr 100 | -------------------------------------------------------------------------------- /src/CMeshManipulator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IMeshManipulator.h" 8 | 9 | namespace irr 10 | { 11 | namespace scene 12 | { 13 | 14 | //! An interface for easy manipulation of meshes. 15 | /** Scale, set alpha value, flip surfaces, and so on. This exists for fixing 16 | problems with wrong imported or exported meshes quickly after loading. It is 17 | not intended for doing mesh modifications and/or animations during runtime. 18 | */ 19 | class CMeshManipulator : public IMeshManipulator 20 | { 21 | public: 22 | //! Recalculates all normals of the mesh. 23 | /** \param mesh: Mesh on which the operation is performed. 24 | \param smooth: Whether to use smoothed normals. */ 25 | void recalculateNormals(scene::IMesh *mesh, bool smooth = false, bool angleWeighted = false) const override; 26 | 27 | //! Recalculates all normals of the mesh buffer. 28 | /** \param buffer: Mesh buffer on which the operation is performed. 29 | \param smooth: Whether to use smoothed normals. */ 30 | void recalculateNormals(IMeshBuffer *buffer, bool smooth = false, bool angleWeighted = false) const override; 31 | 32 | //! Clones a static IMesh into a modifiable SMesh. 33 | SMesh *createMeshCopy(scene::IMesh *mesh) const override; 34 | 35 | //! Returns amount of polygons in mesh. 36 | s32 getPolyCount(scene::IMesh *mesh) const override; 37 | 38 | //! Returns amount of polygons in mesh. 39 | s32 getPolyCount(scene::IAnimatedMesh *mesh) const override; 40 | 41 | //! create a new AnimatedMesh and adds the mesh to it 42 | IAnimatedMesh *createAnimatedMesh(scene::IMesh *mesh, scene::E_ANIMATED_MESH_TYPE type) const override; 43 | }; 44 | 45 | } // end namespace scene 46 | } // end namespace irr 47 | -------------------------------------------------------------------------------- /src/CNSOGLManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | 7 | #ifdef _IRR_COMPILE_WITH_NSOGL_MANAGER_ 8 | 9 | #include "SIrrCreationParameters.h" 10 | #include "SExposedVideoData.h" 11 | #include "IContextManager.h" 12 | #include "SColor.h" 13 | 14 | #import 15 | 16 | namespace irr 17 | { 18 | namespace video 19 | { 20 | // NSOpenGL manager. 21 | class CNSOGLManager : public IContextManager 22 | { 23 | public: 24 | //! Constructor. 25 | CNSOGLManager(); 26 | 27 | //! Destructor 28 | ~CNSOGLManager(); 29 | 30 | // Initialize 31 | bool initialize(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &data) override; 32 | 33 | // Terminate 34 | void terminate() override; 35 | 36 | // Create surface. 37 | bool generateSurface() override; 38 | 39 | // Destroy surface. 40 | void destroySurface() override; 41 | 42 | // Create context. 43 | bool generateContext() override; 44 | 45 | // Destroy EGL context. 46 | void destroyContext() override; 47 | 48 | //! Get current context 49 | const SExposedVideoData &getContext() const; 50 | 51 | //! Change render context, disable old and activate new defined by videoData 52 | bool activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero) override; 53 | 54 | // Get procedure address. 55 | void *getProcAddress(const std::string &procName) override; 56 | 57 | // Swap buffers. 58 | bool swapBuffers() override; 59 | 60 | private: 61 | SIrrlichtCreationParameters Params; 62 | SExposedVideoData PrimaryContext; 63 | SExposedVideoData CurrentContext; 64 | 65 | NSOpenGLPixelFormat *PixelFormat; 66 | }; 67 | } 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/COSOperator.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IOSOperator.h" 8 | 9 | namespace irr 10 | { 11 | 12 | class CIrrDeviceLinux; 13 | 14 | //! The OSOperator provides OS-specific methods and information. 15 | class COSOperator : public IOSOperator 16 | { 17 | public: 18 | // constructor 19 | #if defined(_IRR_COMPILE_WITH_X11_DEVICE_) 20 | COSOperator(const core::stringc &osversion, CIrrDeviceLinux *device); 21 | #endif 22 | COSOperator(const core::stringc &osversion); 23 | 24 | ~COSOperator(); 25 | 26 | COSOperator(const COSOperator &) = delete; 27 | COSOperator &operator=(const COSOperator &) = delete; 28 | 29 | //! Get the current OS version as string. 30 | const core::stringc &getOperatingSystemVersion() const override; 31 | 32 | //! Copies text to the clipboard 33 | //! \param text: text in utf-8 34 | void copyToClipboard(const c8 *text) const override; 35 | 36 | //! Copies text to the primary selection 37 | //! This is a no-op on some platforms. 38 | //! \param text: text in utf-8 39 | void copyToPrimarySelection(const c8 *text) const override; 40 | 41 | //! Get text from the clipboard 42 | //! \return Returns 0 if no string is in there, otherwise an utf-8 string. 43 | const c8 *getTextFromClipboard() const override; 44 | 45 | //! Get text from the primary selection 46 | //! This is a no-op on some platforms. 47 | //! \return Returns 0 if no string is in there, otherwise an utf-8 string. 48 | const c8 *getTextFromPrimarySelection() const override; 49 | 50 | //! Get the total and available system RAM 51 | /** \param totalBytes: will contain the total system memory in Kilobytes (1024 B) 52 | \param availableBytes: will contain the available memory in Kilobytes (1024 B) 53 | \return True if successful, false if not */ 54 | bool getSystemMemory(u32 *Total, u32 *Avail) const override; 55 | 56 | private: 57 | core::stringc OperatingSystem; 58 | 59 | #if defined(_IRR_COMPILE_WITH_X11_DEVICE_) 60 | CIrrDeviceLinux *IrrDeviceLinux; 61 | #endif 62 | 63 | #ifdef _IRR_WINDOWS_API_ 64 | mutable core::stringc ClipboardBuf; 65 | #endif 66 | 67 | #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_ 68 | // These need to be freed with SDL_free 69 | mutable char *ClipboardSelectionText = nullptr; 70 | mutable char *PrimarySelectionText = nullptr; 71 | #endif 72 | }; 73 | 74 | } // end namespace 75 | -------------------------------------------------------------------------------- /src/COpenGLCacheHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | 7 | #ifdef _IRR_COMPILE_WITH_OPENGL_ 8 | 9 | #include "COpenGLCommon.h" 10 | 11 | #include "COpenGLCoreFeature.h" 12 | #include "COpenGLCoreTexture.h" 13 | #include "COpenGLCoreCacheHandler.h" 14 | 15 | namespace irr 16 | { 17 | namespace video 18 | { 19 | 20 | class COpenGLCacheHandler : public COpenGLCoreCacheHandler 21 | { 22 | public: 23 | COpenGLCacheHandler(COpenGLDriver *driver); 24 | virtual ~COpenGLCacheHandler(); 25 | 26 | // Alpha calls. 27 | 28 | void setAlphaFunc(GLenum mode, GLclampf ref); 29 | 30 | void setAlphaTest(bool enable); 31 | 32 | // Client state calls. 33 | 34 | void setClientState(bool vertex, bool normal, bool color, bool texCoord0); 35 | 36 | // Matrix calls. 37 | 38 | void setMatrixMode(GLenum mode); 39 | 40 | // Texture calls. 41 | 42 | void setClientActiveTexture(GLenum texture); 43 | 44 | protected: 45 | GLenum AlphaMode; 46 | GLclampf AlphaRef; 47 | bool AlphaTest; 48 | 49 | GLenum MatrixMode; 50 | 51 | GLenum ClientActiveTexture; 52 | 53 | bool ClientStateVertex; 54 | bool ClientStateNormal; 55 | bool ClientStateColor; 56 | bool ClientStateTexCoord0; 57 | }; 58 | 59 | } // end namespace video 60 | } // end namespace irr 61 | 62 | #endif // _IRR_COMPILE_WITH_OPENGL_ 63 | -------------------------------------------------------------------------------- /src/COpenGLCommon.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #ifdef _IRR_COMPILE_WITH_OPENGL_ 8 | 9 | #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && defined(IRR_PREFER_SDL_GL_HEADER) 10 | #include 11 | #include 12 | #else 13 | #include "vendor/gl.h" 14 | #endif 15 | 16 | #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 17 | #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 18 | 19 | // To check if this header is in the current compile unit (different GL driver implementations use different "GLCommon" headers in Irrlicht) 20 | #define IRR_COMPILE_GL_COMMON 21 | 22 | namespace irr 23 | { 24 | namespace video 25 | { 26 | 27 | // Forward declarations. 28 | 29 | class COpenGLCoreFeature; 30 | 31 | template 32 | class COpenGLCoreTexture; 33 | 34 | template 35 | class COpenGLCoreRenderTarget; 36 | 37 | template 38 | class COpenGLCoreCacheHandler; 39 | 40 | class COpenGLDriver; 41 | typedef COpenGLCoreTexture COpenGLTexture; 42 | typedef COpenGLCoreRenderTarget COpenGLRenderTarget; 43 | class COpenGLCacheHandler; 44 | 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/COpenGLCoreFeature.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | class COpenGLCoreFeature 15 | { 16 | public: 17 | COpenGLCoreFeature() : 18 | BlendOperation(false), ColorAttachment(0), MultipleRenderTarget(0), MaxTextureUnits(1) 19 | { 20 | } 21 | 22 | virtual ~COpenGLCoreFeature() 23 | { 24 | } 25 | 26 | bool BlendOperation; 27 | 28 | u8 ColorAttachment; 29 | u8 MultipleRenderTarget; 30 | u8 MaxTextureUnits; 31 | }; 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/CReadFile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CReadFile.h" 6 | 7 | namespace irr 8 | { 9 | namespace io 10 | { 11 | 12 | CReadFile::CReadFile(const io::path &fileName) : 13 | File(0), FileSize(0), Filename(fileName) 14 | { 15 | #ifdef _DEBUG 16 | setDebugName("CReadFile"); 17 | #endif 18 | 19 | openFile(); 20 | } 21 | 22 | CReadFile::~CReadFile() 23 | { 24 | if (File) 25 | fclose(File); 26 | } 27 | 28 | //! returns how much was read 29 | size_t CReadFile::read(void *buffer, size_t sizeToRead) 30 | { 31 | if (!isOpen()) 32 | return 0; 33 | 34 | return fread(buffer, 1, sizeToRead, File); 35 | } 36 | 37 | //! changes position in file, returns true if successful 38 | //! if relativeMovement==true, the pos is changed relative to current pos, 39 | //! otherwise from begin of file 40 | bool CReadFile::seek(long finalPos, bool relativeMovement) 41 | { 42 | if (!isOpen()) 43 | return false; 44 | 45 | return fseek(File, finalPos, relativeMovement ? SEEK_CUR : SEEK_SET) == 0; 46 | } 47 | 48 | //! returns size of file 49 | long CReadFile::getSize() const 50 | { 51 | return FileSize; 52 | } 53 | 54 | //! returns where in the file we are. 55 | long CReadFile::getPos() const 56 | { 57 | return ftell(File); 58 | } 59 | 60 | //! opens the file 61 | void CReadFile::openFile() 62 | { 63 | if (Filename.size() == 0) { // bugfix posted by rt 64 | File = 0; 65 | return; 66 | } 67 | 68 | File = fopen(Filename.c_str(), "rb"); 69 | 70 | if (File) { 71 | // get FileSize 72 | 73 | fseek(File, 0, SEEK_END); 74 | FileSize = getPos(); 75 | fseek(File, 0, SEEK_SET); 76 | } 77 | } 78 | 79 | //! returns name of file 80 | const io::path &CReadFile::getFileName() const 81 | { 82 | return Filename; 83 | } 84 | 85 | IReadFile *CReadFile::createReadFile(const io::path &fileName) 86 | { 87 | CReadFile *file = new CReadFile(fileName); 88 | if (file->isOpen()) 89 | return file; 90 | 91 | file->drop(); 92 | return 0; 93 | } 94 | 95 | } // end namespace io 96 | } // end namespace irr 97 | -------------------------------------------------------------------------------- /src/CReadFile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include 8 | #include "IReadFile.h" 9 | #include "irrString.h" 10 | 11 | namespace irr 12 | { 13 | 14 | namespace io 15 | { 16 | 17 | /*! 18 | Class for reading a real file from disk. 19 | */ 20 | class CReadFile : public IReadFile 21 | { 22 | public: 23 | CReadFile(const io::path &fileName); 24 | 25 | virtual ~CReadFile(); 26 | 27 | //! returns how much was read 28 | size_t read(void *buffer, size_t sizeToRead) override; 29 | 30 | //! changes position in file, returns true if successful 31 | bool seek(long finalPos, bool relativeMovement = false) override; 32 | 33 | //! returns size of file 34 | long getSize() const override; 35 | 36 | //! returns if file is open 37 | bool isOpen() const 38 | { 39 | return File != 0; 40 | } 41 | 42 | //! returns where in the file we are. 43 | long getPos() const override; 44 | 45 | //! returns name of file 46 | const io::path &getFileName() const override; 47 | 48 | //! Get the type of the class implementing this interface 49 | EREAD_FILE_TYPE getType() const override 50 | { 51 | return ERFT_READ_FILE; 52 | } 53 | 54 | //! create read file on disk. 55 | static IReadFile *createReadFile(const io::path &fileName); 56 | 57 | private: 58 | //! opens the file 59 | void openFile(); 60 | 61 | FILE *File; 62 | long FileSize; 63 | io::path Filename; 64 | }; 65 | 66 | } // end namespace io 67 | } // end namespace irr 68 | -------------------------------------------------------------------------------- /src/CSDLManager.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 sfan5 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #include "CSDLManager.h" 6 | 7 | #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) 8 | 9 | #include "CIrrDeviceSDL.h" 10 | #include "COpenGLCommon.h" 11 | 12 | namespace irr 13 | { 14 | namespace video 15 | { 16 | 17 | CSDLManager::CSDLManager(CIrrDeviceSDL *device) : 18 | IContextManager(), SDLDevice(device) 19 | { 20 | #ifdef _DEBUG 21 | setDebugName("CSDLManager"); 22 | #endif 23 | } 24 | 25 | bool CSDLManager::initialize(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &data) 26 | { 27 | Data = data; 28 | return true; 29 | } 30 | 31 | const SExposedVideoData &CSDLManager::getContext() const 32 | { 33 | return Data; 34 | } 35 | 36 | bool CSDLManager::activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero) 37 | { 38 | return true; 39 | } 40 | 41 | void *CSDLManager::getProcAddress(const std::string &procName) 42 | { 43 | return SDL_GL_GetProcAddress(procName.c_str()); 44 | } 45 | 46 | bool CSDLManager::swapBuffers() 47 | { 48 | SDLDevice->SwapWindow(); 49 | return true; 50 | } 51 | 52 | } 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/CSDLManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 sfan5 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | 7 | #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) 8 | 9 | #include "IContextManager.h" 10 | 11 | namespace irr 12 | { 13 | class CIrrDeviceSDL; 14 | 15 | namespace video 16 | { 17 | 18 | // Manager for SDL with OpenGL 19 | class CSDLManager : public IContextManager 20 | { 21 | public: 22 | CSDLManager(CIrrDeviceSDL *device); 23 | 24 | virtual ~CSDLManager() {} 25 | 26 | bool initialize(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &data) override; 27 | 28 | void terminate() override{}; 29 | bool generateSurface() override { return true; }; 30 | void destroySurface() override{}; 31 | bool generateContext() override { return true; }; 32 | void destroyContext() override{}; 33 | 34 | const SExposedVideoData &getContext() const override; 35 | 36 | bool activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero = false) override; 37 | 38 | void *getProcAddress(const std::string &procName) override; 39 | 40 | bool swapBuffers() override; 41 | 42 | private: 43 | SExposedVideoData Data; 44 | CIrrDeviceSDL *SDLDevice; 45 | }; 46 | } 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/CSceneCollisionManager.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CSceneCollisionManager.h" 6 | #include "ICameraSceneNode.h" 7 | #include "SViewFrustum.h" 8 | 9 | #include "os.h" 10 | #include "irrMath.h" 11 | 12 | namespace irr 13 | { 14 | namespace scene 15 | { 16 | 17 | //! constructor 18 | CSceneCollisionManager::CSceneCollisionManager(ISceneManager *smanager, video::IVideoDriver *driver) : 19 | SceneManager(smanager), Driver(driver) 20 | { 21 | #ifdef _DEBUG 22 | setDebugName("CSceneCollisionManager"); 23 | #endif 24 | 25 | if (Driver) 26 | Driver->grab(); 27 | } 28 | 29 | //! destructor 30 | CSceneCollisionManager::~CSceneCollisionManager() 31 | { 32 | if (Driver) 33 | Driver->drop(); 34 | } 35 | 36 | //! Returns a 3d ray which would go through the 2d screen coordinates. 37 | core::line3d CSceneCollisionManager::getRayFromScreenCoordinates( 38 | const core::position2d &pos, const ICameraSceneNode *camera) 39 | { 40 | core::line3d ln(0, 0, 0, 0, 0, 0); 41 | 42 | if (!SceneManager) 43 | return ln; 44 | 45 | if (!camera) 46 | camera = SceneManager->getActiveCamera(); 47 | 48 | if (!camera) 49 | return ln; 50 | 51 | const scene::SViewFrustum *f = camera->getViewFrustum(); 52 | 53 | core::vector3df farLeftUp = f->getFarLeftUp(); 54 | core::vector3df lefttoright = f->getFarRightUp() - farLeftUp; 55 | core::vector3df uptodown = f->getFarLeftDown() - farLeftUp; 56 | 57 | const core::rect &viewPort = Driver->getViewPort(); 58 | core::dimension2d screenSize(viewPort.getWidth(), viewPort.getHeight()); 59 | 60 | f32 dx = pos.X / (f32)screenSize.Width; 61 | f32 dy = pos.Y / (f32)screenSize.Height; 62 | 63 | if (camera->isOrthogonal()) 64 | ln.start = f->cameraPosition + (lefttoright * (dx - 0.5f)) + (uptodown * (dy - 0.5f)); 65 | else 66 | ln.start = f->cameraPosition; 67 | 68 | ln.end = farLeftUp + (lefttoright * dx) + (uptodown * dy); 69 | 70 | return ln; 71 | } 72 | 73 | } // end namespace scene 74 | } // end namespace irr 75 | -------------------------------------------------------------------------------- /src/CSceneCollisionManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "ISceneCollisionManager.h" 8 | #include "ISceneManager.h" 9 | #include "IVideoDriver.h" 10 | 11 | namespace irr 12 | { 13 | namespace scene 14 | { 15 | 16 | class CSceneCollisionManager : public ISceneCollisionManager 17 | { 18 | public: 19 | //! constructor 20 | CSceneCollisionManager(ISceneManager *smanager, video::IVideoDriver *driver); 21 | 22 | //! destructor 23 | virtual ~CSceneCollisionManager(); 24 | 25 | //! Returns a 3d ray which would go through the 2d screen coordinates. 26 | virtual core::line3d getRayFromScreenCoordinates( 27 | const core::position2d &pos, const ICameraSceneNode *camera = 0) override; 28 | 29 | private: 30 | ISceneManager *SceneManager; 31 | video::IVideoDriver *Driver; 32 | }; 33 | 34 | } // end namespace scene 35 | } // end namespace irr 36 | -------------------------------------------------------------------------------- /src/CTimer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "ITimer.h" 8 | #include "os.h" 9 | 10 | namespace irr 11 | { 12 | //! Device independent implementation of the timer 13 | class CTimer : public ITimer 14 | { 15 | public: 16 | CTimer() 17 | { 18 | os::Timer::initTimer(); 19 | } 20 | 21 | //! Returns current real time in milliseconds of the system. 22 | /** This value does not start with 0 when the application starts. 23 | For example in one implementation the value returned could be the 24 | amount of milliseconds which have elapsed since the system was started. */ 25 | u32 getRealTime() const override 26 | { 27 | return os::Timer::getRealTime(); 28 | } 29 | 30 | //! Returns current virtual time in milliseconds. 31 | /** This value starts with 0 and can be manipulated using setTime(), stopTimer(), 32 | startTimer(), etc. This value depends on the set speed of the timer if the timer 33 | is stopped, etc. If you need the system time, use getRealTime() */ 34 | u32 getTime() const override 35 | { 36 | return os::Timer::getTime(); 37 | } 38 | 39 | //! sets current virtual time 40 | void setTime(u32 time) override 41 | { 42 | os::Timer::setTime(time); 43 | } 44 | 45 | //! Stops the game timer. 46 | /** The timer is reference counted, which means everything which calls 47 | stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop 48 | corretly again. */ 49 | void stop() override 50 | { 51 | os::Timer::stopTimer(); 52 | } 53 | 54 | //! Starts the game timer. 55 | /** The timer is reference counted, which means everything which calls 56 | stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop 57 | corretly again. */ 58 | void start() override 59 | { 60 | os::Timer::startTimer(); 61 | } 62 | 63 | //! Sets the speed of the timer 64 | /** The speed is the factor with which the time is running faster or slower then the 65 | real system time. */ 66 | void setSpeed(f32 speed = 1.0f) override 67 | { 68 | os::Timer::setSpeed(speed); 69 | } 70 | 71 | //! Returns current speed of the timer 72 | /** The speed is the factor with which the time is running faster or slower then the 73 | real system time. */ 74 | f32 getSpeed() const override 75 | { 76 | return os::Timer::getSpeed(); 77 | } 78 | 79 | //! Returns if game timer is currently stopped 80 | bool isStopped() const override 81 | { 82 | bool ret = os::Timer::isStopped(); 83 | return ret; 84 | } 85 | 86 | //! Advances the virtual time 87 | /** Makes the virtual timer update the time value based on the real time. This is 88 | called automatically when calling IrrlichtDevice::run(), but you can call it manually 89 | if you don't use this method. */ 90 | void tick() override 91 | { 92 | os::Timer::tick(); 93 | } 94 | }; 95 | 96 | } // end namespace 97 | -------------------------------------------------------------------------------- /src/CWGLManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Christian Stehno 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | 7 | #ifdef _IRR_COMPILE_WITH_WGL_MANAGER_ 8 | 9 | #include "SIrrCreationParameters.h" 10 | #include "SExposedVideoData.h" 11 | #include "IContextManager.h" 12 | #include "SColor.h" 13 | 14 | #define WIN32_LEAN_AND_MEAN 15 | #include 16 | #include 17 | 18 | namespace irr 19 | { 20 | namespace video 21 | { 22 | // WGL manager. 23 | class CWGLManager : public IContextManager 24 | { 25 | public: 26 | //! Constructor. 27 | CWGLManager(); 28 | 29 | //! Destructor 30 | ~CWGLManager(); 31 | 32 | // Initialize 33 | bool initialize(const SIrrlichtCreationParameters ¶ms, const SExposedVideoData &data) override; 34 | 35 | // Terminate 36 | void terminate() override; 37 | 38 | // Create surface. 39 | bool generateSurface() override; 40 | 41 | // Destroy surface. 42 | void destroySurface() override; 43 | 44 | // Create context. 45 | bool generateContext() override; 46 | 47 | // Destroy EGL context. 48 | void destroyContext() override; 49 | 50 | //! Get current context 51 | const SExposedVideoData &getContext() const override; 52 | 53 | //! Change render context, disable old and activate new defined by videoData 54 | bool activateContext(const SExposedVideoData &videoData, bool restorePrimaryOnZero) override; 55 | 56 | // Get procedure address. 57 | void *getProcAddress(const std::string &procName) override; 58 | 59 | // Swap buffers. 60 | bool swapBuffers() override; 61 | 62 | private: 63 | SIrrlichtCreationParameters Params; 64 | SExposedVideoData PrimaryContext; 65 | SExposedVideoData CurrentContext; 66 | s32 PixelFormat; 67 | PIXELFORMATDESCRIPTOR pfd; 68 | ECOLOR_FORMAT ColorFormat; 69 | void *FunctionPointers[1]; 70 | 71 | HMODULE libHandle; 72 | }; 73 | } 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/CWriteFile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #include "CWriteFile.h" 6 | #include 7 | 8 | namespace irr 9 | { 10 | namespace io 11 | { 12 | 13 | CWriteFile::CWriteFile(const io::path &fileName, bool append) : 14 | Filename(fileName), FileSize(0) 15 | { 16 | #ifdef _DEBUG 17 | setDebugName("CWriteFile"); 18 | #endif 19 | 20 | openFile(append); 21 | } 22 | 23 | CWriteFile::~CWriteFile() 24 | { 25 | if (File) 26 | fclose(File); 27 | } 28 | 29 | //! returns if file is open 30 | inline bool CWriteFile::isOpen() const 31 | { 32 | return File != 0; 33 | } 34 | 35 | //! returns how much was read 36 | size_t CWriteFile::write(const void *buffer, size_t sizeToWrite) 37 | { 38 | if (!isOpen()) 39 | return 0; 40 | 41 | return fwrite(buffer, 1, sizeToWrite, File); 42 | } 43 | 44 | //! changes position in file, returns true if successful 45 | //! if relativeMovement==true, the pos is changed relative to current pos, 46 | //! otherwise from begin of file 47 | bool CWriteFile::seek(long finalPos, bool relativeMovement) 48 | { 49 | if (!isOpen()) 50 | return false; 51 | 52 | return fseek(File, finalPos, relativeMovement ? SEEK_CUR : SEEK_SET) == 0; 53 | } 54 | 55 | //! returns where in the file we are. 56 | long CWriteFile::getPos() const 57 | { 58 | return ftell(File); 59 | } 60 | 61 | //! opens the file 62 | void CWriteFile::openFile(bool append) 63 | { 64 | if (Filename.size() == 0) { 65 | File = 0; 66 | return; 67 | } 68 | 69 | File = fopen(Filename.c_str(), append ? "ab" : "wb"); 70 | 71 | if (File) { 72 | // get FileSize 73 | 74 | fseek(File, 0, SEEK_END); 75 | FileSize = ftell(File); 76 | fseek(File, 0, SEEK_SET); 77 | } 78 | } 79 | 80 | //! returns name of file 81 | const io::path &CWriteFile::getFileName() const 82 | { 83 | return Filename; 84 | } 85 | 86 | //! Flush the content of the buffer in the file 87 | bool CWriteFile::flush() 88 | { 89 | if (!isOpen()) 90 | return false; 91 | 92 | return fflush(File) == 0; // 0 indicates success, otherwise EOF and errno is set 93 | } 94 | 95 | IWriteFile *CWriteFile::createWriteFile(const io::path &fileName, bool append) 96 | { 97 | CWriteFile *file = new CWriteFile(fileName, append); 98 | if (file->isOpen()) 99 | return file; 100 | 101 | file->drop(); 102 | return 0; 103 | } 104 | 105 | } // end namespace io 106 | } // end namespace irr 107 | -------------------------------------------------------------------------------- /src/CWriteFile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include 8 | #include "IWriteFile.h" 9 | #include "irrString.h" 10 | 11 | namespace irr 12 | { 13 | 14 | namespace io 15 | { 16 | 17 | /*! 18 | Class for writing a real file to disk. 19 | */ 20 | class CWriteFile : public IWriteFile 21 | { 22 | public: 23 | CWriteFile(const io::path &fileName, bool append); 24 | 25 | virtual ~CWriteFile(); 26 | 27 | //! Reads an amount of bytes from the file. 28 | size_t write(const void *buffer, size_t sizeToWrite) override; 29 | 30 | //! Changes position in file, returns true if successful. 31 | bool seek(long finalPos, bool relativeMovement = false) override; 32 | 33 | //! Returns the current position in the file. 34 | long getPos() const override; 35 | 36 | //! Returns name of file. 37 | const io::path &getFileName() const override; 38 | 39 | //! Flush the content of the buffer in the file 40 | bool flush() override; 41 | 42 | //! returns if file is open 43 | bool isOpen() const; 44 | 45 | //! creator method 46 | static IWriteFile *createWriteFile(const io::path &fileName, bool append); 47 | 48 | private: 49 | //! opens the file 50 | void openFile(bool append); 51 | 52 | io::path Filename; 53 | FILE *File; 54 | long FileSize; 55 | }; 56 | 57 | } // end namespace io 58 | } // end namespace irr 59 | -------------------------------------------------------------------------------- /src/IAttribute.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "IReferenceCounted.h" 8 | #include "SColor.h" 9 | #include "vector3d.h" 10 | #include "vector2d.h" 11 | #include "position2d.h" 12 | #include "rect.h" 13 | #include "dimension2d.h" 14 | #include "irrString.h" 15 | #include "irrArray.h" 16 | #include "EAttributes.h" 17 | 18 | namespace irr 19 | { 20 | namespace io 21 | { 22 | 23 | // All derived attribute types implement at least getter/setter for their own type (like CBoolAttribute will have setBool/getBool). 24 | // Simple types will also implement getStringW and setString, but don't expect it to work for all types. 25 | // String serialization makes no sense for some attribute-types (like stringw arrays or pointers), but is still useful for many types. 26 | // (Note: I do _not_ know yet why the default string serialization is asymmetric with char* in set and wchar_t* in get). 27 | // Additionally many attribute types will implement conversion functions like CBoolAttribute has p.E. getInt/setInt(). 28 | // The reason for conversion functions is likely to make reading old formats easier which have changed in the meantime. For example 29 | // an old xml can contain a bool attribute which is an int in a newer format. You can still call getInt() even thought the attribute has the wrong type. 30 | // And please do _not_ confuse these attributes here with the ones used in the xml-reader (aka SAttribute which is just a key-value pair). 31 | 32 | class IAttribute : public virtual IReferenceCounted 33 | { 34 | public: 35 | virtual ~IAttribute(){}; 36 | 37 | virtual s32 getInt() const { return 0; } 38 | virtual f32 getFloat() const { return 0; } 39 | virtual bool getBool() const { return false; } 40 | 41 | virtual void setInt(s32 intValue){}; 42 | virtual void setFloat(f32 floatValue){}; 43 | virtual void setBool(bool boolValue){}; 44 | 45 | core::stringc Name; 46 | 47 | virtual E_ATTRIBUTE_TYPE getType() const = 0; 48 | }; 49 | 50 | } // end namespace io 51 | } // end namespace irr 52 | -------------------------------------------------------------------------------- /src/OpenGL/Common.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 Vitaliy Lobachevskiy 2 | // Copyright (C) 2015 Patryk Nadrowski 3 | // This file is part of the "Irrlicht Engine". 4 | // For conditions of distribution and use, see copyright notice in irrlicht.h 5 | 6 | #pragma once 7 | 8 | #include "irrTypes.h" 9 | // even though we have mt_opengl.h our driver code still uses GL_* constants 10 | #if defined(_IRR_COMPILE_WITH_SDL_DEVICE_) 11 | #include 12 | #include 13 | #else 14 | #include "vendor/gl.h" 15 | #endif 16 | 17 | namespace irr 18 | { 19 | namespace video 20 | { 21 | 22 | // Forward declarations. 23 | 24 | class COpenGLCoreFeature; 25 | 26 | template 27 | class COpenGLCoreTexture; 28 | 29 | template 30 | class COpenGLCoreRenderTarget; 31 | 32 | template 33 | class COpenGLCoreCacheHandler; 34 | 35 | class COpenGL3DriverBase; 36 | typedef COpenGLCoreTexture COpenGL3Texture; 37 | typedef COpenGLCoreRenderTarget COpenGL3RenderTarget; 38 | typedef COpenGLCoreCacheHandler COpenGL3CacheHandler; 39 | 40 | enum class OpenGLSpec : u8 41 | { 42 | Core, 43 | Compat, 44 | ES, 45 | // WebGL, // TODO 46 | }; 47 | 48 | struct OpenGLVersion 49 | { 50 | OpenGLSpec Spec; 51 | u8 Major; 52 | u8 Minor; 53 | u8 Release; 54 | }; 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/OpenGL/ExtensionHandler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 Patryk Nadrowski 2 | // Copyright (C) 2009-2010 Amundis 3 | // 2017 modified by Michael Zeilfelder (unifying extension handlers) 4 | // This file is part of the "Irrlicht Engine". 5 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 6 | 7 | #include "ExtensionHandler.h" 8 | 9 | #include "irrString.h" 10 | #include "SMaterial.h" 11 | #include "fast_atof.h" 12 | #include "os.h" 13 | #include 14 | 15 | // FIXME: this basically duplicates what mt_opengl.h already does 16 | 17 | namespace irr 18 | { 19 | namespace video 20 | { 21 | void COpenGL3ExtensionHandler::initExtensionsOld() 22 | { 23 | auto extensions_string = reinterpret_cast(GL.GetString(GL_EXTENSIONS)); 24 | const char *pos = extensions_string; 25 | while (const char *next = strchr(pos, ' ')) { 26 | addExtension(std::string{pos, next}); 27 | pos = next + 1; 28 | } 29 | addExtension(pos); 30 | extensionsLoaded(); 31 | } 32 | 33 | void COpenGL3ExtensionHandler::initExtensionsNew() 34 | { 35 | int ext_count = GetInteger(GL_NUM_EXTENSIONS); 36 | for (int k = 0; k < ext_count; k++) 37 | addExtension(reinterpret_cast(GL.GetStringi(GL_EXTENSIONS, k))); 38 | extensionsLoaded(); 39 | } 40 | 41 | void COpenGL3ExtensionHandler::addExtension(std::string &&name) 42 | { 43 | Extensions.emplace(std::move(name)); 44 | } 45 | 46 | bool COpenGL3ExtensionHandler::queryExtension(const std::string &name) const noexcept 47 | { 48 | return Extensions.find(name) != Extensions.end(); 49 | } 50 | 51 | void COpenGL3ExtensionHandler::extensionsLoaded() 52 | { 53 | os::Printer::log((std::string("Loaded ") + std::to_string(Extensions.size()) + " extensions:").c_str(), ELL_DEBUG); 54 | for (const auto &it : Extensions) 55 | os::Printer::log((std::string(" ") + it).c_str(), ELL_DEBUG); 56 | for (size_t j = 0; j < IRR_OGLES_Feature_Count; ++j) 57 | FeatureAvailable[j] = queryExtension(getFeatureString(j)); 58 | } 59 | 60 | } // end namespace video 61 | } // end namespace irr 62 | -------------------------------------------------------------------------------- /src/OpenGL/FixedPipelineRenderer.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 Vitaliy Lobachevskiy 2 | // Copyright (C) 2014 Patryk Nadrowski 3 | // This file is part of the "Irrlicht Engine". 4 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 5 | 6 | #pragma once 7 | 8 | #include "IShaderConstantSetCallBack.h" 9 | #include "IMaterialRendererServices.h" 10 | 11 | namespace irr 12 | { 13 | namespace video 14 | { 15 | 16 | class COpenGL3MaterialBaseCB : public IShaderConstantSetCallBack 17 | { 18 | public: 19 | COpenGL3MaterialBaseCB(); 20 | 21 | virtual void OnSetMaterial(const SMaterial &material); 22 | virtual void OnSetConstants(IMaterialRendererServices *services, s32 userData); 23 | 24 | protected: 25 | bool FirstUpdateBase; 26 | 27 | s32 WVPMatrixID; 28 | s32 WVMatrixID; 29 | s32 NMatrixID; 30 | 31 | s32 FogEnableID; 32 | s32 FogTypeID; 33 | s32 FogColorID; 34 | s32 FogStartID; 35 | s32 FogEndID; 36 | s32 FogDensityID; 37 | 38 | s32 ThicknessID; 39 | 40 | bool LightEnable; 41 | SColorf GlobalAmbient; 42 | SColorf MaterialAmbient; 43 | SColorf MaterialDiffuse; 44 | SColorf MaterialEmissive; 45 | SColorf MaterialSpecular; 46 | f32 MaterialShininess; 47 | 48 | s32 FogEnable; 49 | s32 FogType; 50 | SColorf FogColor; 51 | f32 FogStart; 52 | f32 FogEnd; 53 | f32 FogDensity; 54 | 55 | f32 Thickness; 56 | }; 57 | 58 | class COpenGL3MaterialSolidCB : public COpenGL3MaterialBaseCB 59 | { 60 | public: 61 | COpenGL3MaterialSolidCB(); 62 | 63 | virtual void OnSetMaterial(const SMaterial &material); 64 | virtual void OnSetConstants(IMaterialRendererServices *services, s32 userData); 65 | 66 | protected: 67 | bool FirstUpdate; 68 | 69 | s32 TMatrix0ID; 70 | s32 AlphaRefID; 71 | s32 TextureUsage0ID; 72 | s32 TextureUnit0ID; 73 | 74 | f32 AlphaRef; 75 | s32 TextureUsage0; 76 | s32 TextureUnit0; 77 | }; 78 | 79 | class COpenGL3MaterialOneTextureBlendCB : public COpenGL3MaterialBaseCB 80 | { 81 | public: 82 | COpenGL3MaterialOneTextureBlendCB(); 83 | 84 | virtual void OnSetMaterial(const SMaterial &material); 85 | virtual void OnSetConstants(IMaterialRendererServices *services, s32 userData); 86 | 87 | protected: 88 | bool FirstUpdate; 89 | 90 | s32 TMatrix0ID; 91 | s32 BlendTypeID; 92 | s32 TextureUsage0ID; 93 | s32 TextureUnit0ID; 94 | 95 | s32 BlendType; 96 | s32 TextureUsage0; 97 | s32 TextureUnit0; 98 | }; 99 | 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/OpenGL/Renderer2D.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #include "Renderer2D.h" 6 | 7 | #include "IGPUProgrammingServices.h" 8 | #include "os.h" 9 | 10 | #include "Driver.h" 11 | 12 | #include "COpenGLCoreFeature.h" 13 | #include "COpenGLCoreTexture.h" 14 | #include "COpenGLCoreCacheHandler.h" 15 | 16 | namespace irr 17 | { 18 | namespace video 19 | { 20 | 21 | COpenGL3Renderer2D::COpenGL3Renderer2D(const c8 *vertexShaderProgram, const c8 *pixelShaderProgram, COpenGL3DriverBase *driver, bool withTexture) : 22 | COpenGL3MaterialRenderer(driver, 0, EMT_SOLID), 23 | WithTexture(withTexture) 24 | { 25 | #ifdef _DEBUG 26 | setDebugName("Renderer2D"); 27 | #endif 28 | 29 | int Temp = 0; 30 | 31 | init(Temp, vertexShaderProgram, pixelShaderProgram, false); 32 | 33 | COpenGL3CacheHandler *cacheHandler = Driver->getCacheHandler(); 34 | 35 | cacheHandler->setProgram(Program); 36 | 37 | // These states don't change later. 38 | 39 | ThicknessID = getPixelShaderConstantID("uThickness"); 40 | if (WithTexture) { 41 | TextureUsageID = getPixelShaderConstantID("uTextureUsage"); 42 | s32 TextureUnitID = getPixelShaderConstantID("uTextureUnit"); 43 | 44 | s32 TextureUnit = 0; 45 | setPixelShaderConstant(TextureUnitID, &TextureUnit, 1); 46 | 47 | s32 TextureUsage = 0; 48 | setPixelShaderConstant(TextureUsageID, &TextureUsage, 1); 49 | } 50 | 51 | cacheHandler->setProgram(0); 52 | } 53 | 54 | COpenGL3Renderer2D::~COpenGL3Renderer2D() 55 | { 56 | } 57 | 58 | void COpenGL3Renderer2D::OnSetMaterial(const video::SMaterial &material, 59 | const video::SMaterial &lastMaterial, 60 | bool resetAllRenderstates, 61 | video::IMaterialRendererServices *services) 62 | { 63 | Driver->getCacheHandler()->setProgram(Program); 64 | Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); 65 | 66 | f32 Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f; 67 | setPixelShaderConstant(ThicknessID, &Thickness, 1); 68 | 69 | if (WithTexture) { 70 | s32 TextureUsage = material.TextureLayers[0].Texture ? 1 : 0; 71 | setPixelShaderConstant(TextureUsageID, &TextureUsage, 1); 72 | } 73 | } 74 | 75 | bool COpenGL3Renderer2D::OnRender(IMaterialRendererServices *service, E_VERTEX_TYPE vtxtype) 76 | { 77 | return true; 78 | } 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/OpenGL/Renderer2D.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Patryk Nadrowski 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "MaterialRenderer.h" 8 | 9 | namespace irr 10 | { 11 | namespace video 12 | { 13 | 14 | class COpenGL3Renderer2D : public COpenGL3MaterialRenderer 15 | { 16 | public: 17 | COpenGL3Renderer2D(const c8 *vertexShaderProgram, const c8 *pixelShaderProgram, COpenGL3DriverBase *driver, bool withTexture); 18 | ~COpenGL3Renderer2D(); 19 | 20 | virtual void OnSetMaterial(const SMaterial &material, const SMaterial &lastMaterial, 21 | bool resetAllRenderstates, IMaterialRendererServices *services); 22 | 23 | virtual bool OnRender(IMaterialRendererServices *service, E_VERTEX_TYPE vtxtype); 24 | 25 | protected: 26 | bool WithTexture; 27 | s32 ThicknessID; 28 | s32 TextureUsageID; 29 | }; 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/OpenGL3/Driver.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 Vitaliy Lobachevskiy 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | #include "OpenGL/Driver.h" 7 | 8 | namespace irr 9 | { 10 | namespace video 11 | { 12 | 13 | /// OpenGL 3+ driver 14 | /// 15 | /// For OpenGL 3.2 and higher. Compatibility profile is required currently. 16 | class COpenGL3Driver : public COpenGL3DriverBase 17 | { 18 | friend IVideoDriver *createOpenGL3Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); 19 | 20 | public: 21 | using COpenGL3DriverBase::COpenGL3DriverBase; 22 | E_DRIVER_TYPE getDriverType() const override; 23 | 24 | protected: 25 | OpenGLVersion getVersionFromOpenGL() const override; 26 | void initFeatures() override; 27 | }; 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/OpenGLES2/Driver.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2023 Vitaliy Lobachevskiy 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in Irrlicht.h 4 | 5 | #pragma once 6 | #include "OpenGL/Driver.h" 7 | 8 | namespace irr 9 | { 10 | namespace video 11 | { 12 | 13 | /// OpenGL ES 2+ driver 14 | /// 15 | /// For OpenGL ES 2.0 and higher. 16 | class COpenGLES2Driver : public COpenGL3DriverBase 17 | { 18 | friend IVideoDriver *createOGLES2Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); 19 | 20 | public: 21 | using COpenGL3DriverBase::COpenGL3DriverBase; 22 | E_DRIVER_TYPE getDriverType() const override; 23 | 24 | protected: 25 | OpenGLVersion getVersionFromOpenGL() const override; 26 | void initFeatures() override; 27 | }; 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/SB3DStructs.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006-2012 Luke Hoschke 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | // B3D Mesh loader 6 | // File format designed by Mark Sibly for the Blitz3D engine and has been 7 | // declared public domain 8 | 9 | #pragma once 10 | 11 | #include "SMaterial.h" 12 | #include "irrMath.h" 13 | 14 | namespace irr 15 | { 16 | namespace scene 17 | { 18 | 19 | struct SB3dChunkHeader 20 | { 21 | c8 name[4]; 22 | s32 size; 23 | }; 24 | 25 | struct SB3dChunk 26 | { 27 | SB3dChunk(const SB3dChunkHeader &header, long sp) : 28 | length(header.size + 8), startposition(sp) 29 | { 30 | length = core::max_(length, 8); 31 | name[0] = header.name[0]; 32 | name[1] = header.name[1]; 33 | name[2] = header.name[2]; 34 | name[3] = header.name[3]; 35 | } 36 | c8 name[4]; 37 | s32 length; 38 | long startposition; 39 | }; 40 | 41 | struct SB3dTexture 42 | { 43 | std::string TextureName; 44 | s32 Flags; 45 | s32 Blend; 46 | f32 Xpos; 47 | f32 Ypos; 48 | f32 Xscale; 49 | f32 Yscale; 50 | f32 Angle; 51 | }; 52 | 53 | struct SB3dMaterial 54 | { 55 | SB3dMaterial() : 56 | red(1.0f), green(1.0f), 57 | blue(1.0f), alpha(1.0f), shininess(0.0f), blend(1), 58 | fx(0) 59 | { 60 | for (u32 i = 0; i < video::MATERIAL_MAX_TEXTURES; ++i) 61 | Textures[i] = 0; 62 | } 63 | video::SMaterial Material; 64 | f32 red, green, blue, alpha; 65 | f32 shininess; 66 | s32 blend, fx; 67 | SB3dTexture *Textures[video::MATERIAL_MAX_TEXTURES]; 68 | }; 69 | 70 | } // end namespace scene 71 | } // end namespace irr 72 | -------------------------------------------------------------------------------- /src/builtInFont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/src/builtInFont.png -------------------------------------------------------------------------------- /src/os.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #pragma once 6 | 7 | #include "irrTypes.h" 8 | #include "irrString.h" 9 | #include "path.h" 10 | #include "ILogger.h" 11 | #include "ITimer.h" 12 | 13 | namespace irr 14 | { 15 | 16 | namespace os 17 | { 18 | class Byteswap 19 | { 20 | public: 21 | static u16 byteswap(u16 num); 22 | static s16 byteswap(s16 num); 23 | static u32 byteswap(u32 num); 24 | static s32 byteswap(s32 num); 25 | static u64 byteswap(u64 num); 26 | static s64 byteswap(s64 num); 27 | static f32 byteswap(f32 num); 28 | // prevent accidental swapping of chars 29 | static inline u8 byteswap(u8 num) { return num; } 30 | static inline c8 byteswap(c8 num) { return num; } 31 | }; 32 | 33 | class Printer 34 | { 35 | public: 36 | // prints out a string to the console out stdout or debug log or whatever 37 | static void print(const c8 *message, ELOG_LEVEL ll = ELL_INFORMATION); 38 | static void log(const c8 *message, ELOG_LEVEL ll = ELL_INFORMATION); 39 | static void log(const wchar_t *message, ELOG_LEVEL ll = ELL_INFORMATION); 40 | 41 | // The string ": " is added between message and hint 42 | static void log(const c8 *message, const c8 *hint, ELOG_LEVEL ll = ELL_INFORMATION); 43 | static void log(const c8 *message, const io::path &hint, ELOG_LEVEL ll = ELL_INFORMATION); 44 | static ILogger *Logger; 45 | }; 46 | 47 | class Timer 48 | { 49 | public: 50 | //! returns the current time in milliseconds 51 | static u32 getTime(); 52 | 53 | //! initializes the real timer 54 | static void initTimer(); 55 | 56 | //! sets the current virtual (game) time 57 | static void setTime(u32 time); 58 | 59 | //! stops the virtual (game) timer 60 | static void stopTimer(); 61 | 62 | //! starts the game timer 63 | static void startTimer(); 64 | 65 | //! sets the speed of the virtual timer 66 | static void setSpeed(f32 speed); 67 | 68 | //! gets the speed of the virtual timer 69 | static f32 getSpeed(); 70 | 71 | //! returns if the timer currently is stopped 72 | static bool isStopped(); 73 | 74 | //! makes the virtual timer update the time value based on the real time 75 | static void tick(); 76 | 77 | //! returns the current real time in milliseconds 78 | static u32 getRealTime(); 79 | 80 | private: 81 | static void initVirtualTimer(); 82 | 83 | static f32 VirtualTimerSpeed; 84 | static s32 VirtualTimerStopCounter; 85 | static u32 StartRealTime; 86 | static u32 LastVirtualTime; 87 | static u32 StaticTime; 88 | }; 89 | 90 | } // end namespace os 91 | } // end namespace irr 92 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | link_libraries(IrrlichtMt::IrrlichtMt) 2 | add_executable(image_loader_test image_loader_test.cpp) 3 | 4 | function(test_image_loader format expected input) 5 | string(TOLOWER ${format} suffix) 6 | add_test(NAME ImageLoader${format}-${input} COMMAND image_loader_test ${expected} data/sample_${input}.${suffix} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 7 | endfunction() 8 | 9 | test_image_loader(BMP 16color-16bpp 4bpp_v3) 10 | # test_image_loader(BMP 16color-16bpp 4bpp_v7) 11 | # test_image_loader(BMP 16color-16bpp 4bpp_v3_rle) 12 | # test_image_loader(BMP 16color-16bpp 4bpp_v7_rle) 13 | test_image_loader(BMP 30color-16bpp 8bpp_v3) 14 | # test_image_loader(BMP 30color-16bpp 8bpp_v7) 15 | test_image_loader(BMP 30color-16bpp 8bpp_v3_rle) 16 | # test_image_loader(BMP 30color-16bpp 8bpp_v7_rle) 17 | # test_image_loader(BMP 30color-16bpp 16bpp_v3) 18 | # test_image_loader(BMP 30color-16bpp 16bpp_v7) 19 | test_image_loader(BMP 30color-24bpp 24bpp_v3) 20 | test_image_loader(BMP 30color-24bpp 24bpp_v7) 21 | 22 | test_image_loader(PNG 30color-24bpp 8bpp) 23 | test_image_loader(PNG 30color-24bpp 24bpp) 24 | 25 | test_image_loader(TGA 30color-32bpp 8bpp_up) 26 | test_image_loader(TGA 30color-32bpp 8bpp_down) 27 | # test_image_loader(TGA 30color-16bpp 8bpp_rle_up) 28 | # test_image_loader(TGA 30color-16bpp 8bpp_rle_down) 29 | test_image_loader(TGA 30color-24bpp 24bpp_up) 30 | test_image_loader(TGA 30color-24bpp 24bpp_down) 31 | test_image_loader(TGA 30color-24bpp 24bpp_rle_up) 32 | test_image_loader(TGA 30color-24bpp 24bpp_rle_down) 33 | -------------------------------------------------------------------------------- /test/data/sample_16bpp_v3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_16bpp_v3.bmp -------------------------------------------------------------------------------- /test/data/sample_16bpp_v7.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_16bpp_v7.bmp -------------------------------------------------------------------------------- /test/data/sample_24bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_24bpp.png -------------------------------------------------------------------------------- /test/data/sample_24bpp_down.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_24bpp_down.tga -------------------------------------------------------------------------------- /test/data/sample_24bpp_rle_down.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_24bpp_rle_down.tga -------------------------------------------------------------------------------- /test/data/sample_24bpp_rle_up.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_24bpp_rle_up.tga -------------------------------------------------------------------------------- /test/data/sample_24bpp_up.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_24bpp_up.tga -------------------------------------------------------------------------------- /test/data/sample_24bpp_v3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_24bpp_v3.bmp -------------------------------------------------------------------------------- /test/data/sample_24bpp_v7.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_24bpp_v7.bmp -------------------------------------------------------------------------------- /test/data/sample_4bpp_v3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_4bpp_v3.bmp -------------------------------------------------------------------------------- /test/data/sample_8bpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp.png -------------------------------------------------------------------------------- /test/data/sample_8bpp_down.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_down.tga -------------------------------------------------------------------------------- /test/data/sample_8bpp_rle_down.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_rle_down.tga -------------------------------------------------------------------------------- /test/data/sample_8bpp_rle_up.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_rle_up.tga -------------------------------------------------------------------------------- /test/data/sample_8bpp_up.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_up.tga -------------------------------------------------------------------------------- /test/data/sample_8bpp_v3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_v3.bmp -------------------------------------------------------------------------------- /test/data/sample_8bpp_v3_rle.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_v3_rle.bmp -------------------------------------------------------------------------------- /test/data/sample_8bpp_v7.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_v7.bmp -------------------------------------------------------------------------------- /test/data/sample_8bpp_v7_rle.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minetest/irrlicht/7173c2c62997b6416f17b90f9a50bff11fef1c4c/test/data/sample_8bpp_v7_rle.bmp --------------------------------------------------------------------------------