16 Commits

Author SHA1 Message Date
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
144 changed files with 559 additions and 3023 deletions

View File

@ -200,7 +200,7 @@ jobs:
./bin/OSX/AutomatedTest null ./bin/OSX/AutomatedTest null
msvc: msvc:
name: VS 2019 ${{ matrix.config.arch }} name: VS 2019 ${{ matrix.config.arch }} ${{ matrix.sdl.label }}
runs-on: windows-2019 runs-on: windows-2019
env: env:
VCPKG_VERSION: 14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44 VCPKG_VERSION: 14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44
@ -218,6 +218,14 @@ jobs:
arch: x64 arch: x64
generator: "-G'Visual Studio 16 2019' -A x64" generator: "-G'Visual Studio 16 2019' -A x64"
vcpkg_triplet: x64-windows vcpkg_triplet: x64-windows
sdl:
-
use: FALSE
label: '(no SDL)'
-
use: TRUE
label: '(with SDL)'
vcpkg_packages: sdl2
steps: steps:
- name: Checkout - name: Checkout
@ -226,7 +234,7 @@ jobs:
- name: Restore from cache and run vcpkg - name: Restore from cache and run vcpkg
uses: lukka/run-vcpkg@v7 uses: lukka/run-vcpkg@v7
with: with:
vcpkgArguments: ${{env.vcpkg_packages}} vcpkgArguments: ${{env.vcpkg_packages}} ${{matrix.sdl.vcpkg_packages}}
vcpkgDirectory: '${{ github.workspace }}\vcpkg' vcpkgDirectory: '${{ github.workspace }}\vcpkg'
appendedCacheKey: ${{ matrix.config.vcpkg_triplet }} appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
vcpkgGitCommitId: ${{ env.VCPKG_VERSION }} vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
@ -235,6 +243,7 @@ jobs:
- name: CMake - name: CMake
run: | run: |
cmake ${{matrix.config.generator}} ` cmake ${{matrix.config.generator}} `
-DUSE_SDL2=${{matrix.sdl.use}} `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" ` -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-DCMAKE_BUILD_TYPE=Release . -DCMAKE_BUILD_TYPE=Release .

3
.gitignore vendored
View File

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

View File

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

View File

@ -100,10 +100,12 @@ int main(int argc, char *argv[])
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh); scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
if (node) 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->setFrameLoop(0, 29);
node->setAnimationSpeed(30); node->setAnimationSpeed(30);
node->setMaterialTexture(0, tex);
} }
} }

View File

@ -1,4 +1,4 @@
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(IRREXAMPLES set(IRREXAMPLES

View File

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

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. */ diffuse material. */
EMT_SOLID = 0, 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. //! Makes the material transparent based on the texture alpha channel.
/** The final color is blended together from the destination /** The final color is blended together from the destination
color and the texture color, using the alpha channel value as 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. //! Makes the material transparent based on the vertex alpha value.
EMT_TRANSPARENT_VERTEX_ALPHA, 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 ) //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
/** Using only first texture. Generic blending method. /** Using only first texture. Generic blending method.
The blend function is set to SMaterial::MaterialTypeParam with The blend function is set to SMaterial::MaterialTypeParam with
@ -135,22 +60,9 @@ namespace video
const char* const sBuiltInMaterialTypeNames[] = const char* const sBuiltInMaterialTypeNames[] =
{ {
"solid", "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",
"trans_alphach_ref", "trans_alphach_ref",
"trans_vertex_alpha", "trans_vertex_alpha",
"trans_reflection_2layer",
"onetexture_blend", "onetexture_blend",
0 0
}; };

View File

@ -97,11 +97,6 @@ namespace scene
/** \param box New bounding box to use for the mesh. */ /** \param box New bounding box to use for the mesh. */
virtual void setBoundingBox( const core::aabbox3df& box) = 0; 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 //! Set the hardware mapping hint
/** This methods allows to define optimization hints for the /** This methods allows to define optimization hints for the
hardware. This enables, e.g., the use of hardware buffers on hardware. This enables, e.g., the use of hardware buffers on

View File

@ -352,38 +352,14 @@ namespace scene
} }
//! Sets all material flags at once to a new value. //! Execute a function on all materials of this scene node.
/** Useful, for example, if you want the whole mesh to be /** Useful for setting material properties, e.g. if you want the whole
affected by light. mesh to be affected by light. */
\param flag Which flag of all materials to be set. template <typename F>
\param newvalue New value of that flag. */ void forEachMaterial(F &&fn) {
void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) for (u32 i = 0; i < getMaterialCount(); i++) {
{ fn(getMaterial(i));
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;
} }

View File

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

View File

@ -147,13 +147,6 @@ namespace scene
return Meshes[0]->getMeshBuffer(material); 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 //! set the hardware mapping hint, for driver
void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) override void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) override
{ {

View File

@ -10,7 +10,7 @@
#include "irrArray.h" #include "irrArray.h"
#include "irrMath.h" #include "irrMath.h"
#include "EMaterialTypes.h" #include "EMaterialTypes.h"
#include "EMaterialFlags.h" #include "EMaterialProps.h"
#include "SMaterialLayer.h" #include "SMaterialLayer.h"
#include "IrrCompileConfig.h" // for IRRLICHT_API #include "IrrCompileConfig.h" // for IRRLICHT_API
@ -256,7 +256,7 @@ namespace video
EZW_OFF = 0, EZW_OFF = 0,
//! This is the default setting for SMaterial and tries to handle things automatically. //! 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. //! 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. //! Basically Irrlicht tries to handle the zwriting for you and assumes transparent materials don't need it.
//! This is addionally affected by IVideoDriver::setAllowZWriteOnTransparent //! This is addionally affected by IVideoDriver::setAllowZWriteOnTransparent
@ -292,7 +292,7 @@ namespace video
SMaterial() SMaterial()
: MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255), : MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
EmissiveColor(0,0,0,0), SpecularColor(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), Shininess(0.0f), MaterialTypeParam(0.0f), Thickness(1.0f),
ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), BlendFactor(0.0f), ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), BlendFactor(0.0f),
PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT), PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
@ -303,7 +303,7 @@ namespace video
{ } { }
//! Texture layer array. //! Texture layer array.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES]; SMaterialLayer TextureLayers[MATERIAL_MAX_TEXTURES];
//! Type of the material. Specifies how everything is blended together //! Type of the material. Specifies how everything is blended together
E_MATERIAL_TYPE MaterialType; E_MATERIAL_TYPE MaterialType;
@ -350,10 +350,6 @@ namespace video
EMT_TRANSPARENT_ALPHA_CHANNEL and EMT_ONETEXTURE_BLEND. */ EMT_TRANSPARENT_ALPHA_CHANNEL and EMT_ONETEXTURE_BLEND. */
f32 MaterialTypeParam; f32 MaterialTypeParam;
//! Second free parameter, dependent on the material type.
/** Mostly ignored. */
f32 MaterialTypeParam2;
//! Thickness of non-3dimensional elements such as lines and points. //! Thickness of non-3dimensional elements such as lines and points.
f32 Thickness; f32 Thickness;
@ -430,9 +426,6 @@ namespace video
f32 PolygonOffsetSlopeScale; f32 PolygonOffsetSlopeScale;
//! Draw as wireframe or filled triangles? Default: false //! 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; bool Wireframe:1;
//! Draw as point cloud or filled triangles? Default: false //! Draw as point cloud or filled triangles? Default: false
@ -466,12 +459,22 @@ namespace video
/** Sometimes, disabling mipmap usage can be useful. Default: true */ /** Sometimes, disabling mipmap usage can be useful. Default: true */
bool UseMipMaps:1; 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 //! Gets the texture transformation matrix for level i
/** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES /** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES
\return Texture matrix for texture level i. */ \return Texture matrix for texture level i. */
core::matrix4& getTextureMatrix(u32 i) core::matrix4& getTextureMatrix(u32 i)
{ {
return TextureLayer[i].getTextureMatrix(); return TextureLayers[i].getTextureMatrix();
} }
//! Gets the immutable texture transformation matrix for level i //! Gets the immutable texture transformation matrix for level i
@ -480,7 +483,7 @@ namespace video
const core::matrix4& getTextureMatrix(u32 i) const const core::matrix4& getTextureMatrix(u32 i) const
{ {
if (i<MATERIAL_MAX_TEXTURES) if (i<MATERIAL_MAX_TEXTURES)
return TextureLayer[i].getTextureMatrix(); return TextureLayers[i].getTextureMatrix();
else else
return core::IdentityMatrix; return core::IdentityMatrix;
} }
@ -492,7 +495,7 @@ namespace video
{ {
if (i>=MATERIAL_MAX_TEXTURES) if (i>=MATERIAL_MAX_TEXTURES)
return; return;
TextureLayer[i].setTextureMatrix(mat); TextureLayers[i].setTextureMatrix(mat);
} }
//! Gets the i-th texture //! Gets the i-th texture
@ -500,7 +503,7 @@ namespace video
\return Texture for texture level i, if defined, else 0. */ \return Texture for texture level i, if defined, else 0. */
ITexture* getTexture(u32 i) const 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 //! Sets the i-th texture
@ -511,144 +514,7 @@ namespace video
{ {
if (i>=MATERIAL_MAX_TEXTURES) if (i>=MATERIAL_MAX_TEXTURES)
return; return;
TextureLayer[i].Texture = tex; TextureLayers[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;
} }
//! Inequality operator //! Inequality operator
@ -664,7 +530,6 @@ namespace video
SpecularColor != b.SpecularColor || SpecularColor != b.SpecularColor ||
Shininess != b.Shininess || Shininess != b.Shininess ||
MaterialTypeParam != b.MaterialTypeParam || MaterialTypeParam != b.MaterialTypeParam ||
MaterialTypeParam2 != b.MaterialTypeParam2 ||
Thickness != b.Thickness || Thickness != b.Thickness ||
Wireframe != b.Wireframe || Wireframe != b.Wireframe ||
PointCloud != b.PointCloud || PointCloud != b.PointCloud ||
@ -689,7 +554,7 @@ namespace video
; ;
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i) for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)
{ {
different |= (TextureLayer[i] != b.TextureLayer[i]); different |= (TextureLayers[i] != b.TextureLayers[i]);
} }
return different; return different;
} }
@ -728,10 +593,8 @@ namespace video
//! as it asks the material renders directly what they do with the material. //! as it asks the material renders directly what they do with the material.
bool isTransparent() const bool isTransparent() const
{ {
if ( MaterialType==EMT_TRANSPARENT_ADD_COLOR || if ( MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL ||
MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL || MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA )
MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA ||
MaterialType==EMT_TRANSPARENT_REFLECTION_2_LAYER )
return true; return true;
return false; return false;

View File

@ -43,6 +43,32 @@ namespace video
"texture_clamp_mirror_clamp_to_edge", "texture_clamp_mirror_clamp_to_edge",
"texture_clamp_mirror_clamp_to_border", 0}; "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 //! Struct for holding material parameters which exist per texture layer
// Note for implementors: Serialization is in CNullDriver // Note for implementors: Serialization is in CNullDriver
class SMaterialLayer class SMaterialLayer
@ -50,7 +76,7 @@ namespace video
public: public:
//! Default constructor //! Default constructor
SMaterialLayer() : Texture(0), TextureWrapU(ETC_REPEAT), TextureWrapV(ETC_REPEAT), TextureWrapW(ETC_REPEAT), 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; TextureWrapU = other.TextureWrapU;
TextureWrapV = other.TextureWrapV; TextureWrapV = other.TextureWrapV;
TextureWrapW = other.TextureWrapW; TextureWrapW = other.TextureWrapW;
BilinearFilter = other.BilinearFilter; MinFilter = other.MinFilter;
TrilinearFilter = other.TrilinearFilter; MagFilter = other.MagFilter;
AnisotropicFilter = other.AnisotropicFilter; AnisotropicFilter = other.AnisotropicFilter;
LODBias = other.LODBias; LODBias = other.LODBias;
@ -157,8 +183,8 @@ namespace video
TextureWrapU != b.TextureWrapU || TextureWrapU != b.TextureWrapU ||
TextureWrapV != b.TextureWrapV || TextureWrapV != b.TextureWrapV ||
TextureWrapW != b.TextureWrapW || TextureWrapW != b.TextureWrapW ||
BilinearFilter != b.BilinearFilter || MinFilter != b.MinFilter ||
TrilinearFilter != b.TrilinearFilter || MagFilter != b.MagFilter ||
AnisotropicFilter != b.AnisotropicFilter || AnisotropicFilter != b.AnisotropicFilter ||
LODBias != b.LODBias; LODBias != b.LODBias;
if (different) if (different)
@ -184,13 +210,11 @@ namespace video
u8 TextureWrapV:4; u8 TextureWrapV:4;
u8 TextureWrapW:4; u8 TextureWrapW:4;
//! Is bilinear filtering enabled? Default: true //! Minification (downscaling) filter
bool BilinearFilter:1; E_TEXTURE_MIN_FILTER MinFilter;
//! Is trilinear filtering enabled? Default: false //! Magnification (upscaling) filter
/** If the trilinear filter flag is enabled, E_TEXTURE_MAG_FILTER MagFilter;
the bilinear filtering flag is ignored. */
bool TrilinearFilter:1;
//! Is anisotropic filtering enabled? Default: 0, disabled //! Is anisotropic filtering enabled? Default: 0, disabled
/** In Irrlicht you can use anisotropic texture filtering /** In Irrlicht you can use anisotropic texture filtering
@ -208,6 +232,16 @@ namespace video
if the value is positive. */ if the value is positive. */
s8 LODBias; s8 LODBias;
//! Sets the MinFilter, MagFilter and AnisotropicFilter properties according
//! to the three relevant boolean values found in the Minetest settings.
/** The value of `trilinear` takes precedence over the value of `bilinear`. */
void setFiltersMinetest(bool bilinear, bool trilinear, bool anisotropic) {
MinFilter = trilinear ? ETMINF_LINEAR_MIPMAP_LINEAR :
(bilinear ? ETMINF_LINEAR_MIPMAP_NEAREST : ETMINF_NEAREST_MIPMAP_NEAREST);
MagFilter = (trilinear || bilinear) ? ETMAGF_LINEAR : ETMAGF_NEAREST;
AnisotropicFilter = anisotropic ? 0xFF : 0;
}
private: private:
friend class SMaterial; friend class SMaterial;

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 //! set the hardware mapping hint, for driver
void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) override 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; SMaterial Material;
//! Which values are overridden //! Which values are overridden
/** OR'ed values from E_MATERIAL_FLAGS. */ /** OR'ed values from E_MATERIAL_PROPS. */
u32 EnableFlags; u32 EnableProps;
//! For those flags in EnableFlags which affect layers, set which of the layers are affected //! For those properties in EnableProps which affect layers, set which of the layers are affected
bool EnableLayerFlags[MATERIAL_MAX_TEXTURES]; bool EnableLayerProps[MATERIAL_MAX_TEXTURES];
//! Which textures are overridden //! Which textures are overridden
bool EnableTextures[MATERIAL_MAX_TEXTURES]; 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]; bool EnableLayers[MATERIAL_MAX_TEXTURES];
//! Set in which render passes the material override is active. //! Set in which render passes the material override is active.
@ -59,19 +59,19 @@ namespace video
core::array<SMaterialTypeReplacement> MaterialTypes; core::array<SMaterialTypeReplacement> MaterialTypes;
//! Default constructor //! 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() void reset()
{ {
EnableFlags = 0; EnableProps = 0;
EnablePasses = 0; EnablePasses = 0;
Enabled = false; Enabled = false;
for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i) 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; EnableTextures[i] = false;
EnableLayers[i] = false; EnableLayers[i] = false;
} }
@ -92,65 +92,65 @@ namespace video
for (u32 f=0; f<32; ++f) for (u32 f=0; f<32; ++f)
{ {
const u32 num=(1<<f); const u32 num=(1<<f);
if (EnableFlags & num) if (EnableProps & num)
{ {
switch (num) switch (num)
{ {
case EMF_WIREFRAME: material.Wireframe = Material.Wireframe; break; case EMP_WIREFRAME: material.Wireframe = Material.Wireframe; break;
case EMF_POINTCLOUD: material.PointCloud = Material.PointCloud; break; case EMP_POINTCLOUD: material.PointCloud = Material.PointCloud; break;
case EMF_GOURAUD_SHADING: material.GouraudShading = Material.GouraudShading; break; case EMP_GOURAUD_SHADING: material.GouraudShading = Material.GouraudShading; break;
case EMF_LIGHTING: material.Lighting = Material.Lighting; break; case EMP_LIGHTING: material.Lighting = Material.Lighting; break;
case EMF_ZBUFFER: material.ZBuffer = Material.ZBuffer; break; case EMP_ZBUFFER: material.ZBuffer = Material.ZBuffer; break;
case EMF_ZWRITE_ENABLE: material.ZWriteEnable = Material.ZWriteEnable; break; case EMP_ZWRITE_ENABLE: material.ZWriteEnable = Material.ZWriteEnable; break;
case EMF_BACK_FACE_CULLING: material.BackfaceCulling = Material.BackfaceCulling; break; case EMP_BACK_FACE_CULLING: material.BackfaceCulling = Material.BackfaceCulling; break;
case EMF_FRONT_FACE_CULLING: material.FrontfaceCulling = Material.FrontfaceCulling; break; case EMP_FRONT_FACE_CULLING: material.FrontfaceCulling = Material.FrontfaceCulling; break;
case EMF_BILINEAR_FILTER: case EMP_MIN_FILTER:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 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; break;
case EMF_TRILINEAR_FILTER: case EMP_MAG_FILTER:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 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; break;
case EMF_ANISOTROPIC_FILTER: case EMP_ANISOTROPIC_FILTER:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 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; break;
case EMF_FOG_ENABLE: material.FogEnable = Material.FogEnable; break; case EMP_FOG_ENABLE: material.FogEnable = Material.FogEnable; break;
case EMF_NORMALIZE_NORMALS: material.NormalizeNormals = Material.NormalizeNormals; break; case EMP_NORMALIZE_NORMALS: material.NormalizeNormals = Material.NormalizeNormals; break;
case EMF_TEXTURE_WRAP: case EMP_TEXTURE_WRAP:
for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) for ( u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{ {
if ( EnableLayerFlags[i] ) if ( EnableLayerProps[i] )
{ {
material.TextureLayer[i].TextureWrapU = Material.TextureLayer[i].TextureWrapU; material.TextureLayers[i].TextureWrapU = Material.TextureLayers[i].TextureWrapU;
material.TextureLayer[i].TextureWrapV = Material.TextureLayer[i].TextureWrapV; material.TextureLayers[i].TextureWrapV = Material.TextureLayers[i].TextureWrapV;
material.TextureLayer[i].TextureWrapW = Material.TextureLayer[i].TextureWrapW; material.TextureLayers[i].TextureWrapW = Material.TextureLayers[i].TextureWrapW;
} }
} }
break; break;
case EMF_ANTI_ALIASING: material.AntiAliasing = Material.AntiAliasing; break; case EMP_ANTI_ALIASING: material.AntiAliasing = Material.AntiAliasing; break;
case EMF_COLOR_MASK: material.ColorMask = Material.ColorMask; break; case EMP_COLOR_MASK: material.ColorMask = Material.ColorMask; break;
case EMF_COLOR_MATERIAL: material.ColorMaterial = Material.ColorMaterial; break; case EMP_COLOR_MATERIAL: material.ColorMaterial = Material.ColorMaterial; break;
case EMF_USE_MIP_MAPS: material.UseMipMaps = Material.UseMipMaps; break; case EMP_USE_MIP_MAPS: material.UseMipMaps = Material.UseMipMaps; break;
case EMF_BLEND_OPERATION: material.BlendOperation = Material.BlendOperation; break; case EMP_BLEND_OPERATION: material.BlendOperation = Material.BlendOperation; break;
case EMF_BLEND_FACTOR: material.BlendFactor = Material.BlendFactor; break; case EMP_BLEND_FACTOR: material.BlendFactor = Material.BlendFactor; break;
case EMF_POLYGON_OFFSET: case EMP_POLYGON_OFFSET:
material.PolygonOffsetDirection = Material.PolygonOffsetDirection; material.PolygonOffsetDirection = Material.PolygonOffsetDirection;
material.PolygonOffsetFactor = Material.PolygonOffsetFactor; material.PolygonOffsetFactor = Material.PolygonOffsetFactor;
material.PolygonOffsetDepthBias = Material.PolygonOffsetDepthBias; material.PolygonOffsetDepthBias = Material.PolygonOffsetDepthBias;
@ -163,11 +163,11 @@ namespace video
{ {
if ( EnableLayers[i] ) if ( EnableLayers[i] )
{ {
material.TextureLayer[i] = Material.TextureLayer[i]; material.TextureLayers[i] = Material.TextureLayers[i];
} }
else if ( EnableTextures[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. //! Iterator to iterate through a UTF-16 string.
class _ustring16_const_iterator : public std::iterator< class _ustring16_const_iterator
std::bidirectional_iterator_tag, // iterator_category
access, // value_type
ptrdiff_t, // difference_type
const access, // pointer
const access // reference
>
{ {
public: public:
typedef _ustring16_const_iterator _Iter; 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_pointer;
typedef const access const_reference; typedef const access const_reference;
typedef ptrdiff_t distance_type;
typedef typename _Base::value_type value_type; // stuff for std::iterator_traits
typedef typename _Base::difference_type difference_type; typedef std::bidirectional_iterator_tag iterator_category;
typedef typename _Base::difference_type distance_type; typedef access value_type;
typedef typename _Base::pointer pointer; typedef distance_type difference_type;
typedef const access pointer;
typedef const_reference reference; typedef const_reference reference;
//! Constructors. //! Constructors.

View File

@ -42,7 +42,7 @@
#include "EGUIAlignment.h" #include "EGUIAlignment.h"
#include "EGUIElementTypes.h" #include "EGUIElementTypes.h"
#include "EHardwareBufferFlags.h" #include "EHardwareBufferFlags.h"
#include "EMaterialFlags.h" #include "EMaterialProps.h"
#include "EMaterialTypes.h" #include "EMaterialTypes.h"
#include "EMeshWriterEnums.h" #include "EMeshWriterEnums.h"
#include "ESceneNodeTypes.h" #include "ESceneNodeTypes.h"

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);
}

View File

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

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_DEVICE_ANDROID_H_INCLUDED__ #pragma once
#define __C_IRR_DEVICE_ANDROID_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_ #ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
@ -100,4 +99,3 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_ANDROID_DEVICE_ #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". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__ #pragma once
#define __C_IRR_KEY_EVENT_WRAPPER_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_ #ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
@ -28,7 +26,7 @@ public:
int getUnicodeChar(int metaState); int getUnicodeChar(int metaState);
private: private:
static jclass Class_KeyEvent; static jclass Class_KeyEvent;
static jmethodID Method_getUnicodeChar; static jmethodID Method_getUnicodeChar;
static jmethodID Method_constructor; static jmethodID Method_constructor;
JNIEnv* JniEnv; JNIEnv* JniEnv;
@ -39,4 +37,3 @@ private:
} // namespace irr } // namespace irr
#endif // _IRR_COMPILE_WITH_ANDROID_DEVICE_ #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". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __BUILD_IN_FONT_H_INCLUDED__ #pragma once
#define __BUILD_IN_FONT_H_INCLUDED__
// header file generated by Bin2H, copyright 2002 by N.Gebhardt. // header file generated by Bin2H, copyright 2002 by N.Gebhardt.
// Bin2H is Freeware. Download it freely from www.code3d.com. // Bin2H is Freeware. Download it freely from www.code3d.com.
@ -1055,5 +1053,3 @@ const u8 BuiltInFontData[] =
const u32 BuiltInFontDataSize = sizeof(BuiltInFontData); const u32 BuiltInFontDataSize = sizeof(BuiltInFontData);
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr
#endif

View File

@ -274,54 +274,23 @@ void CAnimatedMeshSceneNode::render()
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
// for debug purposes only: for (u32 i=0; i<m->getMeshBufferCount(); ++i)
bool renderMeshes = true;
video::SMaterial mat;
if (DebugDataVisible && PassCount==1)
{ {
// overwrite half transparency const bool transparent = driver->needsTransparentRenderPass(Materials[i]);
if (DebugDataVisible & scene::EDS_HALF_TRANSPARENCY)
// 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) driver->setMaterial(material);
{ driver->drawMeshBuffer(mb);
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);
}
} }
} }

View File

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

View File

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

View File

@ -943,19 +943,8 @@ bool CB3DMeshFileLoader::readChunkBRUS()
//Two textures: //Two textures:
if (B3dMaterial.Textures[1]) if (B3dMaterial.Textures[1])
{ {
if (B3dMaterial.alpha==1.f) B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
{ B3dMaterial.Material.ZWriteEnable = video::EZW_OFF;
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;
}
} }
else if (B3dMaterial.Textures[0]) //One texture: else if (B3dMaterial.Textures[0]) //One texture:
{ {
@ -967,10 +956,6 @@ bool CB3DMeshFileLoader::readChunkBRUS()
} }
else if (B3dMaterial.Textures[0]->Flags & 0x4) //(Masked) else if (B3dMaterial.Textures[0]->Flags & 0x4) //(Masked)
B3dMaterial.Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; // TODO: create color key texture 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) else if (B3dMaterial.alpha == 1.f)
B3dMaterial.Material.MaterialType = video::EMT_SOLID; B3dMaterial.Material.MaterialType = video::EMT_SOLID;
else else

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_EGL_MANAGER_H_INCLUDED__ #pragma once
#define __C_EGL_MANAGER_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_EGL_MANAGER_ #ifdef _IRR_COMPILE_WITH_EGL_MANAGER_
@ -114,4 +112,3 @@ namespace video
} }
} }
#endif #endif
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_DEVICE_LINUX_H_INCLUDED__ #pragma once
#define __C_IRR_DEVICE_LINUX_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_ #ifdef _IRR_COMPILE_WITH_X11_DEVICE_
@ -483,5 +481,3 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_X11_DEVICE_ #endif // _IRR_COMPILE_WITH_X11_DEVICE_
#endif // __C_IRR_DEVICE_LINUX_H_INCLUDED__

View File

@ -3,9 +3,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_IRR_DEVICE_OSX_H_INCLUDED__ #pragma once
#define __C_IRR_DEVICE_OSX_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_ #ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
@ -249,5 +247,3 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_OSX_DEVICE_ #endif // _IRR_COMPILE_WITH_OSX_DEVICE_
#endif // __C_IRR_DEVICE_MACOSX_H_INCLUDED__

View File

@ -555,7 +555,7 @@ bool CIrrDeviceSDL::run()
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT; irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL; irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
irrevent.MouseInput.Wheel = static_cast<float>(SDL_event.wheel.y); irrevent.MouseInput.Wheel = SDL_event.wheel.preciseY;
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0; irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0; irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
irrevent.MouseInput.X = MouseX; irrevent.MouseInput.X = MouseX;

View File

@ -4,9 +4,7 @@
// This device code is based on the original SDL device implementation // This device code is based on the original SDL device implementation
// contributed by Shane Parker (sirshane). // contributed by Shane Parker (sirshane).
#ifndef __C_IRR_DEVICE_SDL_H_INCLUDED__ #pragma once
#define __C_IRR_DEVICE_SDL_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_ #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
@ -325,5 +323,3 @@ namespace irr
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_SDL_DEVICE_ #endif // _IRR_COMPILE_WITH_SDL_DEVICE_
#endif // __C_IRR_DEVICE_SDL_H_INCLUDED__

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_DEVICE_STUB_H_INCLUDED__ #pragma once
#define __C_IRR_DEVICE_STUB_H_INCLUDED__
#include "IrrlichtDevice.h" #include "IrrlichtDevice.h"
#include "SIrrCreationParameters.h" #include "SIrrCreationParameters.h"
@ -206,6 +205,3 @@ namespace irr
}; };
} // end namespace irr } // end namespace irr
#endif

View File

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

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_LIMIT_READ_FILE_H_INCLUDED__ #pragma once
#define __C_LIMIT_READ_FILE_H_INCLUDED__
#include "IReadFile.h" #include "IReadFile.h"
#include "irrString.h" #include "irrString.h"
@ -63,6 +62,3 @@ namespace io
} // end namespace io } // end namespace io
} // end namespace irr } // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_LOGGER_H_INCLUDED__ #pragma once
#define __C_LOGGER_H_INCLUDED__
#include "ILogger.h" #include "ILogger.h"
#include "os.h" #include "os.h"
@ -51,6 +50,3 @@ private:
}; };
} // end namespace } // end namespace
#endif

View File

@ -20,7 +20,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_DEBUG) add_definitions(-D_DEBUG)
endif() endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
@ -91,7 +91,7 @@ elseif(ANDROID)
if(USE_SDL2) if(USE_SDL2)
message(FATAL_ERROR "SDL2 device is not (yet) supported on Android") message(FATAL_ERROR "SDL2 device is not (yet) supported on Android")
endif() endif()
set(DEVICE "Android") set(DEVICE "ANDROID")
elseif(EMSCRIPTEN) elseif(EMSCRIPTEN)
add_definitions(-D_IRR_EMSCRIPTEN_PLATFORM_ -D_IRR_COMPILE_WITH_EGL_MANAGER_) add_definitions(-D_IRR_EMSCRIPTEN_PLATFORM_ -D_IRR_COMPILE_WITH_EGL_MANAGER_)
set(LINUX_PLATFORM TRUE) set(LINUX_PLATFORM TRUE)
@ -201,14 +201,14 @@ if(ENABLE_GLES1)
message(FATAL_ERROR "OpenGL ES 1 is not supported with SDL2") message(FATAL_ERROR "OpenGL ES 1 is not supported with SDL2")
endif() endif()
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_) add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
if(DEVICE MATCHES "^(WINDOWS|X11|Android)$") if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_) add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_)
endif() endif()
endif() endif()
if(ENABLE_GLES2) if(ENABLE_GLES2)
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_) add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
if(DEVICE MATCHES "^(WINDOWS|X11|Android)$" OR EMSCRIPTEN) if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_) add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "SDL") elseif(DEVICE STREQUAL "SDL")
set(USE_SDLGL ON) set(USE_SDLGL ON)

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_MEMORY_READ_FILE_H_INCLUDED__ #pragma once
#define __C_MEMORY_READ_FILE_H_INCLUDED__
#include "IMemoryReadFile.h" #include "IMemoryReadFile.h"
#include "IWriteFile.h" #include "IWriteFile.h"
@ -102,6 +101,3 @@ namespace io
} // end namespace io } // end namespace io
} // end namespace irr } // end namespace irr
#endif

View File

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

View File

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

View File

@ -102,45 +102,21 @@ void CMeshSceneNode::render()
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
Box = Mesh->getBoundingBox(); Box = Mesh->getBoundingBox();
// for debug purposes only: for (u32 i=0; i<Mesh->getMeshBufferCount(); ++i)
bool renderMeshes = true;
video::SMaterial mat;
if (DebugDataVisible && PassCount==1)
{ {
// overwrite half transparency scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
if (DebugDataVisible & scene::EDS_HALF_TRANSPARENCY) if (mb)
{ {
for (u32 g=0; g<Mesh->getMeshBufferCount(); ++g) const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
const bool transparent = driver->needsTransparentRenderPass(material);
// only render transparent buffer if this is the transparent render pass
// and solid only in solid pass
if (transparent == isTransparentPass)
{ {
mat = Materials[g]; driver->setMaterial(material);
mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR; driver->drawMeshBuffer(mb);
driver->setMaterial(mat);
driver->drawMeshBuffer(Mesh->getMeshBuffer(g));
}
renderMeshes = false;
}
}
// render original meshes
if (renderMeshes)
{
for (u32 i=0; i<Mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
if (mb)
{
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
const bool transparent = driver->needsTransparentRenderPass(material);
// only render transparent buffer if this is the transparent render pass
// and solid only in solid pass
if (transparent == isTransparentPass)
{
driver->setMaterial(material);
driver->drawMeshBuffer(mb);
}
} }
} }
} }

View File

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

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_NSOGL_MANAGER_H_INCLUDED__ #pragma once
#define __C_NSOGL_MANAGER_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_NSOGL_MANAGER_ #ifdef _IRR_COMPILE_WITH_NSOGL_MANAGER_
@ -70,5 +68,3 @@ namespace video
} }
#endif #endif
#endif

View File

@ -97,19 +97,21 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre
for (u32 i=0; i<video::EVDF_COUNT; ++i) for (u32 i=0; i<video::EVDF_COUNT; ++i)
FeatureEnabled[i]=true; FeatureEnabled[i]=true;
InitMaterial2D.AntiAliasing=video::EAAM_OFF; InitMaterial2D.AntiAliasing = video::EAAM_OFF;
InitMaterial2D.Lighting=false; InitMaterial2D.Lighting = false;
InitMaterial2D.ZWriteEnable=video::EZW_OFF; InitMaterial2D.ZWriteEnable = video::EZW_OFF;
InitMaterial2D.ZBuffer=video::ECFN_DISABLED; InitMaterial2D.ZBuffer = video::ECFN_DISABLED;
InitMaterial2D.UseMipMaps=false; InitMaterial2D.UseMipMaps = false;
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i) InitMaterial2D.forEachTexture([] (auto &tex) {
{ // Using ETMINF_LINEAR_MIPMAP_NEAREST (bilinear) for 2D graphics looks
InitMaterial2D.TextureLayer[i].BilinearFilter=false; // much better and doesn't have any downsides (e.g. regarding pixel art).
InitMaterial2D.TextureLayer[i].TextureWrapU=video::ETC_REPEAT; tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_NEAREST;
InitMaterial2D.TextureLayer[i].TextureWrapV=video::ETC_REPEAT; tex.MagFilter = video::ETMAGF_NEAREST;
InitMaterial2D.TextureLayer[i].TextureWrapW = video::ETC_REPEAT; tex.TextureWrapU = video::ETC_REPEAT;
} tex.TextureWrapV = video::ETC_REPEAT;
OverrideMaterial2D=InitMaterial2D; tex.TextureWrapW = video::ETC_REPEAT;
});
OverrideMaterial2D = InitMaterial2D;
} }

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_VIDEO_NULL_H_INCLUDED__ #pragma once
#define __C_VIDEO_NULL_H_INCLUDED__
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "IFileSystem.h" #include "IFileSystem.h"
@ -662,7 +661,7 @@ namespace video
//! adds a surface, not loaded or created by the Irrlicht Engine //! adds a surface, not loaded or created by the Irrlicht Engine
void addTexture(ITexture* surface); void addTexture(ITexture* surface);
virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image); virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image);
virtual ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image); virtual ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image);
@ -838,6 +837,3 @@ namespace video
} // end namespace video } // end namespace video
} // end namespace irr } // end namespace irr
#endif

View File

@ -2,8 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OBJ_MESH_FILE_LOADER_H_INCLUDED__ #pragma once
#define __C_OBJ_MESH_FILE_LOADER_H_INCLUDED__
#include <map> #include <map>
#include "IMeshLoader.h" #include "IMeshLoader.h"
@ -109,6 +108,3 @@ private:
} // end namespace scene } // end namespace scene
} // end namespace irr } // end namespace irr
#endif

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OGLES2_COMMON_H_INCLUDED__ #pragma once
#define __C_OGLES2_COMMON_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_OGLES2_ #ifdef _IRR_COMPILE_WITH_OGLES2_
@ -72,4 +70,3 @@ namespace video
} }
#endif #endif
#endif

View File

@ -4,6 +4,7 @@
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#include "COGLES2Driver.h" #include "COGLES2Driver.h"
#include <cassert>
#include "CNullDriver.h" #include "CNullDriver.h"
#include "IContextManager.h" #include "IContextManager.h"
@ -204,22 +205,9 @@ COGLES2Driver::~COGLES2Driver()
// Create callbacks. // Create callbacks.
COGLES2MaterialSolidCB* SolidCB = new COGLES2MaterialSolidCB(); COGLES2MaterialSolidCB* SolidCB = new COGLES2MaterialSolidCB();
COGLES2MaterialSolid2CB* Solid2LayerCB = new COGLES2MaterialSolid2CB();
COGLES2MaterialLightmapCB* LightmapCB = new COGLES2MaterialLightmapCB(1.f);
COGLES2MaterialLightmapCB* LightmapAddCB = new COGLES2MaterialLightmapCB(1.f);
COGLES2MaterialLightmapCB* LightmapM2CB = new COGLES2MaterialLightmapCB(2.f);
COGLES2MaterialLightmapCB* LightmapM4CB = new COGLES2MaterialLightmapCB(4.f);
COGLES2MaterialLightmapCB* LightmapLightingCB = new COGLES2MaterialLightmapCB(1.f);
COGLES2MaterialLightmapCB* LightmapLightingM2CB = new COGLES2MaterialLightmapCB(2.f);
COGLES2MaterialLightmapCB* LightmapLightingM4CB = new COGLES2MaterialLightmapCB(4.f);
COGLES2MaterialSolid2CB* DetailMapCB = new COGLES2MaterialSolid2CB();
COGLES2MaterialReflectionCB* SphereMapCB = new COGLES2MaterialReflectionCB();
COGLES2MaterialReflectionCB* Reflection2LayerCB = new COGLES2MaterialReflectionCB();
COGLES2MaterialSolidCB* TransparentAddColorCB = new COGLES2MaterialSolidCB();
COGLES2MaterialSolidCB* TransparentAlphaChannelCB = new COGLES2MaterialSolidCB(); COGLES2MaterialSolidCB* TransparentAlphaChannelCB = new COGLES2MaterialSolidCB();
COGLES2MaterialSolidCB* TransparentAlphaChannelRefCB = new COGLES2MaterialSolidCB(); COGLES2MaterialSolidCB* TransparentAlphaChannelRefCB = new COGLES2MaterialSolidCB();
COGLES2MaterialSolidCB* TransparentVertexAlphaCB = new COGLES2MaterialSolidCB(); COGLES2MaterialSolidCB* TransparentVertexAlphaCB = new COGLES2MaterialSolidCB();
COGLES2MaterialReflectionCB* TransparentReflection2LayerCB = new COGLES2MaterialReflectionCB();
COGLES2MaterialOneTextureBlendCB* OneTextureBlendCB = new COGLES2MaterialOneTextureBlendCB(); COGLES2MaterialOneTextureBlendCB* OneTextureBlendCB = new COGLES2MaterialOneTextureBlendCB();
// Create built-in materials. // Create built-in materials.
@ -230,65 +218,8 @@ COGLES2Driver::~COGLES2Driver()
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main", addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, SolidCB, EMT_SOLID, 0); EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, SolidCB, EMT_SOLID, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Solid2.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2Solid2Layer.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, Solid2LayerCB, EMT_SOLID, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Solid2.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2LightmapModulate.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, LightmapCB, EMT_SOLID, 0);
FragmentShader = OGLES2ShaderPath + "COGLES2LightmapAdd.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, LightmapAddCB, EMT_SOLID, 0);
FragmentShader = OGLES2ShaderPath + "COGLES2LightmapModulate.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, LightmapM2CB, EMT_SOLID, 0);
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, LightmapM4CB, EMT_SOLID, 0);
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, LightmapLightingCB, EMT_SOLID, 0);
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, LightmapLightingM2CB, EMT_SOLID, 0);
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, LightmapLightingM4CB, EMT_SOLID, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Solid2.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2DetailMap.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, DetailMapCB, EMT_SOLID, 0);
VertexShader = OGLES2ShaderPath + "COGLES2SphereMap.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2SphereMap.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, SphereMapCB, EMT_SOLID, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Reflection2Layer.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2Reflection2Layer.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, Reflection2LayerCB, EMT_SOLID, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Solid.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2Solid.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, TransparentAddColorCB, EMT_TRANSPARENT_ADD_COLOR, 0);
FragmentShader = OGLES2ShaderPath + "COGLES2TransparentAlphaChannel.fsh"; FragmentShader = OGLES2ShaderPath + "COGLES2TransparentAlphaChannel.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main", addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, TransparentAlphaChannelCB, EMT_TRANSPARENT_ALPHA_CHANNEL, 0); EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, TransparentAlphaChannelCB, EMT_TRANSPARENT_ALPHA_CHANNEL, 0);
@ -302,13 +233,6 @@ COGLES2Driver::~COGLES2Driver()
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main", addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, TransparentVertexAlphaCB, EMT_TRANSPARENT_ALPHA_CHANNEL, 0); EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, TransparentVertexAlphaCB, EMT_TRANSPARENT_ALPHA_CHANNEL, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Reflection2Layer.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2Reflection2Layer.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
EGST_GS_4_0, scene::EPT_TRIANGLES, scene::EPT_TRIANGLE_STRIP, 0, TransparentReflection2LayerCB, EMT_TRANSPARENT_ALPHA_CHANNEL, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Solid.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2OneTextureBlend.fsh"; FragmentShader = OGLES2ShaderPath + "COGLES2OneTextureBlend.fsh";
addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main", addHighLevelShaderMaterialFromFiles(VertexShader, "main", EVST_VS_2_0, FragmentShader, "main", EPST_PS_2_0, "", "main",
@ -317,22 +241,9 @@ COGLES2Driver::~COGLES2Driver()
// Drop callbacks. // Drop callbacks.
SolidCB->drop(); SolidCB->drop();
Solid2LayerCB->drop();
LightmapCB->drop();
LightmapAddCB->drop();
LightmapM2CB->drop();
LightmapM4CB->drop();
LightmapLightingCB->drop();
LightmapLightingM2CB->drop();
LightmapLightingM4CB->drop();
DetailMapCB->drop();
SphereMapCB->drop();
Reflection2LayerCB->drop();
TransparentAddColorCB->drop();
TransparentAlphaChannelCB->drop(); TransparentAlphaChannelCB->drop();
TransparentAlphaChannelRefCB->drop(); TransparentAlphaChannelRefCB->drop();
TransparentVertexAlphaCB->drop(); TransparentVertexAlphaCB->drop();
TransparentReflection2LayerCB->drop();
OneTextureBlendCB->drop(); OneTextureBlendCB->drop();
// Create 2D material renderers // Create 2D material renderers
@ -354,7 +265,7 @@ COGLES2Driver::~COGLES2Driver()
bool COGLES2Driver::setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture) bool COGLES2Driver::setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture)
{ {
Material.TextureLayer[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already Material.TextureLayers[layerIdx].Texture = const_cast<ITexture*>(texture); // function uses const-pointer for texture because all draw functions use const-pointers already
return CacheHandler->getTextureCache().set(0, texture); return CacheHandler->getTextureCache().set(0, texture);
} }
@ -1786,66 +1697,68 @@ COGLES2Driver::~COGLES2Driver()
if (resetAllRenderstates) if (resetAllRenderstates)
tmpTexture->getStatesCache().IsCached = false; tmpTexture->getStatesCache().IsCached = false;
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].BilinearFilter != tmpTexture->getStatesCache().BilinearFilter || if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MagFilter != tmpTexture->getStatesCache().MagFilter)
material.TextureLayer[i].TrilinearFilter != tmpTexture->getStatesCache().TrilinearFilter)
{ {
E_TEXTURE_MAG_FILTER magFilter = material.TextureLayers[i].MagFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MAG_FILTER, glTexParameteri(tmpTextureType, GL_TEXTURE_MAG_FILTER,
(material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST); magFilter == ETMAGF_NEAREST ? GL_NEAREST :
(assert(magFilter == ETMAGF_LINEAR), GL_LINEAR));
tmpTexture->getStatesCache().BilinearFilter = material.TextureLayer[i].BilinearFilter; tmpTexture->getStatesCache().MagFilter = magFilter;
tmpTexture->getStatesCache().TrilinearFilter = material.TextureLayer[i].TrilinearFilter;
} }
if (material.UseMipMaps && tmpTexture->hasMipMaps()) if (material.UseMipMaps && tmpTexture->hasMipMaps())
{ {
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].BilinearFilter != tmpTexture->getStatesCache().BilinearFilter || if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
material.TextureLayer[i].TrilinearFilter != tmpTexture->getStatesCache().TrilinearFilter || !tmpTexture->getStatesCache().MipMapStatus) !tmpTexture->getStatesCache().MipMapStatus)
{ {
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER, glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
material.TextureLayer[i].TrilinearFilter ? GL_LINEAR_MIPMAP_LINEAR : minFilter == ETMINF_NEAREST_MIPMAP_NEAREST ? GL_NEAREST_MIPMAP_NEAREST :
material.TextureLayer[i].BilinearFilter ? GL_LINEAR_MIPMAP_NEAREST : minFilter == ETMINF_LINEAR_MIPMAP_NEAREST ? GL_LINEAR_MIPMAP_NEAREST :
GL_NEAREST_MIPMAP_NEAREST); minFilter == ETMINF_NEAREST_MIPMAP_LINEAR ? GL_NEAREST_MIPMAP_LINEAR :
(assert(minFilter == ETMINF_LINEAR_MIPMAP_LINEAR), GL_LINEAR_MIPMAP_LINEAR));
tmpTexture->getStatesCache().BilinearFilter = material.TextureLayer[i].BilinearFilter; tmpTexture->getStatesCache().MinFilter = minFilter;
tmpTexture->getStatesCache().TrilinearFilter = material.TextureLayer[i].TrilinearFilter;
tmpTexture->getStatesCache().MipMapStatus = true; tmpTexture->getStatesCache().MipMapStatus = true;
} }
} }
else else
{ {
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].BilinearFilter != tmpTexture->getStatesCache().BilinearFilter || if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].MinFilter != tmpTexture->getStatesCache().MinFilter ||
material.TextureLayer[i].TrilinearFilter != tmpTexture->getStatesCache().TrilinearFilter || tmpTexture->getStatesCache().MipMapStatus) tmpTexture->getStatesCache().MipMapStatus)
{ {
E_TEXTURE_MIN_FILTER minFilter = material.TextureLayers[i].MinFilter;
glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER, glTexParameteri(tmpTextureType, GL_TEXTURE_MIN_FILTER,
(material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST); (minFilter == ETMINF_NEAREST_MIPMAP_NEAREST || minFilter == ETMINF_NEAREST_MIPMAP_LINEAR) ? GL_NEAREST :
(assert(minFilter == ETMINF_LINEAR_MIPMAP_NEAREST || minFilter == ETMINF_LINEAR_MIPMAP_LINEAR), GL_LINEAR));
tmpTexture->getStatesCache().BilinearFilter = material.TextureLayer[i].BilinearFilter; tmpTexture->getStatesCache().MinFilter = minFilter;
tmpTexture->getStatesCache().TrilinearFilter = material.TextureLayer[i].TrilinearFilter;
tmpTexture->getStatesCache().MipMapStatus = false; tmpTexture->getStatesCache().MipMapStatus = false;
} }
} }
#ifdef GL_EXT_texture_filter_anisotropic #ifdef GL_EXT_texture_filter_anisotropic
if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_filter_anisotropic] && if (FeatureAvailable[COGLESCoreExtensionHandler::IRR_GL_EXT_texture_filter_anisotropic] &&
(!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].AnisotropicFilter != tmpTexture->getStatesCache().AnisotropicFilter)) (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].AnisotropicFilter != tmpTexture->getStatesCache().AnisotropicFilter))
{ {
glTexParameteri(tmpTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT, glTexParameteri(tmpTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT,
material.TextureLayer[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayer[i].AnisotropicFilter) : 1); material.TextureLayers[i].AnisotropicFilter>1 ? core::min_(MaxAnisotropy, material.TextureLayers[i].AnisotropicFilter) : 1);
tmpTexture->getStatesCache().AnisotropicFilter = material.TextureLayer[i].AnisotropicFilter; tmpTexture->getStatesCache().AnisotropicFilter = material.TextureLayers[i].AnisotropicFilter;
} }
#endif #endif
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].TextureWrapU != tmpTexture->getStatesCache().WrapU) if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].TextureWrapU != tmpTexture->getStatesCache().WrapU)
{ {
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayer[i].TextureWrapU)); glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_S, getTextureWrapMode(material.TextureLayers[i].TextureWrapU));
tmpTexture->getStatesCache().WrapU = material.TextureLayer[i].TextureWrapU; tmpTexture->getStatesCache().WrapU = material.TextureLayers[i].TextureWrapU;
} }
if (!tmpTexture->getStatesCache().IsCached || material.TextureLayer[i].TextureWrapV != tmpTexture->getStatesCache().WrapV) if (!tmpTexture->getStatesCache().IsCached || material.TextureLayers[i].TextureWrapV != tmpTexture->getStatesCache().WrapV)
{ {
glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayer[i].TextureWrapV)); glTexParameteri(tmpTextureType, GL_TEXTURE_WRAP_T, getTextureWrapMode(material.TextureLayers[i].TextureWrapV));
tmpTexture->getStatesCache().WrapV = material.TextureLayer[i].TextureWrapV; tmpTexture->getStatesCache().WrapV = material.TextureLayers[i].TextureWrapV;
} }
tmpTexture->getStatesCache().IsCached = true; tmpTexture->getStatesCache().IsCached = true;

View File

@ -3,9 +3,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_OGLES2_DRIVER_H_INCLUDED__ #pragma once
#define __C_OGLES2_DRIVER_H_INCLUDED__
#include "SIrrCreationParameters.h" #include "SIrrCreationParameters.h"
@ -405,5 +403,3 @@ private:
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_OGLES2_ #endif // _IRR_COMPILE_WITH_OGLES2_
#endif // __C_OGLES2_DRIVER_H_INCLUDED__

View File

@ -3,9 +3,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_OGLES2_EXTENSION_HANDLER_H_INCLUDED__ #pragma once
#define __C_OGLES2_EXTENSION_HANDLER_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_OGLES2_ #ifdef _IRR_COMPILE_WITH_OGLES2_
@ -190,4 +188,3 @@ namespace video
} }
#endif #endif
#endif

View File

@ -100,7 +100,7 @@ void COGLES2MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services,
services->setPixelShaderConstant(ThicknessID, &Thickness, 1); services->setPixelShaderConstant(ThicknessID, &Thickness, 1);
} }
// EMT_SOLID + EMT_TRANSPARENT_ADD_COLOR + EMT_TRANSPARENT_ALPHA_CHANNEL + EMT_TRANSPARENT_VERTEX_ALPHA // EMT_SOLID + EMT_TRANSPARENT_ALPHA_CHANNEL + EMT_TRANSPARENT_VERTEX_ALPHA
COGLES2MaterialSolidCB::COGLES2MaterialSolidCB() : COGLES2MaterialSolidCB::COGLES2MaterialSolidCB() :
FirstUpdate(true), TMatrix0ID(-1), AlphaRefID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), AlphaRef(0.5f), TextureUsage0(0), TextureUnit0(0) FirstUpdate(true), TMatrix0ID(-1), AlphaRefID(-1), TextureUsage0ID(-1), TextureUnit0ID(-1), AlphaRef(0.5f), TextureUsage0(0), TextureUnit0(0)
@ -112,7 +112,7 @@ void COGLES2MaterialSolidCB::OnSetMaterial(const SMaterial& material)
COGLES2MaterialBaseCB::OnSetMaterial(material); COGLES2MaterialBaseCB::OnSetMaterial(material);
AlphaRef = material.MaterialTypeParam; AlphaRef = material.MaterialTypeParam;
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0; TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
} }
void COGLES2MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services, s32 userData) void COGLES2MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
@ -139,142 +139,6 @@ void COGLES2MaterialSolidCB::OnSetConstants(IMaterialRendererServices* services,
services->setPixelShaderConstant(TextureUnit0ID, &TextureUnit0, 1); services->setPixelShaderConstant(TextureUnit0ID, &TextureUnit0, 1);
} }
// EMT_SOLID_2_LAYER + EMT_DETAIL_MAP
COGLES2MaterialSolid2CB::COGLES2MaterialSolid2CB() :
FirstUpdate(true), TMatrix0ID(-1), TMatrix1ID(-1), TextureUsage0ID(-1), TextureUsage1ID(-1), TextureUnit0ID(-1), TextureUnit1ID(-1),
TextureUsage0(0), TextureUsage1(0), TextureUnit0(0), TextureUnit1(1)
{
}
void COGLES2MaterialSolid2CB::OnSetMaterial(const SMaterial& material)
{
COGLES2MaterialBaseCB::OnSetMaterial(material);
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0;
TextureUsage1 = (material.TextureLayer[1].Texture) ? 1 : 0;
}
void COGLES2MaterialSolid2CB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
{
COGLES2MaterialBaseCB::OnSetConstants(services, userData);
IVideoDriver* driver = services->getVideoDriver();
if (FirstUpdate)
{
TMatrix0ID = services->getVertexShaderConstantID("uTMatrix0");
TMatrix1ID = services->getVertexShaderConstantID("uTMatrix1");
TextureUsage0ID = services->getVertexShaderConstantID("uTextureUsage0");
TextureUsage1ID = services->getVertexShaderConstantID("uTextureUsage1");
TextureUnit0ID = services->getVertexShaderConstantID("uTextureUnit0");
TextureUnit1ID = services->getVertexShaderConstantID("uTextureUnit1");
FirstUpdate = false;
}
core::matrix4 Matrix = driver->getTransform(ETS_TEXTURE_0);
services->setPixelShaderConstant(TMatrix0ID, Matrix.pointer(), 16);
Matrix = driver->getTransform(E_TRANSFORMATION_STATE(ETS_TEXTURE_0 + 1));
services->setPixelShaderConstant(TMatrix1ID, Matrix.pointer(), 16);
services->setPixelShaderConstant(TextureUsage0ID, &TextureUsage0, 1);
services->setPixelShaderConstant(TextureUsage1ID, &TextureUsage1, 1);
services->setPixelShaderConstant(TextureUnit0ID, &TextureUnit0, 1);
services->setPixelShaderConstant(TextureUnit1ID, &TextureUnit1, 1);
}
// EMT_LIGHTMAP + EMT_LIGHTMAP_ADD + EMT_LIGHTMAP_M2 + EMT_LIGHTMAP_M4
COGLES2MaterialLightmapCB::COGLES2MaterialLightmapCB(float modulate) :
FirstUpdate(true), TMatrix0ID(-1), TMatrix1ID(-1), ModulateID(-1), TextureUsage0ID(-1), TextureUsage1ID(-1), TextureUnit0ID(-1), TextureUnit1ID(-1),
Modulate(modulate), TextureUsage0(0), TextureUsage1(0), TextureUnit0(0), TextureUnit1(1)
{
}
void COGLES2MaterialLightmapCB::OnSetMaterial(const SMaterial& material)
{
COGLES2MaterialBaseCB::OnSetMaterial(material);
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0;
TextureUsage1 = (material.TextureLayer[1].Texture) ? 1 : 0;
}
void COGLES2MaterialLightmapCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
{
COGLES2MaterialBaseCB::OnSetConstants(services, userData);
IVideoDriver* driver = services->getVideoDriver();
if (FirstUpdate)
{
TMatrix0ID = services->getVertexShaderConstantID("uTMatrix0");
TMatrix1ID = services->getVertexShaderConstantID("uTMatrix1");
ModulateID = services->getVertexShaderConstantID("uModulate");
TextureUsage0ID = services->getVertexShaderConstantID("uTextureUsage0");
TextureUsage1ID = services->getVertexShaderConstantID("uTextureUsage1");
TextureUnit0ID = services->getVertexShaderConstantID("uTextureUnit0");
TextureUnit1ID = services->getVertexShaderConstantID("uTextureUnit1");
FirstUpdate = false;
}
core::matrix4 Matrix = driver->getTransform(ETS_TEXTURE_0);
services->setPixelShaderConstant(TMatrix0ID, Matrix.pointer(), 16);
Matrix = driver->getTransform(E_TRANSFORMATION_STATE(ETS_TEXTURE_0 + 1));
services->setPixelShaderConstant(TMatrix1ID, Matrix.pointer(), 16);
services->setPixelShaderConstant(ModulateID, &Modulate, 1);
services->setPixelShaderConstant(TextureUsage0ID, &TextureUsage0, 1);
services->setPixelShaderConstant(TextureUsage1ID, &TextureUsage1, 1);
services->setPixelShaderConstant(TextureUnit0ID, &TextureUnit0, 1);
services->setPixelShaderConstant(TextureUnit1ID, &TextureUnit1, 1);
}
// EMT_SPHERE_MAP + EMT_REFLECTION_2_LAYER + EMT_TRANSPARENT_REFLECTION_2_LAYER
COGLES2MaterialReflectionCB::COGLES2MaterialReflectionCB() :
FirstUpdate(true), TMatrix0ID(-1), TextureUsage0ID(-1), TextureUsage1ID(-1), TextureUnit0ID(-1), TextureUnit1ID(-1),
TextureUsage0(0), TextureUsage1(0), TextureUnit0(0), TextureUnit1(1)
{
}
void COGLES2MaterialReflectionCB::OnSetMaterial(const SMaterial& material)
{
COGLES2MaterialBaseCB::OnSetMaterial(material);
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0;
TextureUsage1 = (material.TextureLayer[1].Texture) ? 1 : 0;
}
void COGLES2MaterialReflectionCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)
{
COGLES2MaterialBaseCB::OnSetConstants(services, userData);
IVideoDriver* driver = services->getVideoDriver();
if (FirstUpdate)
{
TMatrix0ID = services->getVertexShaderConstantID("uTMatrix0");
TextureUsage0ID = services->getVertexShaderConstantID("uTextureUsage0");
TextureUsage1ID = services->getVertexShaderConstantID("uTextureUsage1");
TextureUnit0ID = services->getVertexShaderConstantID("uTextureUnit0");
TextureUnit1ID = services->getVertexShaderConstantID("uTextureUnit1");
FirstUpdate = false;
}
core::matrix4 Matrix = driver->getTransform(ETS_TEXTURE_0);
services->setPixelShaderConstant(TMatrix0ID, Matrix.pointer(), 16);
services->setPixelShaderConstant(TextureUsage0ID, &TextureUsage0, 1);
services->setPixelShaderConstant(TextureUsage1ID, &TextureUsage1, 1);
services->setPixelShaderConstant(TextureUnit0ID, &TextureUnit0, 1);
services->setPixelShaderConstant(TextureUnit1ID, &TextureUnit1, 1);
}
// EMT_ONETEXTURE_BLEND // EMT_ONETEXTURE_BLEND
COGLES2MaterialOneTextureBlendCB::COGLES2MaterialOneTextureBlendCB() : COGLES2MaterialOneTextureBlendCB::COGLES2MaterialOneTextureBlendCB() :
@ -305,7 +169,7 @@ void COGLES2MaterialOneTextureBlendCB::OnSetMaterial(const SMaterial& material)
} }
} }
TextureUsage0 = (material.TextureLayer[0].Texture) ? 1 : 0; TextureUsage0 = (material.TextureLayers[0].Texture) ? 1 : 0;
} }
void COGLES2MaterialOneTextureBlendCB::OnSetConstants(IMaterialRendererServices* services, s32 userData) void COGLES2MaterialOneTextureBlendCB::OnSetConstants(IMaterialRendererServices* services, s32 userData)

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#ifndef __C_OGLES2_FIXED_PIPELINE_SHADER_H_INCLUDED__ #pragma once
#define __C_OGLES2_FIXED_PIPELINE_SHADER_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_OGLES2_ #ifdef _IRR_COMPILE_WITH_OGLES2_
@ -86,79 +84,6 @@ protected:
s32 TextureUnit0; s32 TextureUnit0;
}; };
class COGLES2MaterialSolid2CB : public COGLES2MaterialBaseCB
{
public:
COGLES2MaterialSolid2CB();
virtual void OnSetMaterial(const SMaterial& material);
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData);
protected:
bool FirstUpdate;
s32 TMatrix0ID;
s32 TMatrix1ID;
s32 TextureUsage0ID;
s32 TextureUsage1ID;
s32 TextureUnit0ID;
s32 TextureUnit1ID;
s32 TextureUsage0;
s32 TextureUsage1;
s32 TextureUnit0;
s32 TextureUnit1;
};
class COGLES2MaterialLightmapCB : public COGLES2MaterialBaseCB
{
public:
COGLES2MaterialLightmapCB(float modulate);
virtual void OnSetMaterial(const SMaterial& material);
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData);
protected:
bool FirstUpdate;
s32 TMatrix0ID;
s32 TMatrix1ID;
s32 ModulateID;
s32 TextureUsage0ID;
s32 TextureUsage1ID;
s32 TextureUnit0ID;
s32 TextureUnit1ID;
f32 Modulate;
s32 TextureUsage0;
s32 TextureUsage1;
s32 TextureUnit0;
s32 TextureUnit1;
};
class COGLES2MaterialReflectionCB : public COGLES2MaterialBaseCB
{
public:
COGLES2MaterialReflectionCB();
virtual void OnSetMaterial(const SMaterial& material);
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData);
protected:
bool FirstUpdate;
s32 TMatrix0ID;
s32 TextureUsage0ID;
s32 TextureUsage1ID;
s32 TextureUnit0ID;
s32 TextureUnit1ID;
s32 TextureUsage0;
s32 TextureUsage1;
s32 TextureUnit0;
s32 TextureUnit1;
};
class COGLES2MaterialOneTextureBlendCB : public COGLES2MaterialBaseCB class COGLES2MaterialOneTextureBlendCB : public COGLES2MaterialBaseCB
{ {
public: public:
@ -184,5 +109,3 @@ protected:
} }
#endif #endif
#endif

View File

@ -30,7 +30,7 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
IShaderConstantSetCallBack* callback, IShaderConstantSetCallBack* callback,
E_MATERIAL_TYPE baseMaterial, E_MATERIAL_TYPE baseMaterial,
s32 userData) s32 userData)
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), UserData(userData) : Driver(driver), CallBack(callback), Alpha(false), Blending(false), Program(0), UserData(userData)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("COGLES2MaterialRenderer"); setDebugName("COGLES2MaterialRenderer");
@ -42,9 +42,6 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
case EMT_TRANSPARENT_ALPHA_CHANNEL: case EMT_TRANSPARENT_ALPHA_CHANNEL:
Alpha = true; Alpha = true;
break; break;
case EMT_TRANSPARENT_ADD_COLOR:
FixedBlending = true;
break;
case EMT_ONETEXTURE_BLEND: case EMT_ONETEXTURE_BLEND:
Blending = true; Blending = true;
break; break;
@ -62,7 +59,7 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver, COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
IShaderConstantSetCallBack* callback, IShaderConstantSetCallBack* callback,
E_MATERIAL_TYPE baseMaterial, s32 userData) E_MATERIAL_TYPE baseMaterial, s32 userData)
: Driver(driver), CallBack(callback), Alpha(false), Blending(false), FixedBlending(false), Program(0), UserData(userData) : Driver(driver), CallBack(callback), Alpha(false), Blending(false), Program(0), UserData(userData)
{ {
switch (baseMaterial) switch (baseMaterial)
{ {
@ -70,9 +67,6 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
case EMT_TRANSPARENT_ALPHA_CHANNEL: case EMT_TRANSPARENT_ALPHA_CHANNEL:
Alpha = true; Alpha = true;
break; break;
case EMT_TRANSPARENT_ADD_COLOR:
FixedBlending = true;
break;
case EMT_ONETEXTURE_BLEND: case EMT_ONETEXTURE_BLEND:
Blending = true; Blending = true;
break; break;
@ -167,11 +161,6 @@ void COGLES2MaterialRenderer::OnSetMaterial(const video::SMaterial& material,
cacheHandler->setBlend(true); cacheHandler->setBlend(true);
cacheHandler->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); cacheHandler->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
else if (FixedBlending)
{
cacheHandler->setBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
cacheHandler->setBlend(true);
}
else if (Blending) else if (Blending)
{ {
E_BLEND_FACTOR srcRGBFact,dstRGBFact,srcAlphaFact,dstAlphaFact; E_BLEND_FACTOR srcRGBFact,dstRGBFact,srcAlphaFact,dstAlphaFact;
@ -197,7 +186,7 @@ void COGLES2MaterialRenderer::OnUnsetMaterial()
bool COGLES2MaterialRenderer::isTransparent() const bool COGLES2MaterialRenderer::isTransparent() const
{ {
return (Alpha || Blending || FixedBlending); return (Alpha || Blending);
} }

View File

@ -2,9 +2,7 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__ #pragma once
#define __C_OGLES2_SL_MATERIAL_RENDERER_H_INCLUDED__
#ifdef _IRR_COMPILE_WITH_OGLES2_ #ifdef _IRR_COMPILE_WITH_OGLES2_
@ -84,7 +82,6 @@ protected:
bool Alpha; bool Alpha;
bool Blending; bool Blending;
bool FixedBlending;
struct SUniformInfo struct SUniformInfo
{ {
@ -103,5 +100,3 @@ protected:
} }
#endif #endif
#endif

View File

@ -71,7 +71,7 @@ void COGLES2Renderer2D::OnSetMaterial(const video::SMaterial& material,
if ( WithTexture ) if ( WithTexture )
{ {
s32 TextureUsage = material.TextureLayer[0].Texture ? 1 : 0; s32 TextureUsage = material.TextureLayers[0].Texture ? 1 : 0;
setPixelShaderConstant(TextureUsageID, &TextureUsage, 1); setPixelShaderConstant(TextureUsageID, &TextureUsage, 1);
} }
} }

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