├── .gitattributes ├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── Irrlicht.ico ├── README.md ├── docs ├── developers.md ├── fileformat.md ├── make_install.md └── projectfileformat.txt ├── editor.conf.example ├── examples ├── default_dirt.png ├── default_stone.png ├── wool_blue.png ├── wool_green.png └── wool_red.png ├── lib └── irrbloss │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Config.cmake.in │ ├── README.md │ ├── include │ ├── CDynamicMeshBuffer.h │ ├── CIndexBuffer.h │ ├── CMeshBuffer.h │ ├── CVertexBuffer.h │ ├── ECullingTypes.h │ ├── EDebugSceneTypes.h │ ├── EDeviceTypes.h │ ├── EDriverFeatures.h │ ├── EDriverTypes.h │ ├── EFocusFlags.h │ ├── EGUIAlignment.h │ ├── EGUIElementTypes.h │ ├── EHardwareBufferFlags.h │ ├── EMaterialFlags.h │ ├── EMaterialTypes.h │ ├── EMessageBoxFlags.h │ ├── EPrimitiveTypes.h │ ├── EReadFileType.h │ ├── ESceneNodeTypes.h │ ├── EShaderTypes.h │ ├── EVertexAttributes.h │ ├── IAnimatedMesh.h │ ├── IAnimatedMeshSceneNode.h │ ├── ICameraSceneNode.h │ ├── IContextManager.h │ ├── ICursorControl.h │ ├── IDynamicMeshBuffer.h │ ├── IEventReceiver.h │ ├── IFileArchive.h │ ├── IFileList.h │ ├── IFileSystem.h │ ├── IGPUProgrammingServices.h │ ├── IGUIButton.h │ ├── IGUICheckBox.h │ ├── IGUIComboBox.h │ ├── IGUIContextMenu.h │ ├── IGUIEditBox.h │ ├── IGUIElement.h │ ├── IGUIEnvironment.h │ ├── IGUIFont.h │ ├── IGUIFontBitmap.h │ ├── IGUIImage.h │ ├── IGUIImageList.h │ ├── IGUIListBox.h │ ├── IGUIScrollBar.h │ ├── IGUISkin.h │ ├── IGUISpriteBank.h │ ├── IGUIStaticText.h │ ├── IGUIToolbar.h │ ├── IGUIWindow.h │ ├── IGeometryCreator.h │ ├── IImage.h │ ├── IImageLoader.h │ ├── IImageWriter.h │ ├── IIndexBuffer.h │ ├── ILightManager.h │ ├── ILightSceneNode.h │ ├── ILogger.h │ ├── IMaterialRenderer.h │ ├── IMaterialRendererServices.h │ ├── IMemoryReadFile.h │ ├── IMesh.h │ ├── IMeshBuffer.h │ ├── IMeshCache.h │ ├── IMeshLoader.h │ ├── IMeshManipulator.h │ ├── IMeshSceneNode.h │ ├── IMetaTriangleSelector.h │ ├── IOSOperator.h │ ├── IReadFile.h │ ├── IReferenceCounted.h │ ├── IRenderTarget.h │ ├── ISceneCollisionManager.h │ ├── ISceneManager.h │ ├── ISceneNode.h │ ├── IShaderConstantSetCallBack.h │ ├── IShadowVolumeSceneNode.h │ ├── ITexture.h │ ├── ITimer.h │ ├── ITriangleSelector.h │ ├── IVertexBuffer.h │ ├── IVideoDriver.h │ ├── IWriteFile.h │ ├── IrrCompileConfig.h │ ├── IrrlichtDevice.h │ ├── Keycodes.h │ ├── S3DVertex.h │ ├── SAnimatedMesh.h │ ├── SColor.h │ ├── SExposedVideoData.h │ ├── SIrrCreationParameters.h │ ├── SKeyMap.h │ ├── SLight.h │ ├── SMaterial.h │ ├── SMaterialLayer.h │ ├── SMesh.h │ ├── SMeshBuffer.h │ ├── SMeshBufferLightMap.h │ ├── SOverrideMaterial.h │ ├── SSkinMeshBuffer.h │ ├── SVertexIndex.h │ ├── SVertexManipulator.h │ ├── SViewFrustum.h │ ├── aabbox3d.h │ ├── coreutil.h │ ├── dimension2d.h │ ├── exampleHelper.h │ ├── fast_atof.h │ ├── heapsort.h │ ├── irrAllocator.h │ ├── irrArray.h │ ├── irrList.h │ ├── irrMath.h │ ├── irrString.h │ ├── irrTypes.h │ ├── irrlicht.h │ ├── irrpack.h │ ├── irrunpack.h │ ├── line2d.h │ ├── line3d.h │ ├── matrix4.h │ ├── path.h │ ├── plane3d.h │ ├── position2d.h │ ├── quaternion.h │ ├── rect.h │ ├── triangle3d.h │ ├── vector2d.h │ └── vector3d.h │ ├── irrlicht-license.txt │ └── source │ ├── BuiltInFont.h │ ├── CAnimatedMeshSceneNode.cpp │ ├── CAnimatedMeshSceneNode.h │ ├── CBlit.h │ ├── CCameraSceneNode.cpp │ ├── CCameraSceneNode.h │ ├── CColorConverter.cpp │ ├── CColorConverter.h │ ├── CCubeSceneNode.cpp │ ├── CCubeSceneNode.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 │ ├── CGUIContextMenu.cpp │ ├── CGUIContextMenu.h │ ├── CGUIEditBox.cpp │ ├── CGUIEditBox.h │ ├── CGUIEnvironment.cpp │ ├── CGUIEnvironment.h │ ├── CGUIFont.cpp │ ├── CGUIFont.h │ ├── CGUIImage.cpp │ ├── CGUIImage.h │ ├── CGUIImageList.cpp │ ├── CGUIImageList.h │ ├── CGUIListBox.cpp │ ├── CGUIListBox.h │ ├── CGUIMenu.cpp │ ├── CGUIMenu.h │ ├── CGUIMessageBox.cpp │ ├── CGUIMessageBox.h │ ├── CGUIModalScreen.cpp │ ├── CGUIModalScreen.h │ ├── CGUIScrollBar.cpp │ ├── CGUIScrollBar.h │ ├── CGUISkin.cpp │ ├── CGUISkin.h │ ├── CGUISpriteBank.cpp │ ├── CGUISpriteBank.h │ ├── CGUIStaticText.cpp │ ├── CGUIStaticText.h │ ├── CGUIToolBar.cpp │ ├── CGUIToolBar.h │ ├── CGUIWindow.cpp │ ├── CGUIWindow.h │ ├── CGeometryCreator.cpp │ ├── CGeometryCreator.h │ ├── CImage.cpp │ ├── CImage.h │ ├── CImageLoaderPNG.cpp │ ├── CImageLoaderPNG.h │ ├── CImageWriterPNG.cpp │ ├── CImageWriterPNG.h │ ├── CIrrDeviceLinux.cpp │ ├── CIrrDeviceLinux.h │ ├── CIrrDeviceStub.cpp │ ├── CIrrDeviceStub.h │ ├── CIrrDeviceWin32.cpp │ ├── CIrrDeviceWin32.h │ ├── CLightSceneNode.cpp │ ├── CLightSceneNode.h │ ├── CLogger.cpp │ ├── CLogger.h │ ├── CMakeLists.txt │ ├── CMemoryFile.cpp │ ├── CMemoryFile.h │ ├── CMeshCache.cpp │ ├── CMeshCache.h │ ├── CMeshManipulator.cpp │ ├── CMeshManipulator.h │ ├── CMeshSceneNode.cpp │ ├── CMeshSceneNode.h │ ├── CMetaTriangleSelector.cpp │ ├── CMetaTriangleSelector.h │ ├── CNullDriver.cpp │ ├── CNullDriver.h │ ├── COBJMeshFileLoader.cpp │ ├── COBJMeshFileLoader.h │ ├── COSOperator.cpp │ ├── COSOperator.h │ ├── COctreeTriangleSelector.cpp │ ├── COctreeTriangleSelector.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 │ ├── COpenGLShaderMaterialRenderer.cpp │ ├── COpenGLShaderMaterialRenderer.h │ ├── CReadFile.cpp │ ├── CReadFile.h │ ├── CSceneCollisionManager.cpp │ ├── CSceneCollisionManager.h │ ├── CSceneManager.cpp │ ├── CSceneManager.h │ ├── CTimer.h │ ├── CTriangleSelector.cpp │ ├── CTriangleSelector.h │ ├── CWGLManager.cpp │ ├── CWGLManager.h │ ├── CWriteFile.cpp │ ├── CWriteFile.h │ ├── Irrlicht.cpp │ ├── Irrlicht.rc │ ├── KHR │ └── khrplatform.h │ ├── Octree.h │ ├── S2DVertex.h │ ├── SoftwareDriver2_helper.h │ ├── os.cpp │ ├── os.h │ └── resource.h ├── media ├── coordinates.png ├── flip_x.png ├── flip_y.png ├── flip_z.png ├── fontlucida.png ├── gui_scale.png ├── icon.png ├── icon_mode_node.png ├── icon_mode_nodebox.png ├── icon_mode_texture.png ├── rotate_x.png ├── rotate_y.png ├── rotate_z.png ├── sky.png ├── texture_box.png └── texture_terrain.png ├── nodeboxeditor.desktop ├── src ├── Configuration.cpp ├── Configuration.hpp ├── Editor.cpp ├── Editor.hpp ├── EditorState.cpp ├── EditorState.hpp ├── FileFormat │ ├── FileFormat.cpp │ ├── FileFormat.hpp │ ├── Lua.cpp │ ├── Lua.hpp │ ├── NBE.cpp │ ├── NBE.hpp │ ├── helpers.cpp │ ├── helpers.hpp │ ├── obj.cpp │ └── obj.hpp ├── GUIHelpers.cpp ├── GUIHelpers.hpp ├── MenuState.cpp ├── MenuState.hpp ├── common.hpp ├── conf_cmake.hpp.in ├── dialogs │ ├── Dialog.hpp │ ├── FileDialog.cpp │ ├── FileDialog.hpp │ ├── ImageDialog.cpp │ ├── ImageDialog.hpp │ ├── TextureDialog.cpp │ └── TextureDialog.hpp ├── main.cpp ├── minetest.cpp ├── minetest.hpp ├── modes │ ├── NBEditor.cpp │ ├── NBEditor.hpp │ ├── NodeEditor.cpp │ ├── NodeEditor.hpp │ ├── TextureEditor.cpp │ └── TextureEditor.hpp ├── project │ ├── media.cpp │ ├── media.hpp │ ├── node.cpp │ ├── node.hpp │ ├── nodebox.cpp │ ├── nodebox.hpp │ ├── project.cpp │ └── project.hpp └── util │ ├── SimpleFileCombiner.cpp │ ├── SimpleFileCombiner.hpp │ ├── filesys.cpp │ ├── filesys.hpp │ ├── string.cpp │ ├── string.hpp │ ├── tinyfiledialogs.c │ └── tinyfiledialogs.h └── util └── buildbot ├── buildwin32.sh ├── buildwin64.sh ├── toolchain_mingw.cmake └── toolchain_mingw64.cmake /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build 2 | bin 3 | 4 | # Build system 5 | CMakeCache.txt 6 | CMakeFiles 7 | cmake* 8 | Makefile 9 | build/ 10 | _build/ 11 | 12 | # Configuration/generated 13 | editor.conf 14 | debug.txt 15 | conf_cmake.hpp 16 | install_manifest.txt 17 | *.nbe 18 | *.lua 19 | *.obj 20 | 21 | ############ 22 | ## Windows 23 | ############ 24 | 25 | # Windows image file caches 26 | Thumbs.db 27 | 28 | # Folder config file 29 | Desktop.ini 30 | 31 | #Translations 32 | *.mo 33 | 34 | # Mac crap 35 | .DS_Store 36 | 37 | # Linux 38 | *~* 39 | .directory 40 | *kate-swp* 41 | 42 | *.7z 43 | pkgbuild -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | compiler: 3 | - gcc 4 | - clang 5 | env: 6 | # - PLATFORM=Win32 7 | # - PLATFORM=Win64 8 | - PLATFORM=Linux 9 | before_install: ./util/travis/before_install.sh 10 | script: ./util/travis/script.sh 11 | matrix: 12 | fast_finish: true 13 | exclude: 14 | - env: PLATFORM=Win32 15 | compiler: clang 16 | - env: PLATFORM=Win64 17 | compiler: clang 18 | -------------------------------------------------------------------------------- /Irrlicht.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/Irrlicht.ico -------------------------------------------------------------------------------- /docs/fileformat.md: -------------------------------------------------------------------------------- 1 | NBE File Format 2 | =============== 3 | 4 | The first five bytes tell the parser that it is an NBE file. 5 | "NBEFP" 6 | 7 | The next byte is a number between 1 and 255 which indicates how many files there are. 8 | 9 | Next up is the file table. It is in this format: 10 | 11 | | Length | Description | 12 | |----------|-----------------------------------------| 13 | | 50 bytes | Name of the file | 14 | | 4 bytes | Start position of file data, x bytes in | 15 | | 4 bytes | Size of the file data, x bytes | 16 | 17 | Then comes the file data, one after another. 18 | -------------------------------------------------------------------------------- /docs/make_install.md: -------------------------------------------------------------------------------- 1 | Make Install 2 | ============ 3 | 4 | This document will outline the process of installing the editor onto your system, 5 | and will also give important information in order to avoid common slip ups. 6 | 7 | This is only for Linux operating systems. 8 | 9 | Installing 10 | ---------- 11 | 12 | After you compile the editor (see readme, or developers.md), it is as simple as this: 13 | 14 | $ sudo make install 15 | 16 | If you receive any errors, please report them. 17 | 18 | Using Installed Builds 19 | ---------------------- 20 | 21 | To run, use $ nodeboxeditor 22 | 23 | * Project, imports and exports will be saved to and read from /home/. 24 | You can change this with the save_directory setting in editor.conf 25 | * Configuration will be read from /home/.config/nodeboxeditor.conf first, 26 | and then /usr/local/share/nodeboxeditor/editor.conf if that fails. 27 | * Resources are saved in /usr/local/share/nodeboxeditor 28 | * The executable is in /usr/local/bin 29 | * Textures will be imported and exported to /home/. 30 | 31 | -------------------------------------------------------------------------------- /docs/projectfileformat.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------- # 2 | # FILE FORMAT FOR NBE PROJECT FILES USING PARSER VERSION 1 # 3 | # This is the file format for project.txt in .nbe files # 4 | # Comments ARE NOT allowed in real format # 5 | # Axis Y is height # 6 | # --------------------------------------------------------- # 7 | 8 | MINETEST NODEBOX EDITOR # Tells the parser that this is a .nbe file 9 | PARSER 2 # What version the parser uses. Versions may not be backwards compatible. 10 | NAME my_mod_namespace # The folder the mod should be in 11 | 12 | 13 | # Blank lines are okay 14 | 15 | 16 | # -------------------------------------------------- # 17 | # this is a node block which adds an individual node # 18 | # -------------------------------------------------- # 19 | NODE tree_block # Declares a node, and gives it its name. 20 | POSITION 0 0 0 # position in editor grid 21 | # 22 | NODEBOX name -0.5 -0.5 -0.5 0.5 0.5 0.5 # A single box called name. 23 | NODEBOX name -0.5 -0.5 -0.5 0.5 0.5 0.5 # a single box called name 24 | TEXTURE top mod_top_texture.png # uses textures/mod_top_texture.png for top face 25 | END NODE 26 | 27 | 28 | # Blank line 29 | 30 | 31 | # -------------------------------------------------- # 32 | # this is a node block which adds an individual node # 33 | # -------------------------------------------------- # 34 | NODE tree_block_2 # Declares a node, and gives it its name. 35 | POSITION 1 0 0 # position in editor grid. 36 | # 37 | NODEBOX name -0.5 -0.5 -0.5 0.5 0.5 0.5 # A single box called name. 38 | NODEBOX name -0.5 -0.5 -0.5 0.5 0.5 0.5 # a single box called name 39 | END NODE 40 | -------------------------------------------------------------------------------- /editor.conf.example: -------------------------------------------------------------------------------- 1 | # In node box editor mode, snapping makes node boxes 2 | # snap to pixels 3 | snapping = true 4 | 5 | # The resolution the nodebox snaps to (can be overriden per node) 6 | default_snap_res = 16 7 | 8 | # limiting stops node boxes going out of node bounds 9 | limiting = true 10 | 11 | # If true, positions in nodebox properties are shown as multiples of 1/16 12 | fractional_positions = false 13 | 14 | # Directory to save projects and export to. 15 | # Should be absolute path. 16 | save_directory = 17 | 18 | # The editor should attempt to find Minetest automatically 19 | # If it fails, enter an absolute path to the minetest root folder, eg: 20 | # c://Games/Minetest/ 21 | # /home/rubenwardy/Game/Minetest/ 22 | # Do not include bin/minetest or bin/minetest.exe in the root. 23 | minetest_root = 24 | 25 | # The view of each viewport 26 | # can be: pers, front, back, top, bottom, left, right 27 | viewport_top_left = pers 28 | viewport_top_right = top 29 | viewport_bottom_left = front 30 | viewport_bottom_right = right 31 | 32 | # Lighting 33 | # 0: no lighting / shadows 34 | # 1: Depth lighting (things further away from camera are darker) (TODO) 35 | # 2: Normal lighting (like in Minetest) 36 | lighting = 2 37 | 38 | # If true, nodes that are not selected will be hidden 39 | # when not in the node tool 40 | hide_other_nodes = true 41 | 42 | # Move all nodes up when a node is placed at negative y 43 | no_negative_node_y = true 44 | 45 | # Hide the sidebar 46 | hide_sidebar = false 47 | 48 | # Whether the position draw handle should be shown 49 | always_show_position_handle = false 50 | 51 | # Vertical syncronisation 52 | dont_use_vsync = false 53 | 54 | # Enable this if vsync is not working for you 55 | use_sleep = false 56 | 57 | # Screen settings 58 | fullscreen = false 59 | width = 896 60 | height = 520 61 | -------------------------------------------------------------------------------- /examples/default_dirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/examples/default_dirt.png -------------------------------------------------------------------------------- /examples/default_stone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/examples/default_stone.png -------------------------------------------------------------------------------- /examples/wool_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/examples/wool_blue.png -------------------------------------------------------------------------------- /examples/wool_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/examples/wool_green.png -------------------------------------------------------------------------------- /examples/wool_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/examples/wool_red.png -------------------------------------------------------------------------------- /lib/irrbloss/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeFiles 2 | CMakeCache.txt 3 | cmake_install.cmake 4 | Makefile 5 | *.so* 6 | *.a 7 | *.exe 8 | bin/Linux 9 | -------------------------------------------------------------------------------- /lib/irrbloss/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(Irrlicht 4 | VERSION 1.9.0 5 | LANGUAGES CXX 6 | ) 7 | 8 | message(STATUS "*** Building Irrbloss ${PROJECT_VERSION} ***") 9 | 10 | include(GNUInstallDirs) 11 | 12 | if(APPLE) 13 | set(sysname OSX) 14 | elseif(MSVC) 15 | set(sysname Win32-VisualStudio) 16 | elseif(WIN32) 17 | set(sysname Win32-gcc) 18 | else() 19 | set(sysname Linux) 20 | endif() 21 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/${sysname}) 22 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) 23 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/${sysname}) 24 | 25 | if(NOT CMAKE_BUILD_TYPE) 26 | set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE) 27 | endif() 28 | 29 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 30 | add_subdirectory(source) 31 | 32 | # Installation of headers. 33 | install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" 34 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrbloss" 35 | ) 36 | 37 | # Installation of CMake target and configuration files. 38 | install(EXPORT Irrbloss-export 39 | FILE IrrblossTargets.cmake 40 | NAMESPACE Irrbloss:: 41 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Irrbloss" 42 | ) 43 | 44 | include(CMakePackageConfigHelpers) 45 | configure_package_config_file("${PROJECT_SOURCE_DIR}/Config.cmake.in" 46 | "${CMAKE_CURRENT_BINARY_DIR}/IrrblossConfig.cmake" 47 | INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Irrbloss" 48 | NO_SET_AND_CHECK_MACRO 49 | NO_CHECK_REQUIRED_COMPONENTS_MACRO 50 | ) 51 | write_basic_package_version_file( 52 | "${CMAKE_CURRENT_BINARY_DIR}/IrrblossConfigVersion.cmake" 53 | COMPATIBILITY AnyNewerVersion 54 | ) 55 | 56 | install(FILES 57 | "${CMAKE_CURRENT_BINARY_DIR}/IrrblossConfig.cmake" 58 | "${CMAKE_CURRENT_BINARY_DIR}/IrrblossConfigVersion.cmake" 59 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Irrbloss" 60 | ) 61 | -------------------------------------------------------------------------------- /lib/irrbloss/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | if(NOT TARGET Irrbloss::Irrbloss) 4 | include("${CMAKE_CURRENT_LIST_DIR}/IrrblossTargets.cmake") 5 | endif() 6 | -------------------------------------------------------------------------------- /lib/irrbloss/README.md: -------------------------------------------------------------------------------- 1 | # Irrbloss - Irrlicht/IrrlichtMt fork 2 | Irrbloss is a heavily cut down fork of Irrlicht (IrrlichtMt) specifically for Node Box Editor, forked off of IrrlichtMt on commit dc2246d. 3 | 4 | To distinguish it from Irrlicht it has been renamed to Irrbloss which is Swedish for irrlicht. How quirky :) 5 | 6 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_CULLING_TYPES_H_INCLUDED__ 6 | #define __E_CULLING_TYPES_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | namespace irr { 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 | { 27 | "false", 28 | "box", // camera box against node box 29 | "frustum_box", // camera frustum against node box 30 | "frustum_sphere", // camera frustum against node sphere 31 | "occ_query", // occlusion query 32 | 0 33 | }; 34 | 35 | } // end namespace scene 36 | } // end namespace irr 37 | 38 | 39 | #endif // __E_CULLING_TYPES_H_INCLUDED__ 40 | 41 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_DEBUG_SCENE_TYPES_H_INCLUDED__ 6 | #define __E_DEBUG_SCENE_TYPES_H_INCLUDED__ 7 | 8 | namespace irr { 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 | //! Temporary use transparency Material Type 31 | EDS_HALF_TRANSPARENCY = 16, 32 | 33 | //! Show Bounding Boxes of all MeshBuffers 34 | EDS_BBOX_BUFFERS = 32, 35 | 36 | //! EDS_BBOX | EDS_BBOX_BUFFERS 37 | EDS_BBOX_ALL = EDS_BBOX | EDS_BBOX_BUFFERS, 38 | 39 | //! Show all debug infos 40 | EDS_FULL = 0xffffffff 41 | }; 42 | 43 | 44 | } // end namespace scene 45 | } // end namespace irr 46 | 47 | 48 | #endif // __E_DEBUG_SCENE_TYPES_H_INCLUDED__ 49 | 50 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_DEVICE_TYPES_H_INCLUDED__ 6 | #define __E_DEVICE_TYPES_H_INCLUDED__ 7 | 8 | namespace irr { 9 | //! An enum for the different device types supported by the Irrlicht Engine. 10 | enum E_DEVICE_TYPE 11 | { 12 | //! A device native to Microsoft Windows 13 | EIDT_WIN32, 14 | 15 | //! A device native to Unix style operating systems. 16 | EIDT_X11, 17 | 18 | //! A device native to Mac OSX 19 | EIDT_OSX, 20 | 21 | //! This selection allows Irrlicht to choose the best device from the ones available. 22 | EIDT_BEST, 23 | }; 24 | 25 | } // end namespace irr 26 | 27 | #endif // __E_DEVICE_TYPES_H_INCLUDED__ 28 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_DRIVER_TYPES_H_INCLUDED__ 6 | #define __E_DRIVER_TYPES_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | namespace irr { 11 | namespace video { 12 | 13 | //! An enum for all types of drivers the Irrlicht Engine supports. 14 | enum E_DRIVER_TYPE { 15 | //! Null driver, useful for applications to run the engine without visualization. 16 | EDT_NULL, 17 | 18 | //! OpenGL device, available on most platforms. 19 | EDT_OPENGL, 20 | 21 | //! No driver, just for counting the elements 22 | EDT_COUNT 23 | }; 24 | 25 | } // end namespace video 26 | } // end namespace irr 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef E_FOCUS_FLAGS_H_INCLUDED__ 5 | #define E_FOCUS_FLAGS_H_INCLUDED__ 6 | 7 | namespace irr { 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 | //! When set the focus changes when the left mouse-button got clicked while over an element 15 | EFF_SET_ON_LMOUSE_DOWN = 0x1, 16 | 17 | //! When set the focus changes when the right mouse-button got clicked while over an element 18 | //! Note that elements usually don't care about right-click and that won't change with this flag 19 | //! This is mostly to allow taking away focus from elements with right-mouse additionally. 20 | EFF_SET_ON_RMOUSE_DOWN = 0x2, 21 | 22 | //! When set the focus changes when the mouse-cursor is over an element 23 | EFF_SET_ON_MOUSE_OVER = 0x4, 24 | 25 | //! When set the focus can be changed with TAB-key combinations. 26 | EFF_SET_ON_TAB = 0x8, 27 | 28 | //! When set it's possible to set the focus to disabled elements. 29 | EFF_CAN_FOCUS_DISABLED = 0x16 30 | }; 31 | 32 | } // namespace gui 33 | } // namespace irr 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_GUI_ALIGNMENT_H_INCLUDED__ 6 | #define __E_GUI_ALIGNMENT_H_INCLUDED__ 7 | 8 | namespace irr { 9 | namespace gui { 10 | enum EGUI_ALIGNMENT 11 | { 12 | //! Aligned to parent's top or left side (default) 13 | EGUIA_UPPERLEFT=0, 14 | //! Aligned to parent's bottom or right side 15 | EGUIA_LOWERRIGHT, 16 | //! Aligned to the center of parent 17 | EGUIA_CENTER, 18 | //! Stretched to fit parent 19 | EGUIA_SCALE 20 | }; 21 | 22 | //! Names for alignments 23 | const c8* const GUIAlignmentNames[] = { 24 | "upperLeft", 25 | "lowerRight", 26 | "center", 27 | "scale", 28 | 0 29 | }; 30 | 31 | } // namespace gui 32 | } // namespace irr 33 | 34 | #endif // __E_GUI_ALIGNMENT_H_INCLUDED__ 35 | 36 | -------------------------------------------------------------------------------- /lib/irrbloss/include/EGUIElementTypes.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 | #ifndef __E_GUI_ELEMENT_TYPES_H_INCLUDED__ 6 | #define __E_GUI_ELEMENT_TYPES_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | namespace irr { 11 | namespace gui 12 | { 13 | 14 | //! List of all basic Irrlicht GUI elements. 15 | /** An IGUIElement returns this when calling IGUIElement::getType(); */ 16 | enum EGUI_ELEMENT_TYPE { 17 | //! A button (IGUIButton) 18 | EGUIET_BUTTON = 0, 19 | 20 | //! A check box (IGUICheckBox) 21 | EGUIET_CHECK_BOX, 22 | 23 | //! A combo box (IGUIComboBox) 24 | EGUIET_COMBO_BOX, 25 | 26 | //! A context menu (IGUIContextMenu) 27 | EGUIET_CONTEXT_MENU, 28 | 29 | //! A menu (IGUIMenu) 30 | EGUIET_MENU, 31 | 32 | //! An edit box (IGUIEditBox) 33 | EGUIET_EDIT_BOX, 34 | 35 | //! An image (IGUIImage) 36 | EGUIET_IMAGE, 37 | 38 | //! A list box (IGUIListBox) 39 | EGUIET_LIST_BOX, 40 | 41 | //! A message box (IGUIWindow) 42 | EGUIET_MESSAGE_BOX, 43 | 44 | //! A modal screen 45 | EGUIET_MODAL_SCREEN, 46 | 47 | //! A scroll bar (IGUIScrollBar) 48 | EGUIET_SCROLL_BAR, 49 | 50 | //! A static text (IGUIStaticText) 51 | EGUIET_STATIC_TEXT, 52 | 53 | //! A tab control 54 | EGUIET_TAB_CONTROL, 55 | 56 | //! A Table 57 | EGUIET_TABLE, 58 | 59 | //! A tool bar (IGUIToolBar) 60 | EGUIET_TOOL_BAR, 61 | 62 | //! A window 63 | EGUIET_WINDOW, 64 | 65 | //! Unknown type. 66 | EGUIET_ELEMENT, 67 | 68 | //! The root of the GUI 69 | EGUIET_ROOT, 70 | 71 | //! Not an element, amount of elements in there 72 | EGUIET_COUNT, 73 | 74 | //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit. 75 | EGUIET_FORCE_32_BIT = 0x7fffffff 76 | 77 | }; 78 | 79 | } // end namespace gui 80 | } // end namespace irr 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_HARDWARE_BUFFER_FLAGS_INCLUDED__ 6 | #define __E_HARDWARE_BUFFER_FLAGS_INCLUDED__ 7 | 8 | namespace irr { 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 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /lib/irrbloss/include/EMessageBoxFlags.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 | #ifndef __E_MESSAGE_BOX_FLAGS_H_INCLUDED__ 6 | #define __E_MESSAGE_BOX_FLAGS_H_INCLUDED__ 7 | 8 | namespace irr { 9 | namespace gui 10 | { 11 | 12 | //! enumeration for message box layout flags 13 | enum EMESSAGE_BOX_FLAG { 14 | //! Flag for the OK button 15 | EMBF_OK = 0x1, 16 | 17 | //! Flag for the cancel button 18 | EMBF_CANCEL = 0x2, 19 | 20 | //! Flag for the yes button 21 | EMBF_YES = 0x4, 22 | 23 | //! Flag for the no button 24 | EMBF_NO = 0x8, 25 | 26 | //! This value is not used. It only forces this enumeration to compile in 32 bit. 27 | EMBF_FORCE_32BIT = 0x7fffffff 28 | }; 29 | 30 | } // namespace gui 31 | } // namespace irr 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_PRIMITIVE_TYPES_H_INCLUDED__ 6 | #define __E_PRIMITIVE_TYPES_H_INCLUDED__ 7 | 8 | namespace irr { 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 | //! After the first two vertices each further two vertices create a quad with the preceding two. 39 | EPT_QUAD_STRIP, 40 | 41 | //! Every four vertices create a quad. 42 | //! Deprecated with newer OpenGL drivers 43 | EPT_QUADS, 44 | 45 | //! Just as LINE_LOOP, but filled. 46 | //! Deprecated with newer OpenGL drivers 47 | EPT_POLYGON, 48 | 49 | //! The single vertices are expanded to quad billboards on the GPU. 50 | EPT_POINT_SPRITES 51 | }; 52 | 53 | } // end namespace scene 54 | } // end namespace irr 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_READ_FILE_TYPES_H_INCLUDED__ 6 | #define __E_READ_FILE_TYPES_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | namespace irr { 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 | //! Unknown type 24 | EFIT_UNKNOWN = MAKE_IRR_ID('u','n','k','n') 25 | }; 26 | } // end namespace io 27 | } // end namespace irr 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __E_SCENE_NODE_TYPES_H_INCLUDED__ 6 | #define __E_SCENE_NODE_TYPES_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | namespace irr { 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 | //! simple cube scene node 24 | ESNT_CUBE = MAKE_IRR_ID('c','u','b','e'), 25 | 26 | //! Text Scene Node 27 | ESNT_TEXT = MAKE_IRR_ID('t','e','x','t'), 28 | 29 | //! Shadow Volume Scene Node 30 | ESNT_SHADOW_VOLUME = MAKE_IRR_ID('s','h','d','w'), 31 | 32 | //! Octree Scene Node 33 | ESNT_OCTREE = MAKE_IRR_ID('o','c','t','r'), 34 | 35 | //! Mesh Scene Node 36 | ESNT_MESH = MAKE_IRR_ID('m','e','s','h'), 37 | 38 | //! Light Scene Node 39 | ESNT_LIGHT = MAKE_IRR_ID('l','g','h','t'), 40 | 41 | //! Empty Scene Node 42 | ESNT_EMPTY = MAKE_IRR_ID('e','m','t','y'), 43 | 44 | //! Dummy Transformation Scene Node 45 | ESNT_DUMMY_TRANSFORMATION = MAKE_IRR_ID('d','m','m','y'), 46 | 47 | //! Camera Scene Node 48 | ESNT_CAMERA = MAKE_IRR_ID('c','a','m','_'), 49 | 50 | //! Animated Mesh Scene Node 51 | ESNT_ANIMATED_MESH = MAKE_IRR_ID('a','m','s','h'), 52 | 53 | //! Volume Light Scene Node 54 | ESNT_VOLUME_LIGHT = MAKE_IRR_ID('v','o','l','l'), 55 | 56 | //! Unknown scene node 57 | ESNT_UNKNOWN = MAKE_IRR_ID('u','n','k','n'), 58 | 59 | //! Will match with any scene node when checking types 60 | ESNT_ANY = MAKE_IRR_ID('a','n','y','_') 61 | }; 62 | 63 | } // end namespace scene 64 | } // end namespace irr 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /lib/irrbloss/include/EShaderTypes.h: -------------------------------------------------------------------------------- 1 | #ifndef __E_SHADER_TYPES_H_INCLUDED__ 2 | #define __E_SHADER_TYPES_H_INCLUDED__ 3 | 4 | #include "irrTypes.h" 5 | 6 | namespace irr { 7 | namespace video 8 | { 9 | 10 | //! Compile target enumeration for the addHighLevelShaderMaterial() method. 11 | enum E_VERTEX_SHADER_TYPE { 12 | EVST_VS_1_1 = 0, 13 | EVST_VS_2_0, 14 | EVST_VS_2_a, 15 | EVST_VS_3_0, 16 | EVST_VS_4_0, 17 | EVST_VS_4_1, 18 | EVST_VS_5_0, 19 | 20 | //! This is not a type, but a value indicating how much types there are. 21 | EVST_COUNT 22 | }; 23 | 24 | //! Names for all vertex shader types, each entry corresponds to a E_VERTEX_SHADER_TYPE entry. 25 | const c8* const VERTEX_SHADER_TYPE_NAMES[] = { 26 | "vs_1_1", 27 | "vs_2_0", 28 | "vs_2_a", 29 | "vs_3_0", 30 | "vs_4_0", 31 | "vs_4_1", 32 | "vs_5_0", 33 | 0 }; 34 | 35 | //! Compile target enumeration for the addHighLevelShaderMaterial() method. 36 | enum E_PIXEL_SHADER_TYPE { 37 | EPST_PS_1_1 = 0, 38 | EPST_PS_1_2, 39 | EPST_PS_1_3, 40 | EPST_PS_1_4, 41 | EPST_PS_2_0, 42 | EPST_PS_2_a, 43 | EPST_PS_2_b, 44 | EPST_PS_3_0, 45 | EPST_PS_4_0, 46 | EPST_PS_4_1, 47 | EPST_PS_5_0, 48 | 49 | //! This is not a type, but a value indicating how much types there are. 50 | EPST_COUNT 51 | }; 52 | 53 | //! Names for all pixel shader types, each entry corresponds to a E_PIXEL_SHADER_TYPE entry. 54 | const c8* const PIXEL_SHADER_TYPE_NAMES[] = { 55 | "ps_1_1", 56 | "ps_1_2", 57 | "ps_1_3", 58 | "ps_1_4", 59 | "ps_2_0", 60 | "ps_2_a", 61 | "ps_2_b", 62 | "ps_3_0", 63 | "ps_4_0", 64 | "ps_4_1", 65 | "ps_5_0", 66 | 0 }; 67 | 68 | //! Enum for supported geometry shader types 69 | enum E_GEOMETRY_SHADER_TYPE { 70 | EGST_GS_4_0 = 0, 71 | 72 | //! This is not a type, but a value indicating how much types there are. 73 | EGST_COUNT 74 | }; 75 | 76 | //! String names for supported geometry shader types 77 | const c8* const GEOMETRY_SHADER_TYPE_NAMES[] = { 78 | "gs_4_0", 79 | 0 }; 80 | 81 | 82 | } // end namespace video 83 | } // end namespace irr 84 | 85 | #endif // __E_SHADER_TYPES_H_INCLUDED__ 86 | 87 | -------------------------------------------------------------------------------- /lib/irrbloss/include/EVertexAttributes.h: -------------------------------------------------------------------------------- 1 | #ifndef __E_VERTEX_ATTRIBUTES_H_INCLUDED__ 2 | #define __E_VERTEX_ATTRIBUTES_H_INCLUDED__ 3 | 4 | namespace irr { 5 | namespace video 6 | { 7 | 8 | //! Enumeration for all vertex attributes there are. 9 | enum E_VERTEX_ATTRIBUTES { 10 | EVA_POSITION = 0, 11 | EVA_NORMAL, 12 | EVA_COLOR, 13 | EVA_TCOORD0, 14 | EVA_TCOORD1, 15 | EVA_TANGENT, 16 | EVA_BINORMAL, 17 | EVA_COUNT 18 | }; 19 | 20 | //! Array holding the built in vertex attribute names 21 | const char* const sBuiltInVertexAttributeNames[] = { 22 | "inVertexPosition", 23 | "inVertexNormal", 24 | "inVertexColor", 25 | "inTexCoord0", 26 | "inTexCoord1", 27 | "inVertexTangent", 28 | "inVertexBinormal", 29 | 0 30 | }; 31 | 32 | } // end namespace video 33 | } // end namespace irr 34 | 35 | #endif //__E_VERTEX_ATTRIBUTES_H_INCLUDED__ -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_ANIMATED_MESH_H_INCLUDED__ 6 | #define __I_ANIMATED_MESH_H_INCLUDED__ 7 | 8 | #include "aabbox3d.h" 9 | #include "IMesh.h" 10 | 11 | namespace irr { 12 | namespace scene 13 | { 14 | //! Interface for an animated mesh. 15 | class IAnimatedMesh : public IMesh 16 | { 17 | public: 18 | 19 | //! Gets the frame count of the animated mesh. 20 | virtual u32 getFrameCount() const = 0; 21 | 22 | //! Returns the IMesh interface for a frame. 23 | virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) = 0; 24 | 25 | //! Returns the type of the animated mesh. 26 | virtual E_ANIMATED_MESH_TYPE getMeshType() const _IRR_OVERRIDE_ 27 | { 28 | return EAMT_UNKNOWN; 29 | } 30 | }; 31 | 32 | } // end namespace scene 33 | } // end namespace irr 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /lib/irrbloss/include/IAnimatedMeshSceneNode.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 | #ifndef __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ 6 | #define __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ 7 | 8 | #include "ISceneNode.h" 9 | #include "IAnimatedMesh.h" 10 | 11 | namespace irr { 12 | namespace scene 13 | { 14 | class IShadowVolumeSceneNode; 15 | 16 | enum E_JOINT_UPDATE_ON_RENDER 17 | { 18 | //! do nothing 19 | EJUOR_NONE = 0, 20 | 21 | //! get joints positions from the mesh (for attached nodes, etc) 22 | EJUOR_READ, 23 | 24 | //! control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() ) 25 | EJUOR_CONTROL 26 | }; 27 | 28 | 29 | class IAnimatedMeshSceneNode; 30 | 31 | //! Callback interface for catching events of ended animations. 32 | /** Implement this interface and use 33 | IAnimatedMeshSceneNode::setAnimationEndCallback to be able to 34 | be notified if an animation playback has ended. 35 | **/ 36 | class IAnimationEndCallBack : public virtual IReferenceCounted 37 | { 38 | public: 39 | 40 | //! Will be called when the animation playback has ended. 41 | /** See IAnimatedMeshSceneNode::setAnimationEndCallback for 42 | more information. 43 | \param node: Node of which the animation has ended. */ 44 | virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node) = 0; 45 | }; 46 | 47 | //! Scene node capable of displaying an animated mesh. 48 | class IAnimatedMeshSceneNode : public ISceneNode 49 | { 50 | public: 51 | 52 | //! Constructor 53 | IAnimatedMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, 54 | const core::vector3df& position = core::vector3df(0,0,0), 55 | const core::vector3df& rotation = core::vector3df(0,0,0), 56 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) 57 | : ISceneNode(parent, mgr, id, position, rotation, scale) {} 58 | 59 | //! Destructor 60 | virtual ~IAnimatedMeshSceneNode() {} 61 | 62 | //! Returns the currently displayed frame number. 63 | virtual f32 getFrameNr() const = 0; 64 | 65 | //! Sets a new mesh 66 | virtual void setMesh(IAnimatedMesh* mesh) = 0; 67 | 68 | //! Returns the current mesh 69 | virtual IAnimatedMesh* getMesh(void) = 0; 70 | 71 | //! Creates a clone of this scene node and its children. 72 | /** \param newParent An optional new parent. 73 | \param newManager An optional new scene manager. 74 | \return The newly created clone of this node. */ 75 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) = 0; 76 | 77 | }; 78 | 79 | } // end namespace scene 80 | } // end namespace irr 81 | 82 | #endif 83 | 84 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __IRR_I_CONTEXT_MANAGER_H_INCLUDED__ 6 | #define __IRR_I_CONTEXT_MANAGER_H_INCLUDED__ 7 | 8 | #include "SExposedVideoData.h" 9 | #include "SIrrCreationParameters.h" 10 | 11 | namespace irr { 12 | namespace video 13 | { 14 | // For system specific window contexts (used for OpenGL) 15 | class IContextManager : public virtual IReferenceCounted 16 | { 17 | public: 18 | //! Initialize manager with device creation parameters and device window (passed as exposed video data) 19 | virtual bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) =0; 20 | 21 | //! Terminate manager, any cleanup that is left over. Manager needs a new initialize to be usable again 22 | virtual void terminate() =0; 23 | 24 | //! Create surface based on current window set 25 | virtual bool generateSurface() =0; 26 | 27 | //! Destroy current surface 28 | virtual void destroySurface() =0; 29 | 30 | //! Create context based on current surface 31 | virtual bool generateContext() =0; 32 | 33 | //! Destroy current context 34 | virtual void destroyContext() =0; 35 | 36 | //! Get current context 37 | virtual const SExposedVideoData& getContext() const =0; 38 | 39 | //! Change render context, disable old and activate new defined by videoData 40 | //\param restorePrimaryOnZero When true: restore original driver context when videoData is set to 0 values. 41 | // When false: resets the context when videoData is set to 0 values. 42 | /** This is mostly used internally by IVideoDriver::beginScene(). 43 | But if you want to switch threads which access your OpenGL driver you will have to 44 | call this function as follows: 45 | Old thread gives up context with: activateContext(irr::video::SExposedVideoData()); 46 | New thread takes over context with: activateContext(videoDriver->getExposedVideoData()); 47 | Note that only 1 thread at a time may access an OpenGL context. */ 48 | virtual bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero=false) =0; 49 | 50 | //! Swap buffers. 51 | virtual bool swapBuffers() =0; 52 | }; 53 | 54 | } // end namespace video 55 | } // end namespace irr 56 | 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /lib/irrbloss/include/IFileArchive.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt/ Thomas Alten 2 | // This file is part of the "Irrlicht Engine". 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h 4 | 5 | #ifndef __I_FILE_ARCHIVE_H_INCLUDED__ 6 | #define __I_FILE_ARCHIVE_H_INCLUDED__ 7 | 8 | #include "IReadFile.h" 9 | #include "IFileList.h" 10 | 11 | namespace irr { 12 | 13 | namespace io { 14 | 15 | //! FileSystemType: which filesystem should be used for e.g. browsing 16 | enum EFileSystemType { 17 | FILESYSTEM_NATIVE = 0, // Native OS FileSystem 18 | FILESYSTEM_VIRTUAL // Virtual FileSystem 19 | }; 20 | 21 | //! Contains the different types of archives 22 | enum E_FILE_ARCHIVE_TYPE { 23 | //! A virtual directory 24 | EFAT_FOLDER = MAKE_IRR_ID('f','l','d','r'), 25 | 26 | //! The type of this archive is unknown 27 | EFAT_UNKNOWN = MAKE_IRR_ID('u','n','k','n') 28 | }; 29 | 30 | //! The FileArchive manages archives and provides access to files inside them. 31 | class IFileArchive : public virtual IReferenceCounted { 32 | public: 33 | 34 | //! Opens a file based on its name 35 | /** Creates and returns a new IReadFile for a file in the archive. 36 | \param filename The file to open 37 | \return Returns A pointer to the created file on success, 38 | or 0 on failure. */ 39 | virtual IReadFile* createAndOpenFile(const path& filename) =0; 40 | 41 | //! Opens a file based on its position in the file list. 42 | /** Creates and returns 43 | \param index The zero based index of the file. 44 | \return Returns a pointer to the created file on success, or 0 on failure. */ 45 | virtual IReadFile* createAndOpenFile(u32 index) =0; 46 | 47 | //! Returns the complete file tree 48 | /** \return Returns the complete directory tree for the archive, 49 | including all files and folders */ 50 | virtual const IFileList* getFileList() const =0; 51 | 52 | //! get the archive type 53 | virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_UNKNOWN; } 54 | 55 | //! return the name (id) of the file Archive 56 | virtual const io::path& getArchiveName() const =0; 57 | 58 | }; 59 | 60 | } // end namespace io 61 | } // end namespace irr 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_GUI_CHECKBOX_H_INCLUDED__ 6 | #define __I_GUI_CHECKBOX_H_INCLUDED__ 7 | 8 | #include "IGUIElement.h" 9 | 10 | namespace irr { 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 | 22 | //! constructor 23 | IGUICheckBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) 24 | : IGUIElement(EGUIET_CHECK_BOX, environment, parent, id, rectangle) {} 25 | 26 | //! Set if box is checked. 27 | virtual void setChecked(bool checked) = 0; 28 | 29 | //! Returns true if box is checked. 30 | virtual bool isChecked() const = 0; 31 | 32 | //! Sets whether to draw the background 33 | virtual void setDrawBackground(bool draw) = 0; 34 | 35 | //! Checks if background drawing is enabled 36 | /** \return true if background drawing is enabled, false otherwise */ 37 | virtual bool isDrawBackgroundEnabled() const = 0; 38 | 39 | //! Sets whether to draw the border 40 | virtual void setDrawBorder(bool draw) = 0; 41 | 42 | //! Checks if border drawing is enabled 43 | /** \return true if border drawing is enabled, false otherwise */ 44 | virtual bool isDrawBorderEnabled() const = 0; 45 | 46 | }; 47 | 48 | } // end namespace gui 49 | } // end namespace irr 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_GUI_COMBO_BOX_H_INCLUDED__ 6 | #define __I_GUI_COMBO_BOX_H_INCLUDED__ 7 | 8 | #include "IGUIElement.h" 9 | 10 | namespace irr { 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 | 22 | //! constructor 23 | IGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) 24 | : IGUIElement(EGUIET_COMBO_BOX, environment, parent, id, rectangle) {} 25 | 26 | //! Returns amount of items in box 27 | virtual u32 getItemCount() const = 0; 28 | 29 | //! Returns string of an item. the idx may be a value from 0 to itemCount-1 30 | virtual const wchar_t* getItem(u32 idx) const = 0; 31 | 32 | //! Returns item data of an item. the idx may be a value from 0 to itemCount-1 33 | virtual u32 getItemData(u32 idx) const = 0; 34 | 35 | //! Returns index based on item data 36 | virtual s32 getIndexForItemData(u32 data ) const = 0; 37 | 38 | //! Adds an item and returns the index of it 39 | virtual u32 addItem(const wchar_t* text, u32 data = 0) = 0; 40 | 41 | //! Removes an item from the combo box. 42 | /** Warning. This will change the index of all following items */ 43 | virtual void removeItem(u32 idx) = 0; 44 | 45 | //! Deletes all items in the combo box 46 | virtual void clear() = 0; 47 | 48 | //! Returns id of selected item. returns -1 if no item is selected. 49 | virtual s32 getSelected() const = 0; 50 | 51 | //! Sets the selected item. Set this to -1 if no item should be selected 52 | virtual void setSelected(s32 idx) = 0; 53 | 54 | //! Sets text justification of the text area 55 | /** \param horizontal: EGUIA_UPPERLEFT for left justified (default), 56 | EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text. 57 | \param vertical: EGUIA_UPPERLEFT to align with top edge, 58 | EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ 59 | virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0; 60 | 61 | //! Set the maximal number of rows for the selection listbox 62 | virtual void setMaxSelectionRows(u32 max) = 0; 63 | 64 | //! Get the maximal number of rows for the selection listbox 65 | virtual u32 getMaxSelectionRows() const = 0; 66 | }; 67 | 68 | 69 | } // end namespace gui 70 | } // end namespace irr 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_GUI_FONT_BITMAP_H_INCLUDED__ 6 | #define __I_GUI_FONT_BITMAP_H_INCLUDED__ 7 | 8 | #include "IGUIFont.h" 9 | 10 | namespace irr { 11 | namespace gui 12 | { 13 | class IGUISpriteBank; 14 | 15 | //! Font interface. 16 | class IGUIFontBitmap : public IGUIFont { 17 | public: 18 | 19 | //! Returns the type of this font 20 | virtual EGUI_FONT_TYPE getType() const _IRR_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 | virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const _IRR_OVERRIDE_ = 0; 38 | }; 39 | 40 | } // end namespace gui 41 | } // end namespace irr 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /lib/irrbloss/include/IGUIImageList.h: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de 3 | 4 | #ifndef __I_GUI_IMAGE_LIST_H_INCLUDED__ 5 | #define __I_GUI_IMAGE_LIST_H_INCLUDED__ 6 | 7 | #include "IGUIElement.h" 8 | #include "rect.h" 9 | #include "irrTypes.h" 10 | 11 | namespace irr { 12 | namespace gui 13 | { 14 | 15 | //! Font interface. 16 | class IGUIImageList : public virtual IReferenceCounted { 17 | public: 18 | 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 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_GUI_SCROLL_BAR_H_INCLUDED__ 6 | #define __I_GUI_SCROLL_BAR_H_INCLUDED__ 7 | 8 | #include "IGUIElement.h" 9 | 10 | namespace irr { 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 | 22 | //! constructor 23 | IGUIScrollBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) 24 | : IGUIElement(EGUIET_SCROLL_BAR, environment, parent, id, rectangle) {} 25 | 26 | //! sets the maximum value of the scrollbar. 27 | virtual void setMax(s32 max) = 0; 28 | //! gets the maximum value of the scrollbar. 29 | virtual s32 getMax() const = 0; 30 | 31 | //! sets the minimum value of the scrollbar. 32 | virtual void setMin(s32 min) = 0; 33 | //! gets the minimum value of the scrollbar. 34 | virtual s32 getMin() const = 0; 35 | 36 | //! gets the small step value 37 | virtual s32 getSmallStep() const = 0; 38 | 39 | //! Sets the small step 40 | /** That is the amount that the value changes by when clicking 41 | on the buttons or using the cursor keys. */ 42 | virtual void setSmallStep(s32 step) = 0; 43 | 44 | //! gets the large step value 45 | virtual s32 getLargeStep() const = 0; 46 | 47 | //! Sets the large step 48 | /** That is the amount that the value changes by when clicking 49 | in the tray, or using the page up and page down keys. */ 50 | virtual void setLargeStep(s32 step) = 0; 51 | 52 | //! gets the current position of the scrollbar 53 | virtual s32 getPos() const = 0; 54 | 55 | //! sets the current position of the scrollbar 56 | virtual void setPos(s32 pos) = 0; 57 | }; 58 | 59 | 60 | } // end namespace gui 61 | } // end namespace irr 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_GUI_TOOL_BAR_H_INCLUDED__ 6 | #define __I_GUI_TOOL_BAR_H_INCLUDED__ 7 | 8 | #include "IGUIElement.h" 9 | 10 | namespace irr { 11 | namespace video 12 | { 13 | class ITexture; 14 | } // end namespace video 15 | namespace gui { 16 | class IGUIButton; 17 | 18 | //! Stays at the top of its parent like the menu bar and contains tool buttons 19 | class IGUIToolBar : public IGUIElement 20 | { 21 | public: 22 | 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 | 34 | } // end namespace gui 35 | } // end namespace irr 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /lib/irrbloss/include/IGeometryCreator.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 | #ifndef __I_GEOMETRY_CREATOR_H_INCLUDED__ 6 | #define __I_GEOMETRY_CREATOR_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "IMesh.h" 10 | #include "IImage.h" 11 | 12 | namespace irr { 13 | namespace video 14 | { 15 | class IVideoDriver; 16 | class SMaterial; 17 | } 18 | 19 | namespace scene { 20 | 21 | enum ECUBE_MESH_TYPE 22 | { 23 | //! Single buffer with 12 different vertices, normals are average of adjacent planes 24 | //! Order for outgoing (front-face) normals of planes would be: NEG_Z, POS_X, POS_Z, NEG_X, POS_Y, NEG_Y 25 | ECMT_1BUF_12VTX_NA, 26 | 27 | //! One buffer per side, each with 4 vertices, normals are perpendicular to sides 28 | //! Note: You probably will have to scale down your texture uv's to avoid white lines at borders 29 | // as this mesh sets them to 0,1 values. We can't do that when creating the mesh as it 30 | // depends on texture resolution which we don't know at that point. 31 | ECMT_6BUF_4VTX_NP 32 | }; 33 | 34 | //! Helper class for creating geometry on the fly. 35 | /** You can get an instance of this class through ISceneManager::getGeometryCreator() */ 36 | class IGeometryCreator : public IReferenceCounted { 37 | public: 38 | 39 | //! Creates a simple cube mesh. 40 | /** 41 | \param size Dimensions of the cube. 42 | \param type One of ECUBE_MESH_TYPE. So you can chose between cubes with single material or independent materials per side. 43 | \return Generated mesh. 44 | */ 45 | virtual IMesh* createCubeMesh(const core::vector3df& size=core::vector3df(5.f,5.f,5.f), ECUBE_MESH_TYPE type = ECMT_1BUF_12VTX_NA) const =0; 46 | }; 47 | 48 | 49 | } // end namespace scene 50 | } // end namespace irr 51 | 52 | #endif // __I_GEOMETRY_CREATOR_H_INCLUDED__ 53 | 54 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_SURFACE_LOADER_H_INCLUDED__ 6 | #define __I_SURFACE_LOADER_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "IImage.h" 10 | #include "ITexture.h" 11 | #include "path.h" 12 | #include "irrArray.h" 13 | 14 | namespace irr { 15 | namespace io 16 | { 17 | class IReadFile; 18 | } // end namespace io 19 | namespace video { 20 | 21 | //! Class which is able to create a image from a file. 22 | class IImageLoader : public virtual IReferenceCounted { 23 | public: 24 | 25 | //! Check if the file might be loaded by this class 26 | /** 27 | \param filename Name of file to check. 28 | \return True if file seems to be loadable. */ 29 | virtual bool isALoadableFileExtension(const io::path& filename) const = 0; 30 | 31 | //! Check if the file might be loaded by this class 32 | /** Check might look into the file. 33 | \param file File handle to check. 34 | \return True if file seems to be loadable. */ 35 | virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0; 36 | 37 | //! Creates a surface from the file 38 | /** \param file File handle to check. 39 | \return Pointer to newly created image, or 0 upon error. */ 40 | virtual IImage* loadImage(io::IReadFile* file) const = 0; 41 | 42 | //! Creates a multiple surfaces from the file eg. whole cube map. 43 | /** \param file File handle to check. 44 | \param type Pointer to E_TEXTURE_TYPE where a recommended type of the texture will be stored. 45 | \return Array of pointers to newly created images. */ 46 | virtual core::array loadImages(io::IReadFile* file, E_TEXTURE_TYPE* type) const 47 | { 48 | core::array image; 49 | 50 | return image; 51 | } 52 | }; 53 | 54 | 55 | } // end namespace video 56 | } // end namespace irr 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef _I_IMAGE_WRITER_H_INCLUDED__ 6 | #define _I_IMAGE_WRITER_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "irrString.h" 10 | #include "coreutil.h" 11 | 12 | namespace irr { 13 | namespace io 14 | { 15 | class IWriteFile; 16 | } // end namespace io 17 | 18 | namespace video { 19 | class IImage; 20 | 21 | 22 | //! Interface for writing software image data. 23 | class IImageWriter : public IReferenceCounted { 24 | public: 25 | //! Check if this writer can write a file with the given extension 26 | /** \param filename Name of the file to check. 27 | \return True if file extension specifies a writable type. */ 28 | virtual bool isAWriteableFileExtension(const io::path& filename) const = 0; 29 | 30 | //! Write image to file 31 | /** \param file File handle to write to. 32 | \param image Image to write into file. 33 | \param param Writer specific parameter, influencing e.g. quality. 34 | \return True if image was successfully written. */ 35 | virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param = 0) const = 0; 36 | }; 37 | 38 | } // namespace video 39 | } // namespace irr 40 | 41 | #endif // _I_IMAGE_WRITER_H_INCLUDED__ 42 | 43 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_INDEX_BUFFER_H_INCLUDED__ 6 | #define __I_INDEX_BUFFER_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "irrArray.h" 10 | 11 | #include "SVertexIndex.h" 12 | 13 | namespace irr { 14 | 15 | namespace video { 16 | 17 | } 18 | 19 | namespace scene { 20 | 21 | class IIndexBuffer : public virtual IReferenceCounted 22 | { 23 | public: 24 | 25 | virtual void* getData() =0; 26 | 27 | virtual video::E_INDEX_TYPE getType() const =0; 28 | virtual void setType(video::E_INDEX_TYPE IndexType) =0; 29 | 30 | virtual u32 stride() const =0; 31 | 32 | virtual u32 size() const =0; 33 | virtual void push_back (const u32 &element) =0; 34 | virtual u32 operator [](u32 index) const =0; 35 | virtual u32 getLast() =0; 36 | virtual void setValue(u32 index, u32 value) =0; 37 | virtual void set_used(u32 usedNow) =0; 38 | virtual void reallocate(u32 new_size) =0; 39 | virtual u32 allocated_size() const=0; 40 | 41 | virtual void* pointer() =0; 42 | 43 | //! get the current hardware mapping hint 44 | virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0; 45 | 46 | //! set the hardware mapping hint, for driver 47 | virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0; 48 | 49 | //! flags the meshbuffer as changed, reloads hardware buffers 50 | virtual void setDirty() = 0; 51 | 52 | //! Get the currently used ID for identification of changes. 53 | /** This shouldn't be used for anything outside the VideoDriver. */ 54 | virtual u32 getChangedID() const = 0; 55 | }; 56 | 57 | 58 | } // end namespace scene 59 | } // end namespace irr 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /lib/irrbloss/include/ILightManager.h: -------------------------------------------------------------------------------- 1 | // Written by Colin MacDonald - all rights assigned to Nikolaus Gebhardt 2 | // Copyright (C) 2008-2012 Nikolaus Gebhardt 3 | // This file is part of the "Irrlicht Engine". 4 | // For conditions of distribution and use, see copyright notice in irrlicht.h 5 | 6 | #ifndef __I_LIGHT_MANAGER_H_INCLUDED__ 7 | #define __I_LIGHT_MANAGER_H_INCLUDED__ 8 | 9 | #include "IReferenceCounted.h" 10 | #include "irrArray.h" 11 | 12 | namespace irr { 13 | namespace scene 14 | { 15 | class ILightSceneNode; 16 | 17 | //! ILightManager provides an interface for user applications to manipulate the list of lights in the scene. 18 | /** The light list can be trimmed or re-ordered before device/ hardware 19 | lights are created, and/or individual lights can be switched on and off 20 | before or after each scene node is rendered. It is assumed that the 21 | ILightManager implementation will store any data that it wishes to 22 | retain, i.e. the ISceneManager to which it is assigned, the lightList, 23 | the current render pass, and the current scene node. */ 24 | class ILightManager : public IReferenceCounted 25 | { 26 | public: 27 | //! Called after the scene's light list has been built, but before rendering has begun. 28 | /** As actual device/hardware lights are not created until the 29 | ESNRP_LIGHT render pass, this provides an opportunity for the 30 | light manager to trim or re-order the light list, before any 31 | device/hardware lights have actually been created. 32 | \param lightList: the Scene Manager's light list, which 33 | the light manager may modify. This reference will remain valid 34 | until OnPostRender(). 35 | */ 36 | virtual void OnPreRender(core::array & lightList) = 0; 37 | 38 | //! Called after the last scene node is rendered. 39 | /** After this call returns, the lightList passed to OnPreRender() becomes invalid. */ 40 | virtual void OnPostRender(void) = 0; 41 | 42 | //! Called before a render pass begins 43 | /** \param renderPass: the render pass that's about to begin */ 44 | virtual void OnRenderPassPreRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0; 45 | 46 | //! Called after the render pass specified in OnRenderPassPreRender() ends 47 | /** \param[in] renderPass: the render pass that has finished */ 48 | virtual void OnRenderPassPostRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0; 49 | 50 | //! Called before the given scene node is rendered 51 | /** \param[in] node: the scene node that's about to be rendered */ 52 | virtual void OnNodePreRender(ISceneNode* node) = 0; 53 | 54 | //! Called after the the node specified in OnNodePreRender() has been rendered 55 | /** \param[in] node: the scene node that has just been rendered */ 56 | virtual void OnNodePostRender(ISceneNode* node) = 0; 57 | }; 58 | } // end namespace scene 59 | } // end namespace irr 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_MEMORY_READ_FILE_H_INCLUDED__ 6 | #define __I_MEMORY_READ_FILE_H_INCLUDED__ 7 | 8 | #include "IReadFile.h" 9 | 10 | namespace irr { 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 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_MESH_LOADER_H_INCLUDED__ 6 | #define __I_MESH_LOADER_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "path.h" 10 | 11 | namespace irr { 12 | namespace io 13 | { 14 | class IReadFile; 15 | } // end namespace io 16 | namespace scene { 17 | class IAnimatedMesh; 18 | 19 | //! Class which is able to load an animated mesh from a file. 20 | class IMeshLoader : public virtual IReferenceCounted { 21 | public: 22 | 23 | //! Constructor 24 | IMeshLoader() {} 25 | 26 | //! Destructor 27 | virtual ~IMeshLoader() { 28 | } 29 | 30 | //! Returns true if the file might be loaded by this class. 31 | /** This decision should be based on the file extension (e.g. ".cob") 32 | only. 33 | \param filename Name of the file to test. 34 | \return True if the file might be loaded by this class. */ 35 | virtual bool isALoadableFileExtension(const io::path& filename) const = 0; 36 | 37 | //! Creates/loads an animated mesh from the file. 38 | /** \param file File handler to load the file from. 39 | \return Pointer to the created mesh. Returns 0 if loading failed. 40 | If you no longer need the mesh, you should call IAnimatedMesh::drop(). 41 | See IReferenceCounted::drop() for more information. */ 42 | virtual IAnimatedMesh* createMesh(io::IReadFile* file) = 0; 43 | }; 44 | 45 | 46 | } // end namespace scene 47 | } // end namespace irr 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_MESH_SCENE_NODE_H_INCLUDED__ 6 | #define __I_MESH_SCENE_NODE_H_INCLUDED__ 7 | 8 | #include "ISceneNode.h" 9 | 10 | namespace irr { 11 | namespace scene 12 | { 13 | 14 | class IShadowVolumeSceneNode; 15 | class IMesh; 16 | 17 | 18 | //! A scene node displaying a static mesh 19 | class IMeshSceneNode : public ISceneNode { 20 | public: 21 | 22 | //! Constructor 23 | /** Use setMesh() to set the mesh to display. 24 | */ 25 | IMeshSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, 26 | const core::vector3df& position = core::vector3df(0,0,0), 27 | const core::vector3df& rotation = core::vector3df(0,0,0), 28 | const core::vector3df& scale = core::vector3df(1,1,1)) 29 | : ISceneNode(parent, mgr, id, position, rotation, scale) {} 30 | 31 | //! Sets a new mesh to display 32 | /** \param mesh Mesh to display. */ 33 | virtual void setMesh(IMesh* mesh) = 0; 34 | 35 | //! Get the currently defined mesh for display. 36 | /** \return Pointer to mesh which is displayed by this node. */ 37 | virtual IMesh* getMesh(void) = 0; 38 | 39 | }; 40 | 41 | } // end namespace scene 42 | } // end namespace irr 43 | 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /lib/irrbloss/include/IMetaTriangleSelector.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 | #ifndef __I_META_TRIANGLE_SELECTOR_H_INCLUDED__ 6 | #define __I_META_TRIANGLE_SELECTOR_H_INCLUDED__ 7 | 8 | #include "ITriangleSelector.h" 9 | 10 | namespace irr { 11 | namespace scene 12 | { 13 | 14 | //! Interface for making multiple triangle selectors work as one big selector. 15 | /** This is nothing more than a collection of one or more triangle selectors 16 | providing together the interface of one triangle selector. In this way, 17 | collision tests can be done with different triangle soups in one pass. 18 | */ 19 | class IMetaTriangleSelector : public ITriangleSelector { 20 | public: 21 | 22 | //! Adds a triangle selector to the collection of triangle selectors. 23 | /** \param toAdd: Pointer to an triangle selector to add to the list. */ 24 | virtual void addTriangleSelector(ITriangleSelector* toAdd) = 0; 25 | 26 | //! Removes a specific triangle selector from the collection. 27 | /** \param toRemove: Pointer to an triangle selector which is in the 28 | list but will be removed. 29 | \return True if successful, false if not. */ 30 | virtual bool removeTriangleSelector(ITriangleSelector* toRemove) = 0; 31 | 32 | //! Removes all triangle selectors from the collection. 33 | virtual void removeAllTriangleSelectors() = 0; 34 | }; 35 | 36 | } // end namespace scene 37 | } // end namespace irr 38 | 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_OS_OPERATOR_H_INCLUDED__ 6 | #define __I_OS_OPERATOR_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "irrString.h" 10 | 11 | namespace irr { 12 | 13 | //! The Operating system operator provides operation system specific methods and information. 14 | class IOSOperator : public virtual IReferenceCounted { 15 | public: 16 | //! Get the current operation system version as string. 17 | virtual const core::stringc& getOperatingSystemVersion() const = 0; 18 | 19 | //! Copies text to the clipboard 20 | virtual void copyToClipboard(const c8* text) const = 0; 21 | 22 | //! Get text from the clipboard 23 | /** \return Returns 0 if no string is in there. */ 24 | virtual const c8* getTextFromClipboard() const = 0; 25 | }; 26 | 27 | } // end namespace 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_READ_FILE_H_INCLUDED__ 6 | #define __I_READ_FILE_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "coreutil.h" 10 | #include "EReadFileType.h" 11 | 12 | namespace irr { 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 | } // end namespace io 54 | } // end namespace irr 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /lib/irrbloss/include/IShaderConstantSetCallBack.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 | #ifndef __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__ 6 | #define __I_SHADER_CONSTANT_SET_CALLBACT_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | 10 | namespace irr { 11 | namespace video 12 | { 13 | class IMaterialRendererServices; 14 | class SMaterial; 15 | 16 | //! Interface making it possible to set constants for gpu programs every frame. 17 | /** Implement this interface in an own class and pass a pointer to it to one of 18 | the methods in IGPUProgrammingServices when creating a shader. The 19 | OnSetConstants method will be called every frame now. */ 20 | class IShaderConstantSetCallBack : public virtual IReferenceCounted { 21 | public: 22 | 23 | //! Called to let the callBack know the used material (optional method) 24 | virtual void OnSetMaterial(const SMaterial& material) { } 25 | 26 | //! Called by the engine when the vertex and/or pixel shader constants for an material renderer should be set. 27 | /** 28 | Implement the IShaderConstantSetCallBack in an own class and implement your own 29 | OnSetConstants method using the given IMaterialRendererServices interface. 30 | Pass a pointer to this class to one of the methods in IGPUProgrammingServices 31 | when creating a shader. The OnSetConstants method will now be called every time 32 | before geometry is being drawn using your shader material. 33 | \param services: Pointer to an interface providing methods to set the constants for the shader. 34 | \param userData: Userdata int which can be specified when creating the shader. 35 | */ 36 | virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) = 0; 37 | }; 38 | 39 | 40 | } // end namespace video 41 | } // end namespace irr 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /lib/irrbloss/include/IShadowVolumeSceneNode.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 | #ifndef __I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__ 6 | #define __I_SHADOW_VOLUME_SCENE_NODE_H_INCLUDED__ 7 | 8 | #include "ISceneNode.h" 9 | 10 | namespace irr { 11 | namespace scene 12 | { 13 | class IMesh; 14 | 15 | enum ESHADOWVOLUME_OPTIMIZATION 16 | { 17 | //! Create volumes around every triangle 18 | ESV_NONE, 19 | 20 | //! Create volumes only around the silhouette of the mesh 21 | /** This can reduce the number of volumes drastically, 22 | but will have an upfront-cost where it calculates adjacency of 23 | triangles. Also it will not work with all models. Basically 24 | if you see strange black shadow lines then you have a model 25 | for which it won't work. 26 | We get that information about adjacency by comparing the positions of 27 | all edges in the mesh (even if they are in different meshbuffers). */ 28 | ESV_SILHOUETTE_BY_POS 29 | }; 30 | 31 | //! Scene node for rendering a shadow volume into a stencil buffer. 32 | class IShadowVolumeSceneNode : public ISceneNode 33 | { 34 | public: 35 | 36 | //! constructor 37 | IShadowVolumeSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id) 38 | : ISceneNode(parent, mgr, id) {} 39 | 40 | //! Sets the mesh from which the shadow volume should be generated. 41 | /** To optimize shadow rendering, use a simpler mesh for shadows. 42 | */ 43 | virtual void setShadowMesh(const IMesh* mesh) = 0; 44 | 45 | //! Updates the shadow volumes for current light positions. 46 | virtual void updateShadowVolumes() = 0; 47 | 48 | //! Set optimization used to create shadow volumes 49 | /** Default is ESV_SILHOUETTE_BY_POS. If the shadow 50 | looks bad then give ESV_NONE a try (which will be slower). 51 | Alternatively you can try to fix the model, it's often 52 | because it's not closed (aka if you'd put water in it then 53 | that would leak out). */ 54 | virtual void setOptimization(ESHADOWVOLUME_OPTIMIZATION optimization) = 0; 55 | 56 | //! Get currently active optimization used to create shadow volumes 57 | virtual ESHADOWVOLUME_OPTIMIZATION getOptimization() const = 0; 58 | }; 59 | 60 | } // end namespace scene 61 | } // end namespace irr 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_VERTEX_BUFFER_H_INCLUDED__ 6 | #define __I_VERTEX_BUFFER_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "irrArray.h" 10 | #include "S3DVertex.h" 11 | 12 | namespace irr { 13 | namespace scene 14 | { 15 | 16 | class IVertexBuffer : public virtual IReferenceCounted 17 | { 18 | public: 19 | virtual void* getData() =0; 20 | virtual video::E_VERTEX_TYPE getType() const =0; 21 | virtual void setType(video::E_VERTEX_TYPE vertexType) =0; 22 | virtual u32 stride() const =0; 23 | virtual u32 size() const =0; 24 | virtual void push_back(const video::S3DVertex &element) =0; 25 | virtual video::S3DVertex& operator [](const u32 index) const =0; 26 | virtual video::S3DVertex& getLast() =0; 27 | virtual void set_used(u32 usedNow) =0; 28 | virtual void reallocate(u32 new_size) =0; 29 | virtual u32 allocated_size() const =0; 30 | virtual video::S3DVertex* pointer() =0; 31 | 32 | //! get the current hardware mapping hint 33 | virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0; 34 | 35 | //! set the hardware mapping hint, for driver 36 | virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0; 37 | 38 | //! flags the meshbuffer as changed, reloads hardware buffers 39 | virtual void setDirty() =0; 40 | 41 | //! Get the currently used ID for identification of changes. 42 | /** This shouldn't be used for anything outside the VideoDriver. */ 43 | virtual u32 getChangedID() const = 0; 44 | }; 45 | 46 | 47 | } // end namespace scene 48 | } // end namespace irr 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __I_WRITE_FILE_H_INCLUDED__ 6 | #define __I_WRITE_FILE_H_INCLUDED__ 7 | 8 | #include "IReferenceCounted.h" 9 | #include "path.h" 10 | 11 | namespace irr { 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 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __S_EXPOSED_VIDEO_DATA_H_INCLUDED__ 6 | #define __S_EXPOSED_VIDEO_DATA_H_INCLUDED__ 7 | 8 | namespace irr { 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 | SExposedVideoData() {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=0;} 20 | explicit SExposedVideoData(void* Window) {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=Window;} 21 | 22 | struct SOpenGLWin32 23 | { 24 | //! Private GDI Device Context. 25 | /** Get if for example with: HDC h = reinterpret_cast(exposedData.OpenGLWin32.HDc) */ 26 | void* HDc; 27 | 28 | //! Permanent Rendering Context. 29 | /** Get if for example with: HGLRC h = reinterpret_cast(exposedData.OpenGLWin32.HRc) */ 30 | void* HRc; 31 | 32 | //! Window handle. 33 | /** Get with for example with: HWND h = reinterpret_cast(exposedData.OpenGLWin32.HWnd) */ 34 | void* HWnd; 35 | }; 36 | 37 | struct SOpenGLLinux 38 | { 39 | // XWindow handles 40 | void* X11Display; 41 | void* X11Context; 42 | unsigned long X11Window; 43 | unsigned long GLXWindow; 44 | }; 45 | 46 | struct SOpenGLOSX 47 | { 48 | //! The NSOpenGLContext object. 49 | void* Context; 50 | 51 | //! The NSWindow object. 52 | void* Window; 53 | }; 54 | 55 | struct SOpenGLFB 56 | { 57 | //! The EGLNativeWindowType object. 58 | void* Window; 59 | }; 60 | 61 | union 62 | { 63 | SOpenGLWin32 OpenGLWin32; 64 | SOpenGLLinux OpenGLLinux; 65 | SOpenGLOSX OpenGLOSX; 66 | SOpenGLFB OpenGLFB; 67 | }; 68 | }; 69 | 70 | } // end namespace video 71 | } // end namespace irr 72 | 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /lib/irrbloss/include/SKeyMap.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 | #ifndef __S_KEY_MAP_H_INCLUDED__ 6 | #define __S_KEY_MAP_H_INCLUDED__ 7 | 8 | #include "Keycodes.h" 9 | 10 | namespace irr { 11 | 12 | //! enumeration for key actions. Used for example in the FPS Camera. 13 | enum EKEY_ACTION 14 | { 15 | EKA_MOVE_FORWARD = 0, 16 | EKA_MOVE_BACKWARD, 17 | EKA_STRAFE_LEFT, 18 | EKA_STRAFE_RIGHT, 19 | EKA_JUMP_UP, 20 | EKA_CROUCH, 21 | EKA_ROTATE_LEFT, 22 | EKA_ROTATE_RIGHT, 23 | EKA_COUNT, 24 | 25 | //! This value is not used. It only forces this enumeration to compile in 32 bit. 26 | EKA_FORCE_32BIT = 0x7fffffff 27 | }; 28 | 29 | //! Struct storing which key belongs to which action. 30 | struct SKeyMap 31 | { 32 | SKeyMap() {} 33 | SKeyMap(EKEY_ACTION action, EKEY_CODE keyCode) : Action(action), KeyCode(keyCode) {} 34 | 35 | EKEY_ACTION Action; 36 | EKEY_CODE KeyCode; 37 | }; 38 | 39 | } // end namespace irr 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | 8 | -------------------------------------------------------------------------------- /lib/irrbloss/include/SMeshBufferLightMap.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 | 8 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __S_VERTEX_INDEX_H_INCLUDED__ 6 | #define __S_VERTEX_INDEX_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | 11 | namespace irr { 12 | namespace video { 13 | enum E_INDEX_TYPE 14 | { 15 | EIT_16BIT = 0, 16 | EIT_32BIT 17 | }; 18 | 19 | 20 | /* 21 | //! vertex index used by the Irrlicht engine. 22 | template 23 | struct SSpecificVertexIndex { 24 | T Index; 25 | 26 | //! default constructor 27 | SSpecificVertexIndex() {} 28 | 29 | //! constructor 30 | SSpecificVertexIndex(u32 _index) :Index(_index) {} 31 | 32 | bool operator==(const SSpecificVertexIndex& other) const 33 | { 34 | return (Index == other.Index); 35 | } 36 | 37 | bool operator!=(const SSpecificVertexIndex& other) const 38 | { 39 | return (Index != other.Index); 40 | } 41 | 42 | bool operator<(const SSpecificVertexIndex& other) const 43 | { 44 | return (Index < other.Index); 45 | } 46 | 47 | SSpecificVertexIndex operator+(const u32& other) const 48 | { 49 | return SSpecificVertexIndex(Index + other); 50 | } 51 | 52 | operator const u32() const 53 | { 54 | return (const u32)Index; 55 | } 56 | 57 | E_INDEX_TYPE getType() const 58 | { 59 | if (sizeof(T)==sizeof(u16)) 60 | return video::EIT_16BIT; 61 | return video::EIT_32BIT; 62 | } 63 | 64 | }; 65 | 66 | //typedef SSpecificVertexIndex SVertexIndex; 67 | 68 | typedef u32 SVertexIndex; 69 | */ 70 | 71 | 72 | } // end namespace video 73 | } // end namespace irr 74 | 75 | #endif 76 | 77 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __EXAMPLE_HELPER_H_INCLUDED__ 6 | #define __EXAMPLE_HELPER_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | #include "path.h" 10 | 11 | namespace irr { 12 | 13 | static io::path getExampleMediaPath() { 14 | return io::path("../../media/"); 15 | } 16 | 17 | } // end namespace irr 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /lib/irrbloss/include/heapsort.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 | #ifndef __IRR_HEAPSORT_H_INCLUDED__ 6 | #define __IRR_HEAPSORT_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | namespace irr { 11 | namespace core 12 | { 13 | 14 | //! Sinks an element into the heap. 15 | template 16 | inline void heapsink(T*array, s32 element, s32 max) { 17 | while ((element<<1) < max) // there is a left child 18 | { 19 | s32 j = (element<<1); 20 | 21 | if (j+1 < max && array[j] < array[j+1]) 22 | j = j+1; // take right child 23 | 24 | if (array[element] < array[j]) { 25 | T t = array[j]; // swap elements 26 | array[j] = array[element]; 27 | array[element] = t; 28 | element = j; 29 | } 30 | else 31 | return; 32 | } 33 | } 34 | 35 | 36 | //! Sorts an array with size 'size' using heapsort. 37 | template 38 | inline void heapsort(T* array_, s32 size) { 39 | // for heapsink we pretend this is not c++, where 40 | // arrays start with index 0. So we decrease the array pointer, 41 | // the maximum always +2 and the element always +1 42 | 43 | T* virtualArray = array_ - 1; 44 | s32 virtualSize = size + 2; 45 | s32 i; 46 | 47 | // build heap 48 | 49 | for (i=((size-1)/2); i>=0; --i) 50 | heapsink(virtualArray, i+1, virtualSize-1); 51 | 52 | // sort array, leave out the last element (0) 53 | for (i=size-1; i>0; --i) { 54 | T t = array_[0]; 55 | array_[0] = array_[i]; 56 | array_[i] = t; 57 | heapsink(virtualArray, 1, i + 1); 58 | } 59 | } 60 | 61 | } // end namespace core 62 | } // end namespace irr 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /lib/irrbloss/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) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 17 | # pragma warning(disable: 4103) 18 | # pragma pack( push, packing ) 19 | # pragma pack( 1 ) 20 | # define PACK_STRUCT 21 | #elif defined( __DMC__ ) 22 | # pragma pack( push, 1 ) 23 | # define PACK_STRUCT 24 | #elif defined( __GNUC__ ) 25 | // Using pragma pack might work with earlier gcc versions already, but 26 | // it started to be necessary with gcc 4.7 on mingw unless compiled with -mno-ms-bitfields. 27 | // And I found some hints on the web that older gcc versions on the other hand had sometimes 28 | // trouble with pragma pack while they worked with __attribute__((packed)). 29 | # if (__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7)) 30 | # pragma pack( push, packing ) 31 | # pragma pack( 1 ) 32 | # define PACK_STRUCT 33 | # else 34 | # define PACK_STRUCT __attribute__((packed)) 35 | #endif 36 | #else 37 | # error compiler not supported 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /lib/irrbloss/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) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 10 | # pragma pack( pop, packing ) 11 | #elif defined (__DMC__) 12 | # pragma pack( pop ) 13 | #elif defined( __GNUC__ ) 14 | # if (__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7)) 15 | # pragma pack( pop, packing ) 16 | # endif 17 | #endif 18 | 19 | #undef PACK_STRUCT 20 | 21 | -------------------------------------------------------------------------------- /lib/irrbloss/include/path.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 | #ifndef __IRR_PATH_H_INCLUDED__ 6 | #define __IRR_PATH_H_INCLUDED__ 7 | 8 | #include "irrString.h" 9 | 10 | namespace irr { 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 | typedef core::string path; 17 | 18 | //! Used in places where we identify objects by a filename, but don't actually work with the real filename 19 | /** Irrlicht is internally not case-sensitive when it comes to names. 20 | Also this class is a first step towards support for correctly serializing renamed objects. 21 | */ 22 | struct SNamedPath { 23 | //! Constructor 24 | SNamedPath() {} 25 | 26 | //! Constructor 27 | SNamedPath(const path& p) : Path(p), InternalName( PathToName(p) ) { 28 | } 29 | 30 | //! Is smaller comparator 31 | bool operator <(const SNamedPath& other) const 32 | { 33 | return InternalName < other.InternalName; 34 | } 35 | 36 | //! Set the path. 37 | void setPath(const path& p) { 38 | Path = p; 39 | InternalName = PathToName(p); 40 | } 41 | 42 | //! Get the path. 43 | const path& getPath() const 44 | { 45 | return Path; 46 | }; 47 | 48 | //! Get the name which is used to identify the file. 49 | //! This string is similar to the names and filenames used before Irrlicht 1.7 50 | const path& getInternalName() const 51 | { 52 | return InternalName; 53 | } 54 | 55 | //! Implicit cast to io::path 56 | operator core::stringc() const 57 | { 58 | return core::stringc(getPath()); 59 | } 60 | //! Implicit cast to io::path 61 | operator core::stringw() const 62 | { 63 | return core::stringw(getPath()); 64 | } 65 | 66 | protected: 67 | // convert the given path string to a name string. 68 | path PathToName(const path& p) const 69 | { 70 | path name(p); 71 | name.replace( '\\', '/' ); 72 | name.make_lower(); 73 | return name; 74 | } 75 | 76 | private: 77 | path Path; 78 | path InternalName; 79 | }; 80 | 81 | } // io 82 | } // irr 83 | 84 | #endif // __IRR_PATH_H_INCLUDED__ 85 | -------------------------------------------------------------------------------- /lib/irrbloss/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 | #ifndef __IRR_POSITION_H_INCLUDED__ 9 | #define __IRR_POSITION_H_INCLUDED__ 10 | 11 | #include "vector2d.h" 12 | 13 | namespace irr { 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 | 30 | #endif // __IRR_POSITION_H_INCLUDED__ 31 | 32 | -------------------------------------------------------------------------------- /lib/irrbloss/irrlicht-license.txt: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CColorConverter.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 | #ifndef __C_COLOR_CONVERTER_H_INCLUDED__ 6 | #define __C_COLOR_CONVERTER_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | #include "IImage.h" 10 | 11 | namespace irr { 12 | namespace video { 13 | 14 | class CColorConverter { 15 | public: 16 | 17 | //! Functions for converting one image format to another efficiently 18 | //! and hopefully correctly. 19 | //! Note that the format descriptions refer to the ECOLOR_FORMAT's and not to memory layout. 20 | //! Reasons for that go back to DX9 naming which tended to flip 32-bit and 16-bit byte orders so ARGB usually means BGRA. 21 | //! 22 | //! \param sP pointer to source pixel data 23 | //! \param sN number of source pixels to copy 24 | //! \param dP pointer to destination data buffer. must be big enough 25 | //! to hold sN pixels in the output format. 26 | static void convert_A1R5G5B5toR8G8B8(const void* sP, s32 sN, void* dP); 27 | static void convert_A1R5G5B5toA8R8G8B8(const void* sP, s32 sN, void* dP); 28 | static void convert_A1R5G5B5toA1R5G5B5(const void* sP, s32 sN, void* dP); 29 | static void convert_A1R5G5B5toR5G6B5(const void* sP, s32 sN, void* dP); 30 | 31 | static void convert_A8R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP); 32 | static void convert_A8R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP); 33 | static void convert_A8R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP); 34 | static void convert_A8R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP); 35 | static void convert_A8R8G8B8toA1B5G5R5(const void* sP, s32 sN, void* dP); 36 | static void convert_A8R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP); 37 | 38 | static void convert_R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP); 39 | static void convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP); 40 | static void convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP); 41 | static void convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP); 42 | static void convert_A8R8G8B8toA8B8G8R8(const void* sP, s32 sN, void* dP); 43 | 44 | static void convert_R5G6B5toR5G6B5(const void* sP, s32 sN, void* dP); 45 | static void convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP); 46 | static void convert_R5G6B5toA8R8G8B8(const void* sP, s32 sN, void* dP); 47 | static void convert_R5G6B5toA1R5G5B5(const void* sP, s32 sN, void* dP); 48 | static void convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN, 49 | void* dP, ECOLOR_FORMAT dF); 50 | // Check if convert_viaFormat is usable 51 | static bool canConvertFormat(ECOLOR_FORMAT sourceFormat, ECOLOR_FORMAT destFormat); 52 | }; 53 | 54 | 55 | } // end namespace video 56 | } // end namespace irr 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CCubeSceneNode.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 | #ifndef __C_CUBE_SCENE_NODE_H_INCLUDED__ 6 | #define __C_CUBE_SCENE_NODE_H_INCLUDED__ 7 | 8 | #include "IMeshSceneNode.h" 9 | #include "SMesh.h" 10 | 11 | namespace irr { 12 | namespace scene { 13 | class CCubeSceneNode : public IMeshSceneNode 14 | { 15 | public: 16 | 17 | //! constructor 18 | CCubeSceneNode(f32 size, ISceneNode* parent, ISceneManager* mgr, s32 id, 19 | const core::vector3df& position = core::vector3df(0,0,0), 20 | const core::vector3df& rotation = core::vector3df(0,0,0), 21 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); 22 | 23 | virtual ~CCubeSceneNode(); 24 | 25 | virtual void OnRegisterSceneNode() _IRR_OVERRIDE_; 26 | 27 | //! renders the node. 28 | virtual void render() _IRR_OVERRIDE_; 29 | 30 | //! returns the axis aligned bounding box of this node 31 | virtual const core::aabbox3d& getBoundingBox() const _IRR_OVERRIDE_; 32 | 33 | //! returns the material based on the zero based index i. To get the amount 34 | //! of materials used by this scene node, use getMaterialCount(). 35 | //! This function is needed for inserting the node into the scene hierarchy on a 36 | //! optimal position for minimizing renderstate changes, but can also be used 37 | //! to directly modify the material of a scene node. 38 | virtual video::SMaterial& getMaterial(u32 i) _IRR_OVERRIDE_; 39 | 40 | //! returns amount of materials used by this scene node. 41 | virtual u32 getMaterialCount() const _IRR_OVERRIDE_; 42 | 43 | //! Returns type of the scene node 44 | virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_CUBE; } 45 | 46 | //! Creates a clone of this scene node and its children. 47 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) _IRR_OVERRIDE_; 48 | 49 | //! Sets a new mesh to display 50 | virtual void setMesh(IMesh* mesh) _IRR_OVERRIDE_ {} 51 | 52 | //! Returns the current mesh 53 | virtual IMesh* getMesh(void) _IRR_OVERRIDE_ { return Mesh; } 54 | 55 | //! Removes a child from this scene node. 56 | //! Implemented here, to be able to remove the shadow properly, if there is one, 57 | //! or to remove attached child. 58 | virtual bool removeChild(ISceneNode* child) _IRR_OVERRIDE_; 59 | 60 | private: 61 | void setSize(); 62 | 63 | IMesh* Mesh; 64 | IShadowVolumeSceneNode* Shadow; 65 | f32 Size; 66 | }; 67 | 68 | } // end namespace scene 69 | } // end namespace irr 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | namespace scene 10 | { 11 | 12 | //! constructor 13 | CEmptySceneNode::CEmptySceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id) 14 | : ISceneNode(parent, mgr, id) { 15 | #ifdef _DEBUG 16 | setDebugName("CEmptySceneNode"); 17 | #endif 18 | 19 | setAutomaticCulling(scene::EAC_OFF); 20 | } 21 | 22 | 23 | //! pre render event 24 | void CEmptySceneNode::OnRegisterSceneNode() { 25 | if (IsVisible) 26 | SceneManager->registerNodeForRendering(this); 27 | 28 | ISceneNode::OnRegisterSceneNode(); 29 | } 30 | 31 | 32 | //! render 33 | void CEmptySceneNode::render() { 34 | // do nothing 35 | } 36 | 37 | 38 | //! returns the axis aligned bounding box of this node 39 | const core::aabbox3d& CEmptySceneNode::getBoundingBox() const { 40 | return Box; 41 | } 42 | 43 | 44 | //! Creates a clone of this scene node and its children. 45 | ISceneNode* CEmptySceneNode::clone(ISceneNode* newParent, ISceneManager* newManager) { 46 | if (!newParent) 47 | newParent = Parent; 48 | if (!newManager) 49 | newManager = SceneManager; 50 | 51 | CEmptySceneNode* nb = new CEmptySceneNode(newParent, 52 | newManager, ID); 53 | 54 | nb->cloneMembers(this, newManager); 55 | nb->Box = Box; 56 | 57 | if ( newParent ) 58 | nb->drop(); 59 | return nb; 60 | } 61 | 62 | 63 | } // end namespace scene 64 | } // end namespace irr 65 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_EMPTY_SCENE_NODE_H_INCLUDED__ 6 | #define __C_EMPTY_SCENE_NODE_H_INCLUDED__ 7 | 8 | #include "ISceneNode.h" 9 | 10 | namespace irr { 11 | namespace scene 12 | { 13 | 14 | class CEmptySceneNode : public ISceneNode 15 | { 16 | public: 17 | 18 | //! constructor 19 | CEmptySceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id); 20 | 21 | //! returns the axis aligned bounding box of this node 22 | virtual const core::aabbox3d& getBoundingBox() const _IRR_OVERRIDE_; 23 | 24 | //! This method is called just before the rendering process of the whole scene. 25 | virtual void OnRegisterSceneNode() _IRR_OVERRIDE_; 26 | 27 | //! does nothing. 28 | virtual void render() _IRR_OVERRIDE_; 29 | 30 | //! Returns type of the scene node 31 | virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_EMPTY; } 32 | 33 | //! Creates a clone of this scene node and its children. 34 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) _IRR_OVERRIDE_; 35 | 36 | private: 37 | 38 | core::aabbox3d Box; 39 | }; 40 | 41 | } // end namespace scene 42 | } // end namespace irr 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | namespace video { 10 | 11 | CFPSCounter::CFPSCounter() 12 | : FPS(60), Primitive(0), StartTime(0), FramesCounted(0), 13 | PrimitivesCounted(0), PrimitiveAverage(0), PrimitiveTotal(0) { 14 | 15 | } 16 | 17 | //! returns current fps 18 | s32 CFPSCounter::getFPS() const { 19 | return FPS; 20 | } 21 | 22 | //! returns current primitive count 23 | u32 CFPSCounter::getPrimitive() const { 24 | return Primitive; 25 | } 26 | 27 | //! returns average primitive count of last period 28 | u32 CFPSCounter::getPrimitiveAverage() const { 29 | return PrimitiveAverage; 30 | } 31 | 32 | //! returns accumulated primitive count since start 33 | u32 CFPSCounter::getPrimitiveTotal() const { 34 | return PrimitiveTotal; 35 | } 36 | 37 | //! to be called every frame 38 | void CFPSCounter::registerFrame(u32 now, u32 primitivesDrawn) { 39 | ++FramesCounted; 40 | PrimitiveTotal += primitivesDrawn; 41 | PrimitivesCounted += primitivesDrawn; 42 | Primitive = primitivesDrawn; 43 | 44 | const u32 milliseconds = now - StartTime; 45 | 46 | if (milliseconds >= 1500) { 47 | const f32 invMilli = core::reciprocal ( (f32) milliseconds ); 48 | 49 | FPS = core::ceil32 ( ( 1000 * FramesCounted ) * invMilli ); 50 | PrimitiveAverage = core::ceil32 ( ( 1000 * PrimitivesCounted ) * invMilli ); 51 | 52 | FramesCounted = 0; 53 | PrimitivesCounted = 0; 54 | StartTime = now; 55 | } 56 | } 57 | 58 | } // end namespace video 59 | } // end namespace irr 60 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_FPSCOUNTER_H_INCLUDED__ 6 | #define __C_FPSCOUNTER_H_INCLUDED__ 7 | 8 | #include "irrTypes.h" 9 | 10 | namespace irr { 11 | namespace video { 12 | 13 | class CFPSCounter { 14 | public: 15 | CFPSCounter(); 16 | 17 | //! returns current fps 18 | s32 getFPS() const; 19 | 20 | //! returns primitive count 21 | u32 getPrimitive() const; 22 | 23 | //! returns average primitive count of last period 24 | u32 getPrimitiveAverage() const; 25 | 26 | //! returns accumulated primitive count since start 27 | u32 getPrimitiveTotal() const; 28 | 29 | //! to be called every frame 30 | void registerFrame(u32 now, u32 primitive); 31 | 32 | private: 33 | 34 | s32 FPS; 35 | u32 Primitive; 36 | u32 StartTime; 37 | 38 | u32 FramesCounted; 39 | u32 PrimitivesCounted; 40 | u32 PrimitiveAverage; 41 | u32 PrimitiveTotal; 42 | }; 43 | 44 | } // end namespace video 45 | } // end namespace irr 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CFileSystem.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 | #ifndef __C_FILE_SYSTEM_H_INCLUDED__ 6 | #define __C_FILE_SYSTEM_H_INCLUDED__ 7 | 8 | #include "IFileSystem.h" 9 | #include "irrArray.h" 10 | 11 | namespace irr { 12 | namespace io 13 | { 14 | 15 | /*! 16 | FileSystem which uses normal files and one zipfile 17 | */ 18 | class CFileSystem : public IFileSystem { 19 | public: 20 | 21 | //! constructor 22 | CFileSystem(); 23 | 24 | //! destructor 25 | virtual ~CFileSystem(); 26 | 27 | //! opens a file for read access 28 | virtual IReadFile* createAndOpenFile(const io::path& filename) _IRR_OVERRIDE_; 29 | 30 | //! Creates an IReadFile interface for accessing memory like a file. 31 | virtual IReadFile* createMemoryReadFile(const void* memory, s32 len, const io::path& fileName, bool deleteMemoryWhenDropped = false) _IRR_OVERRIDE_; 32 | 33 | //! Opens a file for write access. 34 | virtual IWriteFile* createAndWriteFile(const io::path& filename, bool append=false) _IRR_OVERRIDE_; 35 | 36 | //! Returns the string of the current working directory 37 | virtual const io::path& getWorkingDirectory() _IRR_OVERRIDE_; 38 | 39 | //! Converts a relative path to an absolute (unique) path, resolving symbolic links 40 | virtual io::path getAbsolutePath(const io::path& filename) const _IRR_OVERRIDE_; 41 | 42 | //! Returns the directory a file is located in. 43 | /** \param filename: The file to get the directory from */ 44 | virtual io::path getFileDir(const io::path& filename) const _IRR_OVERRIDE_; 45 | 46 | //! flatten a path and file name for example: "/you/me/../." becomes "/you" 47 | virtual io::path& flattenFilename( io::path& directory, const io::path& root = "/" ) const _IRR_OVERRIDE_; 48 | 49 | //! Get the relative filename, relative to the given directory 50 | virtual path getRelativeFilename(const path& filename, const path& directory) const _IRR_OVERRIDE_; 51 | 52 | virtual EFileSystemType setFileListSystem(EFileSystemType listType) _IRR_OVERRIDE_; 53 | 54 | //! determines if a file exists and would be able to be opened. 55 | virtual bool existFile(const io::path& filename) const _IRR_OVERRIDE_; 56 | 57 | private: 58 | 59 | //! Currently used FileSystemType 60 | EFileSystemType FileSystemType; 61 | //! WorkingDirectory for Native and Virtual filesystems 62 | io::path WorkingDirectory [2]; 63 | //! currently attached Archives 64 | core::array FileArchives; 65 | }; 66 | 67 | 68 | } // end namespace irr 69 | } // end namespace io 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_GLX_MANAGER_H_INCLUDED__ 6 | #define __C_GLX_MANAGER_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | 10 | #ifdef _IRR_COMPILE_WITH_GLX_MANAGER_ 11 | 12 | #include "SIrrCreationParameters.h" 13 | #include "SExposedVideoData.h" 14 | #include "IContextManager.h" 15 | #include "SColor.h" 16 | #include 17 | #include 18 | 19 | // we can't include glx.h here, because gl.h has incompatible types with ogl es headers and it 20 | // cause redefinition errors, thats why we use ugly trick with void* types and casts. 21 | 22 | namespace irr { 23 | namespace video 24 | { 25 | // GLX manager. 26 | class CGLXManager : public IContextManager 27 | { 28 | public: 29 | //! Constructor. 30 | CGLXManager(const SIrrlichtCreationParameters& params, const SExposedVideoData& videodata, int screennr); 31 | 32 | //! Destructor 33 | ~CGLXManager(); 34 | 35 | // Initialize 36 | virtual bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) _IRR_OVERRIDE_; 37 | 38 | // Terminate 39 | virtual void terminate() _IRR_OVERRIDE_; 40 | 41 | // Create surface. 42 | virtual bool generateSurface() _IRR_OVERRIDE_; 43 | 44 | // Destroy surface. 45 | virtual void destroySurface() _IRR_OVERRIDE_; 46 | 47 | // Create context. 48 | virtual bool generateContext() _IRR_OVERRIDE_; 49 | 50 | // Destroy context. 51 | virtual void destroyContext() _IRR_OVERRIDE_; 52 | 53 | //! Get current context 54 | virtual const SExposedVideoData& getContext() const _IRR_OVERRIDE_; 55 | 56 | //! Change render context, disable old and activate new defined by videoData 57 | virtual bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero) _IRR_OVERRIDE_; 58 | 59 | // Swap buffers. 60 | virtual bool swapBuffers() _IRR_OVERRIDE_; 61 | 62 | XVisualInfo* getVisual() const {return VisualInfo;} // return XVisualInfo 63 | 64 | private: 65 | SIrrlichtCreationParameters Params; 66 | SExposedVideoData PrimaryContext; 67 | SExposedVideoData CurrentContext; 68 | XVisualInfo* VisualInfo; 69 | void* glxFBConfig; // GLXFBConfig 70 | XID GlxWin; // GLXWindow 71 | }; 72 | } 73 | } 74 | 75 | #endif 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_GUI_CHECKBOX_H_INCLUDED__ 6 | #define __C_GUI_CHECKBOX_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | #include "IGUICheckBox.h" 10 | 11 | namespace irr { 12 | namespace gui 13 | { 14 | 15 | class CGUICheckBox : public IGUICheckBox 16 | { 17 | public: 18 | 19 | //! constructor 20 | CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle); 21 | 22 | //! set if box is checked 23 | virtual void setChecked(bool checked) _IRR_OVERRIDE_; 24 | 25 | //! returns if box is checked 26 | virtual bool isChecked() const _IRR_OVERRIDE_; 27 | 28 | //! Sets whether to draw the background 29 | virtual void setDrawBackground(bool draw) _IRR_OVERRIDE_; 30 | 31 | //! Checks if background drawing is enabled 32 | /** \return true if background drawing is enabled, false otherwise */ 33 | virtual bool isDrawBackgroundEnabled() const _IRR_OVERRIDE_; 34 | 35 | //! Sets whether to draw the border 36 | virtual void setDrawBorder(bool draw) _IRR_OVERRIDE_; 37 | 38 | //! Checks if border drawing is enabled 39 | /** \return true if border drawing is enabled, false otherwise */ 40 | virtual bool isDrawBorderEnabled() const _IRR_OVERRIDE_; 41 | 42 | //! called if an event happened. 43 | virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; 44 | 45 | //! draws the element and its children 46 | virtual void draw() _IRR_OVERRIDE_; 47 | 48 | private: 49 | 50 | u32 CheckTime; 51 | bool Pressed; 52 | bool Checked; 53 | bool Border; 54 | bool Background; 55 | }; 56 | 57 | } // end namespace gui 58 | } // end namespace irr 59 | 60 | #endif // __C_GUI_CHECKBOX_H_INCLUDED__ 61 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | namespace gui 9 | { 10 | 11 | //! constructor 12 | CGUIImageList::CGUIImageList( video::IVideoDriver* driver ) 13 | : Driver( driver ), 14 | Texture( 0 ), 15 | ImageCount( 0 ), 16 | ImageSize( 0, 0 ), 17 | ImagesPerRow( 0 ), 18 | UseAlphaChannel( false ) { 19 | #ifdef _DEBUG 20 | setDebugName( "CGUIImageList" ); 21 | #endif 22 | 23 | if( Driver ) { 24 | Driver->grab(); 25 | } 26 | } 27 | 28 | //! destructor 29 | CGUIImageList::~CGUIImageList() { 30 | if( Driver ) { 31 | Driver->drop(); 32 | } 33 | 34 | if( Texture ) { 35 | Texture->drop(); 36 | } 37 | } 38 | 39 | //! Creates the image list from texture. 40 | bool CGUIImageList::createImageList(video::ITexture* texture, 41 | core::dimension2d imageSize, 42 | bool useAlphaChannel) { 43 | if( !texture ) { 44 | return false; 45 | } 46 | 47 | Texture = texture; 48 | Texture->grab(); 49 | 50 | ImageSize = imageSize; 51 | 52 | ImagesPerRow = Texture->getSize().Width / ImageSize.Width; 53 | ImageCount = ImagesPerRow * Texture->getSize().Height / ImageSize.Height; 54 | 55 | UseAlphaChannel = useAlphaChannel; 56 | 57 | return true; 58 | } 59 | 60 | //! Draws an image and clips it to the specified rectangle if wanted 61 | void CGUIImageList::draw( s32 index, const core::position2d& destPos, 62 | const core::rect* clip /*= 0*/ ) { 63 | core::rect sourceRect; 64 | 65 | if( !Driver || index < 0 || index >= ImageCount ) { 66 | return; 67 | } 68 | 69 | sourceRect.UpperLeftCorner.X = ( index % ImagesPerRow ) * ImageSize.Width; 70 | sourceRect.UpperLeftCorner.Y = ( index / ImagesPerRow ) * ImageSize.Height; 71 | sourceRect.LowerRightCorner.X = sourceRect.UpperLeftCorner.X + ImageSize.Width; 72 | sourceRect.LowerRightCorner.Y = sourceRect.UpperLeftCorner.Y + ImageSize.Height; 73 | 74 | Driver->draw2DImage( Texture, destPos, sourceRect, clip, 75 | video::SColor( 255, 255, 255, 255 ), UseAlphaChannel ); 76 | } 77 | 78 | } // end namespace gui 79 | } // end namespace irr 80 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CGUIImageList.h: -------------------------------------------------------------------------------- 1 | // This file is part of the "Irrlicht Engine". 2 | // written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de 3 | 4 | #ifndef __C_GUI_IMAGE_LIST_H_INCLUDED__ 5 | #define __C_GUI_IMAGE_LIST_H_INCLUDED__ 6 | 7 | #include "IGUIImageList.h" 8 | #include "IVideoDriver.h" 9 | 10 | namespace irr { 11 | namespace gui 12 | { 13 | 14 | class CGUIImageList : public IGUIImageList { 15 | public: 16 | 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 ) _IRR_OVERRIDE_; 40 | 41 | //! Returns the count of Images in the list. 42 | //! \return Returns the count of Images in the list. 43 | virtual s32 getImageCount() const _IRR_OVERRIDE_ 44 | { return ImageCount; } 45 | 46 | //! Returns the size of the images in the list. 47 | //! \return Returns the size of the images in the list. 48 | virtual core::dimension2d getImageSize() const _IRR_OVERRIDE_ 49 | { return ImageSize; } 50 | 51 | private: 52 | 53 | video::IVideoDriver* Driver; 54 | video::ITexture* Texture; 55 | s32 ImageCount; 56 | core::dimension2d ImageSize; 57 | s32 ImagesPerRow; 58 | bool UseAlphaChannel; 59 | }; 60 | 61 | } // end namespace gui 62 | } // end namespace irr 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CGUIMenu.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 | #ifndef __C_GUI_MENU_H_INCLUDED__ 6 | #define __C_GUI_MENU_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | #include "CGUIContextMenu.h" 10 | 11 | namespace irr { 12 | namespace gui 13 | { 14 | 15 | //! GUI menu interface. 16 | class CGUIMenu : public CGUIContextMenu 17 | { 18 | public: 19 | 20 | //! constructor 21 | CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle); 22 | 23 | //! draws the element and its children 24 | virtual void draw() _IRR_OVERRIDE_; 25 | 26 | //! called if an event happened. 27 | virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; 28 | 29 | //! Updates the absolute position. 30 | virtual void updateAbsolutePosition() _IRR_OVERRIDE_; 31 | 32 | protected: 33 | 34 | virtual void recalculateSize() _IRR_OVERRIDE_; 35 | 36 | //! returns the item highlight-area 37 | virtual core::rect getHRect(const SItem& i, const core::rect& absolute) const _IRR_OVERRIDE_; 38 | 39 | //! Gets drawing rect of Item 40 | virtual core::rect getRect(const SItem& i, const core::rect& absolute) const _IRR_OVERRIDE_; 41 | }; 42 | 43 | } // end namespace gui 44 | } // end namespace irr 45 | 46 | 47 | #endif // __C_GUI_MENU_H_INCLUDED__ 48 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CGUIMessageBox.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 | #ifndef __C_GUI_MESSAGE_BOX_H_INCLUDED__ 6 | #define __C_GUI_MESSAGE_BOX_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | #include "CGUIWindow.h" 10 | #include "IGUIStaticText.h" 11 | #include "IGUIImage.h" 12 | #include "irrArray.h" 13 | 14 | namespace irr { 15 | namespace gui 16 | { 17 | class CGUIMessageBox : public CGUIWindow 18 | { 19 | public: 20 | 21 | //! constructor 22 | CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption, 23 | const wchar_t* text, s32 flag, 24 | IGUIElement* parent, s32 id, core::rect rectangle, video::ITexture* image=0); 25 | 26 | //! destructor 27 | virtual ~CGUIMessageBox(); 28 | 29 | //! called if an event happened. 30 | virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; 31 | 32 | private: 33 | 34 | void refreshControls(); 35 | void setButton(IGUIButton*& button, bool isAvailable, const core::rect & btnRect, const wchar_t * text, IGUIElement*& focusMe); 36 | 37 | IGUIButton* OkButton; 38 | IGUIButton* CancelButton; 39 | IGUIButton* YesButton; 40 | IGUIButton* NoButton; 41 | IGUIStaticText* StaticText; 42 | IGUIImage * Icon; 43 | video::ITexture * IconTexture; 44 | 45 | s32 Flags; 46 | core::stringw MessageText; 47 | bool Pressed; 48 | }; 49 | 50 | } // end namespace gui 51 | } // end namespace irr 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CGUIModalScreen.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 | #ifndef __C_GUI_MODAL_SCREEN_H_INCLUDED__ 6 | #define __C_GUI_MODAL_SCREEN_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | #include "IGUIElement.h" 10 | 11 | namespace irr { 12 | namespace gui 13 | { 14 | 15 | class CGUIModalScreen : public IGUIElement 16 | { 17 | public: 18 | 19 | //! constructor 20 | CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* parent, s32 id); 21 | 22 | //! called if an event happened. 23 | virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; 24 | 25 | //! Removes a child. 26 | virtual void removeChild(IGUIElement* child) _IRR_OVERRIDE_; 27 | 28 | //! Adds a child 29 | virtual void addChild(IGUIElement* child) _IRR_OVERRIDE_; 30 | 31 | 32 | //! draws the element and its children 33 | virtual void draw() _IRR_OVERRIDE_; 34 | 35 | //! Updates the absolute position. 36 | virtual void updateAbsolutePosition() _IRR_OVERRIDE_; 37 | 38 | //! Modalscreen is not a typical element, but rather acts like a state for it's children. 39 | //! isVisible is overriden to give this a useful behavior, so that a modal will no longer 40 | //! be active when its parent is invisible or all its children are invisible. 41 | virtual bool isVisible() const _IRR_OVERRIDE_; 42 | 43 | //! Modals are infinite so every point is inside 44 | virtual bool isPointInside(const core::position2d& point) const _IRR_OVERRIDE_; 45 | 46 | protected: 47 | virtual bool canTakeFocus(IGUIElement* target) const; 48 | 49 | private: 50 | 51 | u32 MouseDownTime; 52 | }; 53 | 54 | 55 | } // end namespace gui 56 | } // end namespace irr 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CGUIToolBar.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 | #ifndef __C_GUI_TOOL_BAR_H_INCLUDED__ 6 | #define __C_GUI_TOOL_BAR_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | #include "IGUIToolbar.h" 10 | 11 | namespace irr { 12 | namespace gui 13 | { 14 | 15 | //! Stays at the top of its parent like the menu bar and contains tool buttons 16 | class CGUIToolBar : public IGUIToolBar 17 | { 18 | public: 19 | 20 | //! constructor 21 | CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle); 22 | 23 | //! called if an event happened. 24 | virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; 25 | 26 | //! draws the element and its children 27 | virtual void draw() _IRR_OVERRIDE_; 28 | 29 | //! Updates the absolute position. 30 | virtual void updateAbsolutePosition() _IRR_OVERRIDE_; 31 | 32 | //! Adds a button to the tool bar 33 | virtual IGUIButton* addButton(s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext=0, 34 | video::ITexture* img=0, video::ITexture* pressed=0, 35 | bool isPushButton=false, bool useAlphaChannel=false) _IRR_OVERRIDE_; 36 | 37 | private: 38 | 39 | s32 ButtonX; 40 | }; 41 | 42 | 43 | } // end namespace gui 44 | } // end namespace irr 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CGUIWindow.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 | #ifndef __C_GUI_WINDOW_H_INCLUDED__ 6 | #define __C_GUI_WINDOW_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | #include "IGUIWindow.h" 10 | 11 | namespace irr { 12 | namespace gui 13 | { 14 | class IGUIButton; 15 | 16 | class CGUIWindow : public IGUIWindow 17 | { 18 | public: 19 | 20 | //! constructor 21 | CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle); 22 | 23 | //! destructor 24 | virtual ~CGUIWindow(); 25 | 26 | //! called if an event happened. 27 | virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_; 28 | 29 | //! update absolute position 30 | virtual void updateAbsolutePosition() _IRR_OVERRIDE_; 31 | 32 | //! draws the element and its children 33 | virtual void draw() _IRR_OVERRIDE_; 34 | 35 | //! Returns pointer to the close button 36 | virtual IGUIButton* getCloseButton() const _IRR_OVERRIDE_; 37 | 38 | //! Returns pointer to the minimize button 39 | virtual IGUIButton* getMinimizeButton() const _IRR_OVERRIDE_; 40 | 41 | //! Returns pointer to the maximize button 42 | virtual IGUIButton* getMaximizeButton() const _IRR_OVERRIDE_; 43 | 44 | //! Returns true if the window is draggable, false if not 45 | virtual bool isDraggable() const _IRR_OVERRIDE_; 46 | 47 | //! Sets whether the window is draggable 48 | virtual void setDraggable(bool draggable) _IRR_OVERRIDE_; 49 | 50 | //! Set if the window background will be drawn 51 | virtual void setDrawBackground(bool draw) _IRR_OVERRIDE_; 52 | 53 | //! Get if the window background will be drawn 54 | virtual bool getDrawBackground() const _IRR_OVERRIDE_; 55 | 56 | //! Set if the window titlebar will be drawn 57 | //! Note: If the background is not drawn, then the titlebar is automatically also not drawn 58 | virtual void setDrawTitlebar(bool draw) _IRR_OVERRIDE_; 59 | 60 | //! Get if the window titlebar will be drawn 61 | virtual bool getDrawTitlebar() const _IRR_OVERRIDE_; 62 | 63 | //! Returns the rectangle of the drawable area (without border and without titlebar) 64 | virtual core::rect getClientRect() const _IRR_OVERRIDE_; 65 | 66 | protected: 67 | 68 | void updateClientRect(); 69 | void refreshSprites(); 70 | 71 | IGUIButton* CloseButton; 72 | IGUIButton* MinButton; 73 | IGUIButton* RestoreButton; 74 | core::rect ClientRect; 75 | video::SColor CurrentIconColor; 76 | 77 | core::position2d DragStart; 78 | bool Dragging, IsDraggable; 79 | bool DrawBackground; 80 | bool DrawTitlebar; 81 | bool IsActive; 82 | }; 83 | 84 | } // end namespace gui 85 | } // end namespace irr 86 | 87 | #endif 88 | 89 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CGeometryCreator.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 | #ifndef __C_GEOMETRY_CREATOR_H_INCLUDED__ 6 | #define __C_GEOMETRY_CREATOR_H_INCLUDED__ 7 | 8 | #include "IGeometryCreator.h" 9 | #include "SMeshBuffer.h" 10 | 11 | namespace irr { 12 | namespace scene { 13 | 14 | //! class for creating geometry on the fly 15 | class CGeometryCreator : public IGeometryCreator { 16 | public: 17 | virtual IMesh* createCubeMesh(const core::vector3df& size, ECUBE_MESH_TYPE type) const _IRR_OVERRIDE_; 18 | }; 19 | 20 | } // end namespace scene 21 | } // end namespace irr 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CImage.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 | #ifndef __C_IMAGE_H_INCLUDED__ 6 | #define __C_IMAGE_H_INCLUDED__ 7 | 8 | #include "IImage.h" 9 | #include "rect.h" 10 | 11 | namespace irr { 12 | namespace video 13 | { 14 | 15 | //! IImage implementation with a lot of special image operations for 16 | //! 16 bit A1R5G5B5/32 Bit A8R8G8B8 images, which are used by the SoftwareDevice. 17 | class CImage : public IImage { 18 | public: 19 | 20 | //! constructor from raw image data 21 | /** \param useForeignMemory: If true, the image will use the data pointer 22 | directly and own it from now on, which means it will also try to delete [] the 23 | data when the image will be destructed. If false, the memory will by copied. */ 24 | CImage(ECOLOR_FORMAT format, const core::dimension2d& size, void* data, 25 | bool ownForeignMemory = true, bool deleteMemory = true); 26 | 27 | //! constructor for empty image 28 | CImage(ECOLOR_FORMAT format, const core::dimension2d& size); 29 | 30 | //! returns a pixel 31 | virtual SColor getPixel(u32 x, u32 y) const _IRR_OVERRIDE_; 32 | 33 | //! sets a pixel 34 | virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ) _IRR_OVERRIDE_; 35 | 36 | //! copies this surface into another, scaling it to fit. 37 | virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format, u32 pitch=0) _IRR_OVERRIDE_; 38 | 39 | //! copies this surface into another, scaling it to fit. 40 | virtual void copyToScaling(IImage* target) _IRR_OVERRIDE_; 41 | 42 | //! copies this surface into another 43 | virtual void copyTo(IImage* target, const core::position2d& pos=core::position2d(0,0)) _IRR_OVERRIDE_; 44 | 45 | //! copies this surface into another 46 | virtual void copyTo(IImage* target, const core::position2d& pos, const core::rect& sourceRect, const core::rect* clipRect=0) _IRR_OVERRIDE_; 47 | }; 48 | 49 | } // end namespace video 50 | } // end namespace irr 51 | 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_IMAGE_LOADER_PNG_H_INCLUDED__ 10 | #define __C_IMAGE_LOADER_PNG_H_INCLUDED__ 11 | 12 | #include "IrrCompileConfig.h" 13 | 14 | #include "IImageLoader.h" 15 | 16 | namespace irr { 17 | namespace video 18 | { 19 | 20 | //! Surface Loader for PNG files 21 | class CImageLoaderPng : public IImageLoader { 22 | public: 23 | 24 | //! returns true if the file maybe is able to be loaded by this class 25 | //! based on the file extension (e.g. ".png") 26 | virtual bool isALoadableFileExtension(const io::path& filename) const _IRR_OVERRIDE_; 27 | 28 | //! returns true if the file maybe is able to be loaded by this class 29 | virtual bool isALoadableFileFormat(io::IReadFile* file) const _IRR_OVERRIDE_; 30 | 31 | //! creates a surface from the file 32 | virtual IImage* loadImage(io::IReadFile* file) const _IRR_OVERRIDE_; 33 | }; 34 | 35 | } // end namespace video 36 | } // end namespace irr 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef _C_IMAGE_WRITER_PNG_H_INCLUDED__ 6 | #define _C_IMAGE_WRITER_PNG_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | 10 | #include "IImageWriter.h" 11 | 12 | namespace irr { 13 | namespace video 14 | { 15 | 16 | class CImageWriterPNG : public IImageWriter { 17 | public: 18 | //! constructor 19 | CImageWriterPNG(); 20 | 21 | //! return true if this writer can write a file with the given extension 22 | virtual bool isAWriteableFileExtension(const io::path& filename) const _IRR_OVERRIDE_; 23 | 24 | //! write image to file 25 | virtual bool writeImage(io::IWriteFile *file, IImage *image, u32 param) const _IRR_OVERRIDE_; 26 | }; 27 | 28 | } // namespace video 29 | } // namespace irr 30 | 31 | #endif // _C_IMAGE_WRITER_PNG_H_INCLUDED__ 32 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | CLogger::CLogger(IEventReceiver* r) 10 | : LogLevel(ELL_INFORMATION), Receiver(r) { 11 | #ifdef _DEBUG 12 | setDebugName("CLogger"); 13 | #endif 14 | } 15 | 16 | //! Returns the current set log level. 17 | ELOG_LEVEL CLogger::getLogLevel() const 18 | { 19 | return LogLevel; 20 | } 21 | 22 | //! Sets a new log level. 23 | void CLogger::setLogLevel(ELOG_LEVEL ll) { 24 | LogLevel = ll; 25 | } 26 | 27 | //! Prints out a text into the log 28 | void CLogger::log(const c8* text, ELOG_LEVEL ll) { 29 | if (ll < LogLevel) 30 | return; 31 | 32 | if (Receiver) { 33 | SEvent event; 34 | event.EventType = EET_LOG_TEXT_EVENT; 35 | event.LogEvent.Text = text; 36 | event.LogEvent.Level = ll; 37 | if (Receiver->OnEvent(event)) 38 | return; 39 | } 40 | 41 | os::Printer::print(text); 42 | } 43 | 44 | //! Prints out a text into the log 45 | void CLogger::log(const c8* text, const c8* hint, ELOG_LEVEL ll) { 46 | if (ll < LogLevel) 47 | return; 48 | 49 | core::stringc s = text; 50 | s += ": "; 51 | s += hint; 52 | log (s.c_str(), ll); 53 | } 54 | 55 | //! Prints out a text into the log 56 | void CLogger::log(const wchar_t* text, ELOG_LEVEL ll) { 57 | if (ll < LogLevel) 58 | return; 59 | 60 | core::stringc s = text; 61 | log(s.c_str(), ll); 62 | } 63 | 64 | //! Prints out a text into the log 65 | void CLogger::log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll) { 66 | if (ll < LogLevel) 67 | return; 68 | 69 | core::stringc s1 = text; 70 | core::stringc s2 = hint; 71 | log(s1.c_str(), s2.c_str(), ll); 72 | } 73 | 74 | //! Prints out a text into the log 75 | void CLogger::log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll) { 76 | if (ll < LogLevel) 77 | return; 78 | 79 | core::stringc s2 = hint; 80 | log( text, s2.c_str(), ll); 81 | } 82 | 83 | //! Sets a new event receiver 84 | void CLogger::setReceiver(IEventReceiver* r) { 85 | Receiver = r; 86 | } 87 | 88 | } // end namespace irr 89 | 90 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_LOGGER_H_INCLUDED__ 6 | #define __C_LOGGER_H_INCLUDED__ 7 | 8 | #include "ILogger.h" 9 | #include "os.h" 10 | #include "irrString.h" 11 | #include "IEventReceiver.h" 12 | 13 | namespace irr { 14 | 15 | //! Class for logging messages, warnings and errors to stdout 16 | class CLogger : public ILogger { 17 | public: 18 | 19 | CLogger(IEventReceiver* r); 20 | 21 | //! Returns the current set log level. 22 | virtual ELOG_LEVEL getLogLevel() const _IRR_OVERRIDE_; 23 | 24 | //! Sets a new log level. virtual void setLogLevel(ELOG_LEVEL ll) _IRR_OVERRIDE_; 25 | virtual void setLogLevel(ELOG_LEVEL ll) _IRR_OVERRIDE_; 26 | 27 | //! Prints out a text into the log 28 | virtual void log(const c8* text, ELOG_LEVEL ll=ELL_INFORMATION) _IRR_OVERRIDE_; 29 | 30 | //! Prints out a text into the log 31 | virtual void log(const wchar_t* text, ELOG_LEVEL ll=ELL_INFORMATION) _IRR_OVERRIDE_; 32 | 33 | //! Prints out a text into the log 34 | virtual void log(const c8* text, const c8* hint, ELOG_LEVEL ll=ELL_INFORMATION) _IRR_OVERRIDE_; 35 | 36 | //! Prints out a text into the log 37 | virtual void log(const c8* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) _IRR_OVERRIDE_; 38 | 39 | //! Prints out a text into the log 40 | virtual void log(const wchar_t* text, const wchar_t* hint, ELOG_LEVEL ll=ELL_INFORMATION) _IRR_OVERRIDE_; 41 | 42 | //! Sets a new event receiver 43 | void setReceiver(IEventReceiver* r); 44 | 45 | private: 46 | 47 | ELOG_LEVEL LogLevel; 48 | IEventReceiver* Receiver; 49 | }; 50 | 51 | } // end namespace 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CMeshCache.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 "CMeshCache.h" 6 | #include "IAnimatedMesh.h" 7 | #include "IMesh.h" 8 | 9 | namespace irr { 10 | namespace scene 11 | { 12 | 13 | static const io::SNamedPath emptyNamedPath; 14 | 15 | CMeshCache::~CMeshCache() { 16 | clear(); 17 | } 18 | 19 | //! adds a mesh to the list 20 | void CMeshCache::addMesh(const io::path& filename, IAnimatedMesh* mesh) { 21 | mesh->grab(); 22 | 23 | MeshEntry e ( filename ); 24 | e.Mesh = mesh; 25 | 26 | Meshes.push_back(e); 27 | } 28 | 29 | //! Removes a mesh from the cache. 30 | void CMeshCache::removeMesh(const IMesh* const mesh) { 31 | if ( !mesh ) 32 | return; 33 | for (u32 i=0; igetMesh(0) == mesh)) { 35 | Meshes[i].Mesh->drop(); 36 | Meshes.erase(i); 37 | return; 38 | } 39 | } 40 | } 41 | 42 | //! Returns amount of loaded meshes 43 | u32 CMeshCache::getMeshCount() const { 44 | return Meshes.size(); 45 | } 46 | 47 | //! Returns current number of the mesh 48 | s32 CMeshCache::getMeshIndex(const IMesh* const mesh) const { 49 | for (u32 i=0; igetMesh(0) == mesh)) 51 | return (s32)i; 52 | } 53 | 54 | return -1; 55 | } 56 | 57 | //! Returns a mesh based on its index number 58 | IAnimatedMesh* CMeshCache::getMeshByIndex(u32 number) { 59 | if (number >= Meshes.size()) 60 | return 0; 61 | 62 | return Meshes[number].Mesh; 63 | } 64 | 65 | //! Returns a mesh based on its name. 66 | IAnimatedMesh* CMeshCache::getMeshByName(const io::path& name) { 67 | MeshEntry e ( name ); 68 | s32 id = Meshes.binary_search(e); 69 | return (id != -1) ? Meshes[id].Mesh : 0; 70 | } 71 | 72 | //! Clears the whole mesh cache, removing all meshes. 73 | void CMeshCache::clear() { 74 | for (u32 i=0; idrop(); 76 | 77 | Meshes.clear(); 78 | } 79 | 80 | //! Clears all meshes that are held in the mesh cache but not used anywhere else. 81 | void CMeshCache::clearUnusedMeshes() { 82 | for (u32 i=0; igetReferenceCount() == 1) { 84 | Meshes[i].Mesh->drop(); 85 | Meshes.erase(i); 86 | --i; 87 | } 88 | } 89 | } 90 | 91 | } // end namespace scene 92 | } // end namespace irr 93 | 94 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_MESH_MANIPULATOR_H_INCLUDED__ 6 | #define __C_MESH_MANIPULATOR_H_INCLUDED__ 7 | 8 | #include "IMeshManipulator.h" 9 | 10 | namespace irr { 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 | public: 21 | //! Flips the direction of surfaces. 22 | /** Changes backfacing triangles to frontfacing triangles and vice versa. 23 | \param mesh: Mesh on which the operation is performed. */ 24 | virtual void flipSurfaces(scene::IMesh* mesh) const _IRR_OVERRIDE_; 25 | 26 | //! Recalculates all normals of the mesh. 27 | /** \param mesh: Mesh on which the operation is performed. 28 | \param smooth: Whether to use smoothed normals. */ 29 | virtual void recalculateNormals(scene::IMesh* mesh, bool smooth = false, bool angleWeighted = false) const _IRR_OVERRIDE_; 30 | 31 | //! Recalculates all normals of the mesh buffer. 32 | /** \param buffer: Mesh buffer on which the operation is performed. 33 | \param smooth: Whether to use smoothed normals. */ 34 | virtual void recalculateNormals(IMeshBuffer* buffer, bool smooth = false, bool angleWeighted = false) const _IRR_OVERRIDE_; 35 | 36 | //! Recalculates tangents, requires a tangent mesh buffer 37 | virtual void recalculateTangents(IMeshBuffer* buffer, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false) const _IRR_OVERRIDE_; 38 | 39 | //! Recalculates tangents, requires a tangent mesh 40 | virtual void recalculateTangents(IMesh* mesh, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false) const _IRR_OVERRIDE_; 41 | }; 42 | 43 | } // end namespace scene 44 | } // end namespace irr 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /lib/irrbloss/source/CMeshSceneNode.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 | #ifndef __C_MESH_SCENE_NODE_H_INCLUDED__ 6 | #define __C_MESH_SCENE_NODE_H_INCLUDED__ 7 | 8 | #include "IMeshSceneNode.h" 9 | #include "IMesh.h" 10 | 11 | namespace irr { 12 | namespace scene 13 | { 14 | 15 | class CMeshSceneNode : public IMeshSceneNode 16 | { 17 | public: 18 | 19 | //! constructor 20 | CMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id, 21 | const core::vector3df& position = core::vector3df(0,0,0), 22 | const core::vector3df& rotation = core::vector3df(0,0,0), 23 | const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); 24 | 25 | //! destructor 26 | virtual ~CMeshSceneNode(); 27 | 28 | //! frame 29 | virtual void OnRegisterSceneNode() _IRR_OVERRIDE_; 30 | 31 | //! renders the node. 32 | virtual void render() _IRR_OVERRIDE_; 33 | 34 | //! returns the axis aligned bounding box of this node 35 | virtual const core::aabbox3d& getBoundingBox() const _IRR_OVERRIDE_; 36 | 37 | //! returns the material based on the zero based index i. To get the amount 38 | //! of materials used by this scene node, use getMaterialCount(). 39 | //! This function is needed for inserting the node into the scene hierarchy on a 40 | //! optimal position for minimizing renderstate changes, but can also be used 41 | //! to directly modify the material of a scene node. 42 | virtual video::SMaterial& getMaterial(u32 i) _IRR_OVERRIDE_; 43 | 44 | //! returns amount of materials used by this scene node. 45 | virtual u32 getMaterialCount() const _IRR_OVERRIDE_; 46 | 47 | //! Returns type of the scene node 48 | virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_MESH; } 49 | 50 | //! Sets a new mesh 51 | virtual void setMesh(IMesh* mesh) _IRR_OVERRIDE_; 52 | 53 | //! Returns the current mesh 54 | virtual IMesh* getMesh(void) _IRR_OVERRIDE_ { return Mesh; } 55 | 56 | //! Creates a clone of this scene node and its children. 57 | virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) _IRR_OVERRIDE_; 58 | 59 | //! Removes a child from this scene node. 60 | //! Implemented here, to be able to remove the shadow properly, if there is one, 61 | //! or to remove attached child. 62 | virtual bool removeChild(ISceneNode* child) _IRR_OVERRIDE_; 63 | 64 | protected: 65 | 66 | void copyMaterials(); 67 | 68 | core::array Materials; 69 | core::aabbox3d Box; 70 | video::SMaterial ReadOnlyMaterial; 71 | 72 | IMesh* Mesh; 73 | IShadowVolumeSceneNode* Shadow; 74 | 75 | s32 PassCount; 76 | bool ReadOnlyMaterials; 77 | }; 78 | 79 | } // end namespace scene 80 | } // end namespace irr 81 | 82 | #endif 83 | 84 | -------------------------------------------------------------------------------- /lib/irrbloss/source/COSOperator.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 "COSOperator.h" 6 | 7 | #ifdef _IRR_WINDOWS_API_ 8 | #include 9 | #else 10 | #include 11 | #include 12 | #ifndef _IRR_ANDROID_PLATFORM_ 13 | #include 14 | #endif 15 | #endif 16 | 17 | #if defined(_IRR_COMPILE_WITH_X11_DEVICE_) 18 | #include "CIrrDeviceLinux.h" 19 | #endif 20 | 21 | #include "fast_atof.h" 22 | 23 | namespace irr { 24 | 25 | #if defined(_IRR_COMPILE_WITH_X11_DEVICE_) 26 | // constructor linux 27 | COSOperator::COSOperator(const core::stringc& osVersion, CIrrDeviceLinux* device) 28 | : OperatingSystem(osVersion), IrrDeviceLinux(device) { 29 | } 30 | #endif 31 | 32 | // constructor 33 | COSOperator::COSOperator(const core::stringc& osVersion) : OperatingSystem(osVersion) { 34 | #ifdef _DEBUG 35 | setDebugName("COSOperator"); 36 | #endif 37 | } 38 | 39 | //! returns the current operating system version as string. 40 | const core::stringc& COSOperator::getOperatingSystemVersion() const { 41 | return OperatingSystem; 42 | } 43 | 44 | //! copies text to the clipboard 45 | void COSOperator::copyToClipboard(const c8* text) const { 46 | if (strlen(text)==0) 47 | return; 48 | 49 | // Windows version 50 | #if defined(_IRR_WINDOWS_API_) 51 | if (!OpenClipboard(NULL) || text == 0) 52 | return; 53 | 54 | EmptyClipboard(); 55 | 56 | HGLOBAL clipbuffer; 57 | char * buffer; 58 | 59 | clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text)+1); 60 | buffer = (char*)GlobalLock(clipbuffer); 61 | 62 | strcpy(buffer, text); 63 | 64 | GlobalUnlock(clipbuffer); 65 | SetClipboardData(CF_TEXT, clipbuffer); 66 | CloseClipboard(); 67 | #elif defined(_IRR_COMPILE_WITH_X11_DEVICE_) 68 | if ( IrrDeviceLinux ) 69 | IrrDeviceLinux->copyToClipboard(text); 70 | #endif 71 | } 72 | 73 | //! gets text from the clipboard 74 | //! \return Returns 0 if no string is in there. 75 | const c8* COSOperator::getTextFromClipboard() const { 76 | #if defined(_IRR_WINDOWS_API_) 77 | if (!OpenClipboard(NULL)) 78 | return 0; 79 | 80 | char * buffer = 0; 81 | 82 | HANDLE hData = GetClipboardData( CF_TEXT ); 83 | buffer = (char*)GlobalLock( hData ); 84 | GlobalUnlock( hData ); 85 | CloseClipboard(); 86 | return buffer; 87 | #elif defined(_IRR_COMPILE_WITH_X11_DEVICE_) 88 | if ( IrrDeviceLinux ) 89 | return IrrDeviceLinux->getTextFromClipboard(); 90 | return 0; 91 | #else 92 | return 0; 93 | #endif 94 | } 95 | 96 | } // end namespace 97 | 98 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_OS_OPERATOR_H_INCLUDED__ 6 | #define __C_OS_OPERATOR_H_INCLUDED__ 7 | 8 | #include "IOSOperator.h" 9 | 10 | namespace irr { 11 | 12 | class CIrrDeviceLinux; 13 | 14 | //! The Operating system operator provides operation system specific methods and information. 15 | class COSOperator : public IOSOperator { 16 | public: 17 | 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 | //! returns the current operation system version as string. 25 | virtual const core::stringc& getOperatingSystemVersion() const _IRR_OVERRIDE_; 26 | 27 | //! copies text to the clipboard 28 | virtual void copyToClipboard(const c8* text) const _IRR_OVERRIDE_; 29 | 30 | //! gets text from the clipboard 31 | //! \return Returns 0 if no string is in there. 32 | virtual const c8* getTextFromClipboard() const _IRR_OVERRIDE_; 33 | 34 | private: 35 | 36 | core::stringc OperatingSystem; 37 | 38 | #if defined(_IRR_COMPILE_WITH_X11_DEVICE_) 39 | CIrrDeviceLinux * IrrDeviceLinux; 40 | #endif 41 | 42 | }; 43 | 44 | } // end namespace 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /lib/irrbloss/source/COctreeTriangleSelector.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 | #ifndef __C_OCTREE_TRIANGLE_SELECTOR_H_INCLUDED__ 6 | #define __C_OCTREE_TRIANGLE_SELECTOR_H_INCLUDED__ 7 | 8 | #include "CTriangleSelector.h" 9 | 10 | namespace irr { 11 | namespace scene 12 | { 13 | 14 | class ISceneNode; 15 | 16 | //! Stupid triangle selector without optimization 17 | class COctreeTriangleSelector : public CTriangleSelector { 18 | public: 19 | 20 | //! Constructs a selector based on a mesh 21 | COctreeTriangleSelector(const IMesh* mesh, ISceneNode* node, s32 minimalPolysPerNode); 22 | 23 | //! Constructs a selector based on a meshbuffer 24 | COctreeTriangleSelector(const IMeshBuffer* meshBuffer, irr::u32 materialIndex, ISceneNode* node, s32 minimalPolysPerNode); 25 | 26 | virtual ~COctreeTriangleSelector(); 27 | 28 | //! Gets all triangles which lie within a specific bounding box. 29 | virtual void getTriangles(core::triangle3df* triangles, s32 arraySize, s32& outTriangleCount, 30 | const core::aabbox3d& box, const core::matrix4* transform, bool useNodeTransform, 31 | irr::core::array* outTriangleInfo) const _IRR_OVERRIDE_; 32 | 33 | //! Gets all triangles which have or may have contact with a 3d line. 34 | virtual void getTriangles(core::triangle3df* triangles, s32 arraySize, 35 | s32& outTriangleCount, const core::line3d& line, 36 | const core::matrix4* transform, bool useNodeTransform, 37 | irr::core::array* outTriangleInfo) const _IRR_OVERRIDE_; 38 | 39 | private: 40 | 41 | struct SOctreeNode 42 | { 43 | SOctreeNode() { 44 | for (u32 i=0; i!=8; ++i) 45 | Child[i] = 0; 46 | } 47 | 48 | ~SOctreeNode() { 49 | for (u32 i=0; i!=8; ++i) 50 | delete Child[i]; 51 | } 52 | 53 | core::array Triangles; 54 | SOctreeNode* Child[8]; 55 | core::aabbox3d Box; 56 | }; 57 | 58 | 59 | void constructOctree(SOctreeNode* node); 60 | void deleteEmptyNodes(SOctreeNode* node); 61 | void getTrianglesFromOctree(SOctreeNode* node, s32& trianglesWritten, 62 | s32 maximumSize, const core::aabbox3d& box, 63 | const core::matrix4* transform, 64 | core::triangle3df* triangles) const; 65 | 66 | void getTrianglesFromOctree(SOctreeNode* node, s32& trianglesWritten, 67 | s32 maximumSize, const core::line3d& line, 68 | const core::matrix4* transform, 69 | core::triangle3df* triangles) const; 70 | 71 | SOctreeNode* Root; 72 | s32 NodeCount; 73 | s32 MinimalPolysPerNode; 74 | }; 75 | 76 | } // end namespace scene 77 | } // end namespace irr 78 | 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_OPENGL_CACHE_HANDLER_H_INCLUDED__ 6 | #define __C_OPENGL_CACHE_HANDLER_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | 10 | #ifdef _IRR_COMPILE_WITH_OPENGL_ 11 | 12 | #include "COpenGLCommon.h" 13 | 14 | #include "COpenGLCoreFeature.h" 15 | #include "COpenGLCoreTexture.h" 16 | #include "COpenGLCoreCacheHandler.h" 17 | 18 | namespace irr { 19 | namespace video 20 | { 21 | 22 | class COpenGLCacheHandler : public COpenGLCoreCacheHandler 23 | { 24 | public: 25 | COpenGLCacheHandler(COpenGLDriver* driver); 26 | virtual ~COpenGLCacheHandler(); 27 | 28 | // Alpha calls. 29 | 30 | void setAlphaFunc(GLenum mode, GLclampf ref); 31 | 32 | void setAlphaTest(bool enable); 33 | 34 | // Client state calls. 35 | 36 | void setClientState(bool vertex, bool normal, bool color, bool texCoord0); 37 | 38 | // Matrix calls. 39 | 40 | void setMatrixMode(GLenum mode); 41 | 42 | // Texture calls. 43 | 44 | void setClientActiveTexture(GLenum texture); 45 | 46 | protected: 47 | GLenum AlphaMode; 48 | GLclampf AlphaRef; 49 | bool AlphaTest; 50 | 51 | GLenum MatrixMode; 52 | 53 | GLenum ClientActiveTexture; 54 | 55 | bool ClientStateVertex; 56 | bool ClientStateNormal; 57 | bool ClientStateColor; 58 | bool ClientStateTexCoord0; 59 | }; 60 | 61 | } // end namespace video 62 | } // end namespace irr 63 | 64 | #endif // _IRR_COMPILE_WITH_OPENGL_ 65 | #endif 66 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_OGLCORE_FEATURE_H_INCLUDED__ 6 | #define __C_OGLCORE_FEATURE_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | 10 | #if defined(_IRR_COMPILE_WITH_OPENGL_) 11 | 12 | #include "irrTypes.h" 13 | 14 | namespace irr { 15 | namespace video 16 | { 17 | 18 | class COpenGLCoreFeature { 19 | public: 20 | COpenGLCoreFeature() : BlendOperation(false), ColorAttachment(0), MultipleRenderTarget(0), MaxTextureUnits(1) { 21 | } 22 | 23 | virtual ~COpenGLCoreFeature() { 24 | } 25 | 26 | bool BlendOperation; 27 | 28 | u8 ColorAttachment; 29 | u8 MultipleRenderTarget; 30 | u8 MaxTextureUnits; 31 | }; 32 | 33 | } 34 | } 35 | 36 | #endif 37 | #endif 38 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | namespace io 9 | { 10 | 11 | CReadFile::CReadFile(const io::path& fileName) 12 | : File(0), FileSize(0), Filename(fileName) { 13 | #ifdef _DEBUG 14 | setDebugName("CReadFile"); 15 | #endif 16 | 17 | openFile(); 18 | } 19 | 20 | CReadFile::~CReadFile() { 21 | if (File) 22 | fclose(File); 23 | } 24 | 25 | //! returns how much was read 26 | size_t CReadFile::read(void* buffer, size_t sizeToRead) { 27 | if (!isOpen()) 28 | return 0; 29 | 30 | return fread(buffer, 1, sizeToRead, File); 31 | } 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 CReadFile::seek(long finalPos, bool relativeMovement) { 37 | if (!isOpen()) 38 | return false; 39 | 40 | return fseek(File, finalPos, relativeMovement ? SEEK_CUR : SEEK_SET) == 0; 41 | } 42 | 43 | //! returns size of file 44 | long CReadFile::getSize() const { 45 | return FileSize; 46 | } 47 | 48 | //! returns where in the file we are. 49 | long CReadFile::getPos() const { 50 | return ftell(File); 51 | } 52 | 53 | //! opens the file 54 | void CReadFile::openFile() { 55 | if (Filename.size() == 0) // bugfix posted by rt 56 | { 57 | File = 0; 58 | return; 59 | } 60 | 61 | File = fopen(Filename.c_str(), "rb"); 62 | 63 | if (File) { 64 | // get FileSize 65 | 66 | fseek(File, 0, SEEK_END); 67 | FileSize = getPos(); 68 | fseek(File, 0, SEEK_SET); 69 | } 70 | } 71 | 72 | //! returns name of file 73 | const io::path& CReadFile::getFileName() const { 74 | return Filename; 75 | } 76 | 77 | IReadFile* CReadFile::createReadFile(const io::path& fileName) { 78 | CReadFile* file = new CReadFile(fileName); 79 | if (file->isOpen()) 80 | return file; 81 | 82 | file->drop(); 83 | return 0; 84 | } 85 | 86 | } // end namespace io 87 | } // end namespace irr 88 | 89 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_READ_FILE_H_INCLUDED__ 6 | #define __C_READ_FILE_H_INCLUDED__ 7 | 8 | #include 9 | #include "IReadFile.h" 10 | #include "irrString.h" 11 | 12 | namespace irr { 13 | 14 | namespace io { 15 | 16 | /*! 17 | Class for reading a real file from disk. 18 | */ 19 | class CReadFile : public IReadFile 20 | { 21 | public: 22 | 23 | CReadFile(const io::path& fileName); 24 | 25 | virtual ~CReadFile(); 26 | 27 | //! returns how much was read 28 | virtual size_t read(void* buffer, size_t sizeToRead) _IRR_OVERRIDE_; 29 | 30 | //! changes position in file, returns true if successful 31 | virtual bool seek(long finalPos, bool relativeMovement = false) _IRR_OVERRIDE_; 32 | 33 | //! returns size of file 34 | virtual long getSize() const _IRR_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 | virtual long getPos() const _IRR_OVERRIDE_; 44 | 45 | //! returns name of file 46 | virtual const io::path& getFileName() const _IRR_OVERRIDE_; 47 | 48 | //! Get the type of the class implementing this interface 49 | virtual EREAD_FILE_TYPE getType() const _IRR_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 | 59 | //! opens the file 60 | void openFile(); 61 | 62 | FILE* File; 63 | long FileSize; 64 | io::path Filename; 65 | }; 66 | 67 | } // end namespace io 68 | } // end namespace irr 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_WGL_MANAGER_H_INCLUDED__ 6 | #define __C_WGL_MANAGER_H_INCLUDED__ 7 | 8 | #include "IrrCompileConfig.h" 9 | 10 | #ifdef _IRR_COMPILE_WITH_WGL_MANAGER_ 11 | 12 | #include "SIrrCreationParameters.h" 13 | #include "SExposedVideoData.h" 14 | #include "IContextManager.h" 15 | #include "SColor.h" 16 | 17 | #define WIN32_LEAN_AND_MEAN 18 | #include 19 | 20 | namespace irr { 21 | namespace video 22 | { 23 | // WGL manager. 24 | class CWGLManager : public IContextManager 25 | { 26 | public: 27 | //! Constructor. 28 | CWGLManager(); 29 | 30 | //! Destructor 31 | ~CWGLManager(); 32 | 33 | // Initialize 34 | virtual bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) _IRR_OVERRIDE_; 35 | 36 | // Terminate 37 | virtual void terminate() _IRR_OVERRIDE_; 38 | 39 | // Create surface. 40 | virtual bool generateSurface() _IRR_OVERRIDE_; 41 | 42 | // Destroy surface. 43 | virtual void destroySurface() _IRR_OVERRIDE_; 44 | 45 | // Create context. 46 | virtual bool generateContext() _IRR_OVERRIDE_; 47 | 48 | // Destroy EGL context. 49 | virtual void destroyContext() _IRR_OVERRIDE_; 50 | 51 | //! Get current context 52 | virtual const SExposedVideoData& getContext() const _IRR_OVERRIDE_; 53 | 54 | //! Change render context, disable old and activate new defined by videoData 55 | virtual bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero) _IRR_OVERRIDE_; 56 | 57 | // Swap buffers. 58 | virtual bool swapBuffers() _IRR_OVERRIDE_; 59 | 60 | private: 61 | SIrrlichtCreationParameters Params; 62 | SExposedVideoData PrimaryContext; 63 | SExposedVideoData CurrentContext; 64 | s32 PixelFormat; 65 | PIXELFORMATDESCRIPTOR pfd; 66 | ECOLOR_FORMAT ColorFormat; 67 | void* FunctionPointers[1]; 68 | }; 69 | } 70 | } 71 | 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | namespace io { 10 | 11 | CWriteFile::CWriteFile(const io::path& fileName, bool append) 12 | : FileSize(0) { 13 | #ifdef _DEBUG 14 | setDebugName("CWriteFile"); 15 | #endif 16 | 17 | Filename = fileName; 18 | openFile(append); 19 | } 20 | 21 | CWriteFile::~CWriteFile() { 22 | if (File) 23 | fclose(File); 24 | } 25 | 26 | //! returns if file is open 27 | inline bool CWriteFile::isOpen() const { 28 | return File != 0; 29 | } 30 | 31 | //! returns how much was read 32 | size_t CWriteFile::write(const void* buffer, size_t sizeToWrite) { 33 | if (!isOpen()) 34 | return 0; 35 | 36 | return fwrite(buffer, 1, sizeToWrite, File); 37 | } 38 | 39 | //! changes position in file, returns true if successful 40 | //! if relativeMovement==true, the pos is changed relative to current pos, 41 | //! otherwise from begin of file 42 | bool CWriteFile::seek(long finalPos, bool relativeMovement) { 43 | if (!isOpen()) 44 | return false; 45 | 46 | return fseek(File, finalPos, relativeMovement ? SEEK_CUR : SEEK_SET) == 0; 47 | } 48 | 49 | //! returns where in the file we are. 50 | long CWriteFile::getPos() const { 51 | return ftell(File); 52 | } 53 | 54 | //! opens the file 55 | void CWriteFile::openFile(bool append) { 56 | if (Filename.size() == 0) { 57 | File = 0; 58 | return; 59 | } 60 | 61 | File = fopen(Filename.c_str(), append ? "ab" : "wb"); 62 | 63 | if (File) { 64 | // get FileSize 65 | 66 | fseek(File, 0, SEEK_END); 67 | FileSize = ftell(File); 68 | fseek(File, 0, SEEK_SET); 69 | } 70 | } 71 | 72 | //! returns name of file 73 | const io::path& CWriteFile::getFileName() const { 74 | return Filename; 75 | } 76 | 77 | //! Flush the content of the buffer in the file 78 | bool CWriteFile::flush() { 79 | if (!isOpen()) 80 | return false; 81 | 82 | return fflush(File) == 0; // 0 indicates success, otherwise EOF and errno is set 83 | } 84 | 85 | IWriteFile* CWriteFile::createWriteFile(const io::path& fileName, bool append) { 86 | CWriteFile* file = new CWriteFile(fileName, append); 87 | if (file->isOpen()) 88 | return file; 89 | 90 | file->drop(); 91 | return 0; 92 | } 93 | 94 | } // end namespace io 95 | } // end namespace irr 96 | 97 | -------------------------------------------------------------------------------- /lib/irrbloss/source/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 | #ifndef __C_WRITE_FILE_H_INCLUDED__ 6 | #define __C_WRITE_FILE_H_INCLUDED__ 7 | 8 | #include 9 | #include "IWriteFile.h" 10 | #include "irrString.h" 11 | 12 | namespace irr { 13 | 14 | namespace io { 15 | 16 | /*! 17 | Class for writing a real file to disk. 18 | */ 19 | class CWriteFile : public IWriteFile 20 | { 21 | public: 22 | 23 | CWriteFile(const io::path& fileName, bool append); 24 | 25 | virtual ~CWriteFile(); 26 | 27 | //! Reads an amount of bytes from the file. 28 | virtual size_t write(const void* buffer, size_t sizeToWrite) _IRR_OVERRIDE_; 29 | 30 | //! Changes position in file, returns true if successful. 31 | virtual bool seek(long finalPos, bool relativeMovement = false) _IRR_OVERRIDE_; 32 | 33 | //! Returns the current position in the file. 34 | virtual long getPos() const _IRR_OVERRIDE_; 35 | 36 | //! Returns name of file. 37 | virtual const io::path& getFileName() const _IRR_OVERRIDE_; 38 | 39 | //! Flush the content of the buffer in the file 40 | virtual bool flush() _IRR_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 | 50 | //! opens the file 51 | void openFile(bool append); 52 | 53 | io::path Filename; 54 | FILE* File; 55 | long FileSize; 56 | }; 57 | 58 | } // end namespace io 59 | } // end namespace irr 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /lib/irrbloss/source/Irrlicht.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // Deutsch (Deutschland) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) 19 | LANGUAGE LANG_GERMAN, SUBLANG_GERMAN 20 | 21 | #ifdef APSTUDIO_INVOKED 22 | ///////////////////////////////////////////////////////////////////////////// 23 | // 24 | // TEXTINCLUDE 25 | // 26 | 27 | 1 TEXTINCLUDE 28 | BEGIN 29 | "resource.h\0" 30 | END 31 | 32 | 2 TEXTINCLUDE 33 | BEGIN 34 | "#include ""windows.h""\r\n" 35 | "\0" 36 | END 37 | 38 | 3 TEXTINCLUDE 39 | BEGIN 40 | "\r\n" 41 | "\0" 42 | END 43 | 44 | #endif // APSTUDIO_INVOKED 45 | 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | // 49 | // Version 50 | // 51 | 52 | VS_VERSION_INFO VERSIONINFO 53 | FILEVERSION 1,9,0,0 54 | PRODUCTVERSION 1,9,0,0 55 | FILEFLAGSMASK 0x3fL 56 | #ifdef _DEBUG 57 | FILEFLAGS 0x1L 58 | #else 59 | FILEFLAGS 0x0L 60 | #endif 61 | FILEOS 0x40004L 62 | FILETYPE 0x2L 63 | FILESUBTYPE 0x0L 64 | BEGIN 65 | BLOCK "StringFileInfo" 66 | BEGIN 67 | BLOCK "040704b0" 68 | BEGIN 69 | VALUE "CompanyName", "Irrlicht Team" 70 | VALUE "FileDescription", "Irrlicht 3d engine" 71 | VALUE "FileVersion", "r3526" 72 | VALUE "InternalName", "Irrlicht.dll" 73 | VALUE "LegalCopyright", "Copyright (C) 2003-2011" 74 | VALUE "OriginalFilename", "Irrlicht.dll" 75 | VALUE "ProductName", "Irrlicht 3d engine" 76 | VALUE "ProductVersion", "1.9.0.alpha" 77 | END 78 | END 79 | BLOCK "VarFileInfo" 80 | BEGIN 81 | VALUE "Translation", 0x407, 1200 82 | END 83 | END 84 | 85 | #endif // Deutsch (Deutschland) resources 86 | ///////////////////////////////////////////////////////////////////////////// 87 | 88 | 89 | 90 | #ifndef APSTUDIO_INVOKED 91 | ///////////////////////////////////////////////////////////////////////////// 92 | // 93 | // Generated from the TEXTINCLUDE 3 resource. 94 | // 95 | 96 | 97 | ///////////////////////////////////////////////////////////////////////////// 98 | #endif // not APSTUDIO_INVOKED 99 | 100 | -------------------------------------------------------------------------------- /lib/irrbloss/source/S2DVertex.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 | #ifndef __S_K_2D_VERTEX_H_INCLUDED__ 6 | #define __S_K_2D_VERTEX_H_INCLUDED__ 7 | 8 | #include "vector2d.h" 9 | 10 | typedef signed short TZBufferType; 11 | 12 | namespace irr { 13 | namespace video { 14 | 15 | struct S2DVertex 16 | { 17 | core::vector2d Pos; // position 18 | core::vector2d TCoords; // texture coordinates 19 | TZBufferType ZValue; // zvalue 20 | u16 Color; 21 | }; 22 | 23 | 24 | } // end namespace video 25 | } // end namespace irr 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /lib/irrbloss/source/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Irrlicht.rc 4 | 5 | #ifdef APSTUDIO_INVOKED 6 | #ifndef APSTUDIO_READONLY_SYMBOLS 7 | #define _APS_NEXT_RESOURCE_VALUE 101 8 | #define _APS_NEXT_COMMAND_VALUE 40001 9 | #define _APS_NEXT_CONTROL_VALUE 1001 10 | #define _APS_NEXT_SYMED_VALUE 101 11 | #endif 12 | #endif 13 | -------------------------------------------------------------------------------- /media/coordinates.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/coordinates.png -------------------------------------------------------------------------------- /media/flip_x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/flip_x.png -------------------------------------------------------------------------------- /media/flip_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/flip_y.png -------------------------------------------------------------------------------- /media/flip_z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/flip_z.png -------------------------------------------------------------------------------- /media/fontlucida.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/fontlucida.png -------------------------------------------------------------------------------- /media/gui_scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/gui_scale.png -------------------------------------------------------------------------------- /media/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/icon.png -------------------------------------------------------------------------------- /media/icon_mode_node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/icon_mode_node.png -------------------------------------------------------------------------------- /media/icon_mode_nodebox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/icon_mode_nodebox.png -------------------------------------------------------------------------------- /media/icon_mode_texture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/icon_mode_texture.png -------------------------------------------------------------------------------- /media/rotate_x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/rotate_x.png -------------------------------------------------------------------------------- /media/rotate_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/rotate_y.png -------------------------------------------------------------------------------- /media/rotate_z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/rotate_z.png -------------------------------------------------------------------------------- /media/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/sky.png -------------------------------------------------------------------------------- /media/texture_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/texture_box.png -------------------------------------------------------------------------------- /media/texture_terrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollerozxa/NodeBoxEditor/5a6963c4e9b9080c9aa435406ed419d8786d15ad/media/texture_terrain.png -------------------------------------------------------------------------------- /nodeboxeditor.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Node Box Editor 3 | GenericName=Minetest Node Box Editor 4 | Comment=Edit and create node boxes for Minetest 5 | GenericName[fr]=Éditeur de node boxes pour Minetest 6 | Comment[fr]=Créer et éditer des node boxes pour Minetest 7 | Exec=nodeboxeditor 8 | Icon=nodeboxeditor 9 | Terminal=false 10 | Type=Application 11 | Categories=Development; 12 | StartupNotify=false 13 | -------------------------------------------------------------------------------- /src/Configuration.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "Configuration.hpp" 5 | #include "util/string.hpp" 6 | 7 | 8 | bool Configuration::load(const std::string & filename){ 9 | std::string line; 10 | std::ifstream file(filename.c_str()); 11 | if (!file) { 12 | return false; 13 | } 14 | while (std::getline(file, line)) { 15 | readLine(line); 16 | } 17 | file.close(); 18 | return true; 19 | } 20 | 21 | 22 | void Configuration::readLine(std::string & line){ 23 | // Skip comments 24 | if (line[0] == '#') 25 | return; 26 | line = trim(line); 27 | 28 | if (line.empty()) { 29 | return; 30 | } 31 | 32 | // Split string into hash and value per 33 | size_t eqPos = line.find('='); 34 | if (eqPos == std::string::npos) { 35 | return; 36 | } 37 | const std::string key = trim(line.substr(0, eqPos)); 38 | const std::string value = trim(line.substr(eqPos + 1)); 39 | 40 | // Create setting 41 | settings[key] = value; 42 | } 43 | 44 | 45 | bool Configuration::save(const std::string & filename){ 46 | std::ofstream file(filename.c_str()); 47 | if (!file) { 48 | return false; 49 | } 50 | for (std::map::const_iterator it = settings.begin(); 51 | it != settings.end(); 52 | ++it) { 53 | file << it->first << " = " << it->second << "\n"; 54 | } 55 | file.close(); 56 | return true; 57 | } 58 | 59 | 60 | const std::string & Configuration::get(const std::string & key) const 61 | { 62 | return settings.find(key)->second; 63 | } 64 | 65 | 66 | void Configuration::set(const std::string & key, const std::string & value) 67 | { 68 | settings[key] = value; 69 | } 70 | 71 | 72 | static inline bool to_bool(const std::string & str) 73 | { 74 | std::string s = str_to_lower(str); 75 | return s == "true" || s == "yes" || s == "1" || s == "on"; 76 | } 77 | 78 | 79 | bool Configuration::getBool(const std::string & key) const 80 | { 81 | return to_bool(settings.find(key)->second); 82 | } 83 | 84 | 85 | int Configuration::getInt(const std::string & key) const 86 | { 87 | return atoi(settings.find(key)->second.c_str()); 88 | } 89 | -------------------------------------------------------------------------------- /src/Configuration.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGURATION_HPP_INCLUDED 2 | #define CONFIGURATION_HPP_INCLUDED 3 | 4 | #include 5 | 6 | class Configuration 7 | { 8 | public: 9 | Configuration() {} 10 | bool load(const std::string & filename); 11 | bool save(const std::string & filename); 12 | 13 | // Getters 14 | const std::string & get(const std::string & key) const; 15 | bool getBool(const std::string & key) const; 16 | int getInt(const std::string & key) const; 17 | 18 | // Setters 19 | void set(const std::string & key, const std::string & value); 20 | protected: 21 | void readLine(std::string & line); 22 | 23 | std::map settings; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/Editor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_HPP_INCLUDED 2 | #define EDITOR_HPP_INCLUDED 3 | 4 | #include "common.hpp" 5 | #include "EditorState.hpp" 6 | #include "project/project.hpp" 7 | 8 | class Editor : public IEventReceiver 9 | { 10 | public: 11 | Editor(); 12 | bool run(IrrlichtDevice *irr_device, Configuration *conf, bool editor_is_installed); 13 | virtual bool OnEvent(const SEvent &event); 14 | private: 15 | void recreateCameras(); 16 | void applyCameraOffsets(EViewport i); 17 | void LoadScene(); 18 | void viewportTick(EViewport vp, rect rect, bool mousehit, bool middlehit); 19 | EViewport getViewportAt(vector2di pos); 20 | 21 | 22 | EditorState *state; 23 | irr::IrrlichtDevice *device; 24 | 25 | // Helper functions 26 | int currentWindow; 27 | ISceneNode *target; 28 | ISceneNode *pivot; 29 | ICameraSceneNode *camera[4]; 30 | vector3df viewport_offset[4]; 31 | EViewport viewport_drag; 32 | vector2di viewport_drag_last; 33 | IMeshSceneNode *plane; 34 | EViewport viewport_contextmenu; 35 | bool click_handled; 36 | bool middle_click_handled; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/EditorState.cpp: -------------------------------------------------------------------------------- 1 | #include "EditorState.hpp" 2 | 3 | EditorState::EditorState(irr::IrrlichtDevice* dev, Project* proj, Configuration* settings) : 4 | device(dev), 5 | project(proj), 6 | currentmode(0), 7 | plane_tri(NULL), 8 | mousedown(false), 9 | settings(settings), 10 | close_requested(false), 11 | modeCount(0), 12 | menu(NULL) 13 | { 14 | for (int i = 0; i < 5; i++) { 15 | modes[i] = NULL; 16 | } 17 | 18 | for (int i = 0; i < NUMBER_OF_KEYS; i++) { 19 | keys[i] = EKS_UP; 20 | } 21 | } 22 | 23 | void EditorState::AddMode(EditorMode* value) 24 | { 25 | modes[modeCount] = value; 26 | value->id = modeCount; 27 | modeCount++; 28 | } 29 | 30 | void EditorState::SelectMode(int id) 31 | { 32 | if (menu->dialog) 33 | if (!menu->dialog->canClose() || !menu->dialog->close()) 34 | return; 35 | 36 | if (!modes[id]) { 37 | return; 38 | } 39 | 40 | if (Mode()) { 41 | Mode()->unload(); 42 | } 43 | 44 | currentmode = id; 45 | 46 | menu->init(); 47 | 48 | if (Mode()) { 49 | Mode()->load(); 50 | } 51 | } 52 | 53 | EViewportType stringToType(std::string input, EViewportType def) 54 | { 55 | if (input == "pers") 56 | return VIEWT_PERS; 57 | else if (input == "front") 58 | return VIEWT_FRONT; 59 | else if (input == "back") 60 | return VIEWT_BACK; 61 | else if (input == "left") 62 | return VIEWT_LEFT; 63 | else if (input == "right") 64 | return VIEWT_RIGHT; 65 | else if (input == "top") 66 | return VIEWT_TOP; 67 | else if (input == "bottom") 68 | return VIEWT_BOTTOM; 69 | else 70 | return def; 71 | } 72 | 73 | EViewportType EditorState::getEViewportType(EViewport id) 74 | { 75 | switch (id) { 76 | case VIEW_TL: 77 | return stringToType(settings->get("viewport_top_left"), VIEWT_PERS); 78 | case VIEW_TR: 79 | return stringToType(settings->get("viewport_top_right"), VIEWT_TOP); 80 | case VIEW_BL: 81 | return stringToType(settings->get("viewport_bottom_left"), VIEWT_FRONT); 82 | default: // case VIEW_BR 83 | return stringToType(settings->get("viewport_bottom_right"), VIEWT_PERS); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/EditorState.hpp: -------------------------------------------------------------------------------- 1 | #ifndef EDITORSTATE_HPP_INCLUDED 2 | #define EDITORSTATE_HPP_INCLUDED 3 | #include "common.hpp" 4 | #include "Configuration.hpp" 5 | #include "project/project.hpp" 6 | #include "MenuState.hpp" 7 | 8 | #define NUMBER_OF_KEYS 252 9 | enum EKeyState 10 | { 11 | EKS_UP = false, 12 | EKS_DOWN = true 13 | }; 14 | 15 | class Project; 16 | class EditorMode; 17 | class MenuState; 18 | class EditorState 19 | { 20 | public: 21 | EditorState(irr::IrrlichtDevice* dev, Project* proj, Configuration* settings); 22 | 23 | // Irrlicht 24 | ITriangleSelector* plane_tri; 25 | IrrlichtDevice* device; 26 | 27 | // Project 28 | Project* project; 29 | 30 | // Editor 31 | EditorMode* Mode(int id) const 32 | { 33 | if (id < 0 || id >= 5) { 34 | return NULL; 35 | } 36 | return modes[id]; 37 | } 38 | EditorMode* Mode() const 39 | { 40 | if (!Mode(currentmode)) 41 | std::cerr << "Warning! Null mode returned..." << std::endl; 42 | return Mode(currentmode); 43 | } 44 | 45 | void SelectMode(int id); 46 | 47 | void AddMode(EditorMode *value); 48 | void CloseEditor() { close_requested = true; } 49 | bool NeedsClose() const { return close_requested; } 50 | 51 | // Input 52 | bool mousedown; 53 | vector2di mouse_position; 54 | EKeyState keys[NUMBER_OF_KEYS]; 55 | 56 | Configuration *settings; 57 | MenuState *menu; 58 | 59 | EViewportType getEViewportType(EViewport id); 60 | 61 | bool isInstalled; 62 | private: 63 | int currentmode; 64 | EditorMode *modes[5]; 65 | int modeCount; 66 | bool close_requested; 67 | }; 68 | 69 | class EditorMode : public irr::IEventReceiver 70 | { 71 | public: 72 | EditorMode(EditorState* st) : state(st) {} 73 | virtual void load() = 0; 74 | virtual void unload() = 0; 75 | virtual void update(double dtime) = 0; 76 | virtual void draw(irr::video::IVideoDriver* driver) {} 77 | virtual void drawViewport(irr::video::IVideoDriver* driver, EViewport viewport, rect area) {} 78 | virtual void viewportTick(EViewport window, irr::video::IVideoDriver* driver, rect offset) = 0; 79 | virtual bool OnEvent(const irr::SEvent &event) = 0; 80 | virtual irr::video::ITexture* icon() = 0; 81 | 82 | int id; 83 | EditorState* state; 84 | }; 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/FileFormat/FileFormat.cpp: -------------------------------------------------------------------------------- 1 | #include "FileFormat.hpp" 2 | #include "NBE.hpp" 3 | #include "Lua.hpp" 4 | #include "../util/filesys.hpp" 5 | 6 | FileFormat *getFromType(FileFormatType id, EditorState *st) 7 | { 8 | switch (id) { 9 | case FILE_FORMAT_NBE: 10 | return new NBEFileFormat(st); 11 | case FILE_FORMAT_LUA: 12 | return new LuaFileFormat(st); 13 | } 14 | return NULL; 15 | } 16 | 17 | 18 | FileFormat *getFromExt(std::string path, EditorState *st) 19 | { 20 | std::string ext = extFromFilename(path); 21 | 22 | std::cerr << "Ext is " << ext.c_str() << std::endl; 23 | 24 | if (ext == "nbe") 25 | return new NBEFileFormat(st); 26 | else if (ext == "lua") 27 | return new LuaFileFormat(st); 28 | else 29 | return NULL; 30 | } 31 | -------------------------------------------------------------------------------- /src/FileFormat/FileFormat.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILEFORMAT_HPP_INCLUDED 2 | #define FILEFORMAT_HPP_INCLUDED 3 | #include 4 | #include "../project/project.hpp" 5 | #include "../EditorState.hpp" 6 | 7 | enum FileFormatError 8 | { 9 | EFFE_NONE, // No error reported 10 | EFFE_IO_ERROR, // Problem opening file 11 | EFFE_READ_OLD_VERSION, // File is too old for this version of NBE 12 | EFFE_READ_NEW_VERSION, // File is newer than this version of NBE 13 | EFFE_READ_PARSE_ERROR, // Corruption or issue in reading file 14 | EFFE_READ_WRONG_TYPE // Wrong type of file 15 | }; 16 | 17 | enum FileFormatType 18 | { 19 | FILE_FORMAT_NBE, 20 | FILE_FORMAT_LUA 21 | }; 22 | 23 | class Project; 24 | class EditorState; 25 | class FileFormat 26 | { 27 | public: 28 | FileFormat(): 29 | error_code(EFFE_NONE) 30 | {} 31 | 32 | virtual Project * read(const std::string &filename, Project *project=NULL) = 0; // Open from file 33 | virtual bool write(Project *project, const std::string & filename) = 0; // Save to file 34 | virtual std::string getAsString(Project *project) { return ""; } 35 | virtual const char * getExtension() const = 0; // Get the main file extension 36 | FileFormatError error_code; 37 | }; 38 | 39 | // FileFormat factory 40 | extern FileFormat *getFromType(FileFormatType id, EditorState *st); 41 | extern FileFormat *getFromExt(std::string path, EditorState *st); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/FileFormat/Lua.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LUAFILEFORMAT_HPP_INCLUDED 2 | #define LUAFILEFORMAT_HPP_INCLUDED 3 | 4 | #include "FileFormat.hpp" 5 | 6 | class LuaFileFormat : public FileFormat 7 | { 8 | public: 9 | LuaFileFormat(EditorState* st) : state(st) {} 10 | virtual bool write(Project* project, const std::string & filename); 11 | virtual std::string getAsString(Project *project); 12 | virtual Project * read(const std::string & file, Project *project=NULL); 13 | 14 | const char * getExtension() const { 15 | return "lua"; 16 | } 17 | private: 18 | EditorState* state; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/FileFormat/NBE.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NBEFILEFORMAT_HPP_INCLUDED 2 | #define NBEFILEFORMAT_HPP_INCLUDED 3 | 4 | #include "FileFormat.hpp" 5 | #include "../project/node.hpp" 6 | 7 | class NBEFileFormat : public FileFormat 8 | { 9 | public: 10 | NBEFileFormat(EditorState *st) : 11 | state(st), 12 | node(NULL), 13 | stage(READ_STAGE_ROOT) 14 | {} 15 | virtual Project *read(const std::string &filename, Project *project=NULL); 16 | virtual bool write(Project *project, const std::string &filename); 17 | virtual const char *getExtension() const { 18 | return "nbe"; 19 | } 20 | enum readstage 21 | { 22 | READ_STAGE_ROOT, 23 | READ_STAGE_NODE 24 | }; 25 | private: 26 | readstage stage; 27 | Node *node; 28 | EditorState *state; 29 | bool merging; 30 | bool readProjectFile(Project *project, const std::string &filename); 31 | bool writeProjectFile(Project *project, const std::string &filename); 32 | void parseLine(Project *project, std::string &line); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/FileFormat/helpers.cpp: -------------------------------------------------------------------------------- 1 | #include "helpers.hpp" 2 | #include "../util/string.hpp" 3 | #include "../util/filesys.hpp" 4 | 5 | void save_file(FileFormat *writer, EditorState *state, std::string file, bool check_ext) 6 | { 7 | if (!writer || !state) 8 | return; 9 | 10 | std::string after(file); 11 | 12 | if (check_ext && after.find('.') == std::string::npos) { 13 | after += '.'; 14 | after += writer->getExtension(); 15 | } 16 | 17 | std::cerr << "Saving to " << after << std::endl; 18 | 19 | if (!writer->write(state->project, after)) { 20 | if (writer->error_code == EFFE_IO_ERROR) { 21 | state->device->getGUIEnvironment()->addMessageBox(L"Unable to Save", 22 | L"Unable to open file to save to"); 23 | } else { 24 | state->device->getGUIEnvironment()->addMessageBox(L"Unable to Save", 25 | L"Unknown reason"); 26 | } 27 | } 28 | 29 | delete writer; 30 | } 31 | 32 | void export_textures(std::string dir, EditorState *state) 33 | { 34 | if (dir == "") 35 | return; 36 | 37 | std::cerr << "Exporting Images to " << dir.c_str() << std::endl; 38 | CreateDir(dir.c_str()); 39 | Media *media = &state->project->media; 40 | std::map& images = media->getList(); 41 | for (std::map::const_iterator it = images.begin(); 42 | it != images.end(); 43 | ++it) { 44 | Media::Image *image = it->second; 45 | if (!image->get()) { 46 | std::cerr << "Image->get() is NULL!" << std::endl; 47 | continue; 48 | } 49 | state->device->getVideoDriver()->writeImageToFile(image->get(), (dir + image->name).c_str()); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/FileFormat/helpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILEFORMAT_HELPERS_HPP_INCLUDED 2 | #define FILEFORMAT_HELPERS_HPP_INCLUDED 3 | #include "../common.hpp" 4 | #include "FileFormat.hpp" 5 | 6 | void save_file(FileFormat *writer, EditorState *state, std::string file, bool check_ext=true); 7 | 8 | void export_textures(std::string dir, EditorState *state); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/FileFormat/obj.cpp: -------------------------------------------------------------------------------- 1 | #include "obj.hpp" 2 | #include 3 | #include 4 | #include "../util/string.hpp" 5 | #include 6 | 7 | void nodeBoxObj(int order, NodeBox *box, std::string &vertices, std::string &faces) 8 | { 9 | std::ostringstream vert; 10 | vert << "v " << -box->one.X << " " << box->one.Y << " " << box->one.Z << "\n"; 11 | vert << "v " << -box->one.X << " " << box->one.Y << " " << box->two.Z << "\n"; 12 | vert << "v " << -box->one.X << " " << box->two.Y << " " << box->two.Z << "\n"; 13 | vert << "v " << -box->one.X << " " << box->two.Y << " " << box->one.Z << "\n"; 14 | 15 | vert << "v " << -box->two.X << " " << box->one.Y << " " << box->one.Z << "\n"; 16 | vert << "v " << -box->two.X << " " << box->one.Y << " " << box->two.Z << "\n"; 17 | vert << "v " << -box->two.X << " " << box->two.Y << " " << box->two.Z << "\n"; 18 | vert << "v " << -box->two.X << " " << box->two.Y << " " << box->one.Z << "\n"; 19 | vertices = vert.str(); 20 | 21 | static const int faces_val[] = { 22 | 1, 2, 3, 4, 23 | 5, 6, 7, 8, 24 | 1, 4, 8, 5, 25 | 2, 3, 7, 6, 26 | 1, 2, 6, 5, 27 | 4, 3, 7, 8 28 | }; 29 | 30 | std::ostringstream fac; 31 | std::string name(box->name); 32 | std::transform(name.begin(), name.end(), name.begin(), ::tolower); 33 | str_replace(std::string(name.c_str(), name.size()), ' ', '_'); 34 | fac << "g " << name << "\n"; 35 | for (int i = 0; i < 6; i++) { 36 | fac << "f " 37 | << faces_val[i*4] + order*8 << " " 38 | << faces_val[i*4 + 1] + order*8 << " " 39 | << faces_val[i*4 + 2] + order*8 << " " 40 | << faces_val[i*4 + 3] + order*8 << "\n"; 41 | } 42 | faces = fac.str(); 43 | } 44 | 45 | std::string nodeToObj(Node *node, std::string filenameNoExt) 46 | { 47 | std::string vertices = ""; 48 | std::string faces = ""; 49 | int count = 0; 50 | for (std::vector::const_iterator it = node->boxes.begin(); 51 | it != node->boxes.end(); 52 | ++it) { 53 | NodeBox* box = *it; 54 | std::string vert = ""; 55 | std::string fac = ""; 56 | nodeBoxObj(count, box, vert, fac); 57 | vertices += vert; 58 | faces += fac; 59 | count++; 60 | } 61 | 62 | std::ostringstream res; 63 | res << "mtllib " << filenameNoExt.c_str() << ".mtl" << std::endl; 64 | res << "o converted_out" << std::endl; 65 | res << vertices.c_str(); 66 | res << "usemtl none" << std::endl; 67 | res << "s off" << std::endl; 68 | res << faces.c_str(); 69 | return res.str(); 70 | } 71 | -------------------------------------------------------------------------------- /src/FileFormat/obj.hpp: -------------------------------------------------------------------------------- 1 | #ifndef OBJ_HPP_INCLUDED 2 | #define OBJ_HPP_INCLUDED 3 | 4 | #include "../project/node.hpp" 5 | 6 | std::string nodeToObj(Node *node, std::string filenameNoExt = "out"); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/GUIHelpers.cpp: -------------------------------------------------------------------------------- 1 | #include "GUIHelpers.hpp" 2 | 3 | void fillTB(IGUIElement* sidebar, int parentId, int id, int value){ 4 | IGUIElement* element = sidebar->getElementFromId(parentId)->getElementFromId(id); 5 | 6 | if (element) { 7 | IGUIEditBox* editbox = static_cast(element); 8 | 9 | if (!editbox) { 10 | return; 11 | } 12 | 13 | editbox->setText(stringw(value).c_str()); 14 | } 15 | } 16 | 17 | void fillTB(IGUIElement* sidebar, int parentId, int id, float value){ 18 | IGUIElement* element = sidebar->getElementFromId(parentId)->getElementFromId(id); 19 | 20 | if (element) { 21 | IGUIEditBox* editbox = static_cast(element); 22 | 23 | if (!editbox) { 24 | return; 25 | } 26 | 27 | editbox->setText(stringw(value).c_str()); 28 | } 29 | } 30 | 31 | 32 | void addBox(IGUIElement* parent, IGUIEnvironment* guienv, vector2di pos, int index, const wchar_t* label){ 33 | guienv->addStaticText(label, 34 | rect(pos.X, pos.Y, pos.X + 20, pos.Y + 20), 35 | false, true, parent)->setNotClipped(true); 36 | guienv->addEditBox(L"", 37 | rect(pos.X + 15, pos.Y, pos.X + 200, pos.Y + 20), 38 | true, parent, index)->setNotClipped(true); 39 | } 40 | 41 | 42 | void addXYZ(IGUIElement* parent,IGUIEnvironment* guienv, vector2di pos, int startIndex){ 43 | addBox(parent, guienv, vector2di(pos.X, pos.Y), startIndex, L"X"); // 0,0 44 | addBox(parent, guienv, vector2di(pos.X, pos.Y + 25), startIndex + 1, L"Y"); // 80, 0 45 | addBox(parent, guienv, vector2di(pos.X, pos.Y + 50), startIndex + 2, L"Z"); // 160, 0 46 | } 47 | -------------------------------------------------------------------------------- /src/GUIHelpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GUIHELPERS_HPP_INCLUDED 2 | #define GUIHELPERS_HPP_INCLUDED 3 | 4 | #include "common.hpp" 5 | 6 | extern void fillTB(IGUIElement* sidebar, int parentId, int id, int value); 7 | extern void fillTB(IGUIElement* sidebar, int parentId, int id, float value); 8 | extern void addBox(IGUIElement* parent, IGUIEnvironment* guienv, vector2di pos, int index, const wchar_t* label); 9 | extern void addXYZ(IGUIElement* parent, IGUIEnvironment* guienv, vector2di pos, int startIndex); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/MenuState.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MENUSTATE_HPP_INCLUDED 2 | #define MENUSTATE_HPP_INCLUDED 3 | #include "common.hpp" 4 | #include "EditorState.hpp" 5 | #include "dialogs/Dialog.hpp" 6 | 7 | #define SIDEBAR_MAX_IDS 20 8 | enum GUI_ID 9 | { 10 | // File 11 | GUI_FILE_NEW_PROJECT = 201, 12 | GUI_FILE_NEW_ITEM, 13 | GUI_FILE_OPEN_PROJECT, 14 | GUI_FILE_SAVE_PROJECT, 15 | GUI_FILE_SAVE_PROJECT_AS, 16 | GUI_FILE_RUN_IN_MINETEST, 17 | GUI_FILE_EXPORT_LUA, 18 | GUI_FILE_EXPORT_MOD, 19 | GUI_FILE_EXPORT_OBJ, 20 | GUI_FILE_EXPORT_TEX, 21 | GUI_FILE_IMPORT, 22 | GUI_FILE_EXIT, 23 | 24 | // Edit 25 | GUI_EDIT_UNDO, 26 | GUI_EDIT_REDO, 27 | GUI_EDIT_SNAP, 28 | GUI_EDIT_LIMIT, 29 | 30 | // View 31 | GUI_VIEW_SP_ALL, 32 | GUI_VIEW_SP_PER, 33 | GUI_VIEW_SP_TOP, 34 | GUI_VIEW_SP_FRT, 35 | GUI_VIEW_SP_RHT, 36 | 37 | // Tools 38 | GUI_PROJ_NEW_BOX, 39 | GUI_PROJ_DELETE_BOX, 40 | GUI_PROJ_CLONE, 41 | GUI_PROJ_IMAGE_IM, 42 | 43 | // Help 44 | GUI_HELP_HELP, 45 | GUI_HELP_FORUM, 46 | GUI_HELP_REPORT, 47 | GUI_HELP_ABOUT, 48 | 49 | // Sidebar 50 | GUI_SIDEBAR, 51 | 52 | // File Dialog 53 | GUI_FILEDIALOG_PATH = GUI_SIDEBAR + SIDEBAR_MAX_IDS, 54 | GUI_DIALOG_SUBMIT, 55 | GUI_DIALOG 56 | }; 57 | 58 | class EditorState; 59 | class Dialog; 60 | class MenuState{ 61 | public: 62 | MenuState(EditorState* state); 63 | void init(); 64 | void draw(IVideoDriver* driver); 65 | bool OnEvent(const SEvent& event); 66 | EditorState *state; 67 | IGUIStaticText *sidebar; 68 | Dialog *dialog; 69 | private: 70 | IGUIContextMenu *projectMenubar; 71 | IGUIContextMenu* menubar; 72 | bool mode_icons_open; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/common.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_HPP_INCLUDED 2 | #define COMMON_HPP_INCLUDED 3 | #include 4 | #include 5 | using namespace irr; 6 | using namespace core; 7 | using namespace scene; 8 | using namespace gui; 9 | using namespace video; 10 | 11 | // Enums 12 | enum ECUBE_SIDE 13 | { 14 | ECS_TOP = 0, 15 | ECS_BOTTOM, 16 | ECS_RIGHT, 17 | ECS_LEFT, 18 | ECS_BACK, 19 | ECS_FRONT 20 | }; 21 | 22 | enum EAxis 23 | { 24 | EAX_X, 25 | EAX_Y, 26 | EAX_Z 27 | }; 28 | 29 | enum EViewport 30 | { 31 | VIEW_NONE = -1, 32 | VIEW_TL, 33 | VIEW_TR, 34 | VIEW_BL, 35 | VIEW_BR 36 | }; 37 | 38 | enum EViewportType 39 | { 40 | VIEWT_PERS = 0, 41 | VIEWT_FRONT, 42 | VIEWT_LEFT, 43 | VIEWT_TOP, 44 | VIEWT_BACK, 45 | VIEWT_RIGHT, 46 | VIEWT_BOTTOM 47 | }; 48 | 49 | enum ECDR 50 | { 51 | CDR_L = 0, 52 | CDR_R, 53 | CDR_U, 54 | CDR_D, 55 | CDR_M 56 | }; 57 | 58 | enum ECDR_DIR 59 | { 60 | CDR_NONE = 0, 61 | CDR_X_P, 62 | CDR_X_N, 63 | CDR_Y_P, 64 | CDR_Y_N, 65 | CDR_Z_P, 66 | CDR_Z_N, 67 | CDR_XZ, 68 | CDR_XY, 69 | CDR_ZY 70 | }; 71 | 72 | // Defines 73 | #include "conf_cmake.hpp" 74 | #define EDITOR_VERSION 1 75 | #define EDITOR_PARSER 1 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/conf_cmake.hpp.in: -------------------------------------------------------------------------------- 1 | #ifndef CONF_CMAKE_HPP_INCLUDED 2 | #define CONF_CMAKE_HPP_INCLUDED 3 | 4 | #define EDITOR_TEXT_VERSION "@NBE_MAJOR_VERSION@.@NBE_MINOR_VERSION@.@NBE_PATCH_VERSION@" 5 | #define EDITOR_TEXT_VERSION_LABEL EDITOR_TEXT_VERSION " - @NBE_LABEL_VERSION@" 6 | 7 | #if @DEBUG@ 8 | #define _DEBUG 9 | #endif 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/dialogs/Dialog.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_HPP_INCLUDED 2 | #define DIALOG_HPP_INCLUDED 3 | #include "../common.hpp" 4 | #include "../EditorState.hpp" 5 | 6 | class EditorState; 7 | class Dialog : public IEventReceiver 8 | { 9 | public: 10 | Dialog(EditorState *mstate): 11 | state(mstate) 12 | {} 13 | 14 | virtual bool canClose() { return true; } 15 | virtual bool close() = 0; 16 | virtual bool OnEvent(const SEvent &event) { return false; } 17 | virtual void draw(IVideoDriver *driver) {} 18 | protected: 19 | EditorState *state; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/dialogs/FileDialog.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILEDIALOG_HPP_INCLUDED 2 | #define FILEDIALOG_HPP_INCLUDED 3 | #include "../common.hpp" 4 | #include "../EditorState.hpp" 5 | 6 | extern void FileDialog_open_project(EditorState *state); 7 | extern void FileDialog_save_project(EditorState *state); 8 | extern void FileDialog_import(EditorState *state); 9 | extern void FileDialog_export(EditorState *state, int parser); 10 | extern void FileDialog_export_obj(EditorState *state, Node *node); 11 | extern void FileDialog_export_mod(EditorState *state); 12 | extern void FileDialog_export_textures(EditorState *state); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/dialogs/ImageDialog.hpp: -------------------------------------------------------------------------------- 1 | #ifndef IMAGEDIALOG_HPP_INCLUDED 2 | #define IMAGEDIALOG_HPP_INCLUDED 3 | #include "Dialog.hpp" 4 | 5 | class ImageDialog : public Dialog 6 | { 7 | public: 8 | ImageDialog(EditorState *mstate, Node *tnode, ECUBE_SIDE tface); 9 | static bool show(EditorState *mstate, Node *node, ECUBE_SIDE face); 10 | void doSave(const SEvent &event); 11 | void doOpen(const SEvent &event); 12 | virtual bool canClose(); 13 | virtual bool close(); 14 | virtual bool OnEvent(const SEvent &event); 15 | private: 16 | IGUIWindow *win; 17 | Node *node; 18 | ECUBE_SIDE face; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/dialogs/TextureDialog.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TEXTUREDIALOG_HPP_INCLUDED 2 | #define TEXTUREDIALOG_HPP_INCLUDED 3 | #include "Dialog.hpp" 4 | 5 | class TextureDialog : public Dialog 6 | { 7 | public: 8 | TextureDialog(EditorState *pstate, Node *pnode, ECUBE_SIDE pface); 9 | static bool show(EditorState *pstate, Node *pnode, ECUBE_SIDE pface); 10 | virtual bool canClose(); 11 | virtual bool close(); 12 | virtual bool OnEvent(const SEvent &event); 13 | virtual void draw(IVideoDriver *driver); 14 | private: 15 | Node *node; 16 | ECUBE_SIDE face; 17 | IGUIWindow *win; 18 | IGUIListBox *lb; 19 | ITexture *the_image; 20 | IGUIContextMenu *context; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/minetest.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MINETEST_HPP_INCLUDED 2 | #define MINETEST_HPP_INCLUDED 3 | 4 | #include "common.hpp" 5 | #include "EditorState.hpp" 6 | #include "Configuration.hpp" 7 | 8 | class Minetest 9 | { 10 | public: 11 | Minetest(Configuration *conf); 12 | bool findMinetest(bool editor_is_installed); 13 | bool runMod(EditorState *state, const std::string &world = "nbe_test"); 14 | private: 15 | bool findMinetestDir(std::string path); 16 | 17 | Configuration *_conf; 18 | std::string minetest_dir; 19 | std::string minetest_exe; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/modes/NBEditor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NBEDITOR_HPP_INCLUDED 2 | #define NBEDITOR_HPP_INCLUDED 3 | #include "../common.hpp" 4 | #include "../EditorState.hpp" 5 | 6 | class EditorState; 7 | class NBEditor; 8 | class CDR 9 | { 10 | public: 11 | CDR() : visible(false) {} 12 | CDR(EViewport win, ECDR typ) : window(win), type(typ), visible(false) {} 13 | 14 | void update(NBEditor* editor, bool drag, rect offset); 15 | ECDR_DIR getActualType(EditorState* state); 16 | 17 | EViewport window; 18 | ECDR type; 19 | vector2d position; 20 | bool visible; 21 | }; 22 | 23 | class EditorMode; 24 | class NBEditor :public EditorMode 25 | { 26 | friend class CDR; 27 | public: 28 | NBEditor(EditorState* st); 29 | 30 | // Interface 31 | virtual void load(); 32 | virtual void unload(); 33 | virtual void update(double dtime); 34 | virtual void drawViewport(irr::video::IVideoDriver* driver, EViewport viewport, rect area); 35 | virtual void viewportTick(EViewport window, irr::video::IVideoDriver* driver, rect offset); 36 | virtual bool OnEvent(const irr::SEvent &event); 37 | virtual irr::video::ITexture* icon(); 38 | void triggerCDRmoved() { prop_needs_update = true; } 39 | 40 | private: 41 | bool wasmd; 42 | int current; 43 | CDR cdrs[20]; 44 | void load_ui(); 45 | void fillProperties(); 46 | void updateProperties(); 47 | bool prop_needs_update; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/modes/NodeEditor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NODEEDITOR_HPP_INCLUDED 2 | #define NODEEDITOR_HPP_INCLUDED 3 | #include "../common.hpp" 4 | #include "../EditorState.hpp" 5 | 6 | class EditorMode; 7 | class NodeEditor :public EditorMode 8 | { 9 | public: 10 | NodeEditor(EditorState* st); 11 | 12 | // Interface 13 | virtual void load(); 14 | virtual void unload(); 15 | virtual void update(double dtime); 16 | virtual void draw(irr::video::IVideoDriver* driver); 17 | virtual void viewportTick(EViewport window, irr::video::IVideoDriver* driver, rect offset); 18 | virtual bool OnEvent(const irr::SEvent &event); 19 | virtual irr::video::ITexture* icon(); 20 | 21 | // The GUI ID numbers for this mode 22 | // NOTE: the maximum that can be here is 20 23 | // see in MenuState.h to raise limit 24 | enum NODE_EDITOR_GUI_ID { 25 | ENG_GUI_MAIN_LISTBOX = GUI_SIDEBAR + 1, 26 | ENG_GUI_MAIN_ADD, 27 | ENG_GUI_MAIN_DEL, 28 | ENG_GUI_MAIN_EDIT, 29 | ENG_GUI_PROP, 30 | ENG_GUI_PROP_NAME, 31 | ENG_GUI_PROP_X, 32 | ENG_GUI_PROP_Y, 33 | ENG_GUI_PROP_Z, 34 | ENG_GUI_PROP_SNAP_RES, 35 | ENG_GUI_PROP_UPDATE, 36 | ENG_GUI_PROP_REVERT 37 | }; 38 | private: 39 | void load_ui(); 40 | void fillProperties(); 41 | void updateProperties(); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/modes/TextureEditor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TEXTUREEDITOR_HPP_INCLUDED 2 | #define TEXTUREEDITOR_HPP_INCLUDED 3 | #include "../common.hpp" 4 | #include "../EditorState.hpp" 5 | 6 | class EditorMode; 7 | class TextureEditor :public EditorMode 8 | { 9 | public: 10 | TextureEditor(EditorState* st); 11 | 12 | // Interface 13 | virtual void load(); 14 | virtual void unload(); 15 | virtual void update(double dtime); 16 | virtual void draw(irr::video::IVideoDriver* driver); 17 | virtual void viewportTick(EViewport window, irr::video::IVideoDriver* driver, rect offset); 18 | virtual bool OnEvent(const irr::SEvent &event); 19 | virtual irr::video::ITexture* icon(); 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/project/media.cpp: -------------------------------------------------------------------------------- 1 | #include "media.hpp" 2 | #include "../util/filesys.hpp" 3 | 4 | Media::~Media() 5 | { 6 | for (std::map::const_iterator it = images.begin(); 7 | it != images.end(); 8 | ++it) { 9 | delete it->second; 10 | } 11 | } 12 | 13 | bool Media::import(std::string filepath, std::string filename, IVideoDriver* driver) 14 | { 15 | return add(filepath, filename, driver->createImageFromFile(filepath.c_str())); 16 | } 17 | 18 | bool Media::add(std::string filepath, std::string filename, IImage *image, bool overwrite) 19 | { 20 | if (!image) 21 | return false; 22 | 23 | filename = trim(filename); 24 | const char *shortpath = filename.c_str(); 25 | if (images[shortpath] != NULL) { 26 | if (overwrite) { 27 | std::cerr << "Overwriting '" << shortpath << "'" << std::endl; 28 | images[shortpath]->update(image); 29 | images[shortpath]->origpath = filepath; 30 | } else { 31 | std::cerr << "Failed to add image '" << shortpath 32 | << "', it already exists (and overwrite was not authorised)" 33 | << std::endl; 34 | return false; 35 | } 36 | } else { 37 | std::cerr << "Adding '" << shortpath << "'" << std::endl; 38 | images[shortpath] = new Media::Image(shortpath, image); 39 | images[shortpath]->origpath = filepath; 40 | } 41 | return true; 42 | } 43 | 44 | Media::Image *Media::get(const char* name) 45 | { 46 | if (!images[name]) { 47 | return NULL; 48 | } 49 | return images[name]; 50 | } 51 | 52 | void Media::debug() 53 | { 54 | std::cerr << "Media Manager:" << std::endl; 55 | for (std::map::const_iterator it = images.begin(); 56 | it != images.end(); 57 | ++it) { 58 | std::cerr << it->second->name.c_str() << " (" << it->second->getHolders() << ")" << std::endl; 59 | } 60 | } 61 | 62 | void Media::clearGrabs() 63 | { 64 | for (std::map::const_iterator it = images.begin(); 65 | it != images.end(); 66 | ++it) { 67 | it->second->dropAll(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/project/media.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MEDIAMANAGER_HPP_INCLUDED 2 | #define MEDIAMANAGER_HPP_INCLUDED 3 | #include "../common.hpp" 4 | #include 5 | #include 6 | 7 | class Media 8 | { 9 | public: 10 | class Image 11 | { 12 | public: 13 | Image(const char *the_name, IImage *the_data): 14 | name(the_name), 15 | data(the_data), 16 | holders(0), 17 | origpath("") 18 | {} 19 | 20 | Image(): 21 | data(NULL) 22 | {} 23 | 24 | std::string name; 25 | std::string origpath; 26 | 27 | IImage *get() const { return data; } 28 | void grab() { holders++; } 29 | void drop() { assert(holders > 0); holders--; } 30 | void dropAll() { holders = 0; } 31 | void deleteImage() { data->drop(); } 32 | unsigned int getHolders() const { return holders; } 33 | void update(IImage *ndata) { data->drop(); data = ndata; } 34 | private: 35 | IImage *data; 36 | unsigned int holders; 37 | }; 38 | 39 | Media() { std::cerr << "Media Manager created!" << std::endl; } 40 | Media(const Media &old) { std::cerr << "Media Manager copied! (This shouldn't happen)" << std::endl; } 41 | ~Media(); 42 | bool import(std::string filepath, std::string filename, IVideoDriver* driver); 43 | bool add(std::string filepath, std::string filename, IImage *image, bool overwrite = false); 44 | Media::Image *get(const char* name); 45 | void clearGrabs(); 46 | void debug(); 47 | std::map& getList() const {return (std::map&)images;}; 48 | private: 49 | std::map images; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/project/node.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NODE_HPP_INCLUDED 2 | #define NODE_HPP_INCLUDED 3 | 4 | #include 5 | #include "../common.hpp" 6 | #include "../EditorState.hpp" 7 | #include "nodebox.hpp" 8 | #include "media.hpp" 9 | 10 | class EditorState; 11 | class NodeBox; 12 | class Node 13 | { 14 | public: 15 | // Construction / Destruction 16 | Node(IrrlichtDevice* device, EditorState* state, unsigned int id); 17 | ~Node(); 18 | 19 | // Node box manager 20 | int GetId() const { return _selected; } 21 | unsigned int NodeId() const { return _nid; } 22 | NodeBox* GetCurrentNodeBox(); 23 | NodeBox* GetNodeBox(int id); 24 | NodeBox* addNodeBox(vector3df one = vector3df(-0.5, -0.5, -0.5), 25 | vector3df two = vector3df(0.5, 0.5, 0.5)); 26 | void deleteNodebox(int id); 27 | void cloneNodebox(int id); 28 | void select(int id) { _selected = id; } 29 | 30 | // Node bulk updaters 31 | void remesh(bool force = false); // creates the node mesh 32 | void remesh(NodeBox *box); 33 | void setAllTextures(Media::Image *def); 34 | void rotate(EAxis axis); 35 | void flip(EAxis axis); 36 | void hide(); 37 | 38 | void setTexture(ECUBE_SIDE face, Media::Image *image); 39 | Media::Image *getTexture(ECUBE_SIDE face) { return images[face]; } 40 | 41 | vector3di position; 42 | std::string name; 43 | std::vector boxes; 44 | int snap_res; 45 | private: 46 | // Data 47 | int _selected; 48 | unsigned int _nid; // the node's id. 49 | int _box_count; 50 | 51 | // Irrlicht 52 | IrrlichtDevice* device; 53 | EditorState* state; 54 | Media::Image *images[6]; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/project/nodebox.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NODEBOX_HPP_INCLUDED 2 | #define NODEBOX_HPP_INCLUDED 3 | 4 | #include 5 | #include "../common.hpp" 6 | #include "../EditorState.hpp" 7 | #include "media.hpp" 8 | 9 | class EditorState; 10 | class NodeBox 11 | { 12 | public: 13 | NodeBox() {}; 14 | 15 | NodeBox(const std::string & name, const vector3df & one, const vector3df & two) : 16 | name(name), one(one), two(two), model(NULL), rebuild_needed(true) 17 | {} 18 | 19 | void removeMesh(IVideoDriver *driver); 20 | 21 | irr::core::vector3df one; 22 | irr::core::vector3df two; 23 | bool rebuild_needed; 24 | std::string name; 25 | irr::scene::IMeshSceneNode* model; 26 | 27 | irr::core::vector3df GetCenter() 28 | { 29 | return vector3df( 30 | one.X + ((two.X - one.X) / 2), 31 | one.Y + ((two.Y - one.Y) / 2), 32 | one.Z + ((two.Z - one.Z) / 2) 33 | ); 34 | } 35 | 36 | irr::core::vector3df GetScale() 37 | { 38 | return vector3df( 39 | (two.X - one.X) / 2, 40 | (two.Y - one.Y) / 2, 41 | (two.Z - one.Z) / 2 42 | ); 43 | } 44 | 45 | // Transformations 46 | void moveFace(EditorState* editor, ECDR_DIR type, 47 | vector3df position, bool both); 48 | void move(EditorState* editor, ECDR_DIR type, vector3df position, 49 | const int snap_res=0); 50 | void rotate(EAxis axis); 51 | void flip(EAxis axis); 52 | 53 | // Create the mesh for the nodebox, store is in this->model. 54 | // 55 | // Only runs if rebuild_needed is true. 56 | void buildMesh(EditorState* editor, vector3di nd_position, 57 | IrrlichtDevice* device, Media::Image* images[6], bool force = false); 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/project/project.cpp: -------------------------------------------------------------------------------- 1 | #include "project.hpp" 2 | #include "node.hpp" 3 | #include "../util/string.hpp" 4 | 5 | Project::Project() : 6 | name("test"), 7 | snode(-1), 8 | _node_count(0) 9 | { 10 | } 11 | 12 | Project::~Project() 13 | { 14 | for (std::list::const_iterator it = nodes.begin(); 15 | it != nodes.end(); 16 | ++it) { 17 | if (*it) { 18 | delete *it; 19 | } 20 | } 21 | } 22 | 23 | Node* Project::GetNode(int id) const 24 | { 25 | int curid = 0; 26 | for (std::list::const_iterator it = nodes.begin(); 27 | it != nodes.end(); 28 | ++it, ++curid) { 29 | if (curid == id) { 30 | return *it; 31 | } 32 | } 33 | return NULL; 34 | } 35 | 36 | 37 | void Project::hideAllButCurrentNode() 38 | { 39 | int curid = 0; 40 | for (std::list::const_iterator it = nodes.begin(); 41 | it != nodes.end(); 42 | ++it, ++curid) { 43 | if (snode == curid) { 44 | (*it)->remesh(); 45 | } else { 46 | (*it)->hide(); 47 | } 48 | } 49 | } 50 | 51 | Node* Project::GetNode(vector3di pos) const 52 | { 53 | for (std::list::const_iterator it = nodes.begin(); 54 | it != nodes.end(); 55 | ++it) { 56 | if (*it && (*it)->position == pos) { 57 | return *it; 58 | } 59 | } 60 | return NULL; 61 | } 62 | 63 | void Project::remesh() 64 | { 65 | for (std::list::const_iterator it = nodes.begin(); 66 | it != nodes.end(); 67 | ++it) { 68 | if (*it) { 69 | (*it)->remesh(); 70 | } 71 | } 72 | } 73 | 74 | void Project::AddNode(EditorState* state, bool select, bool add_initial_box) 75 | { 76 | Node* node = new Node(state->device, state, _node_count); 77 | if (add_initial_box) 78 | node->addNodeBox(); 79 | AddNode(node, select); 80 | } 81 | 82 | void Project::AddNode(Node* node, bool select) 83 | { 84 | _node_count++; 85 | if (node->name == "") { 86 | node->name = "node_" + num_to_str(_node_count); 87 | } 88 | if (node->position == vector3di(0, 0, 0)) 89 | node->position = vector3di((_node_count - 1), 0, 0); 90 | node->remesh(); 91 | nodes.push_back(node); 92 | if (select) { 93 | snode = _node_count - 1; 94 | } 95 | } 96 | 97 | void Project::DeleteNode(int id) 98 | { 99 | if (snode == id) { 100 | snode = -1; 101 | } 102 | 103 | int curid = 0; 104 | for (std::list::iterator it = nodes.begin(); 105 | it != nodes.end(); 106 | ++it, ++curid) { 107 | if (*it && curid == id){ 108 | delete *it; 109 | it = nodes.erase(it); 110 | return; 111 | } 112 | } 113 | } 114 | 115 | Node* Project::GetCurrentNode() const 116 | { 117 | if (snode >= 0) { 118 | return GetNode(snode); 119 | } else { 120 | return NULL; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/project/project.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PROJECT_HPP_INCLUDED 2 | #define PROJECT_HPP_INCLUDED 3 | 4 | #include 5 | #include 6 | #include "../common.hpp" 7 | #include "../EditorState.hpp" 8 | #include "media.hpp" 9 | #include "node.hpp" 10 | 11 | class Node; 12 | class EditorState; 13 | 14 | class Project 15 | { 16 | public: 17 | Project(); 18 | ~Project(); 19 | 20 | // Properties 21 | std::string name; 22 | std::string file; 23 | 24 | // Media 25 | Media media; 26 | 27 | // Nodes 28 | void AddNode(EditorState* state, bool select = true, bool add_initial_box = true); 29 | void AddNode(Node* node, bool select = true); 30 | void DeleteNode(int id); 31 | void SelectNode(int id) { snode = id; } 32 | void hideAllButCurrentNode(); 33 | void remesh(); 34 | Node* GetNode(int id) const; 35 | Node* GetNode(vector3di pos) const; 36 | Node* GetCurrentNode() const; 37 | int GetSelectedNodeId() const { return snode; } 38 | unsigned int GetNodeCount() const { return _node_count; } 39 | 40 | std::list nodes; 41 | private: 42 | int snode; 43 | unsigned int _node_count; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/util/SimpleFileCombiner.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SIMPLEFILECOMBINER_HPP_INCLUDED 2 | #define SIMPLEFILECOMBINER_HPP_INCLUDED 3 | 4 | #include "string.hpp" 5 | #include 6 | #include 7 | 8 | 9 | 10 | class SimpleFileCombiner 11 | { 12 | public: 13 | enum Errors 14 | { 15 | EERR_NONE = 0, 16 | EERR_IO, 17 | EERR_WRONG_FILE 18 | }; 19 | 20 | SimpleFileCombiner(): 21 | errcode(EERR_NONE) 22 | {} 23 | 24 | static const unsigned int sizeofdef = 50 + 2 * sizeof(unsigned int); 25 | class File 26 | { 27 | public: 28 | File(std::string tname, std::vector tbytes): 29 | name(tname), 30 | bytes(tbytes){} 31 | std::string name; 32 | std::vector bytes; 33 | }; 34 | std::list files; 35 | bool write(std::string filename); 36 | bool add(const char* readfrom, std::string file); 37 | std::list read(const char* file, std::string dir); 38 | SimpleFileCombiner::Errors errcode; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/util/filesys.hpp: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_FILESYS_HPP_INCLUDED 2 | #define UTIL_FILESYS_HPP_INCLUDED 3 | #include "string.hpp" 4 | #include 5 | 6 | #ifdef _WIN32 7 | #define DIR_DELIM '\\' 8 | #else 9 | #define DIR_DELIM '/' 10 | #endif 11 | 12 | std::string getSaveLoadDirectory(std::string save_dir_setting, bool editor_is_installed); 13 | 14 | std::string cleanDirectoryPath(std::string &path); 15 | 16 | std::string getTmpDirectory(bool editor_is_installed); 17 | 18 | bool FileExists(const char* path); 19 | bool DirExists(const char* path); 20 | 21 | bool CreateDir(std::string path); 22 | 23 | std::vector filesInDirectory(std::string path); 24 | 25 | std::string filenameWithExt(std::string path); 26 | std::string extFromFilename(std::string path); 27 | std::string filenameWithoutExt(std::string path); 28 | std::string pathWithoutFilename(std::string path); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/util/string.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "string.hpp" 4 | 5 | std::string trim(const std::string & str) 6 | { 7 | std::string s(str); 8 | s.erase(s.find_last_not_of(" \t\r\n") + 1); 9 | s.erase(0, s.find_first_not_of(" \t\r\n")); 10 | return s; 11 | } 12 | 13 | 14 | std::string str_to_lower(const std::string & str) 15 | { 16 | std::string s(str); 17 | std::transform(s.begin(), s.end(), s.begin(), tolower); 18 | return s; 19 | } 20 | 21 | 22 | std::wstring narrow_to_wide(const std::string & input) 23 | { 24 | wchar_t * wide = new wchar_t[input.size() * 2]; 25 | size_t newlen = mbstowcs(wide, input.data(), input.size()); 26 | return std::wstring(wide, newlen); 27 | } 28 | 29 | 30 | std::string str_replace(const std::string & str, char f, char r) 31 | { 32 | std::string s(str); 33 | std::replace(s.begin(), s.end(), f, r); 34 | return s; 35 | } 36 | -------------------------------------------------------------------------------- /src/util/string.hpp: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_STRING_HPP_INCLUDED 2 | #define UTIL_STRING_HPP_INCLUDED 3 | 4 | #include 5 | #include 6 | 7 | extern std::string trim(const std::string & str); 8 | extern std::string str_to_lower(const std::string & str); 9 | extern std::wstring narrow_to_wide(const std::string & input); 10 | extern std::string str_replace(const std::string & str, char f, char r); 11 | 12 | 13 | template 14 | const std::string num_to_str(T num) 15 | { 16 | std::ostringstream os; 17 | os << num; 18 | return os.str(); 19 | } 20 | 21 | #endif // UTIL_STRING_HPP_INCLUDED 22 | -------------------------------------------------------------------------------- /src/util/tinyfiledialogs.h: -------------------------------------------------------------------------------- 1 | /* 2 | tinyfiledialogs.h 3 | optional unique header file of the tiny file dialogs library - tinyfd 4 | created [November 9, 2014] 5 | Copyright (c) 2014 - 2015 Guillaume Vareille http://ysengrin.com 6 | http://tinyfiledialogs.sourceforge.net 7 | 8 | - License - 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any damages 12 | arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, 15 | including commercial applications, and to alter it and redistribute it 16 | freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not 19 | claim that you wrote the original software. If you use this software 20 | in a product, an acknowledgment in the product documentation would be 21 | appreciated but is not required. 22 | 2. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original software. 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | 27 | #ifndef TINYFILEDIALOGS_H 28 | #define TINYFILEDIALOGS_H 29 | 30 | /* 31 | if tinydialogs.c is compiled with a C++ compiler 32 | rather than with a C compiler, you need to comment out: 33 | extern "C" { 34 | and the corresponding closing bracket: 35 | } 36 | */ 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif /* __cplusplus */ 41 | 42 | extern int tinyfd_forceConsole ; /* for UNIX only: 0 (default) or 1 */ 43 | /* 1 forces all dialogs into console mode even when the X server is present */ 44 | /* can be modified at run time */ 45 | 46 | char const * tinyfd_saveFileDialog ( 47 | char const * const aTitle , /* "" */ 48 | char const * const aDefaultPathAndFile , /* "" */ 49 | int const aNumOfFileFilters , /* 0 */ 50 | char const * const * const aFileFilters ) ; /* NULL or {"*.txt"} */ 51 | 52 | char const * tinyfd_openFileDialog ( 53 | char const * const aTitle , /* "" */ 54 | char const * const aDefaultPathAndFile , /* "" */ 55 | int const aNumOfFileFilters , /* 0 */ 56 | char const * const * const aFileFilters , /* NULL or {"*.jpg","*.png"} */ 57 | int aAllowMultipleSelects ) ; /* 0 or 1 */ 58 | /* in case of multiple files, the separator is | */ 59 | 60 | char const * tinyfd_selectFolderDialog ( 61 | char const * const aTitle , /* "" */ 62 | char const * const aDefaultPath ) ; /* "" */ 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif /* __cplusplus */ 67 | 68 | #endif /* TINYFILEDIALOGS_H */ 69 | -------------------------------------------------------------------------------- /util/buildbot/buildwin32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Taken from https://github.com/minetest/minetest LGPL 2.1 or later 3 | 4 | set -e 5 | 6 | dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 7 | if [ $# -ne 1 ]; then 8 | echo "Usage: $0 " 9 | exit 1 10 | fi 11 | builddir=$1 12 | mkdir -p $builddir 13 | mkdir -p $builddir/bin 14 | builddir="$( cd "$builddir" && pwd )" 15 | packagedir=$builddir/packages 16 | libdir=$builddir/libs 17 | 18 | toolchain_file=$dir/toolchain_mingw.cmake 19 | mingwdlldir="/usr/i686-w64-mingw32/bin" 20 | 21 | mkdir -p $packagedir 22 | mkdir -p $libdir 23 | 24 | cd $builddir 25 | 26 | # Get nodeboxeditor 27 | cd $builddir 28 | if [ ! "x$EXISTING_nodeboxeditor_DIR" = "x" ]; then 29 | ln -s $EXISTING_nodeboxeditor_DIR nodeboxeditor 30 | else 31 | [ -d nodeboxeditor ] && (cd nodeboxeditor && git pull) || (git clone https://github.com/ROllerozxa/nodeboxeditor) 32 | fi 33 | cd nodeboxeditor 34 | git_hash=`git show | head -c14 | tail -c7` 35 | 36 | # Build the thing 37 | [ -d _build ] && rm -Rf _build/ 38 | mkdir _build 39 | cd _build 40 | cmake .. -G Ninja \ 41 | -DCMAKE_TOOLCHAIN_FILE=$toolchain_file \ 42 | -DCMAKE_INSTALL_PREFIX=/tmp 43 | 44 | ninja 45 | 46 | # Package the shit 47 | mkdir -p temp_package/ 48 | mkdir -p temp_package/nodeboxeditor 49 | cp ../bin/nodeboxeditor.exe temp_package/ 50 | cp lib/irrbloss/bin/Win32-gcc/Irrbloss.dll temp_package/ 51 | cp $mingwdlldir/lib{{gcc_s_dw2-1,png16-16,ssp-0,stdc++-6,winpthread-1},zlib1}.dll temp_package/ 52 | cp -r ../media/ temp_package/ 53 | -------------------------------------------------------------------------------- /util/buildbot/buildwin64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Taken from https://github.com/minetest/minetest LGPL 2.1 or later 3 | 4 | set -e 5 | 6 | dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 7 | if [ $# -ne 1 ]; then 8 | echo "Usage: $0 " 9 | exit 1 10 | fi 11 | builddir=$1 12 | mkdir -p $builddir 13 | mkdir -p $builddir/bin 14 | builddir="$( cd "$builddir" && pwd )" 15 | packagedir=$builddir/packages 16 | libdir=$builddir/libs 17 | 18 | toolchain_file=$dir/toolchain_mingw64.cmake 19 | mingwdlldir="/usr/x86_64-w64-mingw32/bin" 20 | 21 | mkdir -p $packagedir 22 | mkdir -p $libdir 23 | 24 | cd $builddir 25 | 26 | # Get nodeboxeditor 27 | cd $builddir 28 | if [ ! "x$EXISTING_nodeboxeditor_DIR" = "x" ]; then 29 | ln -s $EXISTING_nodeboxeditor_DIR nodeboxeditor 30 | else 31 | [ -d nodeboxeditor ] && (cd nodeboxeditor && git pull) || (git clone https://github.com/ROllerozxa/nodeboxeditor) 32 | fi 33 | cd nodeboxeditor 34 | git_hash=`git show | head -c14 | tail -c7` 35 | 36 | # Build the thing 37 | [ -d _build ] && rm -Rf _build/ 38 | mkdir _build 39 | cd _build 40 | cmake .. -G Ninja \ 41 | -DCMAKE_TOOLCHAIN_FILE=$toolchain_file \ 42 | -DCMAKE_INSTALL_PREFIX=/tmp 43 | 44 | ninja 45 | 46 | # Package the shit 47 | mkdir -p temp_package/ 48 | cp ../bin/nodeboxeditor.exe temp_package/ 49 | cp lib/irrbloss/bin/Win32-gcc/Irrbloss.dll temp_package/ 50 | cp $mingwdlldir/lib{{gcc_s_seh-1,png16-16,ssp-0,stdc++-6,winpthread-1},zlib1}.dll temp_package/ 51 | cp -r ../media/ temp_package/ 52 | -------------------------------------------------------------------------------- /util/buildbot/toolchain_mingw.cmake: -------------------------------------------------------------------------------- 1 | # Target operating system name 2 | set(CMAKE_SYSTEM_NAME Windows) 3 | 4 | # Compilers to use 5 | set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) 6 | set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) 7 | set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) 8 | 9 | # Location of the target environment 10 | set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) 11 | 12 | # Adjust the default behaviour of the FIND_XXX() commands: 13 | # search for headers and libraries in the target environment, 14 | # search for programs in the host environment 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 18 | 19 | -------------------------------------------------------------------------------- /util/buildbot/toolchain_mingw64.cmake: -------------------------------------------------------------------------------- 1 | # name of the target operating system 2 | SET(CMAKE_SYSTEM_NAME Windows) 3 | 4 | # which compilers to use for C and C++ 5 | SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) 6 | SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) 7 | SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) 8 | 9 | # here is the target environment located 10 | SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) 11 | 12 | # adjust the default behaviour of the FIND_XXX() commands: 13 | # search headers and libraries in the target environment, search 14 | # programs in the host environment 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 18 | --------------------------------------------------------------------------------