Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
class CcameraLensExtension : public CbaseExtension
{
public:
    virtual bool initializeForRendering( Cmaxwell::Ccamera& camera, Cmaxwell* pMaxwell ) = 0;
    
    // Returns camera origin and direction (normalized) in world coordinates, given a point in the 2D buffer (in [0,xRes-1],[0,yRes-1] range)
    virtual bool getCameraRay( Cpoint& origin, Cvector& direction, const Cvector2D& bufferPoint ) = 0;
    // Returns true if the lens has real area or false if this is an ideal lens (pinhole, spherical, etc)
    virtual bool hasArea( void ) const
    {
        return ( false );
    }
    // Returns true if the lens supports Bidirectional Path Tracing
    virtual bool supportsBPT( void ) const
    {
        return ( false );
    }
    // Returns by reference a 2D point in the film in [1,1] coordinates
    // Returns by value the PDF associated to the given input direction
    // If returned PDF is 0.0 the direction is not valid
    virtual real onLensToFilm( Cvector2D& filmPoint, const Cvector& direction )
    {
        return ( 0.0 );
    }
};

...

This is the main function of the extension. Given a point in the film (in [0,xRes-1],[0,yRes-1] range) returns a camera ray with its origin and direction (normalized) in world coordinates. This function is speed critical, so don´t do system calls, allocate or free memory and access files from here.

...

Cvector2D& filmPoint : output, point in the film, int in the range [0,1]x[0,1].

Returns

...