/** * Adds a texture to this material. Throws and error if the maximum number of textures was * reached. * * @param texture * @throws TextureException */ public void addTexture(ATexture texture) throws TextureException { if (mTextureList.indexOf(texture) > -1) return; if (mTextureList.size() + 1 > mMaxTextures) { throw new TextureException( "Maximum number of textures for this material has been reached. Maximum number of textures is " + mMaxTextures + "."); } mTextureList.add(texture); TextureManager.getInstance().addTexture(texture); texture.registerMaterial(this); mIsDirty = true; }