Remove deprecated functionality of SMaterial

This commit is contained in:
Caleb Butler 2023-09-03 19:10:03 -04:00 committed by sfan5
parent 364cb37698
commit 00dd1f8ef3
3 changed files with 20 additions and 60 deletions

View File

@ -228,19 +228,6 @@ namespace video
ECM_DIFFUSE_AND_AMBIENT
};
//! DEPRECATED. Will be removed after Irrlicht 1.9.
/** Flags for the definition of the polygon offset feature. These flags define whether the offset should be into the screen, or towards the eye. */
enum E_POLYGON_OFFSET
{
//! Push pixel towards the far plane, away from the eye
/** This is typically used for rendering inner areas. */
EPO_BACK=0,
//! Pull pixels towards the camera.
/** This is typically used for polygons which should appear on top
of other elements, such as decals. */
EPO_FRONT=1
};
//! Names for polygon offset direction
const c8* const PolygonOffsetDirectionNames[] =
{
@ -289,17 +276,17 @@ namespace video
{
public:
//! Default constructor. Creates a solid, lit material with white colors
SMaterial()
: MaterialType(EMT_SOLID), AmbientColor(255,255,255,255), DiffuseColor(255,255,255,255),
EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
Shininess(0.0f), MaterialTypeParam(0.0f), Thickness(1.0f),
ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL),
ColorMaterial(ECM_DIFFUSE), BlendOperation(EBO_NONE), BlendFactor(0.0f),
PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
PolygonOffsetDepthBias(0.f), PolygonOffsetSlopeScale(0.f),
Wireframe(false), PointCloud(false), GouraudShading(true),
Lighting(true), ZWriteEnable(EZW_AUTO), BackfaceCulling(true), FrontfaceCulling(false),
FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
SMaterial() :
MaterialType(EMT_SOLID), AmbientColor(255, 255, 255, 255),
DiffuseColor(255, 255, 255, 255), EmissiveColor(0, 0, 0, 0),
SpecularColor(255, 255, 255, 255), Shininess(0.0f),
MaterialTypeParam(0.0f), Thickness(1.0f), ZBuffer(ECFN_LESSEQUAL),
AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), ColorMaterial(ECM_DIFFUSE),
BlendOperation(EBO_NONE), BlendFactor(0.0f), PolygonOffsetDepthBias(0.f),
PolygonOffsetSlopeScale(0.f), Wireframe(false), PointCloud(false),
GouraudShading(true), Lighting(true), ZWriteEnable(EZW_AUTO),
BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false),
NormalizeNormals(false), UseMipMaps(true)
{ }
//! Texture layer array.
@ -385,28 +372,16 @@ namespace video
//! Store the blend factors
/** textureBlendFunc/textureBlendFuncSeparate functions should be used to write
properly blending factors to this parameter.
Due to historical reasons this parameter is not used for material type
properly blending factors to this parameter.
Due to historical reasons this parameter is not used for material type
EMT_ONETEXTURE_BLEND which uses MaterialTypeParam instead for the blend factor.
It's generally used only for materials without any blending otherwise (like EMT_SOLID).
It's main use is to allow having shader materials which can enable/disable
blending after they have been created.
It's main use is to allow having shader materials which can enable/disable
blending after they have been created.
When you set this you usually also have to set BlendOperation to a value != EBO_NONE
(setting it to EBO_ADD is probably the most common one value). */
f32 BlendFactor;
//! DEPRECATED. Will be removed after Irrlicht 1.9. Please use PolygonOffsetDepthBias instead.
/** Factor specifying how far the polygon offset should be made.
Specifying 0 disables the polygon offset. The direction is specified separately.
The factor can be from 0 to 7.
Note: This probably never worked on Direct3D9 (was coded for D3D8 which had different value ranges) */
u8 PolygonOffsetFactor:3;
//! DEPRECATED. Will be removed after Irrlicht 1.9.
/** Flag defining the direction the polygon offset is applied to.
Can be to front or to back, specified by values from E_POLYGON_OFFSET. */
E_POLYGON_OFFSET PolygonOffsetDirection:1;
//! A constant z-buffer offset for a polygon/line/point
/** The range of the value is driver specific.
On OpenGL you get units which are multiplied by the smallest value that is guaranteed to produce a resolvable offset.
@ -438,7 +413,7 @@ namespace video
bool Lighting:1;
//! Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
to values other than ECFN_DISABLED */
E_ZWRITE ZWriteEnable:2;
@ -546,8 +521,6 @@ namespace video
ColorMaterial != b.ColorMaterial ||
BlendOperation != b.BlendOperation ||
BlendFactor != b.BlendFactor ||
PolygonOffsetFactor != b.PolygonOffsetFactor ||
PolygonOffsetDirection != b.PolygonOffsetDirection ||
PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||
UseMipMaps != b.UseMipMaps

View File

@ -35,10 +35,10 @@ namespace video
u16 EnablePasses;
//! Global enable flag, overwritten by the SceneManager in each pass
/** NOTE: This is generally _not_ set by users of the engine, but the
Scenemanager uses the EnablePass array and sets Enabled to true if the
/** NOTE: This is generally _not_ set by users of the engine, but the
Scenemanager uses the EnablePass array and sets Enabled to true if the
Override material is enabled in the current pass.
As user you generally _only_ set EnablePasses.
As user you generally _only_ set EnablePasses.
The exception is when rendering without SceneManager but using draw calls in the VideoDriver. */
bool Enabled;
@ -47,7 +47,7 @@ namespace video
SMaterialTypeReplacement(s32 original, u32 replacement) : Original(original), Replacement(replacement) {}
SMaterialTypeReplacement(u32 replacement) : Original(-1), Replacement(replacement) {}
//! SMaterial.MaterialType to replace.
//! SMaterial.MaterialType to replace.
//! -1 for all types or a specific value to only replace that one (which is either one of E_MATERIAL_TYPE or a shader material id)
s32 Original;
@ -151,8 +151,6 @@ namespace video
case EMP_BLEND_OPERATION: material.BlendOperation = Material.BlendOperation; break;
case EMP_BLEND_FACTOR: material.BlendFactor = Material.BlendFactor; break;
case EMP_POLYGON_OFFSET:
material.PolygonOffsetDirection = Material.PolygonOffsetDirection;
material.PolygonOffsetFactor = Material.PolygonOffsetFactor;
material.PolygonOffsetDepthBias = Material.PolygonOffsetDepthBias;
material.PolygonOffsetSlopeScale = Material.PolygonOffsetSlopeScale;
break;

View File

@ -2523,8 +2523,6 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
// Polygon Offset
if (queryFeature(EVDF_POLYGON_OFFSET) && (resetAllRenderStates ||
lastmaterial.PolygonOffsetDirection != material.PolygonOffsetDirection ||
lastmaterial.PolygonOffsetFactor != material.PolygonOffsetFactor ||
lastmaterial.PolygonOffsetSlopeScale != material.PolygonOffsetSlopeScale ||
lastmaterial.PolygonOffsetDepthBias != material.PolygonOffsetDepthBias ))
{
@ -2535,15 +2533,6 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
glPolygonOffset(material.PolygonOffsetSlopeScale, material.PolygonOffsetDepthBias);
}
else if (material.PolygonOffsetFactor)
{
glEnable(material.Wireframe?GL_POLYGON_OFFSET_LINE:material.PointCloud?GL_POLYGON_OFFSET_POINT:GL_POLYGON_OFFSET_FILL);
if (material.PolygonOffsetDirection==EPO_BACK)
glPolygonOffset(1.0f, (GLfloat)material.PolygonOffsetFactor);
else
glPolygonOffset(-1.0f, (GLfloat)-material.PolygonOffsetFactor);
}
else
{
glPolygonOffset(0.0f, 0.f);