public IUserGeneratedTexture NewUserTexture(string name, int width, int height, MyGeneratedTextureType type, int numMipLevels) { MyUserGeneratedTexture texture; m_objectsPoolGenerated.AllocateOrCreate(out texture); switch (type) { case MyGeneratedTextureType.RGBA: CreateRGBA(texture, name, new Vector2I(width, height), true, (byte[])null, true, numMipLevels); break; case MyGeneratedTextureType.RGBA_Linear: CreateRGBA(texture, name, new Vector2I(width, height), false, (byte[])null, true, numMipLevels); break; case MyGeneratedTextureType.Alphamask: CreateR(texture, name, new Vector2I(width, height), null, true, numMipLevels); break; default: throw new Exception(); } return(texture); }
public IUserGeneratedTexture CreateGeneratedTexture(string name, int width, int height, MyGeneratedTextureType type, int numMipLevels) { IGeneratedTexture texture; if (m_generatedTextures.TryGetValue(name, out texture)) { IUserGeneratedTexture userTexture = texture as IUserGeneratedTexture; if (userTexture == null) { MyRenderProxy.Fail("Trying to replace system texture"); return(null); } if (userTexture.Size.X != width || userTexture.Size.Y != height || userTexture.Type != type || userTexture.MipmapCount != numMipLevels) { MyRenderProxy.Fail("Trying to replace existing texture"); } return(userTexture); } var manager = MyManagers.GeneratedTextures; IUserGeneratedTexture ret = manager.NewUserTexture(name, width, height, type, numMipLevels); m_generatedTextures[name] = ret; return(ret); }
public IUserGeneratedTexture CreateGeneratedTexture(string name, int width, int height, MyGeneratedTextureType type, int numMipLevels) { IGeneratedTexture texture; if (m_generatedTextures.TryGetValue(name, out texture)) { IUserGeneratedTexture userTexture = texture as IUserGeneratedTexture; if (userTexture == null) { MyRenderProxy.Fail("Trying to replace system texture"); return null; } if (userTexture.Size.X != width || userTexture.Size.Y != height || userTexture.Type != type || userTexture.NumMipLevels != numMipLevels) { MyRenderProxy.Fail("Trying to replace existing texture"); } return userTexture; } var manager = MyManagers.GeneratedTextures; IUserGeneratedTexture ret = manager.NewUserTexture(name, width, height, type, numMipLevels); m_generatedTextures[name] = ret; return ret; }
public IUserGeneratedTexture NewUserTexture(string name, int width, int height, MyGeneratedTextureType type, int numMipLevels) { MyUserGeneratedTexture texture; m_objectsPoolGenerated.AllocateOrCreate(out texture); switch (type) { case MyGeneratedTextureType.RGBA: CreateRGBA(texture, name, new Vector2I(width, height), true, (byte[])null, true, numMipLevels); break; case MyGeneratedTextureType.RGBA_Linear: CreateRGBA(texture, name, new Vector2I(width, height), false, (byte[])null, true, numMipLevels); break; case MyGeneratedTextureType.Alphamask: CreateR(texture, name, new Vector2I(width, height), null, true, numMipLevels); break; default: throw new Exception(); } return texture; }
/// <returns>Qualified texture</returns> public static void CreateGeneratedTexture(string textureName, int width, int height, MyGeneratedTextureType type = MyGeneratedTextureType.RGBA, int numMiplevels = 1) { CheckValidGeneratedTextureName(textureName); if (numMiplevels <= 0) throw new ArgumentOutOfRangeException("numMiplevels"); var message = MessagePool.Get<MyRenderMessageCreateGeneratedTexture>(MyRenderMessageEnum.CreateGeneratedTexture); message.TextureName = textureName; message.Width = width; message.Height = height; message.Type = type; message.NumMipLevels = numMiplevels; EnqueueMessage(message); }