mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 05:10:04 +00:00 
			
		
		
		
	Define draw item shaders in draw items, not the generic draw layer
This commit is contained in:
		
							parent
							
								
									d84a618d3d
								
							
						
					
					
						commit
						224d36bae5
					
				
					 8 changed files with 88 additions and 83 deletions
				
			
		|  | @ -2,6 +2,12 @@ | |||
| 
 | ||||
| #include <string> | ||||
| 
 | ||||
| #pragma warning(push, 0) | ||||
| #include <glm/glm.hpp> | ||||
| #include <glm/gtc/matrix_transform.hpp> | ||||
| #include <glm/gtc/type_ptr.hpp> | ||||
| #pragma warning(pop) | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
|  | @ -13,20 +19,33 @@ namespace draw | |||
| 
 | ||||
| static const std::string logPrefix_ = "scwx::qt::gl::draw::draw_item"; | ||||
| 
 | ||||
| class DrawItemImpl | ||||
| class DrawItem::Impl | ||||
| { | ||||
| public: | ||||
|    explicit DrawItemImpl() {} | ||||
|    explicit Impl(OpenGLFunctions& gl) : gl_ {gl} {} | ||||
|    ~Impl() {} | ||||
| 
 | ||||
|    ~DrawItemImpl() {} | ||||
|    OpenGLFunctions& gl_; | ||||
| }; | ||||
| 
 | ||||
| DrawItem::DrawItem() : p(std::make_unique<DrawItemImpl>()) {} | ||||
| DrawItem::DrawItem(OpenGLFunctions& gl) : p(std::make_unique<Impl>(gl)) {} | ||||
| DrawItem::~DrawItem() = default; | ||||
| 
 | ||||
| DrawItem::DrawItem(DrawItem&&) noexcept = default; | ||||
| DrawItem::DrawItem(DrawItem&&) noexcept            = default; | ||||
| DrawItem& DrawItem::operator=(DrawItem&&) noexcept = default; | ||||
| 
 | ||||
| void DrawItem::UseDefaultProjection( | ||||
|    const QMapbox::CustomLayerRenderParameters& params, GLint uMVPMatrixLocation) | ||||
| { | ||||
|    glm::mat4 projection = glm::ortho(0.0f, | ||||
|                                      static_cast<float>(params.width), | ||||
|                                      0.0f, | ||||
|                                      static_cast<float>(params.height)); | ||||
| 
 | ||||
|    p->gl_.glUniformMatrix4fv( | ||||
|       uMVPMatrixLocation, 1, GL_FALSE, glm::value_ptr(projection)); | ||||
| } | ||||
| 
 | ||||
| } // namespace draw
 | ||||
| } // namespace gl
 | ||||
| } // namespace qt
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat