gramods
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gramods::gmGraphics::CoordinatesMapper Class Reference

A CoordinatesMapper provides a mapping between 2D and 3D. More...

#include <CoordinatesMapper.hh>

Inheritance diagram for gramods::gmGraphics::CoordinatesMapper:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmGraphics::CoordinatesMapper:
Collaboration graph
[legend]

Public Member Functions

virtual std::string getCommonCode ()
 Returns shader "common" code, lines of code that are needed once regardless if 2D or 3D mapping code is used, or both. More...
 
virtual std::string getTo2DCode ()
 Returns shader code that implements the 3D to 2D mapping for the specific coordinates mapper. More...
 
virtual std::string getTo3DCode ()
 Returns shader code that implements the 2D to 3D mapping for the specific coordinates mapper. More...
 
virtual void setCommonUniforms (GLuint program)
 Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by the common code. More...
 
virtual void setTo2DUniforms (GLuint program)
 Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by the to-2D code. More...
 
virtual void setTo3DUniforms (GLuint program)
 Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by the to-3D code. More...
 
virtual std::string getDefaultKey () override
 Returns the default key, in Configuration, for the Object. More...
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data. More...
 
virtual ~Object ()
 Cleaning up internal data. More...
 
virtual void initialize ()
 Called to initialize the Object. More...
 
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument. More...
 
virtual void traverse (Visitor *visitor)
 Calls the child Object's accept method, if such exist. More...
 
bool isInitialized ()
 Returns true if the Object is initialized. More...
 

Protected Member Functions

const std::string withVarId (std::string) const
 

Protected Attributes

const std::string var_id
 

Detailed Description

A CoordinatesMapper provides a mapping between 2D and 3D.

The 2D coordinates are ranged -1 to 1 and the 3D coordinates should be a unit vector being the direction corresponding to a point in the 2D space.

Member Function Documentation

◆ getCommonCode()

virtual std::string gramods::gmGraphics::CoordinatesMapper::getCommonCode ( )
inlinevirtual

◆ getDefaultKey()

virtual std::string gramods::gmGraphics::CoordinatesMapper::getDefaultKey ( )
inlineoverridevirtual

Returns the default key, in Configuration, for the Object.

Reimplemented from gramods::gmCore::Object.

◆ getTo2DCode()

virtual std::string gramods::gmGraphics::CoordinatesMapper::getTo2DCode ( )
inlinevirtual

Returns shader code that implements the 3D to 2D mapping for the specific coordinates mapper.

The code implements bool mapTo2D(vec3 pos3d, out vec2 pos2d) that calculates the 2D coordinates that correspond to the specified 3D position. Return true if pos2d is set to the 2D mapping of pos3d, or false if there is no such mapping.

Argument pos3 is a unit 3D vector pointing in any direction, and pos2 is a 2D vector with each dimension ranging between -1 and 1, for left/bottom and right/top, respectively.

Reimplemented in gramods::gmGraphics::TransitionCoordinatesMapper, gramods::gmGraphics::StereographicCoordinatesMapper, gramods::gmGraphics::RectilinearCameraModel, gramods::gmGraphics::FisheyeCameraModel, gramods::gmGraphics::EquirectangularCoordinatesMapper, gramods::gmGraphics::EacCoordinatesMapper, and gramods::gmGraphics::AngularFisheyeCoordinatesMapper.

◆ getTo3DCode()

virtual std::string gramods::gmGraphics::CoordinatesMapper::getTo3DCode ( )
inlinevirtual

Returns shader code that implements the 2D to 3D mapping for the specific coordinates mapper.

The code implements bool mapTo3D(vec2 pos2d, out vec3 pos3d) that calculates the 3D coordinates that correspond to the specified 2D position. Return true if pos3d is set to the 3D mapping of pos2d, or false if there is no such mapping.

Argument pos2 is a 2D vector with each dimension ranging between -1 and 1, for left/bottom and right/top, respectively, and pos3 is a unit 3D vector pointing in any direction.

Reimplemented in gramods::gmGraphics::TransitionCoordinatesMapper, gramods::gmGraphics::StereographicCoordinatesMapper, gramods::gmGraphics::RectilinearCameraModel, gramods::gmGraphics::EquirectangularCoordinatesMapper, gramods::gmGraphics::EacCoordinatesMapper, and gramods::gmGraphics::AngularFisheyeCoordinatesMapper.

◆ setCommonUniforms()

virtual void gramods::gmGraphics::CoordinatesMapper::setCommonUniforms ( GLuint  program)
inlinevirtual

◆ setTo2DUniforms()

virtual void gramods::gmGraphics::CoordinatesMapper::setTo2DUniforms ( GLuint  program)
inlinevirtual

Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by the to-2D code.

Reimplemented in gramods::gmGraphics::RectilinearCameraModel, gramods::gmGraphics::FisheyeCameraModel, and gramods::gmGraphics::EacCoordinatesMapper.

◆ setTo3DUniforms()

virtual void gramods::gmGraphics::CoordinatesMapper::setTo3DUniforms ( GLuint  program)
inlinevirtual

Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by the to-3D code.

Reimplemented in gramods::gmGraphics::EacCoordinatesMapper.


The documentation for this class was generated from the following files: