示例#1
0
 public string GetFilepath(string location, MyTextureType type)
 {
     using (List <MyObjectBuilder_AssetModifierDefinition.MyAssetTexture> .Enumerator enumerator = this.Textures.GetEnumerator())
     {
         while (true)
         {
             if (!enumerator.MoveNext())
             {
                 break;
             }
             MyObjectBuilder_AssetModifierDefinition.MyAssetTexture current = enumerator.Current;
             if ((current.Location == location) && (current.Type == type))
             {
                 return(current.Filepath);
             }
         }
     }
     return(null);
 }
示例#2
0
        public static MyGeneratedTextureType ToGeneratedTextureType(this MyTextureType type)
        {
            switch (type)
            {
            case MyTextureType.ColorMetal:
                return(MyGeneratedTextureType.RGBA);

            case MyTextureType.NormalGloss:
                return(MyGeneratedTextureType.RGBA_Linear);

            case MyTextureType.Extensions:
                return(MyGeneratedTextureType.RGBA);

            case MyTextureType.Alphamask:
                return(MyGeneratedTextureType.Alphamask);

            default:
                throw new Exception();
            }
        }
示例#3
0
 public IUserGeneratedTexture CreateGeneratedTexture(string name, int width, int height, MyTextureType type, int numMipLevels)
 {
     return(CreateGeneratedTexture(name, width, height, type.ToGeneratedTextureType(), numMipLevels));
 }
示例#4
0
 public IUserGeneratedTexture CreateGeneratedTexture(string name, int width, int height, MyTextureType type, int numMipLevels)
 {
     return CreateGeneratedTexture(name, width, height, type.ToGeneratedTextureType(), numMipLevels);
 }
示例#5
0
        /// <param name="backgroundColor">null means no background</param>
        /// <param name="blendAlphaChannel">Blend alpha channel</param>
        public static void RenderOffscreenTextureToMaterial(uint renderObjectId, string materialName, string offscreenTexture,
            Color? backgroundColor = null, MyTextureType textureType = MyTextureType.ColorMetal, bool blendAlphaChannel = false)
        {
            CheckValidGeneratedTextureName(offscreenTexture);

            var message = MessagePool.Get<MyRenderMessageRenderOffscreenTextureToMaterial>(MyRenderMessageEnum.RenderOffscreenTextureToMaterial);

            message.OffscreenTexture = offscreenTexture;
            message.MaterialName = materialName;
            message.TextureType = textureType;
            message.BackgroundColor = backgroundColor;
            message.RenderObjectID = renderObjectId;
            message.BlendAlphaChannel = blendAlphaChannel;
            EnqueueMessage(message);
        }
示例#6
0
 public static void ChangeMaterialTexture(uint id, string materialName, string textureName, MyTextureType textureType = MyTextureType.ColorMetal)
 {
     var message = MessagePool.Get<MyRenderMessageChangeMaterialTexture>(MyRenderMessageEnum.ChangeMaterialTexture);
     if (message.Changes == null)
     {
         message.Changes = new List<MyTextureChange>();
     }
     else
     {
         Debug.Assert(message.Changes.Count == 0, "content should be cleared after consuming in renderer");
     }
     message.Changes.Add(new MyTextureChange { TextureName = textureName, TextureType = textureType });
     message.MaterialName = materialName;
     message.RenderObjectID = id;
     EnqueueMessage(message);
 }