public void UpdateTextureTransform(TextureUnitState texUnit, float pageX, float pageZ) { //Axiom.Core.LogManager.Instance.Write("Decal: {0}, {1} page:{2}, {3}", posX, posZ, pageX, pageZ); float pageSize = TerrainManager.Instance.PageSize * TerrainManager.oneMeter; float scaleX = sizeX / pageSize; float scaleZ = sizeZ / pageSize; texUnit.SetTextureScale(scaleX, scaleZ); float centerX = pageX + pageSize / 2f; float centerZ = pageZ + pageSize / 2f; texUnit.SetTextureScroll((centerX - posX) / (pageSize * scaleX), (centerZ - posZ) / (pageSize * scaleZ)); texUnit.SetTextureRotate(rot); }