示例#1
0
        private void AddTextureInfo(ExporterVersion version,
                                    SortedDictionary <string, int> texAndInd,
                                    TextureValuesAggregator aggregator)
        {
            if (version < ExporterVersion.Ver16Alpha1)
            {
                return;
            }

            aggregator.AddAlphaTexture(texAndInd);
            aggregator.AddUvDistortionTexture(texAndInd);

            if (aggregator.IsBlendTextureEnabled)
            {
                aggregator.AddBlendTexture(texAndInd);
                aggregator.AddBlendAlphaTexture(texAndInd);
                aggregator.AddBlendUvDistortionTexture(texAndInd);
            }
            else
            {
                aggregator.AddInt(-1);
                aggregator.AddInt(-1);
                aggregator.AddInt(-1);
            }
        }
示例#2
0
        private void AddAsFile(TextureValuesAggregator aggregator,
                               Data.RendererCommonValues value,
                               SortedDictionary <string, int> texToIndex,
                               SortedDictionary <string, int> normalToIndex,
                               SortedDictionary <string, int> materialToIndex)
        {
            var materialInfo = Core.ResourceCache.LoadMaterialInformation(value.MaterialFile.Path.AbsolutePath) ??
                               new MaterialInformation();
            var textures = value.MaterialFile.GetTextures(materialInfo).Where(_ => _.Item1 != null).ToArray();
            var uniforms = value.MaterialFile.GetUniforms(materialInfo);

            // maximum slot limitation
            if (textures.Length > Constant.UserTextureSlotCount)
            {
                textures = textures.Take(Constant.UserTextureSlotCount).ToArray();
            }

            aggregator.AddInt(materialToIndex.ContainsKey(value.MaterialFile.Path.RelativePath)
                                ? materialToIndex[value.MaterialFile.Path.RelativePath]
                                : (-1));

            aggregator.AddInt(textures.Length);

            foreach (var texture in textures)
            {
                var texture_ = texture.Item1.Value as Data.Value.PathForImage;
                if (texture.Item2.Type == TextureType.Value)
                {
                    aggregator.AddInt(1);
                    aggregator.AddTexIdAndStoreSize(texture_, texture.Item2.Priority, normalToIndex);
                }
                else
                {
                    aggregator.AddInt(0);
                    aggregator.AddTexIdAndStoreSize(texture_, texture.Item2.Priority, texToIndex);
                }
            }

            aggregator.AddInt(uniforms.Count);

            foreach (var uniform in uniforms)
            {
                float[] floats = GetUniformsVertexes(uniform);

                aggregator.AddFloat(floats[0]);
                aggregator.AddFloat(floats[1]);
                aggregator.AddFloat(floats[2]);
                aggregator.AddFloat(floats[3]);
            }
        }
示例#3
0
 private void AddAsBackDistortion(ExporterVersion version,
                                  SortedDictionary <string, int> distortionToIndex,
                                  Data.RendererCommonValues value,
                                  TextureValuesAggregator aggregator)
 {
     aggregator.AddTexIdAndStoreSize(value.ColorTexture, 1, distortionToIndex);
     aggregator.AddInt(-1);
     AddTextureInfo(version, distortionToIndex, aggregator);
 }