/*
         * Game Struct
         *  struct Grid
         *  {
         *          MinX, //0x24
         *          MinY, //0x28
         *          MinZ, //0x2C
         *
         *          MaxX, //0x3C
         *          MaxY, //0x40
         *          MaxZ, //0x44
         *
         *          StepX, //0x54
         *          StepY, //0x58
         *          StepZ, //0x5C
         *
         *          StrideX, //0x60
         *          StrideY, //100
         *          StrideZ, //0x68
         *
         *      MinXYZ (adjusted in setup) //0x6C, 0x70, 0x74
         *      MaxXYZ (adjusted in setup) //0x78, 0x7C, 0x80
         *  }
         */

        public static bool GetInterpolatedSH(ProbeLighting probeLighting, Vector3 worldPosition, bool isTriLinear, ref float[] shData)
        {
            if (!probeLighting.RootGrid.IsInside(worldPosition.X, worldPosition.Y, worldPosition.Z))
            {
                return(false);
            }

            foreach (ProbeVolume volume in probeLighting.Boxes)
            {
                if (volume.Grid.IsInside(worldPosition.X, worldPosition.Y, worldPosition.Z))
                {
                    VoxelState state = VoxelState.Empty;
                    if (isTriLinear)
                    {
                        state = GetSHTriLinear(volume, worldPosition, ref shData);
                    }
                    else
                    {
                        state = GetSHNearest(volume, worldPosition, ref shData);
                    }

                    //Found voxel hit, return true
                    if ((int)state > -1)
                    {
                        return(true);
                    }

                    //Skip if there is a volume using an invisible state
                    if (state == VoxelState.Invisible)
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
 public static void Prepare(byte[] fileData)
 {
     ProbeLighting = new ProbeLighting();
     ProbeLighting.LoadValues(AampFile.LoadFile(new System.IO.MemoryStream(fileData)));
 }