mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-24 17:50:31 +01:00
Switch SMaterial to default copy constructor and assignment operator
It's not 100% identical to what we had as I only copied up to MATERIAL_MAX_TEXTURES_USED before, but I think that was rather premature optimiziation.
(the cost for the extra textures is really in other places, don't think the copy here ever matters).
Was a bit based on Mintest patch, but they messed it up: 4931b34625
(because they didn't notice the difference between MATERIAL_MAX_TEXTURES_USED and MATERIAL_MAX_TEXTURES).
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6363 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
77d5df9b1b
commit
2d5673a1d4
@ -289,9 +289,8 @@ namespace video
|
||||
|
||||
We (mostly) avoid dynamic memory in SMaterial, so the extra memory
|
||||
will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the
|
||||
material comparisons and assignments can be faster. Also several other
|
||||
places in the engine can be faster when reducing this value to the limit
|
||||
you need.
|
||||
material comparisons can be faster. Also several other places in the
|
||||
engine can be faster when reducing this value to the limit you need.
|
||||
|
||||
NOTE: This should only be changed once and before any call to createDevice.
|
||||
NOTE: Do not set it below 1 or above the value of _IRR_MATERIAL_MAX_TEXTURES_.
|
||||
@ -318,63 +317,6 @@ namespace video
|
||||
FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
|
||||
{ }
|
||||
|
||||
//! Copy constructor
|
||||
/** \param other Material to copy from. */
|
||||
SMaterial(const SMaterial& other)
|
||||
{
|
||||
// These pointers are checked during assignment
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
TextureLayer[i].TextureMatrix = 0;
|
||||
*this = other;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
/** \param other Material to copy from. */
|
||||
SMaterial& operator=(const SMaterial& other)
|
||||
{
|
||||
// Check for self-assignment!
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
MaterialType = other.MaterialType;
|
||||
|
||||
AmbientColor = other.AmbientColor;
|
||||
DiffuseColor = other.DiffuseColor;
|
||||
EmissiveColor = other.EmissiveColor;
|
||||
SpecularColor = other.SpecularColor;
|
||||
Shininess = other.Shininess;
|
||||
MaterialTypeParam = other.MaterialTypeParam;
|
||||
MaterialTypeParam2 = other.MaterialTypeParam2;
|
||||
Thickness = other.Thickness;
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
|
||||
{
|
||||
TextureLayer[i] = other.TextureLayer[i];
|
||||
}
|
||||
|
||||
Wireframe = other.Wireframe;
|
||||
PointCloud = other.PointCloud;
|
||||
GouraudShading = other.GouraudShading;
|
||||
Lighting = other.Lighting;
|
||||
ZWriteEnable = other.ZWriteEnable;
|
||||
BackfaceCulling = other.BackfaceCulling;
|
||||
FrontfaceCulling = other.FrontfaceCulling;
|
||||
FogEnable = other.FogEnable;
|
||||
NormalizeNormals = other.NormalizeNormals;
|
||||
ZBuffer = other.ZBuffer;
|
||||
AntiAliasing = other.AntiAliasing;
|
||||
ColorMask = other.ColorMask;
|
||||
ColorMaterial = other.ColorMaterial;
|
||||
BlendOperation = other.BlendOperation;
|
||||
BlendFactor = other.BlendFactor;
|
||||
PolygonOffsetFactor = other.PolygonOffsetFactor;
|
||||
PolygonOffsetDirection = other.PolygonOffsetDirection;
|
||||
PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;
|
||||
PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;
|
||||
UseMipMaps = other.UseMipMaps;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Texture layer array.
|
||||
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Tests finished. 72 tests of 72 passed.
|
||||
Compiled as DEBUG
|
||||
Test suite pass at GMT Mon Apr 25 14:20:20 2022
|
||||
Test suite pass at GMT Tue Apr 26 19:16:37 2022
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user