44 Commits

Author SHA1 Message Date
275e152523 v2 2023-09-18 21:47:45 +02:00
4ca90e3dfd afl-fuzz 2023-09-18 15:48:40 +02:00
679dfd3343 Fix CNullDriver::removeTexture() segfault
`Textures` is not an one-to-one mapping.
Minetest still crashes with this commit but that's because
it attempts to double-free a texture.
broken by 7298b46504
2023-09-13 15:16:57 +02:00
f9d7a632f5 CI: Add MinGW builds with SDL 2023-09-13 13:26:01 +02:00
dc43583a2c CI: Merge 32- and 64-bit MinGW builds 2023-09-13 13:26:01 +02:00
03fd4ff533 Remove unused IVideoDriver::getTextureByIndex and IVideoDriver::renameTexture
* getTextureByIndex is pretty useless (apart from iterating over all texture,
  which we don't do), as you can't get an id.
* renameTexture is broken anyway: The sort call does nothing because the array
  is still flagged as sorted.
2023-09-13 13:24:08 +02:00
b7292226b4 Remove the unnecessary sort in CNullDriver::addTexture 2023-09-13 13:24:08 +02:00
7298b46504 Use binary search in CNullDriver::removeTexture() 2023-09-13 12:33:50 +02:00
af20d9ff86 Remove deprecated function transformBox 2023-09-05 17:21:35 +02:00
00dd1f8ef3 Remove deprecated functionality of SMaterial 2023-09-05 17:21:35 +02:00
364cb37698 Remove deprecated methods from IVideoDriver 2023-09-05 17:21:35 +02:00
7ce9169d8d Remove deprecated method getOperatingSystemVersion 2023-09-05 17:21:35 +02:00
ebdb2e410b Remove deprecated member functions of IMeshCache 2023-09-05 17:21:35 +02:00
a28b8f9e91 Remove deprecated member functions
Removes deprecated member functions of IMaterialRendererServices.
2023-09-05 17:21:35 +02:00
6cd27d5dca Remove deprecated IImage member functions 2023-09-05 17:21:35 +02:00
04ab99f218 Removes deprecated function getNumber
Removes deprecated function getNumber as well as makes all
line terminators the proper CR LN combo.
2023-09-05 17:21:35 +02:00
d753c8b782 Remove deprecated functions related to FileSystem 2023-09-05 17:21:35 +02:00
6a3ed6428f Remove deprecated getBoneName method 2023-09-05 17:21:35 +02:00
3492fd0d2d Remove primitive types not supported in OpenGL 3+
I removed old primitive types that do not work with modern OpenGL.
2023-09-05 17:21:35 +02:00
c6b06533f3 Deduplicate KP_5 from KP_HOME 2023-09-01 15:54:55 +02:00
e609f5f263 Remove leftovers from D3D 2023-09-01 12:45:56 +02:00
ddecc0fae2 Inline a pointless function 2023-09-01 12:26:43 +02:00
dd3a34d674 Remove unused (I)Timer methods 2023-09-01 12:22:27 +02:00
0735220f86 Suppress a -Wunused-but-set-variable warning 2023-08-29 17:33:25 +02:00
0740d055ac Fix uninitialized memory error in operator- for ustring16 iterators 2023-08-29 17:33:25 +02:00
1d4672bd92 Remove the now unused SMaterialLayer::setFiltersMinetest method 2023-08-24 17:20:54 +02:00
ef3bab610d CIrrDeviceLinux: Fix type for NET_WM_PID XChangeProperty
This uses format=32 which in X11's API means a C type of long (with
restricted range when > 32 bits). pid_t is of unknown type, though on
Linux and FreeBSD it's a 32-bit type, so does not have the same size as
long on 64-bit architectures, and thus XChangeProperty reads outside its
bounds. Fix this by casting to and passing a long.
2023-08-15 20:42:12 +02:00
d98dc90b38 cleanup: only build some files on WIN32 and compile EGL only if needed 2023-08-01 20:53:25 +02:00
c311d01c07 Bump revision 2023-07-20 20:14:50 +02:00
d7f75ae882 gitignore: add vscode cmake extension support 2023-07-20 16:29:09 +02:00
e0d4d7d8b4 cleanup: get rid of the legacy #ifndef #define craziness 2023-07-20 16:29:09 +02:00
fb7a0e4298 2D rendering: Enable bilinear filter for downscaling textures
This looks much better and doesn't have any downsides (e.g. regarding pixel art).
2023-07-16 13:02:48 +02:00
a994c31ccf Expose all OpenGL filtering modes, use OpenGL names for them
Because of a review comment by numberZero.
2023-07-16 13:02:48 +02:00
c40045a40a Rename SMaterial::TextureLayer -> SMaterial::TextureLayers
It's not the "texture layer" of the material, but an array of texture layers.
2023-07-16 13:02:48 +02:00
c0ef1092c0 Rename E_MATERIAL_FLAG -> E_MATERIAL_PROP
The enum values don't reference material flags, but material properties.
2023-07-16 13:02:47 +02:00
5ececc7d29 Split up texture filtering properties of SMaterialLayer into MinFilter and MagFilter
You can now set the filter used when scaling textures down and the filter used when scaling textures up separately.
2023-07-16 13:02:26 +02:00
9e0189019e Refactor the way you set material properties
Instead	of using SMaterial::setFlag, you now set them directly on SMaterial or SMaterialLayer.
2023-07-16 13:02:25 +02:00
b249e4523d Use precise y-direction scroll values in SDL 2023-07-03 22:46:08 +02:00
041377c24c CI: Add MSVC/SDL builds 2023-07-03 21:03:37 +02:00
83699a835d Remove content-less comments 2023-06-15 10:01:34 +02:00
98589d2fd2 Remove unused fixed function materials 2023-06-15 10:01:34 +02:00
8c856408f5 Remove use of std::iterator
(Deprecated in C++17.)
2023-06-14 09:45:16 +02:00
cbc7aeb302 Bump C++ std to 17 2023-06-14 09:45:16 +02:00
09af5ac00d Actually fix Android build 2023-06-06 16:20:06 +02:00
179 changed files with 856 additions and 3782 deletions

View File

@ -137,49 +137,37 @@ jobs:
cd bin/Linux
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
win32:
mingw:
name: "MinGW ${{matrix.config.variant}}${{matrix.config.extras}}"
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
config:
- {variant: win32, arch: i686}
- {variant: win64, arch: x86_64}
- {variant: win32, arch: i686, extras: "-sdl"}
- {variant: win64, arch: x86_64, extras: "-sdl"}
steps:
- uses: actions/checkout@v3
- name: Install compiler
run: |
sudo apt-get update && sudo apt-get install cmake -qyy
wget http://minetest.kitsunemimi.pw/mingw-w64-i686_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
wget http://minetest.kitsunemimi.pw/mingw-w64-${{matrix.config.arch}}_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
sudo tar -xaf mingw.tar.xz -C /usr
- name: Build
run: |
./scripts/ci-build-mingw.sh package
env:
CC: i686-w64-mingw32-gcc
CXX: i686-w64-mingw32-g++
CC: ${{matrix.config.arch}}-w64-mingw32-gcc
CXX: ${{matrix.config.arch}}-w64-mingw32-g++
extras: ${{matrix.config.extras}}
- uses: actions/upload-artifact@v3
with:
name: irrlicht-win32
path: ./irrlicht-win32.zip
win64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install compiler
run: |
sudo apt-get update && sudo apt-get install cmake -qyy
wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_11.2.0_ubuntu20.04.tar.xz -O mingw.tar.xz
sudo tar -xaf mingw.tar.xz -C /usr
- name: Build
run: |
./scripts/ci-build-mingw.sh package
env:
CC: x86_64-w64-mingw32-gcc
CXX: x86_64-w64-mingw32-g++
- uses: actions/upload-artifact@v3
with:
name: irrlicht-win64
path: ./irrlicht-win64.zip
name: irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}
path: ./irrlicht-${{matrix.config.variant}}${{matrix.config.extras}}.zip
macos:
runs-on: macos-latest
@ -200,7 +188,7 @@ jobs:
./bin/OSX/AutomatedTest null
msvc:
name: VS 2019 ${{ matrix.config.arch }}
name: VS 2019 ${{ matrix.config.arch }} ${{ matrix.sdl.label }}
runs-on: windows-2019
env:
VCPKG_VERSION: 14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44
@ -218,6 +206,14 @@ jobs:
arch: x64
generator: "-G'Visual Studio 16 2019' -A x64"
vcpkg_triplet: x64-windows
sdl:
-
use: FALSE
label: '(no SDL)'
-
use: TRUE
label: '(with SDL)'
vcpkg_packages: sdl2
steps:
- name: Checkout
@ -226,7 +222,7 @@ jobs:
- name: Restore from cache and run vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: ${{env.vcpkg_packages}}
vcpkgArguments: ${{env.vcpkg_packages}} ${{matrix.sdl.vcpkg_packages}}
vcpkgDirectory: '${{ github.workspace }}\vcpkg'
appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
@ -235,6 +231,7 @@ jobs:
- name: CMake
run: |
cmake ${{matrix.config.generator}} `
-DUSE_SDL2=${{matrix.sdl.use}} `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-DCMAKE_BUILD_TYPE=Release .

3
.gitignore vendored
View File

@ -19,3 +19,6 @@ scripts/glext.h
*.dir/
*.sln
*visualstudio/
# vscode cmake plugin
build/*

View File

@ -7,7 +7,7 @@ else()
cmake_policy(VERSION 3.11)
endif()
set(IRRLICHTMT_REVISION 11)
set(IRRLICHTMT_REVISION 12)
project(Irrlicht
VERSION 1.9.0.${IRRLICHTMT_REVISION}

27
build.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash -e
args=(-DBUILD_EXAMPLES=ON -DENABLE_OPENGL=OFF -DBUILD_SHARED_LIBS=OFF)
export CC=afl-clang-fast
export CXX=afl-clang-fast++
export LD=$CXX
unset AFL_USE_ASAN
if ! grep -Fq '/afl-' build2/CMakeCache.txt; then
rm -rf build2
cmake -S . -B build2 "${args[@]}"
fi
nice make -C build2 clean
nice make -C build2 -j10
for f in build2/bin/Linux/*; do
ln -snfv "../../$f" "bin/Linux/${f##*/}_noasan"
done
export CC=afl-clang-lto
export CXX=afl-clang-lto++
export LD=$CXX
export AFL_USE_ASAN=1
if ! grep -Fq '/afl-' CMakeCache.txt; then
rm -f CMakeCache.txt
cmake . "${args[@]}"
fi
nice make clean
nice make -j10

View File

@ -100,10 +100,12 @@ int main(int argc, char *argv[])
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
if (node)
{
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->forEachMaterial([tex] (video::SMaterial &mat) {
mat.Lighting = false;
mat.setTexture(0, tex);
});
node->setFrameLoop(0, 29);
node->setAnimationSpeed(30);
node->setMaterialTexture(0, tex);
}
}

View File

@ -1,10 +1,11 @@
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(IRREXAMPLES
# removed
LoadTexture
LoadMesh
)
if(UNIX)
if(FALSE)
list(APPEND IRREXAMPLES AutomatedTest)
endif()

View File

@ -0,0 +1,44 @@
#include <irrlicht.h>
#include <iostream>
using namespace irr;
int main(int argc, char *argv[])
{
if (argc < 2)
return 1;
SIrrlichtCreationParameters p;
p.DriverType = video::EDT_NULL;
p.WindowSize = core::dimension2du(640, 480);
p.LoggingLevel = ELL_DEBUG;
auto *device = createDeviceEx(p);
if (!device)
return 1;
auto *smgr = device->getSceneManager();
while (__AFL_LOOP(10000)) {
auto *mfile = device->getFileSystem()->createAndOpenFile(argv[1]);
if (!mfile)
continue;
scene::IAnimatedMesh *mesh;
// Irrlicht matches on file extension so we have to do this by hand
for (u32 i = 0; i < smgr->getMeshLoaderCount(); i++) {
mfile->seek(0);
mesh = smgr->getMeshLoader(i)->createMesh(mfile);
if (mesh) {
core::stringc msg("Loaded using loader #");
msg += core::stringc(i);
device->getLogger()->log(msg.c_str(), ELL_DEBUG);
break;
}
}
if (mesh)
mesh->drop();
mfile->drop();
}
device->drop();
return 0;
}

View File

@ -0,0 +1,29 @@
#include <irrlicht.h>
#include <iostream>
using namespace irr;
int main(int argc, char *argv[])
{
if (argc < 2)
return 1;
SIrrlichtCreationParameters p;
p.DriverType = video::EDT_NULL;
p.WindowSize = core::dimension2du(640, 480);
p.LoggingLevel = ELL_DEBUG;
auto *device = createDeviceEx(p);
if (!device)
return 1;
auto *driver = device->getVideoDriver();
while (__AFL_LOOP(10000)) {
auto *tex = driver->getTexture(argv[1]);
if (tex)
driver->removeTexture(tex);
}
device->drop();
return 0;
}

View File

@ -28,9 +28,6 @@ namespace scene
//! Overlays Mesh Wireframe
EDS_MESH_WIRE_OVERLAY = 8,
//! Temporary use transparency Material Type
EDS_HALF_TRANSPARENCY = 16,
//! Show Bounding Boxes of all MeshBuffers
EDS_BBOX_BUFFERS = 32,

View File

@ -20,13 +20,6 @@ namespace video
render and display any graphics. */
EDT_NULL,
// obsolete constants to make some code happy
// TODO delete
EDT_SOFTWARE,
EDT_BURNINGSVIDEO,
DEPRECATED_EDT_DIRECT3D8_NO_LONGER_EXISTS,
EDT_DIRECT3D9,
//! OpenGL device, available on most platforms.
/** Performs hardware accelerated rendering of 3D and 2D
primitives. */

View File

@ -1,101 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_MATERIAL_FLAGS_H_INCLUDED__
#define __E_MATERIAL_FLAGS_H_INCLUDED__
namespace irr
{
namespace video
{
//! Material flags
enum E_MATERIAL_FLAG
{
//! Draw as wireframe or filled triangles? Default: false
EMF_WIREFRAME = 0x1,
//! Draw as point cloud or filled triangles? Default: false
EMF_POINTCLOUD = 0x2,
//! Flat or Gouraud shading? Default: true
EMF_GOURAUD_SHADING = 0x4,
//! Will this material be lighted? Default: true
EMF_LIGHTING = 0x8,
//! Is the ZBuffer enabled? Default: true
EMF_ZBUFFER = 0x10,
//! May be written to the zbuffer or is it readonly. Default: true
/** This flag is ignored, if the material type is a transparent type. */
EMF_ZWRITE_ENABLE = 0x20,
//! Is backface culling enabled? Default: true
EMF_BACK_FACE_CULLING = 0x40,
//! Is frontface culling enabled? Default: false
/** Overrides EMF_BACK_FACE_CULLING if both are enabled. */
EMF_FRONT_FACE_CULLING = 0x80,
//! Is bilinear filtering enabled? Default: true
EMF_BILINEAR_FILTER = 0x100,
//! Is trilinear filtering enabled? Default: false
/** If the trilinear filter flag is enabled,
the bilinear filtering flag is ignored. */
EMF_TRILINEAR_FILTER = 0x200,
//! Is anisotropic filtering? Default: false
/** In Irrlicht you can use anisotropic texture filtering in
conjunction with bilinear or trilinear texture filtering
to improve rendering results. Primitives will look less
blurry with this flag switched on. */
EMF_ANISOTROPIC_FILTER = 0x400,
//! Is fog enabled? Default: false
EMF_FOG_ENABLE = 0x800,
//! Normalizes normals. Default: false
/** You can enable this if you need to scale a dynamic lighted
model. Usually, its normals will get scaled too then and it
will get darker. If you enable the EMF_NORMALIZE_NORMALS flag,
the normals will be normalized again, and the model will look
as bright as it should. */
EMF_NORMALIZE_NORMALS = 0x1000,
//! Access to all layers texture wrap settings. Overwrites separate layer settings.
/** Note that if you want to change TextureWrapU, TextureWrapV, TextureWrapW
independently, then you can't work with this flag, but will have to set the variables
directly. */
EMF_TEXTURE_WRAP = 0x2000,
//! AntiAliasing mode
EMF_ANTI_ALIASING = 0x4000,
//! ColorMask bits, for enabling the color planes
EMF_COLOR_MASK = 0x8000,
//! ColorMaterial enum for vertex color interpretation
EMF_COLOR_MATERIAL = 0x10000,
//! Flag for enabling/disabling mipmap usage
EMF_USE_MIP_MAPS = 0x20000,
//! Flag for blend operation
EMF_BLEND_OPERATION = 0x40000,
//! Flag for polygon offset
EMF_POLYGON_OFFSET = 0x80000,
//! Flag for blend factor
EMF_BLEND_FACTOR = 0x160000
};
} // end namespace video
} // end namespace irr
#endif // __E_MATERIAL_FLAGS_H_INCLUDED__

87
include/EMaterialProps.h Normal file
View File

@ -0,0 +1,87 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_MATERIAL_PROPS_H_INCLUDED__
#define __E_MATERIAL_PROPS_H_INCLUDED__
namespace irr
{
namespace video
{
//! Material properties
enum E_MATERIAL_PROP
{
//! Corresponds to SMaterial::Wireframe.
EMP_WIREFRAME = 0x1,
//! Corresponds to SMaterial::PointCloud.
EMP_POINTCLOUD = 0x2,
//! Corresponds to SMaterial::GouraudShading.
EMP_GOURAUD_SHADING = 0x4,
//! Corresponds to SMaterial::Lighting.
EMP_LIGHTING = 0x8,
//! Corresponds to SMaterial::ZBuffer.
EMP_ZBUFFER = 0x10,
//! Corresponds to SMaterial::ZWriteEnable.
EMP_ZWRITE_ENABLE = 0x20,
//! Corresponds to SMaterial::BackfaceCulling.
EMP_BACK_FACE_CULLING = 0x40,
//! Corresponds to SMaterial::FrontfaceCulling.
EMP_FRONT_FACE_CULLING = 0x80,
//! Corresponds to SMaterialLayer::MinFilter.
EMP_MIN_FILTER = 0x100,
//! Corresponds to SMaterialLayer::MagFilter.
EMP_MAG_FILTER = 0x200,
//! Corresponds to SMaterialLayer::AnisotropicFilter.
EMP_ANISOTROPIC_FILTER = 0x400,
//! Corresponds to SMaterial::FogEnable.
EMP_FOG_ENABLE = 0x800,
//! Corresponds to SMaterial::NormalizeNormals.
EMP_NORMALIZE_NORMALS = 0x1000,
//! Corresponds to SMaterialLayer::TextureWrapU, TextureWrapV and
//! TextureWrapW.
EMP_TEXTURE_WRAP = 0x2000,
//! Corresponds to SMaterial::AntiAliasing.
EMP_ANTI_ALIASING = 0x4000,
//! Corresponds to SMaterial::ColorMask.
EMP_COLOR_MASK = 0x8000,
//! Corresponds to SMaterial::ColorMaterial.
EMP_COLOR_MATERIAL = 0x10000,
//! Corresponds to SMaterial::UseMipMaps.
EMP_USE_MIP_MAPS = 0x20000,
//! Corresponds to SMaterial::BlendOperation.
EMP_BLEND_OPERATION = 0x40000,
//! Corresponds to SMaterial::PolygonOffsetFactor, PolygonOffsetDirection,
//! PolygonOffsetDepthBias and PolygonOffsetSlopeScale.
EMP_POLYGON_OFFSET = 0x80000,
//! Corresponds to SMaterial::BlendFactor.
EMP_BLEND_FACTOR = 0x100000,
};
} // end namespace video
} // end namespace irr
#endif // __E_MATERIAL_PROPS_H_INCLUDED__

View File

@ -18,75 +18,6 @@ namespace video
diffuse material. */
EMT_SOLID = 0,
//! Solid material with 2 texture layers.
/** The second is blended onto the first using the alpha value
of the vertex colors. This material is currently not implemented in OpenGL.
*/
EMT_SOLID_2_LAYER,
//! Material type with standard lightmap technique
/** There should be 2 textures: The first texture layer is a
diffuse map, the second is a light map. Dynamic light is
ignored. */
EMT_LIGHTMAP,
//! Material type with lightmap technique like EMT_LIGHTMAP.
/** But lightmap and diffuse texture are added instead of modulated. */
EMT_LIGHTMAP_ADD,
//! Material type with standard lightmap technique
/** There should be 2 textures: The first texture layer is a
diffuse map, the second is a light map. Dynamic light is
ignored. The texture colors are effectively multiplied by 2
for brightening. Like known in DirectX as D3DTOP_MODULATE2X. */
EMT_LIGHTMAP_M2,
//! Material type with standard lightmap technique
/** There should be 2 textures: The first texture layer is a
diffuse map, the second is a light map. Dynamic light is
ignored. The texture colors are effectively multiplied by 4
for brightening. Like known in DirectX as D3DTOP_MODULATE4X. */
EMT_LIGHTMAP_M4,
//! Like EMT_LIGHTMAP, but also supports dynamic lighting.
EMT_LIGHTMAP_LIGHTING,
//! Like EMT_LIGHTMAP_M2, but also supports dynamic lighting.
EMT_LIGHTMAP_LIGHTING_M2,
//! Like EMT_LIGHTMAP_M4, but also supports dynamic lighting.
EMT_LIGHTMAP_LIGHTING_M4,
//! Detail mapped material.
/** The first texture is diffuse color map, the second is added
to this and usually displayed with a bigger scale value so that
it adds more detail. The detail map is added to the diffuse map
using ADD_SIGNED, so that it is possible to add and subtract
color from the diffuse map. For example a value of
(127,127,127) will not change the appearance of the diffuse map
at all. Often used for terrain rendering. */
EMT_DETAIL_MAP,
//! Look like a reflection of the environment around it.
/** To make this possible, a texture called 'sphere map' is
used, which must be set as the first texture. */
EMT_SPHERE_MAP,
//! A reflecting material with an optional non reflecting texture layer.
/** The reflection map should be set as first texture. */
EMT_REFLECTION_2_LAYER,
//! A transparent material.
/** Only the first texture is used. The new color is calculated
by simply adding the source color and the dest color. This
means if for example a billboard using a texture with black
background and a red circle on it is drawn with this material,
the result is that only the red circle will be drawn a little
bit transparent, and everything which was black is 100%
transparent and not visible. This material type is useful for
particle effects. */
EMT_TRANSPARENT_ADD_COLOR,
//! Makes the material transparent based on the texture alpha channel.
/** The final color is blended together from the destination
color and the texture color, using the alpha channel value as
@ -115,12 +46,6 @@ namespace video
//! Makes the material transparent based on the vertex alpha value.
EMT_TRANSPARENT_VERTEX_ALPHA,
//! A transparent reflecting material with an optional additional non reflecting texture layer.
/** The reflection map should be set as first texture. The
transparency depends on the alpha value in the vertex colors. A
texture which will not reflect can be set as second texture.*/
EMT_TRANSPARENT_REFLECTION_2_LAYER,
//! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
/** Using only first texture. Generic blending method.
The blend function is set to SMaterial::MaterialTypeParam with
@ -135,22 +60,9 @@ namespace video
const char* const sBuiltInMaterialTypeNames[] =
{
"solid",
"solid_2layer",
"lightmap",
"lightmap_add",
"lightmap_m2",
"lightmap_m4",
"lightmap_light",
"lightmap_light_m2",
"lightmap_light_m4",
"detail_map",
"sphere_map",
"reflection_2layer",
"trans_add",
"trans_alphach",
"trans_alphach_ref",
"trans_vertex_alpha",
"trans_reflection_2layer",
"onetexture_blend",
0
};

View File

@ -36,20 +36,6 @@ namespace scene
//! Explicitly set all vertices for each triangle.
EPT_TRIANGLES,
//! After the first two vertices each further two vertices create a quad with the preceding two.
//! Not supported by Direct3D
EPT_QUAD_STRIP,
//! Every four vertices create a quad.
//! Not supported by Direct3D
//! Deprecated with newer OpenGL drivers
EPT_QUADS,
//! Just as LINE_LOOP, but filled.
//! Not supported by Direct3D
//! Deprecated with newer OpenGL drivers
EPT_POLYGON,
//! The single vertices are expanded to quad billboards on the GPU.
EPT_POINT_SPRITES
};

View File

@ -59,10 +59,6 @@ namespace scene
IBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1) :
ISceneNode(parent, mgr, id),positionHint(-1),scaleHint(-1),rotationHint(-1) { }
//! Get the name of the bone
/** \deprecated Use getName instead. This method may be removed by Irrlicht 1.9 */
_IRR_DEPRECATED_ virtual const c8* getBoneName() const { return getName(); }
//! Get the index of the bone
virtual u32 getBoneIndex() const = 0;

View File

@ -210,58 +210,6 @@ public:
\return A pointer to the specified loader, 0 if the index is incorrect. */
virtual IArchiveLoader* getArchiveLoader(u32 index) const = 0;
//! Adds a zip archive to the file system.
/** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in Irrlicht 1.9,
you should use addFileArchive instead.
After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake3 .pk3 files, which are no different than .zip files.
\param filename: Filename of the zip archive to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.
\return True if the archive was added successfully, false if not. */
_IRR_DEPRECATED_ virtual bool addZipFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
{
return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_ZIP);
}
//! Adds an unzipped archive (or basedirectory with subdirectories..) to the file system.
/** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in Irrlicht 1.9,
you should use addFileArchive instead.
Useful for handling data which will be in a zip file
\param filename: Filename of the unzipped zip archive base directory to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.
\return True if the archive was added successful, false if not. */
_IRR_DEPRECATED_ virtual bool addFolderFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
{
return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_FOLDER);
}
//! Adds a pak archive to the file system.
/** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in Irrlicht 1.9,
you should use addFileArchive instead.
After calling this, the Irrlicht Engine will search and open files directly from this archive too.
This is useful for hiding data from the end user, speeding up file access and making it possible to
access for example Quake2/KingPin/Hexen2 .pak files
\param filename: Filename of the pak archive to add to the file system.
\param ignoreCase: If set to true, files in the archive can be accessed without
writing all letters in the right case.
\param ignorePaths: If set to true, files in the added archive can be accessed
without its complete path.(should not use with Quake2 paks
\return True if the archive was added successful, false if not. */
_IRR_DEPRECATED_ virtual bool addPakFileArchive(const c8* filename, bool ignoreCase=true, bool ignorePaths=true)
{
return addFileArchive(filename, ignoreCase, ignorePaths, EFAT_PAK);
}
//! Get the current working directory.
/** \return Current working directory as a string. */
virtual const path& getWorkingDirectory() =0;

View File

@ -41,12 +41,12 @@ namespace gui
//! Insert an existing tab
/** Note that it will also add the tab as a child of this TabControl.
\param idx Index at which tab will be inserted. Later tabs will be moved.
Previous active tab will stay active unless this is the first
\param idx Index at which tab will be inserted. Later tabs will be moved.
Previous active tab will stay active unless this is the first
element to be inserted in which case it becomes active.
\param tab New tab to insert.
\param serializationMode Internally used for serialization. You should not need this.
When true it reserves space for the index, doesn't move but replaces tabs
When true it reserves space for the index, doesn't move but replaces tabs
and it doesn't change the active tab.
\return Index of added tab (should be same as the one passed) or -1 for failure*/
virtual s32 insertTab(s32 idx, IGUITab* tab, bool serializationMode=false) = 0;
@ -67,8 +67,8 @@ namespace gui
virtual IGUITab* getTab(s32 idx) const = 0;
//! For given element find if it's a tab and return it's zero-based index (or -1 for not found)
/** \param tab Tab for which we are looking (usually you will look for an IGUITab* type as only
those can be tabs, but we allow looking for any kind of IGUIElement* as there are some
/** \param tab Tab for which we are looking (usually you will look for an IGUITab* type as only
those can be tabs, but we allow looking for any kind of IGUIElement* as there are some
use-cases for that even if it just returns 0. For example this way you can check for
all children of this gui-element if they are tabs or some non-tab children.*/
virtual s32 getTabIndex(const IGUIElement *tab) const = 0;
@ -129,15 +129,6 @@ namespace gui
IGUITab(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(EGUIET_TAB, environment, parent, id, rectangle) {}
//! Returns zero based index of tab if in tabcontrol.
/** \deprecated Deprecated in 1.9, use IGUITabControl::getTabIndex instead*/
_IRR_DEPRECATED_ virtual s32 getNumber() const
{
if (Parent && Parent->getType() == EGUIET_TAB_CONTROL)
return static_cast<IGUITabControl*>(Parent)->getTabIndex(this);
return -1;
}
//! sets if the tab should draw its background
virtual void setDrawBackground(bool draw=true) = 0;

View File

@ -183,24 +183,6 @@ public:
return Data;
}
//! Lock function. Use this to get a pointer to the image data.
/** Use getData instead.
\return Pointer to the image data. What type of data is pointed to
depends on the color format of the image. For example if the color
format is ECF_A8R8G8B8, it is of u32. Be sure to call unlock() after
you don't need the pointer any more. */
_IRR_DEPRECATED_ void* lock()
{
return getData();
}
//! Unlock function.
/** Should be called after the pointer received by lock() is not
needed anymore. */
_IRR_DEPRECATED_ void unlock()
{
}
//! Get the mipmap size for this image for a certain mipmap level
/** level 0 will be full image size. Every further level is half the size.
Doesn't care if the image actually has mipmaps, just which size would be needed. */
@ -367,19 +349,6 @@ public:
//! fills the surface with given color
virtual void fill(const SColor &color) =0;
//! Inform whether the image is compressed
_IRR_DEPRECATED_ bool isCompressed() const
{
return IImage::isCompressedFormat(Format);
}
//! Check whether the image has MipMaps
/** \return True if image has MipMaps, else false. */
_IRR_DEPRECATED_ bool hasMipMaps() const
{
return (getMipMapsData() != 0);
}
//! get the amount of Bits per Pixel of the given color format
static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
{

View File

@ -115,30 +115,6 @@ public:
\param constantAmount Amount of registers to be set. One register consists of 4 floats. */
virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1) = 0;
//! \deprecated. This method may be removed by Irrlicht 2.0
_IRR_DEPRECATED_ bool setVertexShaderConstant(const c8* name, const f32* floats, int count)
{
return setVertexShaderConstant(getVertexShaderConstantID(name), floats, count);
}
//! \deprecated. This method may be removed by Irrlicht 2.0
_IRR_DEPRECATED_ bool setVertexShaderConstant(const c8* name, const s32* ints, int count)
{
return setVertexShaderConstant(getVertexShaderConstantID(name), ints, count);
}
//! \deprecated. This method may be removed by Irrlicht 2.0
_IRR_DEPRECATED_ bool setPixelShaderConstant(const c8* name, const f32* floats, int count)
{
return setPixelShaderConstant(getPixelShaderConstantID(name), floats, count);
}
//! \deprecated. This method may be removed by Irrlicht 2.0
_IRR_DEPRECATED_ bool setPixelShaderConstant(const c8* name, const s32* ints, int count)
{
return setPixelShaderConstant(getPixelShaderConstantID(name), ints, count);
}
//! Get pointer to the IVideoDriver interface
/** \return Pointer to the IVideoDriver interface */
virtual IVideoDriver* getVideoDriver() = 0;

View File

@ -97,11 +97,6 @@ namespace scene
/** \param box New bounding box to use for the mesh. */
virtual void setBoundingBox( const core::aabbox3df& box) = 0;
//! Sets a flag of all contained materials to a new value.
/** \param flag: Flag to set in all materials.
\param newvalue: New value to set in all materials. */
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) = 0;
//! Set the hardware mapping hint
/** This methods allows to define optimization hints for the
hardware. This enables, e.g., the use of hardware buffers on

View File

@ -172,9 +172,6 @@ namespace scene
case scene::EPT_TRIANGLE_STRIP: return (indexCount-2);
case scene::EPT_TRIANGLE_FAN: return (indexCount-2);
case scene::EPT_TRIANGLES: return indexCount/3;
case scene::EPT_QUAD_STRIP: return (indexCount-2)/2;
case scene::EPT_QUADS: return indexCount/4;
case scene::EPT_POLYGON: return indexCount; // (not really primitives, that would be 1, works like line_strip)
case scene::EPT_POINT_SPRITES: return indexCount;
}
return 0;

View File

@ -78,46 +78,6 @@ namespace scene
number. */
virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0;
//! Returns a mesh based on its name (often a filename).
/** \deprecated Use getMeshByName() instead. This method may be removed by
Irrlicht 1.9 */
_IRR_DEPRECATED_ IAnimatedMesh* getMeshByFilename(const io::path& filename)
{
return getMeshByName(filename);
}
//! Get the name of a loaded mesh, based on its index. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. This method may be removed by
Irrlicht 1.9 */
_IRR_DEPRECATED_ const io::path& getMeshFilename(u32 index) const
{
return getMeshName(index).getInternalName();
}
//! Get the name of a loaded mesh, if there is any. (Name is often identical to the filename).
/** \deprecated Use getMeshName() instead. This method may be removed by
Irrlicht 1.9 */
_IRR_DEPRECATED_ const io::path& getMeshFilename(const IMesh* const mesh) const
{
return getMeshName(mesh).getInternalName();
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. This method may be removed by
Irrlicht 1.9 */
_IRR_DEPRECATED_ bool setMeshFilename(u32 index, const io::path& filename)
{
return renameMesh(index, filename);
}
//! Renames a loaded mesh.
/** \deprecated Use renameMesh() instead. This method may be removed by
Irrlicht 1.9 */
_IRR_DEPRECATED_ bool setMeshFilename(const IMesh* const mesh, const io::path& filename)
{
return renameMesh(mesh, filename);
}
//! Returns a mesh based on its name.
/** \param name Name of the mesh. Usually a filename.
\return Pointer to the mesh or 0 if there is none with this number. */

View File

@ -18,13 +18,6 @@ public:
//! Get the current operation system version as string.
virtual const core::stringc& getOperatingSystemVersion() const = 0;
//! Get the current operation system version as string.
/** \deprecated Use getOperatingSystemVersion instead. This method will be removed in Irrlicht 1.9. */
_IRR_DEPRECATED_ const wchar_t* getOperationSystemVersion() const
{
return core::stringw(getOperatingSystemVersion()).c_str();
}
//! Copies text to the clipboard
//! \param text: text in utf-8
virtual void copyToClipboard(const c8* text) const = 0;

View File

@ -352,38 +352,14 @@ namespace scene
}
//! Sets all material flags at once to a new value.
/** Useful, for example, if you want the whole mesh to be
affected by light.
\param flag Which flag of all materials to be set.
\param newvalue New value of that flag. */
void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{
for (u32 i=0; i<getMaterialCount(); ++i)
getMaterial(i).setFlag(flag, newvalue);
}
//! Sets the texture of the specified layer in all materials of this scene node to the new texture.
/** \param textureLayer Layer of texture to be set. Must be a
value smaller than MATERIAL_MAX_TEXTURES.
\param texture New texture to be used. */
void setMaterialTexture(u32 textureLayer, video::ITexture* texture)
{
if (textureLayer >= video::MATERIAL_MAX_TEXTURES)
return;
for (u32 i=0; i<getMaterialCount(); ++i)
getMaterial(i).setTexture(textureLayer, texture);
}
//! Sets the material type of all materials in this scene node to a new material type.
/** \param newType New type of material to be set. */
void setMaterialType(video::E_MATERIAL_TYPE newType)
{
for (u32 i=0; i<getMaterialCount(); ++i)
getMaterial(i).MaterialType = newType;
//! Execute a function on all materials of this scene node.
/** Useful for setting material properties, e.g. if you want the whole
mesh to be affected by light. */
template <typename F>
void forEachMaterial(F &&fn) {
for (u32 i = 0; i < getMaterialCount(); i++) {
fn(getMaterial(i));
}
}

View File

@ -97,14 +97,6 @@ enum E_TEXTURE_CREATION_FLAG
*/
ETCF_AUTO_GENERATE_MIP_MAPS = 0x00000100,
//! Enable support for vertex shader texture sampling on some drivers
/** Default is false.
This adds a small costs to all texture switches.
Currently only affects D3D9.
On OpenGL vertex shaders use the same texture unit as pixel shaders, so support there only depends on GL version and not on this flag
*/
ETCF_SUPPORT_VERTEXT_TEXTURE = 0x00000200,
/** This flag is never used, it only forces the compiler to compile
these enumeration values to 32 bit. */
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff

View File

@ -21,41 +21,6 @@ public:
*/
virtual u32 getRealTime() const = 0;
enum EWeekday
{
EWD_SUNDAY=0,
EWD_MONDAY,
EWD_TUESDAY,
EWD_WEDNESDAY,
EWD_THURSDAY,
EWD_FRIDAY,
EWD_SATURDAY
};
struct RealTimeDate
{
// Hour of the day, from 0 to 23
u32 Hour;
// Minute of the hour, from 0 to 59
u32 Minute;
// Second of the minute, due to extra seconds from 0 to 61
u32 Second;
// Year of the Gregorian calender
s32 Year;
// Month of the year, from 1 to 12
u32 Month;
// Day of the month, from 1 to 31
u32 Day;
// Weekday for the current day
EWeekday Weekday;
// Day of the year, from 1 to 366
u32 Yearday;
// Whether daylight saving is on
bool IsDST;
};
virtual RealTimeDate getRealTimeAndDate() const = 0;
//! Returns current virtual time in milliseconds.
/** This value starts with 0 and can be manipulated using setTime(),
stopTimer(), startTimer(), etc. This value depends on the set speed of

View File

@ -265,24 +265,10 @@ namespace video
IReferenceCounted::drop() for more information. */
virtual ITexture* getTexture(io::IReadFile* file) =0;
//! Returns a texture by index
/** \param index: Index of the texture, must be smaller than
getTextureCount() Please note that this index might change when
adding or removing textures
\return Pointer to the texture, or 0 if the texture was not
set or index is out of bounds. This pointer should not be
dropped. See IReferenceCounted::drop() for more information. */
virtual ITexture* getTextureByIndex(u32 index) =0;
//! Returns amount of textures currently loaded
/** \return Amount of textures currently loaded */
virtual u32 getTextureCount() const = 0;
//! Renames a texture
/** \param texture Pointer to the texture to rename.
\param newName New name for the texture. This should be a unique name. */
virtual void renameTexture(ITexture* texture, const io::path& newName) = 0;
//! Creates an empty texture of specified size.
/** \param size: Size of the texture.
\param name A name for the texture. Later calls to
@ -297,24 +283,6 @@ namespace video
virtual ITexture* addTexture(const core::dimension2d<u32>& size,
const io::path& name, ECOLOR_FORMAT format = ECF_A8R8G8B8) = 0;
//! Creates a texture from an IImage.
/** \param name A name for the texture. Later calls of
getTexture() with this name will return this texture.
The name can _not_ be empty.
\param image Image the texture is created from.
\param mipmapData Optional pointer to a mipmaps data.
If this parameter is not given, the mipmaps are derived from image.
\return Pointer to the newly created texture. This pointer
should not be dropped. See IReferenceCounted::drop() for more
information. */
_IRR_DEPRECATED_ ITexture* addTexture(const io::path& name, IImage* image, void* mipmapData)
{
if (image)
image->setMipMapsData(mipmapData, false);
return addTexture(name, image);
}
//! Creates a texture from an IImage.
/** \param name A name for the texture. Later calls of
getTexture() with this name will return this texture.
@ -366,8 +334,7 @@ namespace video
const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
//! Adds a new render target texture with 6 sides for a cubemap map to the texture cache.
/** NOTE: Only supported on D3D9 so far.
\param sideLen Length of one cubemap side.
/** \param sideLen Length of one cubemap side.
\param name A name for the texture. Later calls of getTexture() with this name will return this texture.
The name can _not_ be empty.
\param format The color format of the render target. Floating point formats are supported.
@ -459,15 +426,9 @@ namespace video
color values may not be exactly the same in the engine and for
example in picture edit programs. To avoid this problem, you
could use the makeColorKeyTexture method, which takes the
position of a pixel instead a color value.
\param zeroTexels (deprecated) If set to true, then any texels that match
the color key will have their color, as well as their alpha, set to zero
(i.e. black). This behavior matches the legacy (buggy) behavior prior
to release 1.5 and is provided for backwards compatibility only.
This parameter may be removed by Irrlicht 1.9. */
position of a pixel instead a color value. */
virtual void makeColorKeyTexture(video::ITexture* texture,
video::SColor color,
bool zeroTexels = false) const =0;
video::SColor color) const =0;
//! Sets a boolean alpha channel on the texture based on the color at a position.
/** This makes the texture fully transparent at the texels where
@ -476,15 +437,9 @@ namespace video
\param texture Texture whose alpha channel is modified.
\param colorKeyPixelPos Position of a pixel with the color key
color. Every texel with this color will become fully transparent as
described above.
\param zeroTexels (deprecated) If set to true, then any texels that match
the color key will have their color, as well as their alpha, set to zero
(i.e. black). This behavior matches the legacy (buggy) behavior prior
to release 1.5 and is provided for backwards compatibility only.
This parameter may be removed by Irrlicht 1.9. */
described above. */
virtual void makeColorKeyTexture(video::ITexture* texture,
core::position2d<s32> colorKeyPixelPos,
bool zeroTexels = false) const =0;
core::position2d<s32> colorKeyPixelPos) const =0;
//! Set a render target.
/** This will only work if the driver supports the
@ -1032,27 +987,6 @@ namespace video
See IReferenceCounted::drop() for more information. */
virtual IImage* createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) =0;
//! Creates a software image by converting it to given format from another image.
/** \deprecated Create an empty image and use copyTo(). This method may be removed by Irrlicht 1.9.
\param format Desired color format of the image.
\param imageToCopy Image to copy to the new image.
\return The created image.
If you no longer need the image, you should call IImage::drop().
See IReferenceCounted::drop() for more information. */
_IRR_DEPRECATED_ virtual IImage* createImage(ECOLOR_FORMAT format, IImage *imageToCopy) =0;
//! Creates a software image from a part of another image.
/** \deprecated Create an empty image and use copyTo(). This method may be removed by Irrlicht 1.9.
\param imageToCopy Image to copy to the new image in part.
\param pos Position of rectangle to copy.
\param size Extents of rectangle to copy.
\return The created image.
If you no longer need the image, you should call IImage::drop().
See IReferenceCounted::drop() for more information. */
_IRR_DEPRECATED_ virtual IImage* createImage(IImage* imageToCopy,
const core::position2d<s32>& pos,
const core::dimension2d<u32>& size) =0;
//! Creates a software image from a part of a texture.
/**
\param texture Texture to copy to the new image in part.
@ -1156,23 +1090,6 @@ namespace video
//! Clear the color, depth and/or stencil buffers.
virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) = 0;
//! Clear the color, depth and/or stencil buffers.
_IRR_DEPRECATED_ void clearBuffers(bool backBuffer, bool depthBuffer, bool stencilBuffer, SColor color)
{
u16 flag = 0;
if (backBuffer)
flag |= ECBF_COLOR;
if (depthBuffer)
flag |= ECBF_DEPTH;
if (stencilBuffer)
flag |= ECBF_STENCIL;
clearBuffers(flag, color);
}
//! Clears the ZBuffer.
/** Note that you usually need not to call this method, as it
is automatically done in IVideoDriver::beginScene() or

View File

@ -6,8 +6,8 @@
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
//! Identifies the IrrlichtMt fork customized for the Minetest engine
#define IRRLICHT_VERSION_MT_REVISION 11
#define IRRLICHT_VERSION_MT "mt11"
#define IRRLICHT_VERSION_MT_REVISION 12
#define IRRLICHT_VERSION_MT "mt12"
//! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1

View File

@ -147,13 +147,6 @@ namespace scene
return Meshes[0]->getMeshBuffer(material);
}
//! Set a material flag for all meshbuffers of this mesh.
void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) override
{
for (u32 i=0; i<Meshes.size(); ++i)
Meshes[i]->setMaterialFlag(flag, newvalue);
}
//! set the hardware mapping hint, for driver
void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) override
{

View File

@ -5,12 +5,6 @@
#ifndef __S_EXPOSED_VIDEO_DATA_H_INCLUDED__
#define __S_EXPOSED_VIDEO_DATA_H_INCLUDED__
// forward declarations for internal pointers
struct IDirect3D9;
struct IDirect3DDevice9;
struct IDirect3D8;
struct IDirect3DDevice8;
namespace irr
{
namespace video
@ -27,19 +21,6 @@ struct SExposedVideoData
SExposedVideoData() {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=0;}
explicit SExposedVideoData(void* Window) {OpenGLWin32.HDc=0; OpenGLWin32.HRc=0; OpenGLWin32.HWnd=Window;}
struct SD3D9
{
//! Pointer to the IDirect3D9 interface
IDirect3D9* D3D9;
//! Pointer to the IDirect3DDevice9 interface
IDirect3DDevice9* D3DDev9;
//! Window handle.
/** Get with for example HWND h = reinterpret_cast<HWND>(exposedData.D3D9.HWnd) */
void* HWnd;
};
struct SOpenGLWin32
{
//! Private GDI Device Context.
@ -87,7 +68,6 @@ struct SExposedVideoData
union
{
SD3D9 D3D9;
SOpenGLWin32 OpenGLWin32;
SOpenGLLinux OpenGLLinux;
SOpenGLOSX OpenGLOSX;

View File

@ -40,7 +40,6 @@ namespace irr
Doublebuffer(true),
IgnoreInput(false),
Stereobuffer(false),
HighPrecisionFPU(false),
EventReceiver(0),
WindowId(0),
#ifdef _DEBUG
@ -48,9 +47,6 @@ namespace irr
#else
LoggingLevel(ELL_INFORMATION),
#endif
DisplayAdapter(0),
DriverMultithreaded(false),
UsePerformanceTimer(true),
SDK_version_do_not_use(IRRLICHT_SDK_VERSION),
PrivateData(0),
#ifdef IRR_MOBILE_PATHS
@ -84,13 +80,9 @@ namespace irr
Doublebuffer = other.Doublebuffer;
IgnoreInput = other.IgnoreInput;
Stereobuffer = other.Stereobuffer;
HighPrecisionFPU = other.HighPrecisionFPU;
EventReceiver = other.EventReceiver;
WindowId = other.WindowId;
LoggingLevel = other.LoggingLevel;
DisplayAdapter = other.DisplayAdapter;
DriverMultithreaded = other.DriverMultithreaded;
UsePerformanceTimer = other.UsePerformanceTimer;
PrivateData = other.PrivateData;
OGLES2ShaderPath = other.OGLES2ShaderPath;
return *this;
@ -108,9 +100,6 @@ namespace irr
E_DEVICE_TYPE DeviceType;
//! Type of video driver used to render graphics.
/** This can currently be video::EDT_NULL, video::EDT_SOFTWARE,
video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D9, and video::EDT_OPENGL.
Default: EDT_BURNINGSVIDEO. */
video::E_DRIVER_TYPE DriverType;
//! Size of the window or the video mode in fullscreen mode. Default: 800x600
@ -219,15 +208,6 @@ namespace irr
Default value: false */
bool Stereobuffer;
//! Specifies if the device should use high precision FPU setting
/** This is only relevant for DirectX Devices, which switch to
low FPU precision by default for performance reasons. However,
this may lead to problems with the other computations of the
application. In this case setting this flag to true should help
- on the expense of performance loss, though.
Default value: false */
bool HighPrecisionFPU;
//! A user created event receiver.
IEventReceiver* EventReceiver;
@ -292,23 +272,6 @@ namespace irr
*/
ELOG_LEVEL LoggingLevel;
//! Allows to select which graphic card is used for rendering when more than one card is in the system.
/** So far only supported on D3D */
u32 DisplayAdapter;
//! Create the driver multithreaded.
/** Default is false. Enabling this can slow down your application.
Note that this does _not_ make Irrlicht threadsafe, but only the underlying driver-API for the graphiccard.
So far only supported on D3D. */
bool DriverMultithreaded;
//! Enables use of high performance timers on Windows platform.
/** When performance timers are not used, standard GetTickCount()
is used instead which usually has worse resolution, but also less
problems with speed stepping and other techniques.
*/
bool UsePerformanceTimer;
//! Don't use or change this parameter.
/** Always set it to IRRLICHT_SDK_VERSION, which is done by default.
This is needed for sdk version checks. */

View File

@ -10,7 +10,7 @@
#include "irrArray.h"
#include "irrMath.h"
#include "EMaterialTypes.h"
#include "EMaterialFlags.h"
#include "EMaterialProps.h"
#include "SMaterialLayer.h"
#include "IrrCompileConfig.h" // for IRRLICHT_API
@ -228,19 +228,6 @@ namespace video
ECM_DIFFUSE_AND_AMBIENT
};
//! DEPRECATED. Will be removed after Irrlicht 1.9.
/** Flags for the definition of the polygon offset feature. These flags define whether the offset should be into the screen, or towards the eye. */
enum E_POLYGON_OFFSET
{
//! Push pixel towards the far plane, away from the eye
/** This is typically used for rendering inner areas. */
EPO_BACK=0,
//! Pull pixels towards the camera.
/** This is typically used for polygons which should appear on top
of other elements, such as decals. */
EPO_FRONT=1
};
//! Names for polygon offset direction
const c8* const PolygonOffsetDirectionNames[] =
{
@ -256,7 +243,7 @@ namespace video
EZW_OFF = 0,
//! This is the default setting for SMaterial and tries to handle things automatically.
//! This is also the value which is set when SMaterial::setFlag(EMF_ZWRITE_ENABLE) is enabled.
//! This is what you want to set to enable zwriting.
//! Usually zwriting is enabled non-transparent materials - as far as Irrlicht can recognize those.
//! Basically Irrlicht tries to handle the zwriting for you and assumes transparent materials don't need it.
//! This is addionally affected by IVideoDriver::setAllowZWriteOnTransparent
@ -289,21 +276,21 @@ namespace video
{
public:
//! Default constructor. Creates a solid, lit material with white colors
SMaterial()
: MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), BlendFactor(0.0f),
PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
PolygonOffsetDepthBias(0.f), PolygonOffsetSlopeScale(0.f),
Wireframe(false), PointCloud(false), GouraudShading(true),
Lighting(true), ZWriteEnable(EZW_AUTO), BackfaceCulling(true), FrontfaceCulling(false),
FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
SMaterial() :
MaterialType(EMT_SOLID), AmbientColor(255, 255, 255, 255),
DiffuseColor(255, 255, 255, 255), EmissiveColor(0, 0, 0, 0),
SpecularColor(255, 255, 255, 255), Shininess(0.0f),
MaterialTypeParam(0.0f), Thickness(1.0f), ZBuffer(ECFN_LESSEQUAL),
AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), ColorMaterial(ECM_DIFFUSE),
BlendOperation(EBO_NONE), BlendFactor(0.0f), PolygonOffsetDepthBias(0.f),
PolygonOffsetSlopeScale(0.f), Wireframe(false), PointCloud(false),
GouraudShading(true), Lighting(true), ZWriteEnable(EZW_AUTO),
BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false),
NormalizeNormals(false), UseMipMaps(true)
{ }
//! Texture layer array.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];
SMaterialLayer TextureLayers[MATERIAL_MAX_TEXTURES];
//! Type of the material. Specifies how everything is blended together
E_MATERIAL_TYPE MaterialType;
@ -350,10 +337,6 @@ namespace video
EMT_TRANSPARENT_ALPHA_CHANNEL and EMT_ONETEXTURE_BLEND. */
f32 MaterialTypeParam;
//! Second free parameter, dependent on the material type.
/** Mostly ignored. */
f32 MaterialTypeParam2;
//! Thickness of non-3dimensional elements such as lines and points.
f32 Thickness;
@ -389,28 +372,16 @@ namespace video
//! Store the blend factors
/** textureBlendFunc/textureBlendFuncSeparate functions should be used to write
properly blending factors to this parameter.
Due to historical reasons this parameter is not used for material type
properly blending factors to this parameter.
Due to historical reasons this parameter is not used for material type
EMT_ONETEXTURE_BLEND which uses MaterialTypeParam instead for the blend factor.
It's generally used only for materials without any blending otherwise (like EMT_SOLID).
It's main use is to allow having shader materials which can enable/disable
blending after they have been created.
It's main use is to allow having shader materials which can enable/disable
blending after they have been created.
When you set this you usually also have to set BlendOperation to a value != EBO_NONE
(setting it to EBO_ADD is probably the most common one value). */
f32 BlendFactor;
//! DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
/** Factor specifying how far the polygon offset should be made.
Specifying 0 disables the polygon offset. The direction is specified separately.
The factor can be from 0 to 7.
Note: This probably never worked on Direct3D9 (was coded for D3D8 which had different value ranges) */
u8 PolygonOffsetFactor:3;
//! DEPRECATED. Will be removed after Irrlicht 1.9.
/** Flag defining the direction the polygon offset is applied to.
Can be to front or to back, specified by values from E_POLYGON_OFFSET. */
E_POLYGON_OFFSET PolygonOffsetDirection:1;
//! A constant z-buffer offset for a polygon/line/point
/** The range of the value is driver specific.
On OpenGL you get units which are multiplied by the smallest value that is guaranteed to produce a resolvable offset.
@ -430,9 +401,6 @@ namespace video
f32 PolygonOffsetSlopeScale;
//! Draw as wireframe or filled triangles? Default: false
/** The user can access a material flag using
\code material.Wireframe=true \endcode
or \code material.setFlag(EMF_WIREFRAME, true); \endcode */
bool Wireframe:1;
//! Draw as point cloud or filled triangles? Default: false
@ -445,7 +413,7 @@ namespace video
bool Lighting:1;
//! Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
to values other than ECFN_DISABLED */
E_ZWRITE ZWriteEnable:2;
@ -466,12 +434,22 @@ namespace video
/** Sometimes, disabling mipmap usage can be useful. Default: true */
bool UseMipMaps:1;
//! Execute a function on all texture layers.
/** Useful for setting properties which are not per material, but per
texture layer, e.g. bilinear filtering. */
template <typename F>
void forEachTexture(F &&fn) {
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; i++) {
fn(TextureLayers[i]);
}
}
//! Gets the texture transformation matrix for level i
/** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES
\return Texture matrix for texture level i. */
core::matrix4& getTextureMatrix(u32 i)
{
return TextureLayer[i].getTextureMatrix();
return TextureLayers[i].getTextureMatrix();
}
//! Gets the immutable texture transformation matrix for level i
@ -480,7 +458,7 @@ namespace video
const core::matrix4& getTextureMatrix(u32 i) const
{
if (i<MATERIAL_MAX_TEXTURES)
return TextureLayer[i].getTextureMatrix();
return TextureLayers[i].getTextureMatrix();
else
return core::IdentityMatrix;
}
@ -492,7 +470,7 @@ namespace video
{
if (i>=MATERIAL_MAX_TEXTURES)
return;
TextureLayer[i].setTextureMatrix(mat);
TextureLayers[i].setTextureMatrix(mat);
}
//! Gets the i-th texture
@ -500,7 +478,7 @@ namespace video
\return Texture for texture level i, if defined, else 0. */
ITexture* getTexture(u32 i) const
{
return i < MATERIAL_MAX_TEXTURES ? TextureLayer[i].Texture : 0;
return i < MATERIAL_MAX_TEXTURES ? TextureLayers[i].Texture : 0;
}
//! Sets the i-th texture
@ -511,144 +489,7 @@ namespace video
{
if (i>=MATERIAL_MAX_TEXTURES)
return;
TextureLayer[i].Texture = tex;
}
//! Sets the Material flag to the given value
/** \param flag The flag to be set.
\param value The new value for the flag. */
void setFlag(E_MATERIAL_FLAG flag, bool value)
{
switch (flag)
{
case EMF_WIREFRAME:
Wireframe = value; break;
case EMF_POINTCLOUD:
PointCloud = value; break;
case EMF_GOURAUD_SHADING:
GouraudShading = value; break;
case EMF_LIGHTING:
Lighting = value; break;
case EMF_ZBUFFER:
ZBuffer = value; break;
case EMF_ZWRITE_ENABLE:
ZWriteEnable = value ? EZW_AUTO : EZW_OFF; break;
case EMF_BACK_FACE_CULLING:
BackfaceCulling = value; break;
case EMF_FRONT_FACE_CULLING:
FrontfaceCulling = value; break;
case EMF_BILINEAR_FILTER:
{
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
TextureLayer[i].BilinearFilter = value;
}
break;
case EMF_TRILINEAR_FILTER:
{
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
TextureLayer[i].TrilinearFilter = value;
}
break;
case EMF_ANISOTROPIC_FILTER:
{
if (value)
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
TextureLayer[i].AnisotropicFilter = 0xFF;
else
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
TextureLayer[i].AnisotropicFilter = 0;
}
break;
case EMF_FOG_ENABLE:
FogEnable = value; break;
case EMF_NORMALIZE_NORMALS:
NormalizeNormals = value; break;
case EMF_TEXTURE_WRAP:
{
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value;
TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value;
TextureLayer[i].TextureWrapW = (E_TEXTURE_CLAMP)value;
}
}
break;
case EMF_ANTI_ALIASING:
AntiAliasing = value?EAAM_SIMPLE:EAAM_OFF; break;
case EMF_COLOR_MASK:
ColorMask = value?ECP_ALL:ECP_NONE; break;
case EMF_COLOR_MATERIAL:
ColorMaterial = value?ECM_DIFFUSE:ECM_NONE; break;
case EMF_USE_MIP_MAPS:
UseMipMaps = value; break;
case EMF_BLEND_OPERATION:
BlendOperation = value?EBO_ADD:EBO_NONE; break;
case EMF_BLEND_FACTOR:
break;
case EMF_POLYGON_OFFSET:
PolygonOffsetFactor = value?1:0;
PolygonOffsetDirection = EPO_BACK;
PolygonOffsetSlopeScale = value?1.f:0.f;
PolygonOffsetDepthBias = value?1.f:0.f;
default:
break;
}
}
//! Gets the Material flag
/** \param flag The flag to query.
\return The current value of the flag. */
bool getFlag(E_MATERIAL_FLAG flag) const
{
switch (flag)
{
case EMF_WIREFRAME:
return Wireframe;
case EMF_POINTCLOUD:
return PointCloud;
case EMF_GOURAUD_SHADING:
return GouraudShading;
case EMF_LIGHTING:
return Lighting;
case EMF_ZBUFFER:
return ZBuffer!=ECFN_DISABLED;
case EMF_ZWRITE_ENABLE:
return ZWriteEnable != EZW_OFF;
case EMF_BACK_FACE_CULLING:
return BackfaceCulling;
case EMF_FRONT_FACE_CULLING:
return FrontfaceCulling;
case EMF_BILINEAR_FILTER:
return TextureLayer[0].BilinearFilter;
case EMF_TRILINEAR_FILTER:
return TextureLayer[0].TrilinearFilter;
case EMF_ANISOTROPIC_FILTER:
return TextureLayer[0].AnisotropicFilter!=0;
case EMF_FOG_ENABLE:
return FogEnable;
case EMF_NORMALIZE_NORMALS:
return NormalizeNormals;
case EMF_TEXTURE_WRAP:
return !(TextureLayer[0].TextureWrapU ||
TextureLayer[0].TextureWrapV ||
TextureLayer[0].TextureWrapW);
case EMF_ANTI_ALIASING:
return (AntiAliasing==1);
case EMF_COLOR_MASK:
return (ColorMask!=ECP_NONE);
case EMF_COLOR_MATERIAL:
return (ColorMaterial != ECM_NONE);
case EMF_USE_MIP_MAPS:
return UseMipMaps;
case EMF_BLEND_OPERATION:
return BlendOperation != EBO_NONE;
case EMF_BLEND_FACTOR:
return BlendFactor != 0.f;
case EMF_POLYGON_OFFSET:
return PolygonOffsetFactor != 0 || PolygonOffsetDepthBias != 0.f;
}
return false;
TextureLayers[i].Texture = tex;
}
//! Inequality operator
@ -664,7 +505,6 @@ namespace video
SpecularColor != b.SpecularColor ||
Shininess != b.Shininess ||
MaterialTypeParam != b.MaterialTypeParam ||
MaterialTypeParam2 != b.MaterialTypeParam2 ||
Thickness != b.Thickness ||
Wireframe != b.Wireframe ||
PointCloud != b.PointCloud ||
@ -681,15 +521,13 @@ namespace video
ColorMaterial != b.ColorMaterial ||
BlendOperation != b.BlendOperation ||
BlendFactor != b.BlendFactor ||
PolygonOffsetFactor != b.PolygonOffsetFactor ||
PolygonOffsetDirection != b.PolygonOffsetDirection ||
PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||
UseMipMaps != b.UseMipMaps
;
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
{
different |= (TextureLayer[i] != b.TextureLayer[i]);
different |= (TextureLayers[i] != b.TextureLayers[i]);
}
return different;
}
@ -728,10 +566,8 @@ namespace video
//! as it asks the material renders directly what they do with the material.
bool isTransparent() const
{
if ( MaterialType==EMT_TRANSPARENT_ADD_COLOR ||
MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL ||
MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA ||
MaterialType==EMT_TRANSPARENT_REFLECTION_2_LAYER )
if ( MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL ||
MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA )
return true;
return false;

View File

@ -43,6 +43,32 @@ namespace video
"texture_clamp_mirror_clamp_to_edge",
"texture_clamp_mirror_clamp_to_border", 0};
//! Texture minification filter.
/** Used when scaling textures down. See the documentation on OpenGL's
`GL_TEXTURE_MIN_FILTER` for more information. */
enum E_TEXTURE_MIN_FILTER {
//! Aka nearest-neighbor.
ETMINF_NEAREST_MIPMAP_NEAREST = 0,
//! Aka bilinear.
ETMINF_LINEAR_MIPMAP_NEAREST,
//! Isn't known by any other name.
ETMINF_NEAREST_MIPMAP_LINEAR,
//! Aka trilinear.
ETMINF_LINEAR_MIPMAP_LINEAR,
};
//! Texture magnification filter.
/** Used when scaling textures up. See the documentation on OpenGL's
`GL_TEXTURE_MAG_FILTER` for more information.
Note that mipmaps are only used for minification, not for magnification. */
enum E_TEXTURE_MAG_FILTER {
//! Aka nearest-neighbor.
ETMAGF_NEAREST = 0,
//! Aka bilinear.
ETMAGF_LINEAR,
};
//! Struct for holding material parameters which exist per texture layer
// Note for implementors: Serialization is in CNullDriver
class SMaterialLayer
@ -50,7 +76,7 @@ namespace video
public:
//! Default constructor
SMaterialLayer() : Texture(0), TextureWrapU(ETC_REPEAT), TextureWrapV(ETC_REPEAT), TextureWrapW(ETC_REPEAT),
BilinearFilter(true), TrilinearFilter(false), AnisotropicFilter(0), LODBias(0), TextureMatrix(0)
MinFilter(ETMINF_LINEAR_MIPMAP_NEAREST), MagFilter(ETMAGF_LINEAR), AnisotropicFilter(0), LODBias(0), TextureMatrix(0)
{
}
@ -104,8 +130,8 @@ namespace video
TextureWrapU = other.TextureWrapU;
TextureWrapV = other.TextureWrapV;
TextureWrapW = other.TextureWrapW;
BilinearFilter = other.BilinearFilter;
TrilinearFilter = other.TrilinearFilter;
MinFilter = other.MinFilter;
MagFilter = other.MagFilter;
AnisotropicFilter = other.AnisotropicFilter;
LODBias = other.LODBias;
@ -157,8 +183,8 @@ namespace video
TextureWrapU != b.TextureWrapU ||
TextureWrapV != b.TextureWrapV ||
TextureWrapW != b.TextureWrapW ||
BilinearFilter != b.BilinearFilter ||
TrilinearFilter != b.TrilinearFilter ||
MinFilter != b.MinFilter ||
MagFilter != b.MagFilter ||
AnisotropicFilter != b.AnisotropicFilter ||
LODBias != b.LODBias;
if (different)
@ -184,13 +210,11 @@ namespace video
u8 TextureWrapV:4;
u8 TextureWrapW:4;
//! Is bilinear filtering enabled? Default: true
bool BilinearFilter:1;
//! Minification (downscaling) filter
E_TEXTURE_MIN_FILTER MinFilter;
//! Is trilinear filtering enabled? Default: false
/** If the trilinear filter flag is enabled,
the bilinear filtering flag is ignored. */
bool TrilinearFilter:1;
//! Magnification (upscaling) filter
E_TEXTURE_MAG_FILTER MagFilter;
//! Is anisotropic filtering enabled? Default: 0, disabled
/** In Irrlicht you can use anisotropic texture filtering

View File

@ -117,13 +117,6 @@ namespace scene
}
}
//! sets a flag of all contained materials to a new value
void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) override
{
for (u32 i=0; i<MeshBuffers.size(); ++i)
MeshBuffers[i]->getMaterial().setFlag(flag, newvalue);
}
//! set the hardware mapping hint, for driver
void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) override
{

View File

@ -18,16 +18,16 @@ namespace video
SMaterial Material;
//! Which values are overridden
/** OR'ed values from E_MATERIAL_FLAGS. */
u32 EnableFlags;
/** OR'ed values from E_MATERIAL_PROPS. */
u32 EnableProps;
//! For those flags in EnableFlags which affect layers, set which of the layers are affected
bool EnableLayerFlags[MATERIAL_MAX_TEXTURES];
//! For those properties in EnableProps which affect layers, set which of the layers are affected
bool EnableLayerProps[MATERIAL_MAX_TEXTURES];
//! Which textures are overridden
bool EnableTextures[MATERIAL_MAX_TEXTURES];
//! Overwrite complete layers (settings of EnableLayerFlags and EnableTextures don't matter then for layer data)
//! Overwrite complete layers (settings of EnableLayerProps and EnableTextures don't matter then for layer data)
bool EnableLayers[MATERIAL_MAX_TEXTURES];
//! Set in which render passes the material override is active.
@ -35,10 +35,10 @@ namespace video
u16 EnablePasses;
//! Global enable flag, overwritten by the SceneManager in each pass
/** NOTE: This is generally _not_ set by users of the engine, but the
Scenemanager uses the EnablePass array and sets Enabled to true if the
/** NOTE: This is generally _not_ set by users of the engine, but the
Scenemanager uses the EnablePass array and sets Enabled to true if the
Override material is enabled in the current pass.
As user you generally _only_ set EnablePasses.
As user you generally _only_ set EnablePasses.
The exception is when rendering without SceneManager but using draw calls in the VideoDriver. */
bool Enabled;
@ -47,7 +47,7 @@ namespace video
SMaterialTypeReplacement(s32 original, u32 replacement) : Original(original), Replacement(replacement) {}
SMaterialTypeReplacement(u32 replacement) : Original(-1), Replacement(replacement) {}
//! SMaterial.MaterialType to replace.
//! SMaterial.MaterialType to replace.
//! -1 for all types or a specific value to only replace that one (which is either one of E_MATERIAL_TYPE or a shader material id)
s32 Original;
@ -59,19 +59,19 @@ namespace video
core::array<SMaterialTypeReplacement> MaterialTypes;
//! Default constructor
SOverrideMaterial() : EnableFlags(0), EnablePasses(0), Enabled(false)
SOverrideMaterial() : EnableProps(0), EnablePasses(0), Enabled(false)
{
}
//! disable overrides and reset all flags
//! disable overrides and reset all properties
void reset()
{
EnableFlags = 0;
EnableProps = 0;
EnablePasses = 0;
Enabled = false;
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i)
{
EnableLayerFlags[i] = true; // doesn't do anything unless EnableFlags is set, just saying by default all texture layers are affected by flags
EnableLayerProps[i] = true; // doesn't do anything unless EnableProps is set, just saying by default all texture layers are affected by properties
EnableTextures[i] = false;
EnableLayers[i] = false;
}
@ -92,67 +92,65 @@ namespace video
for (u32 f=0; f<32; ++f)
{
const u32 num=(1<<f);
if (EnableFlags & num)
if (EnableProps & num)
{
switch (num)
{
case EMF_WIREFRAME: material.Wireframe = Material.Wireframe; break;
case EMF_POINTCLOUD: material.PointCloud = Material.PointCloud; break;
case EMF_GOURAUD_SHADING: material.GouraudShading = Material.GouraudShading; break;
case EMF_LIGHTING: material.Lighting = Material.Lighting; break;
case EMF_ZBUFFER: material.ZBuffer = Material.ZBuffer; break;
case EMF_ZWRITE_ENABLE: material.ZWriteEnable = Material.ZWriteEnable; break;
case EMF_BACK_FACE_CULLING: material.BackfaceCulling = Material.BackfaceCulling; break;
case EMF_FRONT_FACE_CULLING: material.FrontfaceCulling = Material.FrontfaceCulling; break;
case EMF_BILINEAR_FILTER:
case EMP_WIREFRAME: material.Wireframe = Material.Wireframe; break;
case EMP_POINTCLOUD: material.PointCloud = Material.PointCloud; break;
case EMP_GOURAUD_SHADING: material.GouraudShading = Material.GouraudShading; break;
case EMP_LIGHTING: material.Lighting = Material.Lighting; break;
case EMP_ZBUFFER: material.ZBuffer = Material.ZBuffer; break;
case EMP_ZWRITE_ENABLE: material.ZWriteEnable = Material.ZWriteEnable; break;
case EMP_BACK_FACE_CULLING: material.BackfaceCulling = Material.BackfaceCulling; break;
case EMP_FRONT_FACE_CULLING: material.FrontfaceCulling = Material.FrontfaceCulling; break;
case EMP_MIN_FILTER:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
if ( EnableLayerFlags[i] )
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].BilinearFilter = Material.TextureLayer[i].BilinearFilter;
material.TextureLayers[i].MinFilter = Material.TextureLayers[i].MinFilter;
}
}
break;
case EMF_TRILINEAR_FILTER:
case EMP_MAG_FILTER:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
if ( EnableLayerFlags[i] )
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].TrilinearFilter = Material.TextureLayer[i].TrilinearFilter;
material.TextureLayers[i].MagFilter = Material.TextureLayers[i].MagFilter;
}
}
break;
case EMF_ANISOTROPIC_FILTER:
case EMP_ANISOTROPIC_FILTER:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
if ( EnableLayerFlags[i] )
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].AnisotropicFilter = Material.TextureLayer[i].AnisotropicFilter;
material.TextureLayers[i].AnisotropicFilter = Material.TextureLayers[i].AnisotropicFilter;
}
}
break;
case EMF_FOG_ENABLE: material.FogEnable = Material.FogEnable; break;
case EMF_NORMALIZE_NORMALS: material.NormalizeNormals = Material.NormalizeNormals; break;
case EMF_TEXTURE_WRAP:
case EMP_FOG_ENABLE: material.FogEnable = Material.FogEnable; break;
case EMP_NORMALIZE_NORMALS: material.NormalizeNormals = Material.NormalizeNormals; break;
case EMP_TEXTURE_WRAP:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
if ( EnableLayerFlags[i] )
if ( EnableLayerProps[i] )
{
material.TextureLayer[i].TextureWrapU = Material.TextureLayer[i].TextureWrapU;
material.TextureLayer[i].TextureWrapV = Material.TextureLayer[i].TextureWrapV;
material.TextureLayer[i].TextureWrapW = Material.TextureLayer[i].TextureWrapW;
material.TextureLayers[i].TextureWrapU = Material.TextureLayers[i].TextureWrapU;
material.TextureLayers[i].TextureWrapV = Material.TextureLayers[i].TextureWrapV;
material.TextureLayers[i].TextureWrapW = Material.TextureLayers[i].TextureWrapW;
}
}
break;
case EMF_ANTI_ALIASING: material.AntiAliasing = Material.AntiAliasing; break;
case EMF_COLOR_MASK: material.ColorMask = Material.ColorMask; break;
case EMF_COLOR_MATERIAL: material.ColorMaterial = Material.ColorMaterial; break;
case EMF_USE_MIP_MAPS: material.UseMipMaps = Material.UseMipMaps; break;
case EMF_BLEND_OPERATION: material.BlendOperation = Material.BlendOperation; break;
case EMF_BLEND_FACTOR: material.BlendFactor = Material.BlendFactor; break;
case EMF_POLYGON_OFFSET:
material.PolygonOffsetDirection = Material.PolygonOffsetDirection;
material.PolygonOffsetFactor = Material.PolygonOffsetFactor;
case EMP_ANTI_ALIASING: material.AntiAliasing = Material.AntiAliasing; break;
case EMP_COLOR_MASK: material.ColorMask = Material.ColorMask; break;
case EMP_COLOR_MATERIAL: material.ColorMaterial = Material.ColorMaterial; break;
case EMP_USE_MIP_MAPS: material.UseMipMaps = Material.UseMipMaps; break;
case EMP_BLEND_OPERATION: material.BlendOperation = Material.BlendOperation; break;
case EMP_BLEND_FACTOR: material.BlendFactor = Material.BlendFactor; break;
case EMP_POLYGON_OFFSET:
material.PolygonOffsetDepthBias = Material.PolygonOffsetDepthBias;
material.PolygonOffsetSlopeScale = Material.PolygonOffsetSlopeScale;
break;
@ -163,11 +161,11 @@ namespace video
{
if ( EnableLayers[i] )
{
material.TextureLayer[i] = Material.TextureLayer[i];
material.TextureLayers[i] = Material.TextureLayers[i];
}
else if ( EnableTextures[i] )
{
material.TextureLayer[i].Texture = Material.TextureLayer[i].Texture;
material.TextureLayers[i].Texture = Material.TextureLayers[i].Texture;
}
}
}

View File

@ -429,24 +429,19 @@ public:
//! Iterator to iterate through a UTF-16 string.
class _ustring16_const_iterator : public std::iterator<
std::bidirectional_iterator_tag, // iterator_category
access, // value_type
ptrdiff_t, // difference_type
const access, // pointer
const access // reference
>
class _ustring16_const_iterator
{
public:
typedef _ustring16_const_iterator _Iter;
typedef std::iterator<std::bidirectional_iterator_tag, access, ptrdiff_t, const access, const access> _Base;
typedef const access const_pointer;
typedef const access const_reference;
typedef ptrdiff_t distance_type;
typedef typename _Base::value_type value_type;
typedef typename _Base::difference_type difference_type;
typedef typename _Base::difference_type distance_type;
typedef typename _Base::pointer pointer;
// stuff for std::iterator_traits
typedef std::bidirectional_iterator_tag iterator_category;
typedef access value_type;
typedef distance_type difference_type;
typedef const access pointer;
typedef const_reference reference;
//! Constructors.
@ -602,7 +597,7 @@ public:
return difference_type();
_Iter i = iter;
difference_type ret;
difference_type ret{};
// Walk up.
if (pos > i.pos)

View File

@ -42,7 +42,7 @@
#include "EGUIAlignment.h"
#include "EGUIElementTypes.h"
#include "EHardwareBufferFlags.h"
#include "EMaterialFlags.h"
#include "EMaterialProps.h"
#include "EMaterialTypes.h"
#include "EMeshWriterEnums.h"
#include "ESceneNodeTypes.h"
@ -255,8 +255,7 @@ namespace irr
//! Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.
/** If you need more parameters to be passed to the creation of the Irrlicht Engine device,
use the createDeviceEx() function.
\param driverType: Type of the video driver to use. This can currently be video::EDT_NULL,
video::EDT_SOFTWARE, video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D9 and video::EDT_OPENGL.
\param driverType: Type of the video driver to use.
\param windowSize: Size of the window or the video mode in fullscreen mode.
\param bits: Bits per pixel in fullscreen mode. Ignored if windowed mode.
\param fullscreen: Should be set to true if the device should run in fullscreen. Otherwise
@ -280,16 +279,6 @@ namespace irr
bool vsync = false,
IEventReceiver* receiver = 0);
//! typedef for Function Pointer
typedef IrrlichtDevice* (IRRCALLCONV *funcptr_createDevice )(
video::E_DRIVER_TYPE driverType,
const core::dimension2d<u32>& windowSize,
u32 bits,
bool fullscreen,
bool stencilbuffer,
bool vsync,
IEventReceiver* receiver);
//! Creates an Irrlicht device with the option to specify advanced parameters.
/** Usually you should used createDevice() for creating an Irrlicht Engine device.
@ -302,10 +291,6 @@ namespace irr
extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
const SIrrlichtCreationParameters& parameters);
//! typedef for Function Pointer
typedef IrrlichtDevice* (IRRCALLCONV *funcptr_createDeviceEx )( const SIrrlichtCreationParameters& parameters );
// THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES
// EXISTING ONLY FOR THE DOCUMENTATION SOFTWARE DOXYGEN.

View File

@ -151,7 +151,7 @@ namespace core
CMatrix4<T> operator*(const CMatrix4<T>& other) const;
//! Multiply by another matrix.
/** Like calling: (*this) = (*this) * other
/** Like calling: (*this) = (*this) * other
*/
CMatrix4<T>& operator*=(const CMatrix4<T>& other);
@ -190,10 +190,10 @@ namespace core
//! Get the rotation, as set by setRotation() when you already know the scale used to create the matrix
/** NOTE: The scale needs to be the correct one used to create this matrix.
You can _not_ use the result of getScale(), but have to save your scale
You can _not_ use the result of getScale(), but have to save your scale
variable in another place (like ISceneNode does).
NOTE: No scale value can be 0 or the result is undefined.
NOTE: It does not necessarily return the *same* Euler angles as those set by setRotationDegrees(),
NOTE: It does not necessarily return the *same* Euler angles as those set by setRotationDegrees(),
but the rotation will be equivalent, i.e. will have the same result when used to rotate a vector or node.
NOTE: It will (usually) give wrong results when further transformations have been added in the matrix (like shear).
WARNING: There have been troubles with this function over the years and we may still have missed some corner cases.
@ -203,9 +203,9 @@ namespace core
//! Returns the rotation, as set by setRotation().
/** NOTE: You will have the same end-rotation as used in setRotation, but it might not use the same axis values.
NOTE: This only works correct if no other matrix operations have been done on the inner 3x3 matrix besides
NOTE: This only works correct if no other matrix operations have been done on the inner 3x3 matrix besides
setting rotation (so no scale/shear). Thought it (probably) works as long as scale doesn't flip handedness.
NOTE: It does not necessarily return the *same* Euler angles as those set by setRotationDegrees(),
NOTE: It does not necessarily return the *same* Euler angles as those set by setRotationDegrees(),
but the rotation will be equivalent, i.e. will have the same result when used to rotate a vector or node.
*/
core::vector3d<T> getRotationDegrees() const;
@ -278,13 +278,6 @@ namespace core
void transformPlane( const core::plane3d<f32> &in, core::plane3d<f32> &out) const;
//! Transforms a axis aligned bounding box
/** The result box of this operation may not be accurate at all. For
correct results, use transformBoxEx() */
void transformBox(core::aabbox3d<f32>& box) const;
//! Transforms a axis aligned bounding box
/** The result box of this operation should be accurate, but this operation
is slower than transformBox(). */
void transformBoxEx(core::aabbox3d<f32>& box) const;
//! Multiplies this matrix by a 1x4 matrix
@ -906,8 +899,8 @@ namespace core
//! Returns a rotation which (mostly) works in combination with the given scale
/**
This code was originally written by by Chev (assuming no scaling back then,
/**
This code was originally written by by Chev (assuming no scaling back then,
we can be blamed for all problems added by regarding scale)
*/
template <class T>
@ -953,17 +946,17 @@ namespace core
template <class T>
inline core::vector3d<T> CMatrix4<T>::getRotationDegrees() const
{
// Note: Using getScale() here make it look like it could do matrix decomposition.
// It can't! It works (or should work) as long as rotation doesn't flip the handedness
// aka scale swapping 1 or 3 axes. (I think we could catch that as well by comparing
// Note: Using getScale() here make it look like it could do matrix decomposition.
// It can't! It works (or should work) as long as rotation doesn't flip the handedness
// aka scale swapping 1 or 3 axes. (I think we could catch that as well by comparing
// crossproduct of first 2 axes to direction of third axis, but TODO)
// And maybe it should also offer the solution for the simple calculation
// And maybe it should also offer the solution for the simple calculation
// without regarding scaling as Irrlicht did before 1.7
core::vector3d<T> scale(getScale());
// We assume the matrix uses rotations instead of negative scaling 2 axes.
// Otherwise it fails even for some simple cases, like rotating around
// 2 axes by 180<EFBFBD> which getScale thinks is a negative scaling.
// Otherwise it fails even for some simple cases, like rotating around
// 2 axes by 180° which getScale thinks is a negative scaling.
if (scale.Y<0 && scale.Z<0)
{
scale.Y =-scale.Y;
@ -1278,22 +1271,6 @@ namespace core
transformPlane( out );
}
//! Transforms the edge-points of a bounding box
//! Deprecated as it's usually not what people need (regards only 2 corners, but other corners might be outside the box after transformation)
//! Use transformBoxEx instead.
template <class T>
_IRR_DEPRECATED_ inline void CMatrix4<T>::transformBox(core::aabbox3d<f32>& box) const
{
#if defined ( USE_MATRIX_TEST )
if (isIdentity())
return;
#endif
transformVect(box.MinEdge);
transformVect(box.MaxEdge);
box.repair();
}
//! Transforms a axis aligned bounding box more accurately than transformBox()
template <class T>
inline void CMatrix4<T>::transformBoxEx(core::aabbox3d<f32>& box) const

View File

@ -100,8 +100,7 @@ namespace core
//! Check if a point is inside the triangle (border-points count also as inside)
/** This method uses a barycentric coordinate system.
It is faster than isPointInside but is more susceptible to floating point rounding
errors. This will especially be noticeable when the FPU is in single precision mode
(which is for example set on default by Direct3D).
errors.
\param p Point to test. Assumes that this point is already
on the plane of the triangle.
\return True if point is inside the triangle, otherwise false. */

View File

@ -1,70 +0,0 @@
precision mediump float;
/* Uniforms */
uniform int uTextureUsage0;
uniform int uTextureUsage1;
uniform sampler2D uTextureUnit0;
uniform sampler2D uTextureUnit1;
uniform int uFogEnable;
uniform int uFogType;
uniform vec4 uFogColor;
uniform float uFogStart;
uniform float uFogEnd;
uniform float uFogDensity;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec2 vTextureCoord1;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
float computeFog()
{
const float LOG2 = 1.442695;
float FogFactor = 0.0;
if (uFogType == 0) // Exp
{
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
}
else if (uFogType == 1) // Linear
{
float Scale = 1.0 / (uFogEnd - uFogStart);
FogFactor = (uFogEnd - vFogCoord) * Scale;
}
else if (uFogType == 2) // Exp2
{
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
}
FogFactor = clamp(FogFactor, 0.0, 1.0);
return FogFactor;
}
void main()
{
vec4 Color0 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 Color1 = vec4(1.0, 1.0, 1.0, 1.0);
if (bool(uTextureUsage0))
Color0 = texture2D(uTextureUnit0, vTextureCoord0);
if (bool(uTextureUsage1))
Color1 = texture2D(uTextureUnit1, vTextureCoord1);
vec4 FinalColor = vec4(Color0 + (Color1 - 0.5)) * vVertexColor + vSpecularColor;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
FinalColor = mix(FogColor, FinalColor, FogFactor);
}
gl_FragColor = FinalColor;
}

View File

@ -1,70 +0,0 @@
precision mediump float;
/* Uniforms */
uniform int uTextureUsage0;
uniform int uTextureUsage1;
uniform sampler2D uTextureUnit0;
uniform sampler2D uTextureUnit1;
uniform int uFogEnable;
uniform int uFogType;
uniform vec4 uFogColor;
uniform float uFogStart;
uniform float uFogEnd;
uniform float uFogDensity;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec2 vTextureCoord1;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
float computeFog()
{
const float LOG2 = 1.442695;
float FogFactor = 0.0;
if (uFogType == 0) // Exp
{
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
}
else if (uFogType == 1) // Linear
{
float Scale = 1.0 / (uFogEnd - uFogStart);
FogFactor = (uFogEnd - vFogCoord) * Scale;
}
else if (uFogType == 2) // Exp2
{
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
}
FogFactor = clamp(FogFactor, 0.0, 1.0);
return FogFactor;
}
void main()
{
vec4 Color0 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 Color1 = vec4(1.0, 1.0, 1.0, 1.0);
if (bool(uTextureUsage0))
Color0 = texture2D(uTextureUnit0, vTextureCoord0);
if (bool(uTextureUsage1))
Color1 = texture2D(uTextureUnit1, vTextureCoord1);
vec4 FinalColor = (Color0 + Color1) * vVertexColor + vSpecularColor;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
FinalColor = mix(FogColor, FinalColor, FogFactor);
}
gl_FragColor = FinalColor;
}

View File

@ -1,72 +0,0 @@
precision mediump float;
/* Uniforms */
uniform float uModulate;
uniform int uTextureUsage0;
uniform int uTextureUsage1;
uniform sampler2D uTextureUnit0;
uniform sampler2D uTextureUnit1;
uniform int uFogEnable;
uniform int uFogType;
uniform vec4 uFogColor;
uniform float uFogStart;
uniform float uFogEnd;
uniform float uFogDensity;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec2 vTextureCoord1;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
float computeFog()
{
const float LOG2 = 1.442695;
float FogFactor = 0.0;
if (uFogType == 0) // Exp
{
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
}
else if (uFogType == 1) // Linear
{
float Scale = 1.0 / (uFogEnd - uFogStart);
FogFactor = (uFogEnd - vFogCoord) * Scale;
}
else if (uFogType == 2) // Exp2
{
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
}
FogFactor = clamp(FogFactor, 0.0, 1.0);
return FogFactor;
}
void main()
{
vec4 Color0 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 Color1 = vec4(1.0, 1.0, 1.0, 1.0);
if (bool(uTextureUsage0))
Color0 = texture2D(uTextureUnit0, vTextureCoord0);
if (bool(uTextureUsage1))
Color1 = texture2D(uTextureUnit1, vTextureCoord1);
vec4 FinalColor = (Color0 * Color1 * uModulate) * vVertexColor;
FinalColor += vSpecularColor;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
FinalColor = mix(FogColor, FinalColor, FogFactor);
}
gl_FragColor = FinalColor;
}

View File

@ -1,70 +0,0 @@
precision mediump float;
/* Uniforms */
uniform int uTextureUsage0;
uniform int uTextureUsage1;
uniform sampler2D uTextureUnit0;
uniform sampler2D uTextureUnit1;
uniform int uFogEnable;
uniform int uFogType;
uniform vec4 uFogColor;
uniform float uFogStart;
uniform float uFogEnd;
uniform float uFogDensity;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec2 vTextureCoord1;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
float computeFog()
{
const float LOG2 = 1.442695;
float FogFactor = 0.0;
if (uFogType == 0) // Exp
{
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
}
else if (uFogType == 1) // Linear
{
float Scale = 1.0 / (uFogEnd - uFogStart);
FogFactor = (uFogEnd - vFogCoord) * Scale;
}
else if (uFogType == 2) // Exp2
{
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
}
FogFactor = clamp(FogFactor, 0.0, 1.0);
return FogFactor;
}
void main()
{
vec4 Color0 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 Color1 = vec4(1.0, 1.0, 1.0, 1.0);
if (bool(uTextureUsage0))
Color0 = texture2D(uTextureUnit0, vTextureCoord0);
if (bool(uTextureUsage1))
Color1 = texture2D(uTextureUnit1, vTextureCoord1);
vec4 FinalColor = (Color0 * Color1) * vVertexColor + vSpecularColor;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
FinalColor = mix(FogColor, FinalColor, FogFactor);
}
gl_FragColor = FinalColor;
}

View File

@ -1,53 +0,0 @@
/* Attributes */
attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
attribute vec2 inTexCoord1;
/* Uniforms */
uniform mat4 uWVPMatrix;
uniform mat4 uWVMatrix;
uniform mat4 uNMatrix;
uniform mat4 uTMatrix0;
uniform vec4 uGlobalAmbient;
uniform vec4 uMaterialAmbient;
uniform vec4 uMaterialDiffuse;
uniform vec4 uMaterialEmissive;
uniform vec4 uMaterialSpecular;
uniform float uMaterialShininess;
uniform float uThickness;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec2 vTextureCoord1;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
void main()
{
gl_Position = uWVPMatrix * vec4(inVertexPosition, 1.0);
gl_PointSize = uThickness;
vec4 TextureCoord0 = vec4(inTexCoord0.x, inTexCoord0.y, 1.0, 1.0);
vTextureCoord0 = vec4(uTMatrix0 * TextureCoord0).xy;
vec3 Position = (uWVMatrix * vec4(inVertexPosition, 1.0)).xyz;
vec3 P = normalize(Position);
vec3 N = normalize(vec4(uNMatrix * vec4(inVertexNormal, 0.0)).xyz);
vec3 R = reflect(P, N);
float V = 2.0 * sqrt(R.x*R.x + R.y*R.y + (R.z+1.0)*(R.z+1.0));
vTextureCoord1 = vec2(R.x/V + 0.5, R.y/V + 0.5);
vVertexColor = inVertexColor.bgra;
vSpecularColor = vec4(0.0, 0.0, 0.0, 0.0);
vFogCoord = length(Position);
}

View File

@ -1,51 +0,0 @@
/* Attributes */
attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
attribute vec2 inTexCoord1;
/* Uniforms */
uniform mat4 uWVPMatrix;
uniform mat4 uWVMatrix;
uniform mat4 uNMatrix;
uniform mat4 uTMatrix0;
uniform mat4 uTMatrix1;
uniform vec4 uGlobalAmbient;
uniform vec4 uMaterialAmbient;
uniform vec4 uMaterialDiffuse;
uniform vec4 uMaterialEmissive;
uniform vec4 uMaterialSpecular;
uniform float uMaterialShininess;
uniform float uThickness;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec2 vTextureCoord1;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
void main()
{
gl_Position = uWVPMatrix * vec4(inVertexPosition, 1.0);
gl_PointSize = uThickness;
vec4 TextureCoord0 = vec4(inTexCoord0.x, inTexCoord0.y, 1.0, 1.0);
vTextureCoord0 = vec4(uTMatrix0 * TextureCoord0).xy;
vec4 TextureCoord1 = vec4(inTexCoord1.x, inTexCoord1.y, 1.0, 1.0);
vTextureCoord1 = vec4(uTMatrix1 * TextureCoord1).xy;
vVertexColor = inVertexColor.bgra;
vSpecularColor = vec4(0.0, 0.0, 0.0, 0.0);
vec3 Position = (uWVMatrix * vec4(inVertexPosition, 1.0)).xyz;
vFogCoord = length(Position);
}

View File

@ -1,72 +0,0 @@
precision mediump float;
/* Uniforms */
uniform int uTextureUsage0;
uniform int uTextureUsage1;
uniform sampler2D uTextureUnit0;
uniform sampler2D uTextureUnit1;
uniform int uFogEnable;
uniform int uFogType;
uniform vec4 uFogColor;
uniform float uFogStart;
uniform float uFogEnd;
uniform float uFogDensity;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec2 vTextureCoord1;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
float computeFog()
{
const float LOG2 = 1.442695;
float FogFactor = 0.0;
if (uFogType == 0) // Exp
{
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
}
else if (uFogType == 1) // Linear
{
float Scale = 1.0 / (uFogEnd - uFogStart);
FogFactor = (uFogEnd - vFogCoord) * Scale;
}
else if (uFogType == 2) // Exp2
{
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
}
FogFactor = clamp(FogFactor, 0.0, 1.0);
return FogFactor;
}
void main()
{
vec4 Color0 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 Color1 = vec4(1.0, 1.0, 1.0, 1.0);
if (bool(uTextureUsage0))
Color0 = texture2D(uTextureUnit0, vTextureCoord0);
if (bool(uTextureUsage1))
Color1 = texture2D(uTextureUnit1, vTextureCoord1);
vec4 FinalColor = (Color0 * vVertexColor.a + Color1 * (1.0 - vVertexColor.a)) * vVertexColor;
FinalColor += vSpecularColor;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
FinalColor = mix(FogColor, FinalColor, FogFactor);
}
gl_FragColor = FinalColor;
}

View File

@ -1,62 +0,0 @@
precision mediump float;
/* Uniforms */
uniform int uTextureUsage0;
uniform sampler2D uTextureUnit0;
uniform int uFogEnable;
uniform int uFogType;
uniform vec4 uFogColor;
uniform float uFogStart;
uniform float uFogEnd;
uniform float uFogDensity;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
float computeFog()
{
const float LOG2 = 1.442695;
float FogFactor = 0.0;
if (uFogType == 0) // Exp
{
FogFactor = exp2(-uFogDensity * vFogCoord * LOG2);
}
else if (uFogType == 1) // Linear
{
float Scale = 1.0 / (uFogEnd - uFogStart);
FogFactor = (uFogEnd - vFogCoord) * Scale;
}
else if (uFogType == 2) // Exp2
{
FogFactor = exp2(-uFogDensity * uFogDensity * vFogCoord * vFogCoord * LOG2);
}
FogFactor = clamp(FogFactor, 0.0, 1.0);
return FogFactor;
}
void main()
{
vec4 Color = vVertexColor;
if (bool(uTextureUsage0))
Color *= texture2D(uTextureUnit0, vTextureCoord0);
Color += vSpecularColor;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
Color = mix(FogColor, Color, FogFactor);
}
gl_FragColor = Color;
}

View File

@ -1,48 +0,0 @@
/* Attributes */
attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
attribute vec2 inTexCoord1;
/* Uniforms */
uniform mat4 uWVPMatrix;
uniform mat4 uWVMatrix;
uniform mat4 uNMatrix;
uniform vec4 uGlobalAmbient;
uniform vec4 uMaterialAmbient;
uniform vec4 uMaterialDiffuse;
uniform vec4 uMaterialEmissive;
uniform vec4 uMaterialSpecular;
uniform float uMaterialShininess;
uniform float uThickness;
/* Varyings */
varying vec2 vTextureCoord0;
varying vec4 vVertexColor;
varying vec4 vSpecularColor;
varying float vFogCoord;
void main()
{
gl_Position = uWVPMatrix * vec4(inVertexPosition, 1.0);
gl_PointSize = uThickness;
vec3 Position = (uWVMatrix * vec4(inVertexPosition, 1.0)).xyz;
vec3 P = normalize(Position);
vec3 N = normalize(vec4(uNMatrix * vec4(inVertexNormal, 0.0)).xyz);
vec3 R = reflect(P, N);
float V = 2.0 * sqrt(R.x*R.x + R.y*R.y + (R.z+1.0)*(R.z+1.0));
vTextureCoord0 = vec2(R.x/V + 0.5, R.y/V + 0.5);
vVertexColor = inVertexColor.bgra;
vSpecularColor = vec4(0.0, 0.0, 0.0, 0.0);
vFogCoord = length(Position);
}

34
repro.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
aflout=out/default
myout=out_rep
exe=./bin/Linux/LoadMesh
rm -rf "$myout" && mkdir -p "$myout"
find $aflout/crashes -name 'id:*' -print | \
while read file; do
echo "➤ Testing $file..."
short=${file##*/}
short=${short%%,*}
fout=$myout/$short.txt
$exe "$file" >"$fout" 2>&1
r=$?
if grep -Fq '==ERROR: AddressSanitizer: SEGV on unknown address' "$fout"; then
gdb -q --batch -iex 'set confirm off' -ex r -ex bt --args \
${exe}_noasan "$file" >"$fout" 2>&1
if grep -Eq '^(Thread|Program).*received signal' "$fout"; then
cp "$file" "$myout/$short.bin"
echo "✔ Reproduced (gdb)"
else
echo "✗ Not reproduced (gdb)"
rm -f "$fout"
fi
continue
fi
grep -Fq '==ABORTING' "$fout" && r=1
if [ $r -eq 0 ]; then
echo "✗ Not reproduced (asan)"
rm -f "$fout"
continue
fi
cp "$file" "$myout/$short.bin"
echo "✔ Reproduced (asan)"
done

17
run.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
export AFL_SKIP_CPUFREQ=1
export AFL_TMPDIR=/dev/shm
exe=./bin/Linux/LoadMesh
opts=(
-t 100
-i sample_u/
-o out/
)
if ! [ -d sample_u ]; then
mkdir sample_u
afl-cmin.bash -T 4 -i sample/ -o sample_u/ -- $exe @@
echo; echo
fi
exec afl-fuzz \
"${opts[@]}" "$@" \
-- $exe @@

View File

@ -4,9 +4,14 @@
variant=win32
[[ "$(basename "$CXX")" == "x86_64-"* ]] && variant=win64
with_sdl=0
[[ "$extras" == *"-sdl"* ]] && with_sdl=1
#with_gl3=0
#[[ "$extras" == *"-gl3"* ]] && with_gl3=1
libjpeg_version=2.1.5.1
libpng_version=1.6.39
sdl2_version=2.28.1
zlib_version=1.2.13
mkdir -p libs
@ -16,10 +21,13 @@ libs=$PWD
wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip
[ -e libpng.zip ] || \
wget "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip" -O libpng.zip
[[ $with_sdl -eq 0 || -e sdl2.zip ]] || \
wget "http://minetest.kitsunemimi.pw/sdl2-$sdl2_version-$variant.zip" -O sdl2.zip
[ -e zlib.zip ] || \
wget "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip" -O zlib.zip
[ -d libjpeg ] || unzip -o libjpeg.zip -d libjpeg
[ -d libpng ] || unzip -o libpng.zip -d libpng
[[ $with_sdl -eq 0 || -d sdl2 ]] || unzip -o sdl2.zip -d sdl2
[ -d zlib ] || unzip -o zlib.zip -d zlib
popd
@ -32,6 +40,11 @@ tmp=(
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
-DZLIB_INCLUDE_DIR=$libs/zlib/include
)
[ $with_sdl -eq 1 ] && tmp+=(
-DUSE_SDL2=ON
-DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake
)
#[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON)
cmake . "${tmp[@]}"
make -j$(nproc)
@ -41,8 +54,9 @@ if [ "$1" = "package" ]; then
# strip library
"${CXX%-*}-strip" --strip-unneeded _install/usr/local/lib/*.dll
# bundle the DLLs that are specific to Irrlicht (kind of a hack)
cp -p $libs/*/bin/lib{jpeg,png}*.dll _install/usr/local/lib/
shopt -s nullglob
cp -p $libs/*/bin/{libjpeg,libpng,SDL}*.dll _install/usr/local/lib/
# create a ZIP
(cd _install/usr/local; zip -9r "$OLDPWD"/irrlicht-$variant.zip -- *)
(cd _install/usr/local; zip -9r "$OLDPWD/irrlicht-$variant$extras.zip" -- *)
fi
exit 0

View File

@ -2,10 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ANDROID_ASSET_FILE_ARCHIVE_H_INCLUDED__
#define __C_ANDROID_ASSET_FILE_ARCHIVE_H_INCLUDED__
#pragma once
#ifdef _IRR_COMPILE_ANDROID_ASSET_READER_
@ -47,7 +44,7 @@ namespace io
//! get the archive type
virtual E_FILE_ARCHIVE_TYPE getType() const;
//! Add a directory to read files from. Since the Android
//! Add a directory to read files from. Since the Android
//! API does not return names of directories, they need to
//! be added manually.
virtual void addDirectoryToFileList(const io::path &filename);
@ -65,5 +62,3 @@ namespace io
} // end namespace irr
#endif // _IRR_COMPILE_ANDROID_ASSET_READER_
#endif // __C_ANDROID_ASSET_READER_H_INCLUDED__

View File

@ -2,10 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ANDROID_ASSET_READER_H_INCLUDED__
#define __C_ANDROID_ASSET_READER_H_INCLUDED__
#pragma once
#ifdef _IRR_COMPILE_ANDROID_ASSET_READER_
@ -70,5 +67,3 @@ namespace io
} // end namespace irr
#endif // _IRR_COMPILE_ANDROID_ASSET_READER_
#endif // __C_ANDROID_ASSET_READER_H_INCLUDED__

View File

@ -535,11 +535,7 @@ void CIrrDeviceAndroid::createDriver()
case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break;
case video::EDT_SOFTWARE:
case video::EDT_BURNINGSVIDEO:
case video::EDT_OPENGL:
case video::DEPRECATED_EDT_DIRECT3D8_NO_LONGER_EXISTS:
case video::EDT_DIRECT3D9:
os::Printer::log("This driver is not available in Android. Try OpenGL ES 1.0 or ES 2.0.", ELL_ERROR);
break;
default:

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_DEVICE_ANDROID_H_INCLUDED__
#define __C_IRR_DEVICE_ANDROID_H_INCLUDED__
#pragma once
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
@ -100,4 +99,3 @@ namespace irr
} // end namespace irr
#endif // _IRR_COMPILE_WITH_ANDROID_DEVICE_
#endif // __C_IRR_DEVICE_ANDROID_H_INCLUDED__

View File

@ -1,9 +1,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__
#define __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__
#pragma once
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
@ -28,7 +26,7 @@ public:
int getUnicodeChar(int metaState);
private:
static jclass Class_KeyEvent;
static jclass Class_KeyEvent;
static jmethodID Method_getUnicodeChar;
static jmethodID Method_constructor;
JNIEnv* JniEnv;
@ -39,4 +37,3 @@ private:
} // namespace irr
#endif // _IRR_COMPILE_WITH_ANDROID_DEVICE_
#endif // __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __BUILD_IN_FONT_H_INCLUDED__
#define __BUILD_IN_FONT_H_INCLUDED__
#pragma once
// header file generated by Bin2H, copyright 2002 by N.Gebhardt.
// Bin2H is Freeware. Download it freely from www.code3d.com.
@ -1055,5 +1053,3 @@ const u8 BuiltInFontData[] =
const u32 BuiltInFontDataSize = sizeof(BuiltInFontData);
} // end namespace gui
} // end namespace irr
#endif

View File

@ -274,54 +274,23 @@ void CAnimatedMeshSceneNode::render()
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
// for debug purposes only:
bool renderMeshes = true;
video::SMaterial mat;
if (DebugDataVisible && PassCount==1)
for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{
// overwrite half transparency
if (DebugDataVisible & scene::EDS_HALF_TRANSPARENCY)
const bool transparent = driver->needsTransparentRenderPass(Materials[i]);
// only render transparent buffer if this is the transparent render pass
// and solid only in solid pass
if (transparent == isTransparentPass)
{
scene::IMeshBuffer* mb = m->getMeshBuffer(i);
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* mb = m->getMeshBuffer(i);
mat = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->setMaterial(mat);
driver->drawMeshBuffer(mb);
}
renderMeshes = false;
}
}
// render original meshes
if (renderMeshes)
{
for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{
const bool transparent = driver->needsTransparentRenderPass(Materials[i]);
// only render transparent buffer if this is the transparent render pass
// and solid only in solid pass
if (transparent == isTransparentPass)
{
scene::IMeshBuffer* mb = m->getMeshBuffer(i);
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->setMaterial(material);
driver->drawMeshBuffer(mb);
}
driver->setMaterial(material);
driver->drawMeshBuffer(mb);
}
}

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__
#define __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__
#pragma once
#include "IAnimatedMeshSceneNode.h"
#include "IAnimatedMesh.h"
@ -180,6 +179,3 @@ namespace scene
} // end namespace scene
} // end namespace irr
#endif

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ATTRIBUTES_H_INCLUDED__
#define __C_ATTRIBUTES_H_INCLUDED__
#pragma once
#include "IAttributes.h"
#include "IAttribute.h"
@ -148,5 +146,3 @@ protected:
} // end namespace io
} // end namespace irr
#endif

View File

@ -943,19 +943,8 @@ bool CB3DMeshFileLoader::readChunkBRUS()
//Two textures:
if (B3dMaterial.Textures[1])
{
if (B3dMaterial.alpha==1.f)
{
if (B3dMaterial.Textures[1]->Blend == 5) //(Multiply 2)
B3dMaterial.Material.MaterialType = video::EMT_LIGHTMAP_M2;
else
B3dMaterial.Material.MaterialType = video::EMT_LIGHTMAP;
B3dMaterial.Material.Lighting = false;
}
else
{
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
}
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
}
else if (B3dMaterial.Textures[0]) //One texture:
{
@ -967,10 +956,6 @@ bool CB3DMeshFileLoader::readChunkBRUS()
}
else if (B3dMaterial.Textures[0]->Flags & 0x4) //(Masked)
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; // TODO: create color key texture
else if (B3dMaterial.Textures[0]->Flags & 0x40)
B3dMaterial.Material.MaterialType = video::EMT_SPHERE_MAP;
else if (B3dMaterial.Textures[0]->Flags & 0x80)
B3dMaterial.Material.MaterialType = video::EMT_SPHERE_MAP; // TODO: Should be cube map
else if (B3dMaterial.alpha == 1.f)
B3dMaterial.Material.MaterialType = video::EMT_SOLID;
else

View File

@ -7,8 +7,7 @@
// declared public domain
#ifndef __C_B3D_MESH_LOADER_H_INCLUDED__
#define __C_B3D_MESH_LOADER_H_INCLUDED__
#pragma once
#include "IMeshLoader.h"
#include "ISceneManager.h"
@ -82,6 +81,3 @@ private:
} // end namespace scene
} // end namespace irr
#endif // __C_B3D_MESH_LOADER_H_INCLUDED__

View File

@ -4,8 +4,7 @@
// Modified version with rigging/skinning support
#ifndef __IRR_B3D_MESH_WRITER_H_INCLUDED__
#define __IRR_B3D_MESH_WRITER_H_INCLUDED__
#pragma once
#include "IMeshWriter.h"
#include "IWriteFile.h"
@ -50,4 +49,3 @@ private:
} // end namespace
} // end namespace
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_BILLBOARD_SCENE_NODE_H_INCLUDED__
#define __C_BILLBOARD_SCENE_NODE_H_INCLUDED__
#pragma once
#include "IBillboardSceneNode.h"
#include "SMeshBuffer.h"
@ -116,5 +115,3 @@ private:
} // end namespace scene
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef _C_BLIT_H_INCLUDED_
#define _C_BLIT_H_INCLUDED_
#pragma once
#include "SoftwareDriver2_helper.h"
@ -1058,6 +1057,3 @@ static s32 Blit(eBlitter operation,
}
}
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_BONE_SCENE_NODE_H_INCLUDED__
#define __C_BONE_SCENE_NODE_H_INCLUDED__
#pragma once
// Used with SkinnedMesh and IAnimatedMeshSceneNode, for boned meshes
@ -69,5 +68,3 @@ namespace scene
} // end namespace scene
} // end namespace irr
#endif

View File

@ -19,8 +19,7 @@ CCameraSceneNode::CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 i
: ICameraSceneNode(parent, mgr, id, position),
BoundingBox(core::vector3df(0, 0, 0)), // Camera has no size. Still not sure if FLT_MAX might be the better variant
Target(lookat), UpVector(0.0f, 1.0f, 0.0f), ZNear(1.0f), ZFar(3000.0f),
InputReceiverEnabled(true), TargetAndRotationAreBound(false),
HasD3DStyleProjectionMatrix(true)
InputReceiverEnabled(true), TargetAndRotationAreBound(false)
{
#ifdef _DEBUG
setDebugName("CCameraSceneNode");
@ -36,7 +35,6 @@ CCameraSceneNode::CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 i
if ( d->getCurrentRenderTargetSize().Height )
Aspect = (f32)d->getCurrentRenderTargetSize().Width /
(f32)d->getCurrentRenderTargetSize().Height;
HasD3DStyleProjectionMatrix = d->getDriverType() != video::EDT_OPENGL;
}
ViewArea.setFarNearDistance(ZFar - ZNear);
@ -223,7 +221,7 @@ void CCameraSceneNode::setFOV(f32 f)
void CCameraSceneNode::recalculateProjectionMatrix()
{
ViewArea.getTransform ( video::ETS_PROJECTION ).buildProjectionMatrixPerspectiveFovLH(Fovy, Aspect, ZNear, ZFar, HasD3DStyleProjectionMatrix);
ViewArea.getTransform ( video::ETS_PROJECTION ).buildProjectionMatrixPerspectiveFovLH(Fovy, Aspect, ZNear, ZFar, false);
IsOrthogonal = false;
}
@ -296,7 +294,7 @@ void CCameraSceneNode::recalculateViewArea()
core::matrix4 m(core::matrix4::EM4CONST_NOTHING);
m.setbyproduct_nocheck(ViewArea.getTransform(video::ETS_PROJECTION),
ViewArea.getTransform(video::ETS_VIEW));
ViewArea.setFrom(m, HasD3DStyleProjectionMatrix);
ViewArea.setFrom(m, false);
}

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_CAMERA_SCENE_NODE_H_INCLUDED__
#define __C_CAMERA_SCENE_NODE_H_INCLUDED__
#pragma once
#include "ICameraSceneNode.h"
#include "SViewFrustum.h"
@ -162,12 +161,7 @@ namespace scene
bool InputReceiverEnabled;
bool TargetAndRotationAreBound;
bool HasD3DStyleProjectionMatrix; // true: projection from 0 to w; false: -w to w
};
} // end namespace
} // end namespace
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_COLOR_CONVERTER_H_INCLUDED__
#define __C_COLOR_CONVERTER_H_INCLUDED__
#pragma once
#include "irrTypes.h"
#include "IImage.h"
@ -97,5 +96,3 @@ public:
} // end namespace video
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_DUMMY_TRANSFORMATION_SCENE_NODE_H_INCLUDED__
#define __C_DUMMY_TRANSFORMATION_SCENE_NODE_H_INCLUDED__
#pragma once
#include "IDummyTransformationSceneNode.h"
@ -58,5 +57,3 @@ namespace scene
} // end namespace scene
} // end namespace irr
#endif

View File

@ -4,8 +4,6 @@
#include "CEGLManager.h"
#ifdef _IRR_COMPILE_WITH_EGL_MANAGER_
#include "irrString.h"
#include "irrArray.h"
#include "os.h"
@ -44,7 +42,7 @@ bool CEGLManager::initialize(const SIrrlichtCreationParameters& params, const SE
return true;
// Window is depend on platform.
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
#if defined(_IRR_WINDOWS_API_)
EglWindow = (NativeWindowType)Data.OpenGLWin32.HWnd;
Data.OpenGLWin32.HDc = GetDC((HWND)EglWindow);
EglDisplay = eglGetDisplay((NativeDisplayType)Data.OpenGLWin32.HDc);
@ -99,7 +97,7 @@ void CEGLManager::terminate()
EglDisplay = EGL_NO_DISPLAY;
}
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
#if defined(_IRR_WINDOWS_API_)
if (Data.OpenGLWin32.HDc)
{
ReleaseDC((HWND)EglWindow, (HDC)Data.OpenGLWin32.HDc);
@ -664,4 +662,3 @@ bool CEGLManager::testEGLError()
}
}
#endif

View File

@ -2,11 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_EGL_MANAGER_H_INCLUDED__
#define __C_EGL_MANAGER_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_EGL_MANAGER_
#pragma once
#include <EGL/egl.h>
@ -113,5 +109,3 @@ namespace video
};
}
}
#endif
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_EMPTY_SCENE_NODE_H_INCLUDED__
#define __C_EMPTY_SCENE_NODE_H_INCLUDED__
#pragma once
#include "ISceneNode.h"
@ -41,6 +40,3 @@ namespace scene
} // end namespace scene
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_FPSCOUNTER_H_INCLUDED__
#define __C_FPSCOUNTER_H_INCLUDED__
#pragma once
#include "irrTypes.h"
@ -48,7 +47,3 @@ private:
} // end namespace video
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_FILE_LIST_H_INCLUDED__
#define __C_FILE_LIST_H_INCLUDED__
#pragma once
#include "IFileList.h"
#include "irrString.h"
@ -132,7 +131,3 @@ protected:
} // end namespace irr
} // end namespace io
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_FILE_SYSTEM_H_INCLUDED__
#define __C_FILE_SYSTEM_H_INCLUDED__
#pragma once
#include "IFileSystem.h"
#include "irrArray.h"
@ -140,6 +139,3 @@ private:
} // end namespace irr
} // end namespace io
#endif

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_GLX_MANAGER_H_INCLUDED__
#define __C_GLX_MANAGER_H_INCLUDED__
#pragma once
#ifdef _IRR_COMPILE_WITH_GLX_MANAGER_
@ -76,6 +74,3 @@ namespace video
}
#endif
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_BUTTON_H_INCLUDED__
#define __C_GUI_BUTTON_H_INCLUDED__
#pragma once
#include "IGUIButton.h"
#include "IGUISpriteBank.h"
@ -240,5 +239,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_BUTTON_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_CHECKBOX_H_INCLUDED__
#define __C_GUI_CHECKBOX_H_INCLUDED__
#pragma once
#include "IGUICheckBox.h"
@ -56,5 +55,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_CHECKBOX_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_COMBO_BOX_H_INCLUDED__
#define __C_GUI_COMBO_BOX_H_INCLUDED__
#pragma once
#include "IGUIComboBox.h"
#include "IGUIStaticText.h"
@ -103,5 +102,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_COMBO_BOX_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_EDIT_BOX_H_INCLUDED__
#define __C_GUI_EDIT_BOX_H_INCLUDED__
#pragma once
#include "IGUIEditBox.h"
#include "irrArray.h"
@ -197,5 +196,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_EDIT_BOX_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_ENVIRONMENT_H_INCLUDED__
#define __C_GUI_ENVIRONMENT_H_INCLUDED__
#pragma once
#include "IGUIEnvironment.h"
#include "IGUIElement.h"
@ -227,5 +226,3 @@ private:
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_ENVIRONMENT_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
#define __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__
#pragma once
#include "IGUIFileOpenDialog.h"
#include "IGUIButton.h"
@ -86,5 +85,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_FILE_OPEN_DIALOG_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_FONT_H_INCLUDED__
#define __C_GUI_FONT_H_INCLUDED__
#pragma once
#include "IGUIFontBitmap.h"
#include "irrString.h"
@ -107,5 +106,3 @@ private:
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_FONT_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_IMAGE_H_INCLUDED__
#define __C_GUI_IMAGE_H_INCLUDED__
#pragma once
#include "IGUIImage.h"
@ -98,5 +97,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_IMAGE_H_INCLUDED__

View File

@ -1,8 +1,7 @@
// This file is part of the "Irrlicht Engine".
// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
#ifndef __C_GUI_IMAGE_LIST_H_INCLUDED__
#define __C_GUI_IMAGE_LIST_H_INCLUDED__
#pragma once
#include "IGUIImageList.h"
#include "IVideoDriver.h"
@ -62,6 +61,3 @@ private:
} // end namespace gui
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_LIST_BOX_H_INCLUDED__
#define __C_GUI_LIST_BOX_H_INCLUDED__
#pragma once
#include "IGUIListBox.h"
#include "irrArray.h"
@ -174,5 +173,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_SCROLL_BAR_H_INCLUDED__
#define __C_GUI_SCROLL_BAR_H_INCLUDED__
#pragma once
#include "IGUIScrollBar.h"
#include "IGUIButton.h"
@ -97,5 +96,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_SKIN_H_INCLUDED__
#define __C_GUI_SKIN_H_INCLUDED__
#pragma once
#include "IGUISkin.h"
#include "irrString.h"
@ -230,5 +229,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_SPRITE_BANK_H_INCLUDED__
#define __C_GUI_SPRITE_BANK_H_INCLUDED__
#pragma once
#include "IGUISpriteBank.h"
@ -83,5 +82,3 @@ protected:
} // end namespace gui
} // end namespace irr
#endif // __C_GUI_SPRITE_BANK_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_STATIC_TEXT_H_INCLUDED__
#define __C_GUI_STATIC_TEXT_H_INCLUDED__
#pragma once
#include "IGUIStaticText.h"
#include "irrArray.h"
@ -132,5 +131,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_TAB_CONTROL_H_INCLUDED__
#define __C_GUI_TAB_CONTROL_H_INCLUDED__
#pragma once
#include "IGUITabControl.h"
#include "irrArray.h"
@ -180,5 +179,3 @@ namespace gui
} // end namespace gui
} // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IMAGE_H_INCLUDED__
#define __C_IMAGE_H_INCLUDED__
#pragma once
#include "IImage.h"
#include "rect.h"
@ -74,7 +73,3 @@ private:
} // end namespace video
} // end namespace irr
#endif

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IMAGE_LOADER_BMP_H_INCLUDED__
#define __C_IMAGE_LOADER_BMP_H_INCLUDED__
#pragma once
#include "IImageLoader.h"
@ -85,5 +83,3 @@ private:
} // end namespace video
} // end namespace irr
#endif

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IMAGE_LOADER_JPG_H_INCLUDED__
#define __C_IMAGE_LOADER_JPG_H_INCLUDED__
#pragma once
#include "IImageLoader.h"
@ -91,6 +89,3 @@ private:
} // end namespace video
} // end namespace irr
#endif

View File

@ -6,9 +6,7 @@
// i wanted to be able to read in PNG images with irrlicht :)
// why? lossless compression with 8-bit alpha channel!
#ifndef __C_IMAGE_LOADER_PNG_H_INCLUDED__
#define __C_IMAGE_LOADER_PNG_H_INCLUDED__
#pragma once
#include "IImageLoader.h"
@ -36,5 +34,3 @@ public:
} // end namespace video
} // end namespace irr
#endif

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IMAGE_LOADER_TGA_H_INCLUDED__
#define __C_IMAGE_LOADER_TGA_H_INCLUDED__
#pragma once
#include "IImageLoader.h"
@ -68,5 +66,3 @@ private:
} // end namespace video
} // end namespace irr
#endif

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef _C_IMAGE_WRITER_JPG_H_INCLUDED__
#define _C_IMAGE_WRITER_JPG_H_INCLUDED__
#pragma once
#include "IImageWriter.h"
@ -28,5 +26,3 @@ public:
}
}
#endif // _C_IMAGE_WRITER_JPG_H_INCLUDED__

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef _C_IMAGE_WRITER_PNG_H_INCLUDED__
#define _C_IMAGE_WRITER_PNG_H_INCLUDED__
#pragma once
#include "IImageWriter.h"
@ -28,5 +26,3 @@ public:
} // namespace video
} // namespace irr
#endif // _C_IMAGE_WRITER_PNG_H_INCLUDED__

View File

@ -332,7 +332,7 @@ void CIrrDeviceLinux::setupTopLevelXorgWindow()
Atom NET_WM_PID = XInternAtom(XDisplay, "_NET_WM_PID", false);
pid_t pid = getpid();
long pid = static_cast<long>(getpid());
XChangeProperty(XDisplay, XWindow, NET_WM_PID,
XA_CARDINAL, 32, PropModeReplace,
@ -633,11 +633,6 @@ void CIrrDeviceLinux::createDriver()
os::Printer::log("No WebGL1 support compiled in.", ELL_ERROR);
#endif
break;
case video::DEPRECATED_EDT_DIRECT3D8_NO_LONGER_EXISTS:
case video::EDT_DIRECT3D9:
os::Printer::log("This driver is not available in Linux. Try OpenGL or Software renderer.",
ELL_ERROR);
break;
case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break;
@ -1485,7 +1480,7 @@ void CIrrDeviceLinux::createKeyMap()
KeyMap.push_back(SKeyMap(XK_Next, KEY_NEXT));
KeyMap.push_back(SKeyMap(XK_Page_Down, KEY_NEXT));
KeyMap.push_back(SKeyMap(XK_End, KEY_END));
KeyMap.push_back(SKeyMap(XK_Begin, KEY_HOME));
KeyMap.push_back(SKeyMap(XK_Begin, KEY_NUMPAD5));
KeyMap.push_back(SKeyMap(XK_Num_Lock, KEY_NUMLOCK));
KeyMap.push_back(SKeyMap(XK_KP_Space, KEY_SPACE));
KeyMap.push_back(SKeyMap(XK_KP_Tab, KEY_TAB));
@ -1505,7 +1500,7 @@ void CIrrDeviceLinux::createKeyMap()
KeyMap.push_back(SKeyMap(XK_KP_Next, KEY_NEXT));
KeyMap.push_back(SKeyMap(XK_KP_Page_Down, KEY_NEXT));
KeyMap.push_back(SKeyMap(XK_KP_End, KEY_END));
KeyMap.push_back(SKeyMap(XK_KP_Begin, KEY_HOME));
KeyMap.push_back(SKeyMap(XK_KP_Begin, KEY_NUMPAD5));
KeyMap.push_back(SKeyMap(XK_KP_Insert, KEY_INSERT));
KeyMap.push_back(SKeyMap(XK_KP_Delete, KEY_DELETE));
KeyMap.push_back(SKeyMap(XK_KP_Equal, 0)); // ???

Some files were not shown because too many files have changed in this diff Show More