mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 20:30:05 +00:00 
			
		
		
		
	Adding custom offset and scaling for color table to fragment shader
This commit is contained in:
		
							parent
							
								
									3e92847901
								
							
						
					
					
						commit
						aa48d8610a
					
				
					 6 changed files with 60 additions and 14 deletions
				
			
		|  | @ -47,7 +47,9 @@ public: | |||
|        longitude_ {}, | ||||
|        sweepTime_ {}, | ||||
|        colorTable_ {}, | ||||
|        colorTableLut_ {} | ||||
|        colorTableLut_ {}, | ||||
|        colorTableMin_ {2}, | ||||
|        colorTableMax_ {254} | ||||
|    { | ||||
|       auto it = blockTypes_.find(product); | ||||
| 
 | ||||
|  | @ -81,6 +83,8 @@ public: | |||
| 
 | ||||
|    std::shared_ptr<common::ColorTable>    colorTable_; | ||||
|    std::vector<boost::gil::rgba8_pixel_t> colorTableLut_; | ||||
|    uint16_t                               colorTableMin_; | ||||
|    uint16_t                               colorTableMax_; | ||||
| 
 | ||||
|    std::shared_ptr<common::ColorTable> savedColorTable_; | ||||
|    float                               savedScale_; | ||||
|  | @ -100,14 +104,16 @@ Level2ProductView::Level2ProductView( | |||
| Level2ProductView::~Level2ProductView() = default; | ||||
| 
 | ||||
| const std::vector<boost::gil::rgba8_pixel_t>& | ||||
| Level2ProductView::color_table() const | ||||
| Level2ProductView::color_table(uint16_t& minValue, uint16_t& maxValue) const | ||||
| { | ||||
|    if (p->colorTableLut_.size() == 0) | ||||
|    { | ||||
|       return RadarProductView::color_table(); | ||||
|       return RadarProductView::color_table(minValue, maxValue); | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       minValue = p->colorTableMin_; | ||||
|       maxValue = p->colorTableMax_; | ||||
|       return p->colorTableLut_; | ||||
|    } | ||||
| } | ||||
|  | @ -216,6 +222,9 @@ void Level2ProductView::UpdateColorTable() | |||
|                     lut[i - *dataRange.begin()] = p->colorTable_->Color(f); | ||||
|                  }); | ||||
| 
 | ||||
|    p->colorTableMin_ = rangeMin; | ||||
|    p->colorTableMax_ = rangeMax; | ||||
| 
 | ||||
|    p->savedColorTable_ = p->colorTable_; | ||||
|    p->savedOffset_     = offset; | ||||
|    p->savedScale_      = scale; | ||||
|  |  | |||
|  | @ -28,9 +28,10 @@ public: | |||
|       std::shared_ptr<manager::RadarProductManager> radarProductManager); | ||||
|    ~Level2ProductView(); | ||||
| 
 | ||||
|    const std::vector<boost::gil::rgba8_pixel_t>& color_table() const override; | ||||
|    std::chrono::system_clock::time_point         sweep_time() const override; | ||||
|    const std::vector<float>&                     vertices() const override; | ||||
|    const std::vector<boost::gil::rgba8_pixel_t>& | ||||
|    color_table(uint16_t& minValue, uint16_t& maxValue) const override; | ||||
|    std::chrono::system_clock::time_point sweep_time() const override; | ||||
|    const std::vector<float>&             vertices() const override; | ||||
| 
 | ||||
|    void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable) override; | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,6 +18,8 @@ static const std::vector<boost::gil::rgba8_pixel_t> DEFAULT_COLOR_TABLE = { | |||
|    boost::gil::rgba8_pixel_t(0, 128, 0, 255), | ||||
|    boost::gil::rgba8_pixel_t(255, 192, 0, 255), | ||||
|    boost::gil::rgba8_pixel_t(255, 0, 0, 255)}; | ||||
| static const uint16_t DEFAULT_COLOR_TABLE_MIN = 2u; | ||||
| static const uint16_t DEFAULT_COLOR_TABLE_MAX = 255u; | ||||
| 
 | ||||
| class RadarProductViewImpl | ||||
| { | ||||
|  | @ -31,8 +33,10 @@ RadarProductView::RadarProductView() : | |||
| RadarProductView::~RadarProductView() = default; | ||||
| 
 | ||||
| const std::vector<boost::gil::rgba8_pixel_t>& | ||||
| RadarProductView::color_table() const | ||||
| RadarProductView::color_table(uint16_t& minValue, uint16_t& maxValue) const | ||||
| { | ||||
|    minValue = DEFAULT_COLOR_TABLE_MIN; | ||||
|    maxValue = DEFAULT_COLOR_TABLE_MAX; | ||||
|    return DEFAULT_COLOR_TABLE; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,9 +25,10 @@ public: | |||
|    explicit RadarProductView(); | ||||
|    ~RadarProductView(); | ||||
| 
 | ||||
|    virtual const std::vector<boost::gil::rgba8_pixel_t>& color_table() const; | ||||
|    virtual std::chrono::system_clock::time_point         sweep_time() const; | ||||
|    virtual const std::vector<float>&                     vertices() const = 0; | ||||
|    virtual const std::vector<boost::gil::rgba8_pixel_t>& | ||||
|    color_table(uint16_t& minValue, uint16_t& maxValue) const; | ||||
|    virtual std::chrono::system_clock::time_point sweep_time() const; | ||||
|    virtual const std::vector<float>&             vertices() const = 0; | ||||
| 
 | ||||
|    void Initialize(); | ||||
|    virtual void | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat