| 1 | // SPDX-FileCopyrightText: 2000 David Megginson |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #ifndef FGTEXTUREDLAYER_HXX |
| 5 | #define FGTEXTUREDLAYER_HXX |
| 6 | |
| 7 | #include "FGCroppedTexture.hxx" |
| 8 | #include "FGInstrumentLayer.hxx" |
| 9 | |
| 10 | /** |
| 11 | * A textured layer of an instrument. |
| 12 | * |
| 13 | * This is a layer holding a single texture. Normally, the texture's |
| 14 | * background should be transparent so that lower layers and the panel |
| 15 | * background can show through. |
| 16 | */ |
| 17 | class FGTexturedLayer : public FGInstrumentLayer { |
| 18 | public: |
| 19 | static void Init (const GLuint Program_Object, |
| 20 | const GLint Position_Loc, |
| 21 | const GLint Tex_Coord_Loc, |
| 22 | const GLint MVP_Loc, |
| 23 | const GLint Sampler_Loc); |
| 24 | |
| 25 | FGTexturedLayer (const int w = -1, const int h = -1); |
| 26 | FGTexturedLayer (const FGCroppedTexture_ptr texture, const int w = -1, const int h = -1); |
| 27 | virtual ~FGTexturedLayer (); |
| 28 | |
| 29 | virtual void draw (); |
| 30 | |
| 31 | virtual void setTexture (const FGCroppedTexture_ptr texture); |
| 32 | FGCroppedTexture_ptr getTexture () const; |
| 33 | |
| 34 | void setEmissive (const bool emissive); |
| 35 | |
| 36 | private: |
| 37 | void getDisplayList (); |
| 38 | |
| 39 | FGCroppedTexture_ptr m_texture; |
| 40 | bool m_emissive; |
| 41 | |
| 42 | static GLuint Textured_Layer_Program_Object; |
| 43 | static GLint Textured_Layer_Position_Loc; |
| 44 | static GLint Textured_Layer_Tex_Coord_Loc; |
| 45 | static GLint Textured_Layer_MVP_Loc; |
| 46 | static GLint Textured_Layer_Sampler_Loc; |
| 47 | }; |
| 48 | |
| 49 | #endif |