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

Public Member Functions

Box3d boundingBox () const
 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 () &&
 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 &
 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 (uint viewId) const
 This member function must draw the object. It will be called at every frame.
 
void drawId (uint viewId, uint id) 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.
 
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.
 
bool isVisible () const
 This member function is used to check if the object is visible.
 
void setVisibility (bool vis)
 This member function is used to set the visibility of the object.
 
- Public Member Functions inherited from vcl::PolymorphicObjectVector< DrawableObject >
Reference at (uint i)
 Access the specified element with bounds checking.
 
ValueType at (uint i)
 Access the specified element with bounds checking.
 
ConstValueType at (uint i) const
 
ConstReference at (uint i) const
 Access the specified element with bounds checking.
 
Reference atMod (int i)
 Access the specified element, computing first the module of the position w.r.t. the size of the container.
 
ValueType atMod (int i)
 Access the specified element, computing first the module of the position w.r.t. the size of the container.
 
ConstReference atMod (int i) const
 Access the specified element, computing first the module of the position w.r.t. the size of the container.
 
ConstValueType atMod (uint i) const
 
Reference back ()
 Access the last element of the Vector.
 
ValueType back ()
 Access the last element of the Vector.
 
ConstReference back () const
 Access the last element of the Vector.
 
ConstValueType back () const
 
Iterator begin ()
 Return an iterator pointing to the beginning of the Vector.
 
Iterator begin ()
 Return an iterator pointing to the beginning of the Vector.
 
ConstIterator begin () const
 
ConstIterator begin () const
 Return a const iterator pointing to the beginning of the Vector.
 
void clear ()
 Remove all elements from the Vector.
 
bool contains (const MakeConstPointerT< T > &e) const
 Check if the Vector contains the specified element.
 
Pointer data ()
 Returns a pointer to the underlying array serving as element storage. The pointer is such that range [data(), data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
 
ConstPointer data () const
 
ConstPointer data () const
 Returns a const pointer to the underlying array serving as element storage. The pointer is such that range [data(), data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
 
bool empty () const noexcept
 Returns whether the vector is empty (i.e. whether its size is 0).
 
Iterator end ()
 Return an iterator pointing to the end of the Vector.
 
Iterator end ()
 Return an iterator pointing to the end of the Vector.
 
ConstIterator end () const
 Return a const iterator pointing to the end of the Vector.
 
ConstIterator end () const
 
void erase (uint i)
 Remove the element at the specified index from the Vector.
 
void fill (const T &e)
 Fill all elements of the Vector with the specified value.
 
void fill (const T &e)
 Fill all elements of the Vector with clones of the specified value.
 
ConstIterator find (const MakeConstPointer< T > &e) const
 
Iterator find (const MakeConstPointerT< T > &e)
 Find the first occurrence of the specified element in the Vector.
 
ConstIterator find (const MakeConstPointerT< T > &e) const
 Find the first occurrence of the specified element in the Vector.
 
Reference front ()
 Access the first element of the Vector.
 
ValueType front ()
 Access the first element of the Vector.
 
ConstValueType front () const
 
ConstReference front () const
 Access the first element of the Vector.
 
uint indexOf (const MakeConstPointerT< T > &e) const
 Get the index of the first occurrence of the specified element in the Vector.
 
void insert (uint i, const T &v)
 Insert an element at the specified position in the Vector.
 
void insert (uint i, const T &v)
 Insert an element at the specified position in the Vector.
 
void insert (uint i, T &&v)
 Insert an element at the specified position in the Vector.
 
void insert (uint i, T &&v)
 Insert an element at the specified position in the Vector.
 
ValueType operator() (uint i)
 Returns a reference to the element at specified location i. No bounds checking is performed.
 
PolymorphicObjectVectoroperator= (PolymorphicObjectVector other)
 Assignment operator of the PolymorphicObjectVector.
 
ValueType operator[] (uint i)
 Returns a reference to the element at specified location i. No bounds checking is performed.
 
 PolymorphicObjectVector (const PolymorphicObjectVector &other)
 Creates a Vector object with copied of the elements of the other Vector.
 
 PolymorphicObjectVector (ItType first, ItType last)
 Constructs the container with the contents of the range [first, last).
 
 PolymorphicObjectVector (PolymorphicObjectVector &&other) noexcept
 Move constructor.
 
 PolymorphicObjectVector (RangeType &&rng)
 Constructs the container with the contents of the range rng.
 
 PolymorphicObjectVector (std::size_t size, const T &value)
 Creates a Vector object with the specified size.
 
void pushBack (const T &v)
 Add an element to the end of the Vector.
 
void pushBack (const T &v)
 Add an element to the end of the Vector.
 
void pushBack (T &&v)
 Add an element to the end of the Vector.
 
void pushBack (T &&v)
 Add an element to the end of the Vector.
 
void resize (uint n, const T &v)
 Resize the Vector to the specified size.
 
void resize (uint n, const T &v=T())
 Resize the Vector to the specified size.
 
void set (Base::ConstIterator it, const T &e)
 Set the value of the element at the specified position.
 
void set (ConstIterator it, const T &e)
 Set the value of the element at the specified position.
 
void set (ConstIterator it, T &&e)
 Set the value of the element at the specified position.
 
void set (Rng &&r)
 Set the elements of the Vector using the values from a range.
 
void set (Rng &&r)
 Set the elements of the Vector using the values from a range.
 
void set (uint i, const T &e)
 Set the value of the element at the specified position.
 
void set (uint i, const T &e)
 Set the value of the element at the specified position.
 
void set (uint i, T &&e)
 Set the value of the element at the specified position.
 
std::size_t size () const
 Returns the size of the container.
 
void swap (PolymorphicObjectVector &other)
 Swaps the contents of the container with those of other.
 
void swap (Vector &other)
 Swaps the contents of the container with those of other.
 
- Public Member Functions inherited from vcl::DrawableObject
 DrawableObject ()=default
 Empty constructor.
 
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 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 Types

using Base = PolymorphicObjectVector< DrawableObject >
 

Private Member Functions

uint firstVisibleObject () const
 

Private Attributes

bool mVisible = true
 

Additional Inherited Members

- Public Types inherited from vcl::PolymorphicObjectVector< DrawableObject >
using ConstIterator = Base::ConstIterator
 
using ConstValueType = Base::ConstValueType
 
using Iterator = BaseVector::ConstIterator
 
using ValueType = Base::ValueType
 
- Static Public Attributes inherited from vcl::PolymorphicObjectVector< DrawableObject >
static const int SIZE
 Size of the vector at compile time. It will be -1 if the Vector has dynamic size.
 
- Protected Types inherited from vcl::PointerVector< T, N >
using ConstIterator = ConstPointerIterator< typename Base::ConstIterator >
 
using ConstPointer = const ConstValueType *
 
using ConstValueType = MakeConstPointerT< ValueType >
 
using Iterator = Base::Iterator
 
using Pointer = Base::Pointer
 
using Reference = Base::Reference
 
using ValueType = Base::ValueType
 
- Protected Types inherited from vcl::Vector< T, N >
using ConstIterator = Container::const_iterator
 A const iterator to the elements of the Vector.
 
using ConstPointer = Container::const_pointer
 A const pointer to the type of the elements stored in the Vector.
 
using ConstReference = Container::const_reference
 A const reference to the type of the elements stored in the Vector.
 
using Iterator = Container::iterator
 An iterator to the elements of the Vector.
 
using Pointer = Container::pointer
 A pointer to the type of the elements stored in the Vector.
 
using Reference = Container::reference
 A reference to the type of the elements stored in the Vector.
 
using ValueType = Container::value_type
 The type of the elements stored in the Vector.
 
- Protected Member Functions inherited from vcl::PointerVector< T, N >
Reference at (uint i)
 Access the specified element with bounds checking.
 
ConstReference at (uint i) const
 Access the specified element with bounds checking.
 
ConstValueType at (uint i) const
 
Reference atMod (int i)
 Access the specified element, computing first the module of the position w.r.t. the size of the container.
 
ConstReference atMod (int i) const
 Access the specified element, computing first the module of the position w.r.t. the size of the container.
 
ConstValueType atMod (uint i) const
 
Reference back ()
 Access the last element of the Vector.
 
ConstReference back () const
 Access the last element of the Vector.
 
ConstValueType back () const
 
Iterator begin ()
 Return an iterator pointing to the beginning of the Vector.
 
ConstIterator begin () const
 Return a const iterator pointing to the beginning of the Vector.
 
ConstIterator begin () const
 
void clear ()
 Remove all elements from the Vector.
 
bool contains (const MakeConstPointerT< T > &e) const
 Check if the Vector contains the specified element.
 
Pointer data ()
 Returns a pointer to the underlying array serving as element storage. The pointer is such that range [data(), data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
 
ConstPointer data () const
 Returns a const pointer to the underlying array serving as element storage. The pointer is such that range [data(), data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
 
ConstPointer data () const
 
bool empty () const noexcept
 Returns whether the vector is empty (i.e. whether its size is 0).
 
Iterator end ()
 Return an iterator pointing to the end of the Vector.
 
ConstIterator end () const
 Return a const iterator pointing to the end of the Vector.
 
ConstIterator end () const
 
void erase (uint i)
 Remove the element at the specified index from the Vector.
 
void fill (const T &e)
 Fill all elements of the Vector with the specified value.
 
ConstIterator find (const MakeConstPointer< T > &e) const
 
Iterator find (const MakeConstPointerT< T > &e)
 Find the first occurrence of the specified element in the Vector.
 
ConstIterator find (const MakeConstPointerT< T > &e) const
 Find the first occurrence of the specified element in the Vector.
 
Reference front ()
 Access the first element of the Vector.
 
ConstReference front () const
 Access the first element of the Vector.
 
ConstValueType front () const
 
uint indexOf (const MakeConstPointerT< T > &e) const
 Get the index of the first occurrence of the specified element in the Vector.
 
void insert (uint i, const T &v)
 Insert an element at the specified position in the Vector.
 
void insert (uint i, T &&v)
 Insert an element at the specified position in the Vector.
 
ConstValueType operator() (uint i) const
 
ConstValueType operator[] (uint i) const
 
void pushBack (const T &v)
 Add an element to the end of the Vector.
 
void pushBack (T &&v)
 Add an element to the end of the Vector.
 
void resize (uint n, const T &v=T())
 Resize the Vector to the specified size.
 
void set (ConstIterator it, const T &e)
 Set the value of the element at the specified position.
 
void set (ConstIterator it, T &&e)
 Set the value of the element at the specified position.
 
template<Range Rng>
requires InputRange<Rng, T>
void set (Rng &&r)
 Set the elements of the Vector using the values from a range.
 
void set (uint i, const T &e)
 Set the value of the element at the specified position.
 
void set (uint i, T &&e)
 Set the value of the element at the specified position.
 
std::size_t size () const
 Returns the size of the container.
 
void swap (Vector &other)
 Swaps the contents of the container with those of other.
 
 Vector ()=default
 Creates an empty Vector object.
 
template<typename ItType >
 Vector (ItType first, ItType last)
 Constructs the container with the contents of the range [first, last).
 
template<Range RangeType>
 Vector (RangeType &&rng)
 Constructs the container with the contents of the range rng.
 
 Vector (std::initializer_list< T > list)
 Constructs the container with the contents of the initializer list list.
 
 Vector (std::size_t size, const T &value=T())
 Creates a Vector object with the specified size.
 
- Protected Member Functions inherited from vcl::Vector< T, N >
Reference at (uint i)
 Access the specified element with bounds checking.
 
ConstReference at (uint i) const
 Access the specified element with bounds checking.
 
Reference atMod (int i)
 Access the specified element, computing first the module of the position w.r.t. the size of the container.
 
ConstReference atMod (int i) const
 Access the specified element, computing first the module of the position w.r.t. the size of the container.
 
Reference back ()
 Access the last element of the Vector.
 
ConstReference back () const
 Access the last element of the Vector.
 
Iterator begin ()
 Return an iterator pointing to the beginning of the Vector.
 
ConstIterator begin () const
 Return a const iterator pointing to the beginning of the Vector.
 
void clear ()
 Remove all elements from the Vector.
 
bool contains (const MakeConstPointerT< T > &e) const
 Check if the Vector contains the specified element.
 
Pointer data ()
 Returns a pointer to the underlying array serving as element storage. The pointer is such that range [data(), data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
 
ConstPointer data () const
 Returns a const pointer to the underlying array serving as element storage. The pointer is such that range [data(), data() + size()) is always a valid range, even if the container is empty (data() is not dereferenceable in that case).
 
void deserialize (std::istream &is)
 
template<typename... Args>
requires (N < 0)
void emplace (uint i, Args &&... args)
 Insert an element at the specified position in the Vector.
 
bool empty () const noexcept
 Returns whether the vector is empty (i.e. whether its size is 0).
 
Iterator end ()
 Return an iterator pointing to the end of the Vector.
 
ConstIterator end () const
 Return a const iterator pointing to the end of the Vector.
 
void erase (uint i)
 Remove the element at the specified index from the Vector.
 
void fill (const T &e)
 Fill all elements of the Vector with the specified value.
 
Iterator find (const MakeConstPointerT< T > &e)
 Find the first occurrence of the specified element in the Vector.
 
ConstIterator find (const MakeConstPointerT< T > &e) const
 Find the first occurrence of the specified element in the Vector.
 
Reference front ()
 Access the first element of the Vector.
 
ConstReference front () const
 Access the first element of the Vector.
 
uint indexOf (const MakeConstPointerT< T > &e) const
 Get the index of the first occurrence of the specified element in the Vector.
 
void insert (uint i, const T &v)
 Insert an element at the specified position in the Vector.
 
void insert (uint i, T &&v)
 Insert an element at the specified position in the Vector.
 
Reference operator() (uint i)
 Returns a reference to the element at specified location i. No bounds checking is performed.
 
ConstReference operator() (uint i) const
 Returns a const reference to the element at specified location i. No bounds checking is performed.
 
Reference operator[] (uint i)
 Returns a reference to the element at specified location i. No bounds checking is performed.
 
ConstReference operator[] (uint i) const
 Returns a const reference to the element at specified location i. No bounds checking is performed.
 
void pushBack (const T &v)
 Add an element to the end of the Vector.
 
void pushBack (T &&v)
 Add an element to the end of the Vector.
 
void resize (uint n, const T &v=T())
 Resize the Vector to the specified size.
 
void serialize (std::ostream &os) const
 
void set (ConstIterator it, const T &e)
 Set the value of the element at the specified position.
 
void set (ConstIterator it, T &&e)
 Set the value of the element at the specified position.
 
template<Range Rng>
requires InputRange<Rng, T>
void set (Rng &&r)
 Set the elements of the Vector using the values from a range.
 
void set (uint i, const T &e)
 Set the value of the element at the specified position.
 
void set (uint i, T &&e)
 Set the value of the element at the specified position.
 
std::size_t size () const
 Returns the size of the container.
 
void swap (Vector &other)
 Swaps the contents of the container with those of other.
 
 Vector ()=default
 Creates an empty Vector object.
 
template<typename ItType >
 Vector (ItType first, ItType last)
 Constructs the container with the contents of the range [first, last).
 
template<Range RangeType>
 Vector (RangeType &&rng)
 Constructs the container with the contents of the range rng.
 
 Vector (std::initializer_list< T > list)
 Constructs the container with the contents of the initializer list list.
 
 Vector (std::size_t size, const T &value=T())
 Creates a Vector object with the specified size.
 
- Protected Member Functions inherited from vcl::DrawableObject
void swap (DrawableObject &other)
 Utility swap function that allows to swap the content of two DrawableObject instances.
 
- Protected Attributes inherited from vcl::Vector< T, N >
Container mContainer
 
- Static Protected Attributes inherited from vcl::PointerVector< T, N >
static const int SIZE
 Size of the vector at compile time. It will be -1 if the Vector has dynamic size.
 
- Static Protected Attributes inherited from vcl::Vector< T, N >
static const int SIZE = N
 Size of the vector at compile time. It will be -1 if the Vector has dynamic size.
 

Member Function Documentation

◆ boundingBox()

Box3d vcl::DrawableObjectVector::boundingBox ( ) const
virtual

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::DrawableObjectVector::clone ( ) &&
virtual

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::DrawableObjectVector::clone ( ) const &
virtual

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::DrawableObjectVector::draw ( uint  viewId) const
virtual

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

Parameters
viewIdThe ID of the view to draw. It may be used depending on the rendering engine.

Implements vcl::DrawableObject.

◆ drawId()

void vcl::DrawableObjectVector::drawId ( uint  viewId,
uint  id 
) const
virtual

This member function should draw the object. It will be called on request when the renderer needs to draw the ID of the object.

Parameters
viewIdThe ID of the view to draw. It may be used depending on the rendering engine.
idThe ID of the object.

Reimplemented from vcl::DrawableObject.

◆ init()

void vcl::DrawableObjectVector::init ( )
virtual

This member function is called after the initialization of the Context. It must initialize and bind data to the GPU like buffers and textures.

Reimplemented from vcl::DrawableObject.

◆ isVisible()

bool vcl::DrawableObjectVector::isVisible ( ) const
virtual

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::DrawableObjectVector::setVisibility ( bool  vis)
virtual

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 files: