| 
									
										
										
										
											2012-11-14 19:53:46 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2019-02-18 07:21:50 +11:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Copyright 2012, Blender Foundation. | 
					
						
							| 
									
										
										
										
											2012-11-14 19:53:46 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-08 11:49:51 +10:00
										 |  |  | #ifndef __COM_MAPRANGEOPERATION_H__
 | 
					
						
							|  |  |  | #define __COM_MAPRANGEOPERATION_H__
 | 
					
						
							| 
									
										
										
										
											2012-11-14 19:53:46 +00:00
										 |  |  | #include "COM_NodeOperation.h"
 | 
					
						
							|  |  |  | #include "DNA_texture_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * this program converts an input color to an output value. | 
					
						
							|  |  |  |  * it assumes we are in sRGB color space. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class MapRangeOperation : public NodeOperation { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |  private: | 
					
						
							|  |  |  |   /**
 | 
					
						
							|  |  |  |    * Cached reference to the inputProgram | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   SocketReader *m_inputOperation; | 
					
						
							|  |  |  |   SocketReader *m_sourceMinOperation; | 
					
						
							|  |  |  |   SocketReader *m_sourceMaxOperation; | 
					
						
							|  |  |  |   SocketReader *m_destMinOperation; | 
					
						
							|  |  |  |   SocketReader *m_destMaxOperation; | 
					
						
							| 
									
										
										
										
											2012-11-14 19:53:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   bool m_useClamp; | 
					
						
							| 
									
										
										
										
											2018-06-17 17:05:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |  public: | 
					
						
							|  |  |  |   /**
 | 
					
						
							|  |  |  |    * Default constructor | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   MapRangeOperation(); | 
					
						
							| 
									
										
										
										
											2018-06-17 17:05:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    * the inner loop of this program | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); | 
					
						
							| 
									
										
										
										
											2018-06-17 17:05:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    * Initialize the execution | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   void initExecution(); | 
					
						
							| 
									
										
										
										
											2018-06-17 17:05:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    * Deinitialize the execution | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   void deinitExecution(); | 
					
						
							| 
									
										
										
										
											2018-06-17 17:05:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /**
 | 
					
						
							|  |  |  |    * Clamp the output | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   void setUseClamp(bool value) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     this->m_useClamp = value; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-11-14 19:53:46 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | #endif
 |