Browse Source

Remove more unused code (#87)

pull/89/head
sfan5 6 months ago
committed by GitHub
parent
commit
dd09fdcb4e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 133
      include/CDynamicMeshBuffer.h
  2. 71
      include/EMaterialTypes.h
  3. 36
      include/ETerrainElements.h
  4. 211
      include/IDynamicMeshBuffer.h
  5. 1
      include/ISceneManager.h
  6. 14
      include/IVideoDriver.h
  7. 43
      include/SKeyMap.h
  8. 2
      include/SMaterial.h
  9. 260
      include/SSharedMeshBuffer.h
  10. 5
      include/irrlicht.h
  11. 74
      media/Shaders/COGLES2NormalMap.fsh
  12. 52
      media/Shaders/COGLES2NormalMap.vsh
  13. 82
      media/Shaders/COGLES2ParallaxMap.fsh
  14. 61
      media/Shaders/COGLES2ParallaxMap.vsh
  15. 67
      source/Irrlicht/CBlit.h
  16. 4
      source/Irrlicht/CMakeLists.txt
  17. 118
      source/Irrlicht/CNullDriver.cpp
  18. 33
      source/Irrlicht/CNullDriver.h
  19. 11
      source/Irrlicht/COBJMeshFileLoader.cpp
  20. 38
      source/Irrlicht/COGLES2Driver.cpp
  21. 2
      source/Irrlicht/COGLES2Driver.h
  22. 8
      source/Irrlicht/COGLES2MaterialRenderer.cpp
  23. 132
      source/Irrlicht/COGLES2NormalMapRenderer.cpp
  24. 62
      source/Irrlicht/COGLES2NormalMapRenderer.h
  25. 146
      source/Irrlicht/COGLES2ParallaxMapRenderer.cpp
  26. 65
      source/Irrlicht/COGLES2ParallaxMapRenderer.h
  27. 11
      source/Irrlicht/COGLESDriver.cpp
  28. 20
      source/Irrlicht/COpenGLDriver.cpp
  29. 292
      source/Irrlicht/COpenGLNormalMapRenderer.cpp
  30. 51
      source/Irrlicht/COpenGLNormalMapRenderer.h
  31. 355
      source/Irrlicht/COpenGLParallaxMapRenderer.cpp
  32. 57
      source/Irrlicht/COpenGLParallaxMapRenderer.h
  33. 8
      source/Irrlicht/COpenGLSLMaterialRenderer.cpp
  34. 8
      source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
  35. 713
      source/Irrlicht/CSoftwareTexture2.cpp
  36. 185
      source/Irrlicht/CSoftwareTexture2.h
  37. 875
      source/Irrlicht/S4DVertex.h
  38. 205
      source/Irrlicht/SoftwareDriver2_compile_config.h
  39. 946
      source/Irrlicht/SoftwareDriver2_helper.h
  40. 52
      source/Irrlicht/irrMathFastCompat.h

133
include/CDynamicMeshBuffer.h

@ -1,133 +0,0 @@
// Copyright (C) 2008-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
#define __C_DYNAMIC_MESHBUFFER_H_INCLUDED__
#include "IDynamicMeshBuffer.h"
#include "CVertexBuffer.h"
#include "CIndexBuffer.h"
namespace irr
{
namespace scene
{
class CDynamicMeshBuffer: public IDynamicMeshBuffer
{
public:
//! constructor
CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType)
: PrimitiveType(EPT_TRIANGLES)
{
VertexBuffer=new CVertexBuffer(vertexType);
IndexBuffer=new CIndexBuffer(indexType);
}
//! destructor
virtual ~CDynamicMeshBuffer()
{
if (VertexBuffer)
VertexBuffer->drop();
if (IndexBuffer)
IndexBuffer->drop();
}
virtual IVertexBuffer& getVertexBuffer() const _IRR_OVERRIDE_
{
return *VertexBuffer;
}
virtual IIndexBuffer& getIndexBuffer() const _IRR_OVERRIDE_
{
return *IndexBuffer;
}
virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer) _IRR_OVERRIDE_
{
if (newVertexBuffer)
newVertexBuffer->grab();
if (VertexBuffer)
VertexBuffer->drop();
VertexBuffer=newVertexBuffer;
}
virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer) _IRR_OVERRIDE_
{
if (newIndexBuffer)
newIndexBuffer->grab();
if (IndexBuffer)
IndexBuffer->drop();
IndexBuffer=newIndexBuffer;
}
//! Get Material of this buffer.
virtual const video::SMaterial& getMaterial() const _IRR_OVERRIDE_
{
return Material;
}
//! Get Material of this buffer.
virtual video::SMaterial& getMaterial() _IRR_OVERRIDE_
{
return Material;
}
//! Get bounding box
virtual const core::aabbox3d<f32>& getBoundingBox() const _IRR_OVERRIDE_
{
return BoundingBox;
}
//! Set bounding box
virtual void setBoundingBox( const core::aabbox3df& box) _IRR_OVERRIDE_
{
BoundingBox = box;
}
//! Recalculate bounding box
virtual void recalculateBoundingBox() _IRR_OVERRIDE_
{
if (!getVertexBuffer().size())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset(getVertexBuffer()[0].Pos);
for (u32 i=1; i<getVertexBuffer().size(); ++i)
BoundingBox.addInternalPoint(getVertexBuffer()[i].Pos);
}
}
//! Describe what kind of primitive geometry is used by the meshbuffer
virtual void setPrimitiveType(E_PRIMITIVE_TYPE type) _IRR_OVERRIDE_
{
PrimitiveType = type;
}
//! Get the kind of primitive geometry which is used by the meshbuffer
virtual E_PRIMITIVE_TYPE getPrimitiveType() const _IRR_OVERRIDE_
{
return PrimitiveType;
}
video::SMaterial Material;
core::aabbox3d<f32> BoundingBox;
//! Primitive type used for rendering (triangles, lines, ...)
E_PRIMITIVE_TYPE PrimitiveType;
private:
CDynamicMeshBuffer(const CDynamicMeshBuffer&); // = delete in c++11, prevent copying
IVertexBuffer *VertexBuffer;
IIndexBuffer *IndexBuffer;
};
} // end namespace scene
} // end namespace irr
#endif

71
include/EMaterialTypes.h

@ -121,71 +121,6 @@ namespace video
texture which will not reflect can be set as second texture.*/
EMT_TRANSPARENT_REFLECTION_2_LAYER,
//! A solid normal map renderer.
/** First texture is the color map, the second should be the
normal map. Note that you should use this material only when
drawing geometry consisting of vertices of type
S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
this format using IMeshManipulator::createMeshWithTangents()
(See SpecialFX2 Tutorial). This shader runs on vertex shader
1.1 and pixel shader 1.1 capable hardware and falls back to a
fixed function lighted material if this hardware is not
available. Only two lights are supported by this shader, if
there are more, the nearest two are chosen. */
EMT_NORMAL_MAP_SOLID,
//! A transparent normal map renderer.
/** First texture is the color map, the second should be the
normal map. Note that you should use this material only when
drawing geometry consisting of vertices of type
S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
this format using IMeshManipulator::createMeshWithTangents()
(See SpecialFX2 Tutorial). This shader runs on vertex shader
1.1 and pixel shader 1.1 capable hardware and falls back to a
fixed function lighted material if this hardware is not
available. Only two lights are supported by this shader, if
there are more, the nearest two are chosen. */
EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR,
//! A transparent (based on the vertex alpha value) normal map renderer.
/** First texture is the color map, the second should be the
normal map. Note that you should use this material only when
drawing geometry consisting of vertices of type
S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into
this format using IMeshManipulator::createMeshWithTangents()
(See SpecialFX2 Tutorial). This shader runs on vertex shader
1.1 and pixel shader 1.1 capable hardware and falls back to a
fixed function lighted material if this hardware is not
available. Only two lights are supported by this shader, if
there are more, the nearest two are chosen. */
EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA,
//! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping.
/** Looks a lot more realistic. This only works when the
hardware supports at least vertex shader 1.1 and pixel shader
1.4. First texture is the color map, the second should be the
normal map. The normal map texture should contain the height
value in the alpha component. The
IVideoDriver::makeNormalMapTexture() method writes this value
automatically when creating normal maps from a heightmap when
using a 32 bit texture. The height scale of the material
(affecting the bumpiness) is being controlled by the
SMaterial::MaterialTypeParam member. If set to zero, the
default value (0.02f) will be applied. Otherwise the value set
in SMaterial::MaterialTypeParam is taken. This value depends on
with which scale the texture is mapped on the material. Too
high or low values of MaterialTypeParam can result in strange
artifacts. */
EMT_PARALLAX_MAP_SOLID,
//! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
/** Using EMT_TRANSPARENT_ADD_COLOR as base material. */
EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR,
//! A material like EMT_PARALLAX_MAP_SOLID, but transparent.
/** Using EMT_TRANSPARENT_VERTEX_ALPHA as base material. */
EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA,
//! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC )
/** Using only first texture. Generic blending method.
The blend function is set to SMaterial::MaterialTypeParam with
@ -216,12 +151,6 @@ namespace video
"trans_alphach_ref",
"trans_vertex_alpha",
"trans_reflection_2layer",
"normalmap_solid",
"normalmap_trans_add",
"normalmap_trans_vertexalpha",
"parallaxmap_solid",
"parallaxmap_trans_add",
"parallaxmap_trans_vertexalpha",
"onetexture_blend",
0
};

36
include/ETerrainElements.h

@ -1,36 +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_TERRAIN_ELEMENTS_H__
#define __E_TERRAIN_ELEMENTS_H__
namespace irr
{
namespace scene
{
//! enumeration for patch sizes specifying the size of patches in the TerrainSceneNode
enum E_TERRAIN_PATCH_SIZE
{
//! patch size of 9, at most, use 4 levels of detail with this patch size.
ETPS_9 = 9,
//! patch size of 17, at most, use 5 levels of detail with this patch size.
ETPS_17 = 17,
//! patch size of 33, at most, use 6 levels of detail with this patch size.
ETPS_33 = 33,
//! patch size of 65, at most, use 7 levels of detail with this patch size.
ETPS_65 = 65,
//! patch size of 129, at most, use 8 levels of detail with this patch size.
ETPS_129 = 129
};
} // end namespace scene
} // end namespace irr
#endif

211
include/IDynamicMeshBuffer.h

@ -1,211 +0,0 @@
// Copyright (C) 2008-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
#define __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__
#include "IMeshBuffer.h"
#include "IVertexBuffer.h"
#include "IIndexBuffer.h"
namespace irr
{
namespace scene
{
/** a dynamic meshBuffer */
class IDynamicMeshBuffer : public IMeshBuffer
{
public:
virtual IVertexBuffer &getVertexBuffer() const =0;
virtual IIndexBuffer &getIndexBuffer() const =0;
virtual void setVertexBuffer(IVertexBuffer *vertexBuffer) =0;
virtual void setIndexBuffer(IIndexBuffer *indexBuffer) =0;
//! Get the material of this meshbuffer
/** \return Material of this buffer. */
virtual video::SMaterial& getMaterial() _IRR_OVERRIDE_ =0;
//! Get the material of this meshbuffer
/** \return Material of this buffer. */
virtual const video::SMaterial& getMaterial() const _IRR_OVERRIDE_ =0;
//! Get the axis aligned bounding box of this meshbuffer.
/** \return Axis aligned bounding box of this buffer. */
virtual const core::aabbox3df& getBoundingBox() const _IRR_OVERRIDE_ =0;
//! Set axis aligned bounding box
/** \param box User defined axis aligned bounding box to use
for this buffer. */
virtual void setBoundingBox(const core::aabbox3df& box) _IRR_OVERRIDE_ =0;
//! Recalculates the bounding box. Should be called if the mesh changed.
virtual void recalculateBoundingBox() _IRR_OVERRIDE_ =0;
//! Append the vertices and indices to the current buffer
/** Only works for compatible vertex types.
\param vertices Pointer to a vertex array.
\param numVertices Number of vertices in the array.
\param indices Pointer to index array.
\param numIndices Number of indices in array. */
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) _IRR_OVERRIDE_
{
}
//! Append the meshbuffer to the current buffer
/** Only works for compatible vertex types
\param other Buffer to append to this one. */
virtual void append(const IMeshBuffer* const other) _IRR_OVERRIDE_
{
}
// ------------------- To be removed? ------------------- //
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const _IRR_OVERRIDE_
{
return getVertexBuffer().getHardwareMappingHint();
}
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const _IRR_OVERRIDE_
{
return getIndexBuffer().getHardwareMappingHint();
}
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX ) _IRR_OVERRIDE_
{
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
getVertexBuffer().setHardwareMappingHint(NewMappingHint);
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
getIndexBuffer().setHardwareMappingHint(NewMappingHint);
}
//! flags the mesh as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
{
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)
getVertexBuffer().setDirty();
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX)
getIndexBuffer().setDirty();
}
virtual u32 getChangedID_Vertex() const _IRR_OVERRIDE_
{
return getVertexBuffer().getChangedID();
}
virtual u32 getChangedID_Index() const _IRR_OVERRIDE_
{
return getIndexBuffer().getChangedID();
}
// ------------------- Old interface ------------------- //
//! Get type of vertex data which is stored in this meshbuffer.
/** \return Vertex type of this buffer. */
virtual video::E_VERTEX_TYPE getVertexType() const _IRR_OVERRIDE_
{
return getVertexBuffer().getType();
}
//! Get access to vertex data. The data is an array of vertices.
/** Which vertex type is used can be determined by getVertexType().
\return Pointer to array of vertices. */
virtual const void* getVertices() const _IRR_OVERRIDE_
{
return getVertexBuffer().getData();
}
//! Get access to vertex data. The data is an array of vertices.
/** Which vertex type is used can be determined by getVertexType().
\return Pointer to array of vertices. */
virtual void* getVertices() _IRR_OVERRIDE_
{
return getVertexBuffer().getData();
}
//! Get amount of vertices in meshbuffer.
/** \return Number of vertices in this buffer. */
virtual u32 getVertexCount() const _IRR_OVERRIDE_
{
return getVertexBuffer().size();
}
//! Get type of index data which is stored in this meshbuffer.
/** \return Index type of this buffer. */
virtual video::E_INDEX_TYPE getIndexType() const _IRR_OVERRIDE_
{
return getIndexBuffer().getType();
}
//! Get access to indices.
/** \return Pointer to indices array. */
virtual const u16* getIndices() const _IRR_OVERRIDE_
{
return (u16*)getIndexBuffer().getData();
}
//! Get access to indices.
/** \return Pointer to indices array. */
virtual u16* getIndices() _IRR_OVERRIDE_
{
return (u16*)getIndexBuffer().getData();
}
//! Get amount of indices in this meshbuffer.
/** \return Number of indices in this buffer. */
virtual u32 getIndexCount() const _IRR_OVERRIDE_
{
return getIndexBuffer().size();
}
//! returns position of vertex i
virtual const core::vector3df& getPosition(u32 i) const _IRR_OVERRIDE_
{
return getVertexBuffer()[i].Pos;
}
//! returns position of vertex i
virtual core::vector3df& getPosition(u32 i) _IRR_OVERRIDE_
{
return getVertexBuffer()[i].Pos;
}
//! returns texture coords of vertex i
virtual const core::vector2df& getTCoords(u32 i) const _IRR_OVERRIDE_
{
return getVertexBuffer()[i].TCoords;
}
//! returns texture coords of vertex i
virtual core::vector2df& getTCoords(u32 i) _IRR_OVERRIDE_
{
return getVertexBuffer()[i].TCoords;
}
//! returns normal of vertex i
virtual const core::vector3df& getNormal(u32 i) const _IRR_OVERRIDE_
{
return getVertexBuffer()[i].Normal;
}
//! returns normal of vertex i
virtual core::vector3df& getNormal(u32 i) _IRR_OVERRIDE_
{
return getVertexBuffer()[i].Normal;
}
};
} // end namespace scene
} // end namespace irr
#endif

1
include/ISceneManager.h

@ -12,7 +12,6 @@
#include "vector3d.h"
#include "dimension2d.h"
#include "SColor.h"
#include "ETerrainElements.h"
#include "ESceneNodeTypes.h"
#include "EMeshWriterEnums.h"
#include "SceneParameters.h"

14
include/IVideoDriver.h

@ -509,20 +509,6 @@ namespace video
core::position2d<s32> colorKeyPixelPos,
bool zeroTexels = false) const =0;
//! Creates a normal map from a height map texture.
/** As input is considered to be a height map the texture is read like:
- For a 32-bit texture only the red channel is regarded
- For a 16-bit texture the rgb-values are averaged.
Output channels red/green for X/Y and blue for up (Z).
For a 32-bit texture we store additionally the height value in the
alpha channel. This value is used by the video::EMT_PARALLAX_MAP_SOLID
material and similar materials.
On the borders the texture is considered to repeat.
\param texture Height map texture which is converted to a normal map.
\param amplitude Constant value by which the height
information is multiplied.*/
virtual void makeNormalMapTexture(video::ITexture* texture, f32 amplitude=1.0f) const =0;
//! Set a render target.
/** This will only work if the driver supports the
EVDF_RENDER_TO_TARGET feature, which can be queried with

43
include/SKeyMap.h

@ -1,43 +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 __S_KEY_MAP_H_INCLUDED__
#define __S_KEY_MAP_H_INCLUDED__
#include "Keycodes.h"
namespace irr
{
//! enumeration for key actions. Used for example in the FPS Camera.
enum EKEY_ACTION
{
EKA_MOVE_FORWARD = 0,
EKA_MOVE_BACKWARD,
EKA_STRAFE_LEFT,
EKA_STRAFE_RIGHT,
EKA_JUMP_UP,
EKA_CROUCH,
EKA_ROTATE_LEFT,
EKA_ROTATE_RIGHT,
EKA_COUNT,
//! This value is not used. It only forces this enumeration to compile in 32 bit.
EKA_FORCE_32BIT = 0x7fffffff
};
//! Struct storing which key belongs to which action.
struct SKeyMap
{
SKeyMap() {}
SKeyMap(EKEY_ACTION action, EKEY_CODE keyCode) : Action(action), KeyCode(keyCode) {}
EKEY_ACTION Action;
EKEY_CODE KeyCode;
};
} // end namespace irr
#endif

2
include/SMaterial.h

@ -355,7 +355,7 @@ namespace video
f32 Shininess;
//! Free parameter, dependent on the material type.
/** Mostly ignored, used for example in EMT_PARALLAX_MAP_SOLID,
/** Mostly ignored, used for example in
EMT_TRANSPARENT_ALPHA_CHANNEL and EMT_ONETEXTURE_BLEND. */
f32 MaterialTypeParam;

260
include/SSharedMeshBuffer.h

@ -1,260 +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 __S_SHARED_MESH_BUFFER_H_INCLUDED__
#define __S_SHARED_MESH_BUFFER_H_INCLUDED__
#include "irrArray.h"
#include "IMeshBuffer.h"
namespace irr
{
namespace scene
{
//! Implementation of the IMeshBuffer interface with shared vertex list
struct SSharedMeshBuffer : public IMeshBuffer
{
//! constructor
SSharedMeshBuffer()
: IMeshBuffer()
, Vertices(0), ChangedID_Vertex(1), ChangedID_Index(1)
, MappingHintVertex(EHM_NEVER), MappingHintIndex(EHM_NEVER)
, PrimitiveType(EPT_TRIANGLES)
{
#ifdef _DEBUG
setDebugName("SSharedMeshBuffer");
#endif
}
//! constructor
SSharedMeshBuffer(core::array<video::S3DVertex> *vertices) : IMeshBuffer(), Vertices(vertices), ChangedID_Vertex(1), ChangedID_Index(1), MappingHintVertex(EHM_NEVER), MappingHintIndex(EHM_NEVER)
{
#ifdef _DEBUG
setDebugName("SSharedMeshBuffer");
#endif
}
//! returns the material of this meshbuffer
virtual const video::SMaterial& getMaterial() const _IRR_OVERRIDE_
{
return Material;
}
//! returns the material of this meshbuffer
virtual video::SMaterial& getMaterial() _IRR_OVERRIDE_
{
return Material;
}
//! returns pointer to vertices
virtual const void* getVertices() const _IRR_OVERRIDE_
{
if (Vertices)
return Vertices->const_pointer();
else
return 0;
}
//! returns pointer to vertices
virtual void* getVertices() _IRR_OVERRIDE_
{
if (Vertices)
return Vertices->pointer();
else
return 0;
}
//! returns amount of vertices
virtual u32 getVertexCount() const _IRR_OVERRIDE_
{
if (Vertices)
return Vertices->size();
else
return 0;
}
//! returns pointer to indices
virtual const u16* getIndices() const _IRR_OVERRIDE_
{
return Indices.const_pointer();
}
//! returns pointer to indices
virtual u16* getIndices() _IRR_OVERRIDE_
{
return Indices.pointer();
}
//! returns amount of indices
virtual u32 getIndexCount() const _IRR_OVERRIDE_
{
return Indices.size();
}
//! Get type of index data which is stored in this meshbuffer.
virtual video::E_INDEX_TYPE getIndexType() const _IRR_OVERRIDE_
{
return video::EIT_16BIT;
}
//! returns an axis aligned bounding box
virtual const core::aabbox3d<f32>& getBoundingBox() const _IRR_OVERRIDE_
{
return BoundingBox;
}
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box) _IRR_OVERRIDE_
{
BoundingBox = box;
}
//! returns which type of vertex data is stored.
virtual video::E_VERTEX_TYPE getVertexType() const _IRR_OVERRIDE_
{
return video::EVT_STANDARD;
}
//! recalculates the bounding box. should be called if the mesh changed.
virtual void recalculateBoundingBox() _IRR_OVERRIDE_
{
if (!Vertices || Vertices->empty() || Indices.empty())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset((*Vertices)[Indices[0]].Pos);
for (u32 i=1; i<Indices.size(); ++i)
BoundingBox.addInternalPoint((*Vertices)[Indices[i]].Pos);
}
}
//! returns position of vertex i
virtual const core::vector3df& getPosition(u32 i) const _IRR_OVERRIDE_
{
_IRR_DEBUG_BREAK_IF(!Vertices);
return (*Vertices)[Indices[i]].Pos;
}
//! returns position of vertex i
virtual core::vector3df& getPosition(u32 i) _IRR_OVERRIDE_
{
_IRR_DEBUG_BREAK_IF(!Vertices);
return (*Vertices)[Indices[i]].Pos;
}
//! returns normal of vertex i
virtual const core::vector3df& getNormal(u32 i) const _IRR_OVERRIDE_
{
_IRR_DEBUG_BREAK_IF(!Vertices);
return (*Vertices)[Indices[i]].Normal;
}
//! returns normal of vertex i
virtual core::vector3df& getNormal(u32 i) _IRR_OVERRIDE_
{
_IRR_DEBUG_BREAK_IF(!Vertices);
return (*Vertices)[Indices[i]].Normal;
}
//! returns texture coord of vertex i
virtual const core::vector2df& getTCoords(u32 i) const _IRR_OVERRIDE_
{
_IRR_DEBUG_BREAK_IF(!Vertices);
return (*Vertices)[Indices[i]].TCoords;
}
//! returns texture coord of vertex i
virtual core::vector2df& getTCoords(u32 i) _IRR_OVERRIDE_
{
_IRR_DEBUG_BREAK_IF(!Vertices);
return (*Vertices)[Indices[i]].TCoords;
}
//! append the vertices and indices to the current buffer
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) _IRR_OVERRIDE_ {}
//! append the meshbuffer to the current buffer
virtual void append(const IMeshBuffer* const other) _IRR_OVERRIDE_ {}
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const _IRR_OVERRIDE_
{
return MappingHintVertex;
}
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const _IRR_OVERRIDE_
{
return MappingHintIndex;
}
//! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) _IRR_OVERRIDE_
{
if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
MappingHintVertex=NewMappingHint;
if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
MappingHintIndex=NewMappingHint;
}
//! Describe what kind of primitive geometry is used by the meshbuffer
virtual void setPrimitiveType(E_PRIMITIVE_TYPE type) _IRR_OVERRIDE_
{
PrimitiveType = type;
}
//! Get the kind of primitive geometry which is used by the meshbuffer
virtual E_PRIMITIVE_TYPE getPrimitiveType() const _IRR_OVERRIDE_
{
return PrimitiveType;
}
//! flags the mesh as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_
{
if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
++ChangedID_Vertex;
if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
++ChangedID_Index;
}
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual u32 getChangedID_Vertex() const _IRR_OVERRIDE_ {return ChangedID_Vertex;}
//! Get the currently used ID for identification of changes.
/** This shouldn't be used for anything outside the VideoDriver. */
virtual u32 getChangedID_Index() const _IRR_OVERRIDE_ {return ChangedID_Index;}
//! Material of this meshBuffer
video::SMaterial Material;
//! Shared Array of vertices
core::array<video::S3DVertex> *Vertices;
//! Array of indices
core::array<u16> Indices;
//! ID used for hardware buffer management
u32 ChangedID_Vertex;
//! ID used for hardware buffer management
u32 ChangedID_Index;
//! Bounding box
core::aabbox3df BoundingBox;
//! hardware mapping hint
E_HARDWARE_MAPPING MappingHintVertex;
E_HARDWARE_MAPPING MappingHintIndex;
//! Primitive type used for rendering (triangles, lines, ...)
E_PRIMITIVE_TYPE PrimitiveType;
};
} // end namespace scene
} // end namespace irr
#endif

5
include/irrlicht.h

@ -31,7 +31,6 @@
#include "IrrCompileConfig.h"
#include "aabbox3d.h"
#include "CDynamicMeshBuffer.h"
#include "CIndexBuffer.h"
#include "CMeshBuffer.h"
#include "coreutil.h"
@ -50,7 +49,6 @@
#include "EMeshWriterEnums.h"
#include "EMessageBoxFlags.h"
#include "ESceneNodeTypes.h"
#include "ETerrainElements.h"
#include "fast_atof.h"
#include "heapsort.h"
#include "IAnimatedMesh.h"
@ -63,7 +61,6 @@
#include "IContextManager.h"
#include "ICursorControl.h"
#include "IDummyTransformationSceneNode.h"
#include "IDynamicMeshBuffer.h"
#include "IEventReceiver.h"
#include "IFileList.h"
#include "IFileSystem.h"
@ -150,12 +147,10 @@
#include "SColor.h"
#include "SExposedVideoData.h"
#include "SIrrCreationParameters.h"
#include "SKeyMap.h"
#include "SLight.h"
#include "SMaterial.h"
#include "SMesh.h"
#include "SMeshBuffer.h"
#include "SSharedMeshBuffer.h"
#include "SSkinMeshBuffer.h"
#include "SVertexIndex.h"
#include "SViewFrustum.h"

74
media/Shaders/COGLES2NormalMap.fsh

@ -1,74 +0,0 @@
#define MAX_LIGHTS 2
precision mediump float;
/* Uniforms */
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 vTexCoord;
varying vec3 vLightVector[MAX_LIGHTS];
varying vec4 vLightColor[MAX_LIGHTS];
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 = texture2D(uTextureUnit0, vTexCoord);
vec3 Normal = texture2D(uTextureUnit1, vTexCoord).xyz * 2.0 - 1.0;
vec4 FinalColor = vec4(0.0, 0.0, 0.0, 0.0);
for (int i = 0; i < int(MAX_LIGHTS); i++)
{
vec3 LightVector = normalize(vLightVector[i]);
float Lambert = max(dot(LightVector, Normal), 0.0);
FinalColor += vec4(Lambert) * vLightColor[i];
}
FinalColor *= Color;
FinalColor.w = vLightColor[0].w;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
FinalColor = mix(FogColor, FinalColor, FogFactor);
}
gl_FragColor = FinalColor;
}

52
media/Shaders/COGLES2NormalMap.vsh

@ -1,52 +0,0 @@
#define MAX_LIGHTS 2
/* Attributes */
attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec3 inVertexTangent;
attribute vec3 inVertexBinormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
/* Uniforms */
uniform mat4 uWVPMatrix;
uniform mat4 uWVMatrix;
uniform vec3 uLightPosition[MAX_LIGHTS];
uniform vec4 uLightColor[MAX_LIGHTS];
/* Varyings */
varying vec2 vTexCoord;
varying vec3 vLightVector[MAX_LIGHTS];
varying vec4 vLightColor[MAX_LIGHTS];
varying float vFogCoord;
void main()
{
gl_Position = uWVPMatrix * vec4(inVertexPosition, 1.0);
vTexCoord = inTexCoord0;
for (int i = 0; i < int(MAX_LIGHTS); i++)
{
vec3 LightVector = uLightPosition[i] - inVertexPosition;
vLightVector[i].x = dot(inVertexTangent, LightVector);
vLightVector[i].y = dot(inVertexBinormal, LightVector);
vLightVector[i].z = dot(inVertexNormal, LightVector);
vLightColor[i].x = dot(LightVector, LightVector);
vLightColor[i].x *= uLightColor[i].a;
vLightColor[i] = vec4(inversesqrt(vLightColor[i].x));
vLightColor[i] *= uLightColor[i];
vLightColor[i].a = inVertexColor.a;
vLightColor[i].x = clamp(vLightColor[i].x, 0.0, 1.0);
vLightColor[i].y = clamp(vLightColor[i].y, 0.0, 1.0);
vLightColor[i].z = clamp(vLightColor[i].z, 0.0, 1.0);
}
vFogCoord = length((uWVMatrix * vec4(inVertexPosition, 1.0)).xyz);
}

82
media/Shaders/COGLES2ParallaxMap.fsh

@ -1,82 +0,0 @@
#define MAX_LIGHTS 2
precision mediump float;
/* Uniforms */
uniform float uFactor;
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 vTexCoord;
varying vec3 vEyeVector;
varying vec3 vLightVector[MAX_LIGHTS];
varying vec4 vLightColor[MAX_LIGHTS];
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 TempFetch = texture2D(uTextureUnit1, vTexCoord) * 2.0 - 1.0;
TempFetch *= uFactor;
vec3 EyeVector = normalize(vEyeVector);
vec2 TexCoord = EyeVector.xy * TempFetch.w + vTexCoord;
vec4 Color = texture2D(uTextureUnit0, TexCoord);
vec3 Normal = texture2D(uTextureUnit1, TexCoord).xyz * 2.0 - 1.0;
vec4 FinalColor = vec4(0.0, 0.0, 0.0, 0.0);
for (int i = 0; i < int(MAX_LIGHTS); i++)
{
vec3 LightVector = normalize(vLightVector[i]);
float Lambert = max(dot(LightVector, Normal), 0.0);
FinalColor += vec4(Lambert) * vLightColor[i];
}
FinalColor *= Color;
FinalColor.w = vLightColor[0].w;
if (bool(uFogEnable))
{
float FogFactor = computeFog();
vec4 FogColor = uFogColor;
FogColor.a = 1.0;
FinalColor = mix(FogColor, FinalColor, FogFactor);
}
gl_FragColor = FinalColor;
}

61
media/Shaders/COGLES2ParallaxMap.vsh

@ -1,61 +0,0 @@
#define MAX_LIGHTS 2
/* Attributes */
attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec3 inVertexTangent;
attribute vec3 inVertexBinormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
/* Uniforms */
uniform mat4 uWVPMatrix;
uniform mat4 uWVMatrix;
uniform vec3 uEyePosition;
uniform vec3 uLightPosition[MAX_LIGHTS];
uniform vec4 uLightColor[MAX_LIGHTS];
/* Varyings */
varying vec2 vTexCoord;
varying vec3 vEyeVector;
varying vec3 vLightVector[MAX_LIGHTS];
varying vec4 vLightColor[MAX_LIGHTS];
varying float vFogCoord;
void main()
{
gl_Position = uWVPMatrix * vec4(inVertexPosition, 1.0);
vTexCoord = inTexCoord0;
vec3 EyeVector = uEyePosition - inVertexPosition;
vEyeVector.x = dot(inVertexTangent, EyeVector);
vEyeVector.y = dot(inVertexBinormal, EyeVector);
vEyeVector.z = dot(inVertexNormal, EyeVector);
vEyeVector *= vec3(1.0, -1.0, -1.0);
for (int i = 0; i < int(MAX_LIGHTS); i++)
{
vec3 LightVector = uLightPosition[i] - inVertexPosition;
vLightVector[i].x = dot(inVertexTangent, LightVector);
vLightVector[i].y = dot(inVertexBinormal, LightVector);
vLightVector[i].z = dot(inVertexNormal, LightVector);
vLightColor[i].x = dot(LightVector, LightVector);
vLightColor[i].x *= uLightColor[i].a;
vLightColor[i] = vec4(inversesqrt(vLightColor[i].x));
vLightColor[i] *= uLightColor[i];
vLightColor[i].a = inVertexColor.a;
vLightColor[i].x = clamp(vLightColor[i].x, 0.0, 1.0);
vLightColor[i].y = clamp(vLightColor[i].y, 0.0, 1.0);
vLightColor[i].z = clamp(vLightColor[i].z, 0.0, 1.0);
}
vFogCoord = length((uWVMatrix * vec4(inVertexPosition, 1.0)).xyz);
}

67
source/Irrlicht/CBlit.h

@ -1057,73 +1057,6 @@ static s32 Blit(eBlitter operation,
return 1;
}
#if defined(SOFTWARE_DRIVER_2_2D_AS_2D)
static s32 StretchBlit(eBlitter operation,
video::IImage* dest, const core::rect<s32>* destClipping,const core::rect<s32> *destRect,
video::IImage* const source,const core::rect<s32> *srcRect, const core::dimension2d<u32>* source_org,
u32 argb)
{
tExecuteBlit blitter = getBlitter2( operation, dest, source );
if ( 0 == blitter )
{
return 0;
}
SBlitJob job;
AbsRectangle destClip;
AbsRectangle v;
setClip(destClip, destClipping, dest, 0, 0);
setClip(v, destRect, 0, 1, 0);
if (!intersect(job.Dest, destClip, v))
return 0;
// Clipping
setClip ( job.Source, srcRect, source, 1, source_org);
job.width = job.Dest.x1-job.Dest.x0;
job.height = job.Dest.y1-job.Dest.y0;
job.argb = argb;
// use original dest size, despite any clipping
const int dst_w = v.x1 - v.x0; // destRect->getWidth();
const int dst_h = v.y1 - v.y0; // destRect->getHeight();
const int src_w = job.Source.x1 - job.Source.x0;
const int src_h = job.Source.y1 - job.Source.y0;
job.stretch = dst_w != src_w || dst_h != src_h;
job.x_stretch = dst_w ? (float)src_w / (float)dst_w : 1.f;
job.y_stretch = dst_h ? (float)src_h / (float)dst_h : 1.f;
if ( source )
{
job.srcPitch = source->getPitch();
job.srcPixelMul = source->getBytesPerPixel();
//dest-clippling. advance source. loosing subpixel precision
job.Source.x0 += (s32)floorf(job.x_stretch * (job.Dest.x0 - v.x0));
job.Source.y0 += (s32)floorf(job.y_stretch * (job.Dest.y0 - v.y0));
job.src = (void*) ( (u8*) source->getData() + ( job.Source.y0 * job.srcPitch ) + ( job.Source.x0 * job.srcPixelMul ) );
}
else
{
// use srcPitch for color operation on dest
job.srcPitch = job.width * dest->getBytesPerPixel();
}
job.dstPitch = dest->getPitch();
job.dstPixelMul = dest->getBytesPerPixel();
job.dst = (void*) ( (u8*) dest->getData() + ( job.Dest.y0 * job.dstPitch ) + ( job.Dest.x0 * job.dstPixelMul ) );
blitter( &job );
return 1;
}
#endif
}
#endif

4
source/Irrlicht/CMakeLists.txt

@ -162,8 +162,6 @@ set(IRRDRVROBJ
CNullDriver.cpp
COpenGLCacheHandler.cpp
COpenGLDriver.cpp
COpenGLNormalMapRenderer.cpp
COpenGLParallaxMapRenderer.cpp
COpenGLShaderMaterialRenderer.cpp
COpenGLSLMaterialRenderer.cpp
COpenGLExtensionHandler.cpp
@ -173,8 +171,6 @@ set(IRRDRVROBJ
COGLES2ExtensionHandler.cpp
COGLES2FixedPipelineRenderer.cpp
COGLES2MaterialRenderer.cpp
COGLES2NormalMapRenderer.cpp
COGLES2ParallaxMapRenderer.cpp
COGLES2Renderer2D.cpp
CWebGL1Driver.cpp
CGLXManager.cpp

118
source/Irrlicht/CNullDriver.cpp

@ -1291,124 +1291,6 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
}
//! Creates a normal map from a height map texture.
//! \param amplitude: Constant value by which the height information is multiplied.
void CNullDriver::makeNormalMapTexture(video::ITexture* texture, f32 amplitude) const
{
if (!texture)
return;
if (texture->getColorFormat() != ECF_A1R5G5B5 &&
texture->getColorFormat() != ECF_A8R8G8B8 )
{
os::Printer::log("Error: Unsupported texture color format for making normal map.", ELL_ERROR);
return;
}
core::dimension2d<u32> dim = texture->getSize();
amplitude = amplitude / 255.0f;
f32 vh = dim.Height / (f32)dim.Width;
f32 hh = dim.Width / (f32)dim.Height;
if (texture->getColorFormat() == ECF_A8R8G8B8)
{
// ECF_A8R8G8B8 version
s32 *p = (s32*)texture->lock();
if (!p)
{
os::Printer::log("Could not lock texture for making normal map.", ELL_ERROR);
return;
}
// copy texture
u32 pitch = texture->getPitch() / 4;
s32* in = new s32[dim.Height * pitch];
memcpy(in, p, dim.Height * pitch * 4);
for (s32 x=0; x < s32(pitch); ++x)
for (s32 y=0; y < s32(dim.Height); ++y)
{
// TODO: this could be optimized really a lot
core::vector3df h1((x-1)*hh, nml32(x-1, y, pitch, dim.Height, in)*amplitude, y*vh);
core::vector3df h2((x+1)*hh, nml32(x+1, y, pitch, dim.Height, in)*amplitude, y*vh);
//core::vector3df v1(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
//core::vector3df v2(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
core::vector3df v1(x*hh, nml32(x, y+1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
core::vector3df v2(x*hh, nml32(x, y-1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
core::vector3df v = v1-v2;
core::vector3df h = h1-h2;
core::vector3df n = v.crossProduct(h);
n.normalize();
n *= 0.5f;
n += core::vector3df(0.5f,0.5f,0.5f); // now between 0 and 1
n *= 255.0f;
s32 height = (s32)nml32(x, y, pitch, dim.Height, in);
p[y*pitch + x] = video::SColor(
height, // store height in alpha
(s32)n.X, (s32)n.Z, (s32)n.Y).color;
}
delete [] in;
texture->unlock();
}
else
{
// ECF_A1R5G5B5 version
s16 *p = (s16*)texture->lock();
if (!p)
{
os::Printer::log("Could not lock texture for making normal map.", ELL_ERROR);
return;
}
u32 pitch = texture->getPitch() / 2;
// copy texture
s16* in = new s16[dim.Height * pitch];
memcpy(in, p, dim.Height * pitch * 2);
for (s32 x=0; x < s32(pitch); ++x)
for (s32 y=0; y < s32(dim.Height); ++y)
{
// TODO: this could be optimized really a lot
core::vector3df h1((x-1)*hh, nml16(x-1, y, pitch, dim.Height, in)*amplitude, y*vh);
core::vector3df h2((x+1)*hh, nml16(x+1, y, pitch, dim.Height, in)*amplitude, y*vh);
core::vector3df v1(x*hh, nml16(x, y-1, pitch, dim.Height, in)*amplitude, (y-1)*vh);
core::vector3df v2(x*hh, nml16(x, y+1, pitch, dim.Height, in)*amplitude, (y+1)*vh);
core::vector3df v = v1-v2;
core::vector3df h = h1-h2;
core::vector3df n = v.crossProduct(h);
n.normalize();
n *= 0.5f;
n += core::vector3df(0.5f,0.5f,0.5f); // now between 0 and 1
n *= 255.0f;
p[y*pitch + x] = video::RGBA16((u32)n.X, (u32)n.Z, (u32)n.Y);
}
delete [] in;
texture->unlock();
}
texture->regenerateMipMapLevels();
}
//! Returns the maximum amount of primitives (mostly vertices) which
//! the device is able to render with one drawIndexedTriangleList
//! call.

33
source/Irrlicht/CNullDriver.h

@ -335,10 +335,6 @@ namespace video
virtual void makeColorKeyTexture(video::ITexture* texture, core::position2d<s32> colorKeyPixelPos,
bool zeroTexels) const _IRR_OVERRIDE_;
//! Creates a normal map from a height map texture.
//! \param amplitude: Constant value by which the height information is multiplied.
virtual void makeNormalMapTexture(video::ITexture* texture, f32 amplitude=1.0f) const _IRR_OVERRIDE_;
//! Returns the maximum amount of primitives (mostly vertices) which
//! the device is able to render with one drawIndexedTriangleList
//! call.
@ -720,35 +716,6 @@ namespace video
// prints renderer version
void printVersion();
//! normal map lookup 32 bit version
inline f32 nml32(int x, int y, int pitch, int height, s32 *p) const
{
if (x < 0)
x = pitch-1;
if (x >= pitch)
x = 0;
if (y < 0)
y = height-1;
if (y >= height)
y = 0;
return (f32)(((p[(y * pitch) + x])>>16) & 0xff);
}
//! normal map lookup 16 bit version
inline f32 nml16(int x, int y, int pitch, int height, s16 *p) const
{
if (x < 0)
x = pitch-1;
if (x >= pitch)
x = 0;
if (y < 0)
y = height-1;
if (y >= height)
y = 0;
return (f32) getAverage ( p[(y * pitch) + x] );
}
inline bool getWriteZBuffer(const SMaterial& material) const
{
switch ( material.ZWriteEnable )

11
source/Irrlicht/COBJMeshFileLoader.cpp

@ -316,16 +316,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
Materials[m]->Meshbuffer->recalculateBoundingBox();
if (Materials[m]->RecalculateNormals)
SceneManager->getMeshManipulator()->recalculateNormals(Materials[m]->Meshbuffer);
if (Materials[m]->Meshbuffer->Material.MaterialType == video::EMT_PARALLAX_MAP_SOLID)
{
SMesh tmp;
tmp.addMeshBuffer(Materials[m]->Meshbuffer);
IMesh* tangentMesh = SceneManager->getMeshManipulator()->createMeshWithTangents(&tmp);
mesh->addMeshBuffer(tangentMesh->getMeshBuffer(0));
tangentMesh->drop();
}
else
mesh->addMeshBuffer( Materials[m]->Meshbuffer );
mesh->addMeshBuffer( Materials[m]->Meshbuffer );
}
}

38
source/Irrlicht/COGLES2Driver.cpp

@ -15,8 +15,6 @@
#include "COGLES2MaterialRenderer.h"
#include "COGLES2FixedPipelineRenderer.h"
#include "COGLES2NormalMapRenderer.h"
#include "COGLES2ParallaxMapRenderer.h"
#include "COGLES2Renderer2D.h"
#include "EVertexAttributes.h"
@ -248,12 +246,6 @@ COGLES2Driver::~COGLES2Driver()
COGLES2MaterialSolidCB* TransparentAlphaChannelRefCB = new COGLES2MaterialSolidCB();
COGLES2MaterialSolidCB* TransparentVertexAlphaCB = new COGLES2MaterialSolidCB();
COGLES2MaterialReflectionCB* TransparentReflection2LayerCB = new COGLES2MaterialReflectionCB();
COGLES2MaterialNormalMapCB* NormalMapCB = new COGLES2MaterialNormalMapCB();
COGLES2MaterialNormalMapCB* NormalMapAddColorCB = new COGLES2MaterialNormalMapCB();
COGLES2MaterialNormalMapCB* NormalMapVertexAlphaCB = new COGLES2MaterialNormalMapCB();
COGLES2MaterialParallaxMapCB* ParallaxMapCB = new COGLES2MaterialParallaxMapCB();
COGLES2MaterialParallaxMapCB* ParallaxMapAddColorCB = new COGLES2MaterialParallaxMapCB();
COGLES2MaterialParallaxMapCB* ParallaxMapVertexAlphaCB = new COGLES2MaterialParallaxMapCB();
COGLES2MaterialOneTextureBlendCB* OneTextureBlendCB = new COGLES2MaterialOneTextureBlendCB();
// Create built-in materials.
@ -342,30 +334,6 @@ COGLES2Driver::~COGLES2Driver()
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 + "COGLES2NormalMap.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2NormalMap.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, NormalMapCB, 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, NormalMapAddColorCB, EMT_TRANSPARENT_ADD_COLOR, 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, NormalMapVertexAlphaCB, EMT_TRANSPARENT_ALPHA_CHANNEL, 0);
VertexShader = OGLES2ShaderPath + "COGLES2ParallaxMap.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2ParallaxMap.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, ParallaxMapCB, 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, ParallaxMapAddColorCB, EMT_TRANSPARENT_ADD_COLOR, 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, ParallaxMapVertexAlphaCB, EMT_TRANSPARENT_ALPHA_CHANNEL, 0);
VertexShader = OGLES2ShaderPath + "COGLES2Solid.vsh";
FragmentShader = OGLES2ShaderPath + "COGLES2OneTextureBlend.fsh";
@ -391,12 +359,6 @@ COGLES2Driver::~COGLES2Driver()
TransparentAlphaChannelRefCB->drop();
TransparentVertexAlphaCB->drop();
TransparentReflection2LayerCB->drop();
NormalMapCB->drop();
NormalMapAddColorCB->drop();
NormalMapVertexAlphaCB->drop();
ParallaxMapCB->drop();
ParallaxMapAddColorCB->drop();
ParallaxMapVertexAlphaCB->drop();
OneTextureBlendCB->drop();
// Create 2D material renderers

2
source/Irrlicht/COGLES2Driver.h

@ -37,8 +37,6 @@ namespace video
{
class COGLES2FixedPipelineRenderer;
class COGLES2NormalMapRenderer;
class COGLES2ParallaxMapRenderer;
class COGLES2Renderer2D;
class COGLES2Driver : public CNullDriver, public IMaterialRendererServices, public COGLES2ExtensionHandler

8
source/Irrlicht/COGLES2MaterialRenderer.cpp

@ -40,13 +40,9 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
{
case EMT_TRANSPARENT_VERTEX_ALPHA:
case EMT_TRANSPARENT_ALPHA_CHANNEL:
case EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:
case EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:
Alpha = true;
break;
case EMT_TRANSPARENT_ADD_COLOR:
case EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:
case EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:
FixedBlending = true;
break;
case EMT_ONETEXTURE_BLEND:
@ -72,13 +68,9 @@ COGLES2MaterialRenderer::COGLES2MaterialRenderer(COGLES2Driver* driver,
{
case EMT_TRANSPARENT_VERTEX_ALPHA:
case EMT_TRANSPARENT_ALPHA_CHANNEL:
case EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA:
case EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA:
Alpha = true;
break;
case EMT_TRANSPARENT_ADD_COLOR:
case EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR:
case EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR:
FixedBlending = true;
break;
case EMT_ONETEXTURE_BLEND: