Пример #1
0
        public static string GetAlphamaskTexture(MyMeshPartInfo mwmPart, string contentPath)
        {
            if (mwmPart.m_MaterialDesc == null)
            {
                return("");
            }
            var relativePath = mwmPart.m_MaterialDesc.Textures.Get("AlphamaskTexture", "");

            return(MyResourceUtils.GetTextureFullPath(relativePath, contentPath));
        }
            public int GetOrAddSlice(string filepath)
            {
                filepath = MyResourceUtils.GetTextureFullPath(filepath);

                if (m_lookupTable.ContainsKey(filepath))
                {
                    return(m_lookupTable[filepath]);
                }

                int sliceNum = m_filepaths.Count;

                m_lookupTable.Add(filepath, sliceNum);
                m_filepaths.Add(filepath);
                m_dirtyFlag = true;
                return(sliceNum);
            }
Пример #3
0
        public Vector4I[] CreateTextureIndices(List <MyMeshPartInfo> partInfos, int verticesNum, string contentPath)
        {
            Vector4I[] indices = new Vector4I[verticesNum];
            for (int i = 0; i < verticesNum; i++)
            {
                indices[i] = new Vector4I(DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX, DEFAULT_ARRAY_TEXTURE_INDEX);
            }

            if (!MyRender11.Settings.UseGeometryArrayTextures) // system is disabled
            {
                return(indices);
            }

            foreach (MyMeshPartInfo partInfo in partInfos)
            {
                MyMaterialDescriptor materialDesc = partInfo.m_MaterialDesc;
                if (materialDesc == null)
                {
                    continue;
                }
                string cmTexture, ngTexture, extTexture, alphamaskTexture;
                if (!materialDesc.Textures.TryGetValue("ColorMetalTexture", out cmTexture))
                {
                    continue;
                }
                if (!materialDesc.Textures.TryGetValue("NormalGlossTexture", out ngTexture))
                {
                    continue;
                }
                materialDesc.Textures.TryGetValue("AddMapsTexture", out extTexture);
                materialDesc.Textures.TryGetValue("AlphamaskTexture", out alphamaskTexture);

                cmTexture        = MyResourceUtils.GetTextureFullPath(cmTexture, contentPath);
                ngTexture        = MyResourceUtils.GetTextureFullPath(ngTexture, contentPath);
                extTexture       = MyResourceUtils.GetTextureFullPath(extTexture, contentPath);
                alphamaskTexture = MyResourceUtils.GetTextureFullPath(alphamaskTexture, contentPath);

                Vector4I textureIndices = GetTextureIndices(cmTexture, ngTexture, extTexture, alphamaskTexture);

                foreach (var offset in partInfo.m_indices)
                {
                    indices[offset] = textureIndices;
                }
            }

            return(indices);
        }
Пример #4
0
        internal static MyMeshMaterialId GetMaterialId(string name, string contentPath, string colorMetalTexture, string normalGlossTexture, string extensionTexture, string technique)
        {
            MyMeshMaterialInfo desc;

            desc = new MyMeshMaterialInfo
            {
                Name = X.TEXT_(name),
                ColorMetal_Texture  = MyResourceUtils.GetTextureFullPath(colorMetalTexture, contentPath),
                NormalGloss_Texture = MyResourceUtils.GetTextureFullPath(normalGlossTexture, contentPath),
                Extensions_Texture  = MyResourceUtils.GetTextureFullPath(extensionTexture, contentPath),
                Alphamask_Texture   = String.Empty,
                Technique           = ConvertToDrawTechnique(technique),
                TextureTypes        = GetMaterialTextureTypes(colorMetalTexture, normalGlossTexture, extensionTexture, null),
                Facing = MyFacingEnum.None,
            };

            return(GetMaterialId(ref desc));
        }
Пример #5
0
        public static MyMeshMaterialInfo ConvertImportDescToMeshMaterialInfo(MyMaterialDescriptor importDesc,
                                                                             string contentPath, string assetFile = null)
        {
            string colorMetalTexture  = importDesc.Textures.Get("ColorMetalTexture", "");
            string normalGlossTexture = importDesc.Textures.Get("NormalGlossTexture", "");
            string extensionTexture   = importDesc.Textures.Get("AddMapsTexture", "");
            string alphamaskTexture   = importDesc.Textures.Get("AlphamaskTexture", null);

            MyMeshMaterialInfo info = new MyMeshMaterialInfo
            {
                Name = X.TEXT_(importDesc.MaterialName),
                ColorMetal_Texture  = MyResourceUtils.GetTextureFullPath(colorMetalTexture, contentPath),
                NormalGloss_Texture = MyResourceUtils.GetTextureFullPath(normalGlossTexture, contentPath),
                Extensions_Texture  = MyResourceUtils.GetTextureFullPath(extensionTexture, contentPath),
                Alphamask_Texture   = MyResourceUtils.GetTextureFullPath(alphamaskTexture, contentPath),
                TextureTypes        = GetMaterialTextureTypes(colorMetalTexture, normalGlossTexture, extensionTexture, alphamaskTexture),
                Technique           = ConvertToDrawTechnique(importDesc.Technique),
                Facing           = importDesc.Facing,
                WindScaleAndFreq = importDesc.WindScaleAndFreq
            };

            return(info);
        }