Ejemplo n.º 1
0
 private void AddAsDefaultMaterial(ExporterVersion version,
                                   SortedDictionary <string, int> texToIndex,
                                   Data.RendererCommonValues value,
                                   TextureValuesAggregator aggregator)
 {
     aggregator.AddTexIdAndStoreSize(value.ColorTexture, 1, texToIndex);
     aggregator.AddInt(-1);
     AddTextureInfo(version, texToIndex, aggregator);
 }
Ejemplo n.º 2
0
 private void AddAsLighting(ExporterVersion version,
                            SortedDictionary <string, int> texToIndex,
                            SortedDictionary <string, int> normalTexToIndex,
                            Data.RendererCommonValues value,
                            TextureValuesAggregator aggregator)
 {
     aggregator.AddTexIdAndStoreSize(value.ColorTexture, 1, texToIndex);
     aggregator.AddTexIdAndStoreSize(value.NormalTexture, 2, normalTexToIndex);
     AddTextureInfo(version, texToIndex, aggregator);
 }
Ejemplo n.º 3
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]);
            }
        }