def copyTextureAlpha(srcTex, dstTex): srcRGBA = rapi.imageGetTexRGBA(srcTex) dstRGBA = rapi.imageGetTexRGBA(dstTex) for y in range(0, dstTex.height): for x in range(0, dstTex.width): fracX = x / dstTex.width fracY = y / dstTex.height sample = rapi.imageInterpolatedSample(srcRGBA, srcTex.width, srcTex.height, fracX, fracY) #overwrite the destination alpha dstRGBA[y*dstTex.width*4 + x*4 + 3] = int(sample[3]*255.0); #convert destination texture to the modified rgba32 dstTex.pixelData = dstRGBA dstTex.pixelType = noesis.NOESISTEX_RGBA32
def copyTextureAlpha(srcTex, dstTex): srcRGBA = rapi.imageGetTexRGBA(srcTex) dstRGBA = rapi.imageGetTexRGBA(dstTex) for y in range(0, dstTex.height): for x in range(0, dstTex.width): fracX = x / dstTex.width fracY = y / dstTex.height sample = rapi.imageInterpolatedSample(srcRGBA, srcTex.width, srcTex.height, fracX, fracY) #overwrite the destination alpha dstRGBA[y * dstTex.width * 4 + x * 4 + 3] = int(sample[3] * 255.0) #convert destination texture to the modified rgba32 dstTex.pixelData = dstRGBA dstTex.pixelType = noesis.NOESISTEX_RGBA32
def decodeHOMM6NormalMap(normTex): rgba = rapi.imageGetTexRGBA(normTex) rgba = rapi.imageNormalSwizzle(rgba, normTex.width, normTex.height, 1, 1, 0) normTex.pixelData = rgba normTex.pixelType = noesis.NOESISTEX_RGBA32