gramods
Classes | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
gramods::gmGraphics::Geometry Class Reference

A Geometry contains information for projection of graphics on a geometrical shape, such as a sphere or a plane. More...

#include <Geometry.hh>

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

Classes

struct  Impl
 

Public Member Functions

 Geometry (Impl *_impl=nullptr)
 
virtual bool getCameraFromPosition (Camera vfrustum, Eigen::Vector3f position, Camera &rfrustum)
 Calculates and returns a frustum, with optical center at the specified position, that contains the intersection between the provided frustum and the geometrical shape. More...
 
virtual std::string getIntersectionCode ()
 Returns shader code that implements the necessary functions for the specific geometry. More...
 
virtual void setMapperUniforms (GLuint)
 Called by the code that is using this geometry object, to let the it set the uniforms used by the mapper code. More...
 
void setInside (bool on)
 Set true if the projection should be calculated for the inside of the geometry, and not the outside. 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...
 

Static Public Attributes

static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 

Protected Attributes

std::unique_ptr< Impl_impl
 

Detailed Description

A Geometry contains information for projection of graphics on a geometrical shape, such as a sphere or a plane.

Member Function Documentation

◆ getCameraFromPosition()

bool gramods::gmGraphics::Geometry::getCameraFromPosition ( Camera  vfrustum,
Eigen::Vector3f  position,
Camera rfrustum 
)
virtual

Calculates and returns a frustum, with optical center at the specified position, that contains the intersection between the provided frustum and the geometrical shape.

Parameters
[in]vfrustumThe view frustum, typically the frustum of a projector that projects onto a geometrical surface.
[in]positionThe rendering position, that will be the position of the returned render frustum.
[out]rfrustumThe render frustum, a frustum that will provide a rendering of the scene, from the provided position, onto the geometry where this geometry is seen by the vfrustum frustum.
Returns
True if a camera could be specified and false if there is no valid camera that fulfills the requirements, for example if the view because of non-linearities in the geometry would result in a field-of-view of 180 degrees or more.

Reimplemented in gramods::gmGraphics::SphereGeometry, and gramods::gmGraphics::PlaneGeometry.

◆ getDefaultKey()

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

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

Reimplemented from gramods::gmCore::Object.

◆ getIntersectionCode()

virtual std::string gramods::gmGraphics::Geometry::getIntersectionCode ( )
inlinevirtual

Returns shader code that implements the necessary functions for the specific geometry.

The code must implement

  • vec3 getIntersection(vec3 pos, vec3 dir) - returns the intersection between the line defined by the specified position and direction vector and the geometry. Return (0,0,0) if there is no intersection.

Reimplemented in gramods::gmGraphics::SphereGeometry, and gramods::gmGraphics::PlaneGeometry.

◆ setInside()

void gramods::gmGraphics::Geometry::setInside ( bool  on)

Set true if the projection should be calculated for the inside of the geometry, and not the outside.

Default is false (projection is estimated for the outside of the geometry).

XML-attribute: inside

◆ setMapperUniforms()

virtual void gramods::gmGraphics::Geometry::setMapperUniforms ( GLuint  )
inlinevirtual

Called by the code that is using this geometry object, to let the it set the uniforms used by the mapper code.

Reimplemented in gramods::gmGraphics::SphereGeometry, and gramods::gmGraphics::PlaneGeometry.


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