1 /** 2 * Copyright: Copyright (C) 2018 Gabriel Gheorghe, All Rights Reserved 3 * Authors: $(Gabriel Gheorghe) 4 * License: $(LINK2 https://www.gnu.org/licenses/gpl-3.0.txt, GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007) 5 * Source: $(LINK2 https://github.com/GabyForceQ/LibertyEngine/blob/master/source/liberty/material/impl.d) 6 * Documentation: 7 * Coverage: 8 **/ 9 module liberty.material.impl; 10 11 import liberty.image.format.bmp; 12 import liberty.core.engine; 13 import liberty.material.factory; 14 import liberty.graphics.shader; 15 import liberty.graphics.texture.impl; 16 import liberty.graphics.texture.io; 17 18 /** 19 * 20 **/ 21 final class Material : IDefaultMaterialsFactory { 22 private { 23 Texture texture; 24 } 25 26 /** 27 * 28 **/ 29 this(BMPImage image) { 30 setTexture(TextureIO.loadBMP(image)); 31 } 32 33 /** 34 * 35 **/ 36 this(string texturePath) { 37 setTexture(TextureIO.loadTexture(texturePath)); 38 } 39 40 /** 41 * 42 **/ 43 this(string[6] texturesPath) { 44 texture = TextureIO.loadCubeMapTexture(texturesPath); 45 } 46 47 /** 48 * 49 **/ 50 void setTexture(Texture texture) { 51 this.texture = texture; 52 } 53 54 /** 55 * 56 **/ 57 Texture getTexture() { 58 return texture; 59 } 60 }