mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Allow to override ImDrawIdx type (#292)
This commit is contained in:
		@@ -2182,13 +2182,10 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr
 | 
				
			|||||||
            draw_list->CmdBuffer.pop_back();
 | 
					            draw_list->CmdBuffer.pop_back();
 | 
				
			||||||
        out_render_list.push_back(draw_list);
 | 
					        out_render_list.push_back(draw_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (sizeof(ImDrawIdx) < 4)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
        // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices)
 | 
					        // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices)
 | 
				
			||||||
            // If this assert triggers because you are drawing lots of stuff manually, a workaround is to use BeginChild()/EndChild() to put your draw commands in a new draw list
 | 
					        // If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly.
 | 
				
			||||||
            unsigned int max_vtx_idx = (unsigned int)1 << (sizeof(ImDrawIdx)*8);
 | 
					        const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8);
 | 
				
			||||||
            IM_ASSERT(draw_list->_VtxCurrentIdx <= max_vtx_idx);
 | 
					        IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx);
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size;
 | 
					        GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size;
 | 
				
			||||||
        GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size;
 | 
					        GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								imgui.h
									
									
									
									
									
								
							@@ -1013,8 +1013,10 @@ struct ImDrawCmd
 | 
				
			|||||||
    void*           UserCallbackData;       // The draw callback code can access this.
 | 
					    void*           UserCallbackData;       // The draw callback code can access this.
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Vertex index
 | 
					// Vertex index (override with, e.g. '#define ImDrawIdx unsigned int' in ImConfig)
 | 
				
			||||||
 | 
					#ifndef ImDrawIdx
 | 
				
			||||||
typedef unsigned short ImDrawIdx;
 | 
					typedef unsigned short ImDrawIdx;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Vertex layout
 | 
					// Vertex layout
 | 
				
			||||||
#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
 | 
					#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user