cBlockArea: Added the msMask merge strategy.
This commit is contained in:
parent
0d916a3e2f
commit
1229795ff0
@ -200,6 +200,8 @@ g_APIDesc =
|
|||||||
msFillAir = { Notes = "Dst is overwritten by Src only where Src has air blocks" },
|
msFillAir = { Notes = "Dst is overwritten by Src only where Src has air blocks" },
|
||||||
msImprint = { Notes = "Src overwrites Dst anywhere where Dst has non-air blocks" },
|
msImprint = { Notes = "Src overwrites Dst anywhere where Dst has non-air blocks" },
|
||||||
msLake = { Notes = "Special mode for merging lake images" },
|
msLake = { Notes = "Special mode for merging lake images" },
|
||||||
|
msSpongePrint = { Notes = "Similar to msImprint, sponge block doesn't overwrite anything, all other blocks overwrite everything"},
|
||||||
|
msMask = { Notes = "The blocks that are exactly the same are kept in Dst, all differing blocks are replaced by air"},
|
||||||
},
|
},
|
||||||
ConstantGroups =
|
ConstantGroups =
|
||||||
{
|
{
|
||||||
@ -293,7 +295,6 @@ g_APIDesc =
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<strong>msSpongePrint</strong> - used for most prefab-generators to merge the prefabs. Similar to
|
<strong>msSpongePrint</strong> - used for most prefab-generators to merge the prefabs. Similar to
|
||||||
msImprint, but uses the sponge block as the NOP block instead, so that the prefabs may carve out air
|
msImprint, but uses the sponge block as the NOP block instead, so that the prefabs may carve out air
|
||||||
@ -306,10 +307,26 @@ g_APIDesc =
|
|||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td> A </td><td> sponge </td><td> A </td><td> Sponge is the NOP block </td>
|
<td> A </td><td> sponge </td><td> A </td><td> Sponge is the NOP block </td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td> * </td><td> B </td><td> B </td><td> Everything else overwrites anything </td>
|
<td> * </td><td> B </td><td> B </td><td> Everything else overwrites anything </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
]],
|
|
||||||
|
<p>
|
||||||
|
<strong>msMask</strong> - the blocks that are the same in the other area are kept, all the
|
||||||
|
differing blocks are replaced with air. Meta is used in the comparison, too, two blocks of the
|
||||||
|
same type but different meta are considered different and thus replaced with air.
|
||||||
|
</p>
|
||||||
|
<table><tbody><tr>
|
||||||
|
<th colspan="2"> area block </th><th> </th><th> Notes </th>
|
||||||
|
</tr><tr>
|
||||||
|
<th> this </th><th> Src </th><th> result </th><th> </th>
|
||||||
|
</tr><tr>
|
||||||
|
<td> A </td><td> A </td><td> A </td><td> Same blocks are kept </td>
|
||||||
|
</tr><tr>
|
||||||
|
<td> A </td><td> non-A </td><td> air </td><td> Differing blocks are replaced with air </td>
|
||||||
|
</tr>
|
||||||
|
</tbody></table>
|
||||||
|
]],
|
||||||
}, -- Merge strategies
|
}, -- Merge strategies
|
||||||
}, -- AdditionalInfo
|
}, -- AdditionalInfo
|
||||||
}, -- cBlockArea
|
}, -- cBlockArea
|
||||||
|
@ -173,6 +173,21 @@ static inline void MergeCombinatorSpongePrint(BLOCKTYPE & a_DstType, BLOCKTYPE a
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Combinator used for cBlockArea::msMask merging */
|
||||||
|
static inline void MergeCombinatorMask(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
|
||||||
|
{
|
||||||
|
// If the blocks are the same, keep the dest; otherwise replace with air
|
||||||
|
if ((a_SrcType != a_DstType) || (a_SrcMeta != a_DstMeta))
|
||||||
|
{
|
||||||
|
a_DstType = E_BLOCK_AIR;
|
||||||
|
a_DstMeta = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cBlockArea:
|
// cBlockArea:
|
||||||
|
|
||||||
@ -710,6 +725,21 @@ void cBlockArea::Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_R
|
|||||||
break;
|
break;
|
||||||
} // case msSpongePrint
|
} // case msSpongePrint
|
||||||
|
|
||||||
|
case msMask:
|
||||||
|
{
|
||||||
|
InternalMergeBlocks(
|
||||||
|
m_BlockTypes, a_Src.GetBlockTypes(),
|
||||||
|
DstMetas, SrcMetas,
|
||||||
|
SizeX, SizeY, SizeZ,
|
||||||
|
SrcOffX, SrcOffY, SrcOffZ,
|
||||||
|
DstOffX, DstOffY, DstOffZ,
|
||||||
|
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
|
||||||
|
m_Size.x, m_Size.y, m_Size.z,
|
||||||
|
MergeCombinatorMask
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
} // case msMask
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
LOGWARNING("Unknown block area merge strategy: %d", a_Strategy);
|
LOGWARNING("Unknown block area merge strategy: %d", a_Strategy);
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
msImprint,
|
msImprint,
|
||||||
msLake,
|
msLake,
|
||||||
msSpongePrint,
|
msSpongePrint,
|
||||||
|
msMask,
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
cBlockArea(void);
|
cBlockArea(void);
|
||||||
@ -152,6 +153,14 @@ public:
|
|||||||
+----------+--------+--------+
|
+----------+--------+--------+
|
||||||
| A | sponge | A | Sponge is the NOP block
|
| A | sponge | A | Sponge is the NOP block
|
||||||
| * | B | B | Everything else overwrites anything
|
| * | B | B | Everything else overwrites anything
|
||||||
|
|
||||||
|
msMask:
|
||||||
|
Combines two areas, the blocks that are the same are kept, differing ones are reset to air
|
||||||
|
| area block | |
|
||||||
|
| this | Src | result |
|
||||||
|
+------+-------+--------+
|
||||||
|
| A | A | A | Same blocks are kept
|
||||||
|
| A | non-A | air | Everything else is replaced with air
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy);
|
void Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy);
|
||||||
|
Loading…
Reference in New Issue
Block a user