Exemple #1
0
        /// <summary>
        /// 球面調和関数を用いて圧縮する(RGBのみ)
        /// </summary>
        /// <param name="coef_list"></param>
        /// <param name="pCube"></param>
        public Vector3[] CompressRGB(SHCalcData pCube)
        {
            //	SH計算
            ComputeSHTable();
            //	立体角計算
            ComputeDeltaFormFactor();

            //	イメージデータを圧縮
            Vector3[] coefList = new Vector3[s_SHCoefNum[m_shBandNum]];
            for (int l = 0; l < s_SHCoefNum[m_shBandNum]; ++l)
            {
                double r = 0.0;
                double g = 0.0;
                double b = 0.0;

                for (uint f = 0; f < (int)CubeMapFace.Max; ++f)
                {
                    Color3[] face_color = pCube.GetCubeColorData(f);
                    for (uint p = 0; p < m_cubeMapSize * m_cubeMapSize; ++p)
                    {
                        double value = ((double)m_pDeltaFormFactorTable[f, p] * (double)m_pCubeSHTable[f, p, l]);
                        r += (double)(face_color[p].Red * value);
                        g += (double)(face_color[p].Green * value);
                        b += (double)(face_color[p].Blue * value);
                    }
                }

                coefList[l].X = (float)(r);
                coefList[l].Y = (float)(g);
                coefList[l].Z = (float)(b);
            }
            return(coefList);
        }
Exemple #2
0
        /// <summary>
        /// 球面調和関数を用いて圧縮する(Rのみ)
        /// </summary>
        /// <param name="coef_list"></param>
        /// <param name="pCube"></param>
        public void CompressR(float[] coef_list, SHCalcData pCube)
        {
            //	SH計算
            ComputeSHTable();
            //	立体角計算
            ComputeDeltaFormFactor();

            //	イメージデータを圧縮
            for (int l = 0; l < s_SHCoefNum[m_shBandNum]; ++l)
            {
                double r = 0.0;
                for (uint f = 0; f < (int)CubeMapFace.Max; ++f)
                {
                    Color3[] face_color = pCube.GetCubeColorData(f);
                    for (uint p = 0; p < m_cubeMapSize * m_cubeMapSize; ++p)
                    {
                        double value = ((double)m_pDeltaFormFactorTable[f, p] * (double)m_pCubeSHTable[f, p, l]);
                        r += ((double)face_color[p].Red * value);
                    }
                }

                coef_list[l] = (float)(r);
            }
        }