//------------------------------------------ //called to apply the texture to the terrain public unsafe bool applyToDstLayer(BTerrainQuadNode node, int terrainGridX, int terrainGridZ, bool selectionMode, bool alternate) { UInt32 *MskPtr = mStroke.getBits(); mMskImgWidth = (uint)mStroke.cBufferSize; mMskImgHeight = (uint)mStroke.cBufferSize; bool changed = Texturing_LayerEditor.setMaskAlphaToLayer(node, MskPtr, mMskImgWidth, mMskImgHeight, mStroke.mAlphaValue, terrainGridX, terrainGridZ, (char)mTexArrayIndex); mStroke.unlockBits(); if (changed) { //node.getTextureData().free(); for (int i = 0; i < Terrain.BTerrainTexturing.cMaxNumLevels; i++) { node.getTextureData(i).free(); } } return(true); }