Update the call signature of compute_primary_ray
It takes the current X and Y coordinates and the height and width of the image.
This commit is contained in:
		
							parent
							
								
									05327fbe7a
								
							
						
					
					
						commit
						0e1106aa41
					
				
					 2 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -120,8 +120,10 @@ Camera::SetUp(const Vector3& up)
 | 
			
		|||
 * the view into the scene.
 | 
			
		||||
 */
 | 
			
		||||
Ray
 | 
			
		||||
OrthographicCamera::compute_primary_ray(const int &x,
 | 
			
		||||
                                        const int &y)
 | 
			
		||||
OrthographicCamera::compute_primary_ray(const int x,
 | 
			
		||||
                                        const int width,
 | 
			
		||||
                                        const int y,
 | 
			
		||||
                                        const int height)
 | 
			
		||||
    const
 | 
			
		||||
{
 | 
			
		||||
    // Calculate the point on the image plane that the given (x,y) coordinate pair corresponds to.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,12 +28,13 @@ public:
 | 
			
		|||
    void set_direction(const Vector3 &d);
 | 
			
		||||
    float get_angle() const;
 | 
			
		||||
 | 
			
		||||
    virtual Ray compute_primary_ray(const int &x, const int &y) const = 0;
 | 
			
		||||
    const Vector3& GetRight() const;
 | 
			
		||||
    void SetRight(const Vector3& right);
 | 
			
		||||
    const Vector3& GetUp() const;
 | 
			
		||||
    void SetUp(const Vector3& up);
 | 
			
		||||
 | 
			
		||||
    virtual Ray compute_primary_ray(const int x, const int width,
 | 
			
		||||
                                    const int y, const int height) const = 0;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    // Size of the image plane.
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +52,8 @@ class OrthographicCamera
 | 
			
		|||
    : public Camera
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    Ray compute_primary_ray(const int &x, const int &y) const;
 | 
			
		||||
    Ray compute_primary_ray(const int x, const int width,
 | 
			
		||||
                            const int y, const int height) const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue