コード例 #1
0
        private static void outputLightmaps(String uncompressedPath, String ambientPath, List <LightMap> lightmaps)
        {
            Settings.stream.SetProgressBarMaximum(lightmaps.Count);
            foreach (LightMap l in lightmaps)
            {
                /* for reference
                 * int[,] boxFilter = {
                 *                  {1,1,1},
                 *                  {1,1,1},
                 *                  {1,1,1}
                 *                 };
                 */
                int[,] gaussFilter =
                {
                    { 1, 2, 1 },
                    { 2, 4, 2 },
                    { 1, 2, 1 }
                };

                Targa lightMap = l.makeLightMapTexture(uncompressedPath);
                lightMap.applyFilter(gaussFilter);
                lightMap.writeToFile();

                l.makeAmbientOcclusionTexture(ambientPath).writeToFile();
                l.makeShadowMapTexture(uncompressedPath).writeToFile();

                Settings.stream.UpdateProgress();
            }
        }
コード例 #2
0
        private void outputLightmaps(List <LightMap> lightmaps)
        {
            Settings.stream.SetProgressBarMaximum(lightmaps.Count);
            foreach (LightMap l in lightmaps)
            {
                int[,] boxFilter =
                {
                    { 1, 1, 1 },
                    { 1, 0, 1 },
                    { 1, 1, 1 }
                };

                /*
                 * int[,] gaussFilter = {
                 *                  {0,1,2,1,0},
                 *                  {1,2,4,2,1},
                 *                  {2,4,8,4,2},
                 *                  {1,2,4,2,1},
                 *                  {0,1,2,1,0}
                 *                 };
                 */
                int[,] gaussFilter =
                {
                    { 1, 2, 1 },
                    { 2, 4, 2 },
                    { 1, 2, 1 }
                };

                String lightmapPath = lightmapJobs[l.model.name][l.mesh.name];
                Targa  lightMap     = l.makeLightMapTexture(Path.GetDirectoryName(lightmapPath), Path.GetFileName(lightmapPath));

                /*lightMap.grow(boxFilter);
                *  lightMap.grow(boxFilter);
                *  lightMap.grow(boxFilter);
                *  lightMap.grow(boxFilter);
                *  lightMap.grow(boxFilter);
                *  lightMap.grow(boxFilter);*/
                lightMap.applyFilter(gaussFilter);
                lightMap.writeToFile();

                String ambientPath = ambientJobs[l.model.name][l.mesh.name];
                l.makeAmbientOcclusionTexture(Path.GetDirectoryName(ambientPath), Path.GetFileName(ambientPath)).writeToFile();

                String shadowmapPath = shadowmapJobs[l.model.name][l.mesh.name];
                Targa  shadowMap     = l.makeShadowMapTexture(Path.GetDirectoryName(shadowmapPath), Path.GetFileName(shadowmapPath));

                /*
                 * shadowMap.grow(boxFilter);
                 * shadowMap.grow(boxFilter);
                 * shadowMap.grow(boxFilter);
                 * shadowMap.grow(boxFilter);
                 * shadowMap.grow(boxFilter);
                 * shadowMap.grow(boxFilter);
                 * shadowMap.grow(boxFilter);
                 * shadowMap.grow(boxFilter);
                 * shadowMap.applyFilter(gaussFilter);
                 * //*/
                shadowMap.applyFilter(gaussFilter);
                shadowMap.writeToFile();

                Settings.stream.UpdateProgress();
            }
        }