mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	3d:: a system for drawing transparent things, with sorting being the responsibility of HR
This commit is contained in:
		
							
								
								
									
										4
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -2090,6 +2090,9 @@ enum class PPR { | |||||||
|   MINEMARK, ARROW, |   MINEMARK, ARROW, | ||||||
|   MOBILE_ARROW, |   MOBILE_ARROW, | ||||||
|   LINE,  |   LINE,  | ||||||
|  |   // in depth tested models transparent surfaces need to be depth sorted by HyperRogue | ||||||
|  |   // and set to PPR::TRANSPARENT to draw them after all the opaque ones | ||||||
|  |   TRANSPARENT, | ||||||
|   // no depth testing for SUPERLINE and above |   // no depth testing for SUPERLINE and above | ||||||
|   SUPERLINE, TEXT, CIRCLE, |   SUPERLINE, TEXT, CIRCLE, | ||||||
|   MAX, |   MAX, | ||||||
| @@ -2832,6 +2835,7 @@ struct textureinfo { | |||||||
| struct drawqueueitem { | struct drawqueueitem { | ||||||
|   PPR prio; |   PPR prio; | ||||||
|   color_t color; |   color_t color; | ||||||
|  |   int subprio; | ||||||
|   virtual void draw() = 0; |   virtual void draw() = 0; | ||||||
|   virtual void draw_back() {} |   virtual void draw_back() {} | ||||||
|   virtual void draw_pre() {} |   virtual void draw_pre() {} | ||||||
|   | |||||||
| @@ -1515,6 +1515,12 @@ void drawqueue() { | |||||||
|         < xintval(ap2.V * xpush0(.1)); |         < xintval(ap2.V * xpush0(.1)); | ||||||
|       }); |       }); | ||||||
|  |  | ||||||
|  |   for(PPR p: {PPR::TRANSPARENT}) | ||||||
|  |     sort(&ptds[qp0[int(p)]], &ptds[qp[int(p)]],  | ||||||
|  |       [] (const unique_ptr<drawqueueitem>& p1, const unique_ptr<drawqueueitem>& p2) { | ||||||
|  |         return p1->subprio > p2->subprio; | ||||||
|  |         }); | ||||||
|  |  | ||||||
|   profile_stop(3); |   profile_stop(3); | ||||||
|  |  | ||||||
| #if CAP_SDL | #if CAP_SDL | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue