Visual Computing Library  devel
Loading...
Searching...
No Matches
vcl::DrawableLines Class Reference
Inheritance diagram for vcl::DrawableLines:

Public Member Functions

vcl::Box3d boundingBox () const override
 This member function is used to find a good camera position to render object. It should return the the bounding box of the object. Return a null bounding box if the object shouldn't influence the position of the camera.
 
std::shared_ptr< DrawableObjectclone () &&override
 This member function is used to create a new DrawableObject that is a moved from the current one. This object will be destroyed after the call of this function. Each derived class must implement this member function, that returns a shared pointer pointing to the moved object. For more details about this paradigm, check polimorphism clone in modern c++: https://www.fluentcpp.com/2017/09/08/make-polymorphic-copy-modern-cpp/.
 
std::shared_ptr< DrawableObjectclone () const &override
 This member function is used to create a new copy of the DrawableObject. Each derived class must implement this member function, that returns a shared pointer pointing to a copy of the current one. for more details about this paradigm, check polimorphism clone in modern c++: https://www.fluentcpp.com/2017/09/08/make-polymorphic-copy-modern-cpp/.
 
void draw (const DrawObjectSettings &settings) const override
 This member function must draw the object. It will be called at every frame.
 
 DrawableLines (const DrawableLines &other)
 
 DrawableLines (const std::vector< float > &vertCoords, const std::vector< float > &vertNormals=std::vector< float >(), const std::vector< uint > &vertColors=std::vector< uint >(), const std::vector< uint > &lineColors=std::vector< uint >())
 
 DrawableLines (const std::vector< float > &vertCoords, const std::vector< uint > &lineIndices, const std::vector< float > &vertNormals=std::vector< float >(), const std::vector< uint > &vertColors=std::vector< uint >(), const std::vector< uint > &lineColors=std::vector< uint >())
 
 DrawableLines (DrawableLines &&other)
 
bool isVisible () const override
 This member function is used to check if the object is visible.
 
DrawableLinesoperator= (DrawableLines other)
 
void setImplementationType (ImplementationType type)
 
void setPoints (const std::vector< float > &vertCoords, const std::vector< float > &vertNormals, const std::vector< uint > &vertColors, const std::vector< uint > &lineColors)
 
void setPoints (const std::vector< float > &vertCoords, const std::vector< uint > &lineIndices, const std::vector< float > &vertNormals, const std::vector< uint > &vertColors, const std::vector< uint > &lineColors)
 
void setVisibility (bool vis) override
 This member function is used to set the visibility of the object.
 
void swap (DrawableLines &other)
 
- Public Member Functions inherited from vcl::Lines
ColorToUse colorToUse () const
 Returns the color that is used to render the lines.
 
void draw (uint viewId) const
 Draws in the given view the lines with the current settings.
 
ColorgeneralColor ()
 Returns a reference to the general color that is used to render the lines when colorToUse() is set to ColorToUse::GENERAL. This allows to modify the color directly.
 
Color generalColor () const
 Returns the general color that is used to render the lines when colorToUse() is set to ColorToUse::GENERAL.
 
ImplementationType implementationType () const
 Returns the current implementation type that is used to render the lines.
 
 Lines (const std::vector< float > &vertCoords, const std::vector< float > &vertNormals, const std::vector< uint > &vertColors, const std::vector< uint > &lineColors, float thickness=5.0f, bool shadingPerVertex=false, ColorToUse colorToUse=ColorToUse::GENERAL, ImplementationType type=ImplementationType::COUNT)
 Creates a Lines object with given points and parameters.
 
 Lines (const std::vector< float > &vertCoords, const std::vector< uint > &lineIndices, const std::vector< float > &vertNormals, const std::vector< uint > &vertColors, const std::vector< uint > &lineColors, float thickness=5.0f, bool shadingPerVertex=false, ColorToUse colorToUse=ColorToUse::GENERAL, ImplementationType type=ImplementationType::COUNT)
 Creates a Lines object with given points and parameters.
 
 Lines (ImplementationType type=ImplementationType::COUNT)
 Creates a Lines object with default parameters and without points.
 
void setColorToUse (ColorToUse color)
 Sets which color to use for rendering the lines.
 
void setPoints (const std::vector< float > &vertCoords, const std::vector< float > &vertNormals, const std::vector< uint > &vertColors, const std::vector< uint > &lineColors, ImplementationType type=ImplementationType::COUNT)
 Sets the points of the lines.
 
void setPoints (const std::vector< float > &vertCoords, const std::vector< uint > &lineIndices, const std::vector< float > &vertNormals, const std::vector< uint > &vertColors, const std::vector< uint > &lineColors, ImplementationType type=ImplementationType::COUNT)
 Sets the points of the lines.
 
void setShading (bool perVertex)
 Sets wether to use per vertex shading (using vertex normals) or not.
 
bool shadingPerVertex () const
 Returns true if shading is computed per vertex using vertex normals, false if no shading is applied.
 
floatthickness ()
 Returns a reference to the thickness of the lines (in pixels). This allows to modify the thickness directly.
 
float thickness () const
 Returns the thickness of the lines (in pixels).
 
- Public Member Functions inherited from vcl::DrawableObject
 DrawableObject ()=default
 Empty constructor.
 
virtual void drawId (const DrawObjectSettings &settings) const
 This member function should draw the object. It will be called on request when the renderer needs to draw the ID of the object.
 
std::string & info ()
 Returns a reference of the info of the object, that allows to modify it.
 
const std::string & info () const
 Returns the info of the object.
 
virtual void init ()
 This member function is called after the initialization of the Context. It must initialize and bind data to the GPU like buffers and textures.
 
virtual std::string & name ()
 Returns a reference of the name of the object, that allows to modify it.
 
virtual const std::string & name () const
 Returns the name of the object.
 

Private Attributes

std::vector< uint > mLineColors
 
std::vector< uint > mLineIndices
 
bool mUseLineIndices = false
 
std::vector< uint > mVertColors
 
std::vector< floatmVertCoords
 
std::vector< floatmVertNormals
 
bool mVisible = true
 

Friends

void swap (DrawableLines &first, DrawableLines &second)
 

Additional Inherited Members

- Public Types inherited from vcl::Lines
enum class  ColorToUse { PER_VERTEX , PER_EDGE , GENERAL }
 
enum class  ImplementationType { PRIMITIVE = 0 , CPU_GENERATED = 1 , COUNT }
 
- Protected Member Functions inherited from vcl::DrawableObject
void swap (DrawableObject &other)
 Utility swap function that allows to swap the content of two DrawableObject instances.
 

Member Function Documentation

◆ boundingBox()

vcl::Box3d vcl::DrawableLines::boundingBox ( ) const
inlineoverridevirtual

This member function is used to find a good camera position to render object. It should return the the bounding box of the object. Return a null bounding box if the object shouldn't influence the position of the camera.

Returns
The bounding box of the object.

Implements vcl::DrawableObject.

◆ clone() [1/2]

std::shared_ptr< DrawableObject > vcl::DrawableLines::clone ( ) &&
inlineoverridevirtual

This member function is used to create a new DrawableObject that is a moved from the current one. This object will be destroyed after the call of this function. Each derived class must implement this member function, that returns a shared pointer pointing to the moved object. For more details about this paradigm, check polimorphism clone in modern c++: https://www.fluentcpp.com/2017/09/08/make-polymorphic-copy-modern-cpp/.

Generally, if your class that inherits from DrawableObject is called MyObject, the clone member function should be implemented as follows:

std::shared_ptr<DrawableObject> MyObject::clone() &&
{
return std::make_shared<MyObject>(std::move(*this));
}
Returns
A shared pointers that points to a new DrawableObject that is a moved from the current one.

Implements vcl::DrawableObject.

◆ clone() [2/2]

std::shared_ptr< DrawableObject > vcl::DrawableLines::clone ( ) const &
inlineoverridevirtual

This member function is used to create a new copy of the DrawableObject. Each derived class must implement this member function, that returns a shared pointer pointing to a copy of the current one. for more details about this paradigm, check polimorphism clone in modern c++: https://www.fluentcpp.com/2017/09/08/make-polymorphic-copy-modern-cpp/.

Generally, if your class that inherits from DrawableObject is called MyObject, the clone member function should be implemented as follows:

std::shared_ptr<DrawableObject> MyObject::clone() const&
{
return std::make_shared<MyObject>(*this);
}
A class representing a box in N-dimensional space.
Definition box.h:46
Returns
A shared pointers that points to a new DrawableObject that is a copy of the current one.

Implements vcl::DrawableObject.

◆ draw()

void vcl::DrawableLines::draw ( const DrawObjectSettings settings) const
inlineoverridevirtual

This member function must draw the object. It will be called at every frame.

Parameters
[in]settingsThe settings to use to draw the object.

Implements vcl::DrawableObject.

◆ isVisible()

bool vcl::DrawableLines::isVisible ( ) const
inlineoverridevirtual

This member function is used to check if the object is visible.

Returns
true if the object is visible;

Implements vcl::DrawableObject.

◆ setVisibility()

void vcl::DrawableLines::setVisibility ( bool  vis)
inlineoverridevirtual

This member function is used to set the visibility of the object.

Parameters
[in]vistrue if the object should be visible;

Implements vcl::DrawableObject.


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