Commit d92b6f40 authored by Cédric Traizet's avatar Cédric Traizet

Merge branch 'release-7.0' into 'develop'

Release 7.0

See merge request !620
parents 3fcfa934 1475a236
Pipeline #2934 passed with stages
in 8 minutes and 1 second
......@@ -119,7 +119,10 @@ fast-build:
legal-check:
extends: .common
only: [merge_requests, develop, headers_check]
only:
- merge_requests
- develop
- /^release-[0-9]+\.[0-9]+$/
stage: precheck
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
variables:
......
......@@ -237,7 +237,7 @@ class Handler:
K8S_SECRET_API_TOKEN -> Token for Gitlab API
CI_MERGE_REQUEST_REF_PATH -> Ref name to push the status (only for merge request pipeline)
CI_COMMIT_REF_NAME -> Ref name to push the status
They can be overriden by a full command line :
They can be overridden by a full command line :
cdash_handler.py commit_sha1 project_id project_directory token ref_name
"""
if __name__ == "__main__":
......
......@@ -66,7 +66,7 @@ if __name__ == "__main__":
# are we in a merge_request pipeline ?
if 'CI_MERGE_REQUEST_IID' in env.keys():
if not CheckEnvParameters(['K8S_SECRET_API_TOKEN']):
print("WARNING: Make sure you have set a valid acces token for Gitlab API." \
print("WARNING: Make sure you have set a valid access token for Gitlab API." \
+ "The K8S_SECRET_API_TOKEN environment variable should be set in 'Settings -> CI/CD -> Variables'" \
+ "Without this token, some feature of the CI platform will be disabled.")
sys.exit(0)
......
......@@ -56,7 +56,7 @@ OTB_USE_SIFTFAST:BOOL=ON
OTB_USE_SPTW:BOOL=ON
OTB_USE_SSE_FLAGS:BOOL=ON")
# Usefull if MPI is ON : OTB_MPIEXEC_OPT:STRING=--allow-run-as-root
# Useful if MPI is ON : OTB_MPIEXEC_OPT:STRING=--allow-run-as-root
set (otb_wrap_option
"OTB_WRAP_PYTHON:BOOL=ON")
......@@ -70,7 +70,7 @@ if(XDK_PATH)
set(cmake_configure_option
"${cmake_configure_option}
CMAKE_PREFIX_PATH=${XDK_PATH}")
foreach(remote_module OTBTemporalGapFilling SertitObject DiapOTBModule)#otbGRM
foreach(remote_module OTBTemporalGapFilling SertitObject otbGRM DiapOTBModule)
set(cmake_configure_option
"${cmake_configure_option}
Module_${remote_module}:BOOL=ON")
......
......@@ -38,8 +38,8 @@ git shortlog -es HEAD | cut -f 2- \
curl -s ${GITLAB_PROJECT_URL}/raw/master/CI/contributors/known-contributors.txt \
| sort -u > ${KNOWN_CONTRIBUTORS}
diff ${KNOWN_CONTRIBUTORS} ${GIT_CONTRIBUTORS} > ${UNKNOWN_CONTRIBUTORS}
if [ "$?" -ne "0" ] ; then
diff ${KNOWN_CONTRIBUTORS} ${GIT_CONTRIBUTORS} | grep '^>' > ${UNKNOWN_CONTRIBUTORS}
if [ -s "${UNKNOWN_CONTRIBUTORS}" ] ; then
echo ""
echo "WARNING: ***************************************************************"
echo "WARNING: Unknown contributors found:"
......
......@@ -101,7 +101,7 @@ reset_qt_i18n_sources()
repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE)
# Find python stuff
# Version 3 is prefered before 2
# Version 3 is preferred before 2
set ( Python_ADDITIONAL_VERSIONS "3;2" )
set ( PythonInterp_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
set ( PythonLibs_FIND_REQUIRED ${OTB_WRAP_PYTHON} )
......@@ -131,8 +131,8 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
#-----------------------------------------------------------------------------
# OTB version number.
set(OTB_VERSION_MAJOR "6")
set(OTB_VERSION_MINOR "7")
set(OTB_VERSION_MAJOR "7")
set(OTB_VERSION_MINOR "0")
set(OTB_VERSION_PATCH "0")
set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
......
......@@ -10,6 +10,7 @@
<dd><a href="https://www.orfeo-toolbox.org/CookBook-6.2/">6.2.0</a></dd>
<dd><a href="https://www.orfeo-toolbox.org/CookBook-6.4/">6.4.0</a></dd>
<dd><a href="https://www.orfeo-toolbox.org/CookBook-6.6.1/">6.6.1</a></dd>
<dd><a href="https://www.orfeo-toolbox.org/CookBook-7.0/">7.0.0</a></dd>
<dd><a href="https://www.orfeo-toolbox.org/CookBook-develop/">develop</a></dd>
</dl>
</div>
......
......@@ -116,7 +116,7 @@ Alternative prototype for performance
Automatic type deduction will also work with the following signature:
``void (const R&, T1 t1, T2 t2 ..., TN tn)``
This will be more efficient when ``R`` is of type ``itk::VariableLengthVector<T>`` and should be prefered in this case.
This will be more efficient when ``R`` is of type ``itk::VariableLengthVector<T>`` and should be preferred in this case.
Automatic type deduction examples
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -125,7 +125,7 @@ Consider the following free function:
.. code-block:: cpp
itk::VariableLenghtVector<double> myFreeFunction(unsigned char a,
itk::VariableLengthVector<double> myFreeFunction(unsigned char a,
const std::complex<float>& b,
const itk::VariableLengthVector<short>& c,
const itk::ConstNeighborhoodIterator<otb::Image<double>>& d) {...}
......
......@@ -224,7 +224,7 @@ Mixed in-memory / on-disk connection
As an extension to the connection of OTB Applications (described in previous
section), a mixed mode is also available to easily switch between:
- **in-memory**: if you want to avoid unecessary I/O between applications
- **in-memory**: if you want to avoid unnecessary I/O between applications
- **on-disk**: if you want intermediate outputs on disk
This mixed mode is based on the ``Application::ConnectImage()`` function. This
......
......@@ -13,7 +13,7 @@ With QGIS > 3.8, the plugin is in the QGIS core. So you just need install OTB an
Download and Install OTB
^^^^^^^^^^^^^^^^^^^^^^^^
OTB is not distributed with qgis-otb-plugin. It is a seperate project and has its own git repository.
OTB is not distributed with qgis-otb-plugin. It is a separate project and has its own git repository.
Download latest OTB version: https://www.orfeo-toolbox.org/download/.
Configure plugin in QGIS
......
......@@ -67,7 +67,7 @@ OTBGdalAdapters_EXPORT bool operator!=(const SpatialReference& sr1, const Spatia
* either they fail or they provide a definitive, valid object.
*
* Building a SpatialReference requires to call one of the From*()
* method. There are no public constructors (appart from copy and
* method. There are no public constructors (apart from copy and
* assignment)
*
* \ingroup OTBGdalAdapters
......@@ -167,7 +167,7 @@ public:
* \pre -180<=lon<=180
* \pre -90<=lat<=90
* \param lon Point longitude
* \param lat Point lattitude
* \param lat Point latitude
* \param zone Output UTM zone
* \param hem output hemisphere
*/
......
......@@ -48,7 +48,7 @@ public:
"The training vector data must contain polygons with a positive integer field "
"representing the class label. The name of this field can be set using the *Class label field* parameter.\n\n"
"Training and validation sample lists are built such that each class is equally represented in both lists. One parameter controlls the ratio "
"Training and validation sample lists are built such that each class is equally represented in both lists. One parameter controls the ratio "
"between the number of samples in training and validation sets. Two parameters manage the size of the training and "
"validation sets per class and per image.\n\n"
......
......@@ -452,15 +452,30 @@ public:
RemoveNoDataEntry();
// Generate output
if (GetParameterAsString("out") == "xml")
{
DisableParameter("out.vector.filename");
DisableParameter("out.raster.filename");
EnableParameter("out.xml.filename");
WriteXMLStatsFile();
}
else // vector or raster
{
if (m_FromLabelImage)
GenerateVectorDataFromLabelImage();
if (GetParameterAsString("out") == "vector")
{
EnableParameter("out.vector.filename");
DisableParameter("out.raster.filename");
DisableParameter("out.xml.filename");
WriteVectorData();
}
else if (GetParameterAsString("out") == "raster")
{
DisableParameter("out.vector.filename");
EnableParameter("out.raster.filename");
DisableParameter("out.xml.filename");
WriteRasterData();
}
else
otbAppLogFATAL("Unknown output mode");
}
......
......@@ -107,7 +107,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::TrainSharkKMeans(typena
for (unsigned int i = 0; i < meanMeasurementVector.Size(); ++i)
{
scaleRV[i] = 1 / stddevMeasurementVector[i];
// Substract the normalized mean
// Subtract the normalized mean
offsetRV[i] = -meanMeasurementVector[i] / stddevMeasurementVector[i];
}
......
......@@ -276,11 +276,11 @@ private:
SetMinimumParameterFloatValue("comp.feather.slim.exponent", 0);
MandatoryOff("comp.feather.slim.exponent");
// comp.feather.slim.lenght (i.e. blending lenght)
AddParameter(ParameterType_Float, "comp.feather.slim.lenght", "Transition length (In cartographic units)");
MandatoryOn("comp.feather.slim.lenght");
SetMinimumParameterFloatValue("comp.feather.slim.lenght", 0);
MandatoryOff("comp.feather.slim.lenght");
// comp.feather.slim.length (i.e. blending length)
AddParameter(ParameterType_Float, "comp.feather.slim.length", "Transition length (In cartographic units)");
MandatoryOn("comp.feather.slim.length");
SetMinimumParameterFloatValue("comp.feather.slim.length", 0);
MandatoryOff("comp.feather.slim.length");
// harmo (harmonization)
AddParameter(ParameterType_Group, "harmo", "Spectral bands harmonization mode");
......@@ -969,7 +969,7 @@ private:
ComputeDistanceOffset<SlimFeatherMosaicFilterType>(m_SlimFeatherMosaicFilter);
// Set transition length and smoothness
m_SlimFeatherMosaicFilter->SetFeatheringTransitionDistance(GetParameterFloat("comp.feather.slim.lenght"));
m_SlimFeatherMosaicFilter->SetFeatheringTransitionDistance(GetParameterFloat("comp.feather.slim.length"));
m_SlimFeatherMosaicFilter->SetFeatheringSmoothness(GetParameterFloat("comp.feather.slim.exponent"));
mosaicFilter = static_cast<MosaicFilterType*>(m_SlimFeatherMosaicFilter);
......
......@@ -442,7 +442,7 @@ otb_test_application(NAME MosaicTestSlimFeathering
OPTIONS -il ${INPUTDATA}/SP67_FR_subset_1.tif ${INPUTDATA}/SP67_FR_subset_2.tif
-out ${TEMP}/apTvMosaicTestSlimFeathering.tif uint8
-comp.feather slim
-comp.feather.slim.lenght 100
-comp.feather.slim.length 100
VALID --compare-image ${EPSILON_8}
${BASELINE}/apTvMosaicTestSlimFeathering.tif
${TEMP}/apTvMosaicTestSlimFeathering.tif)
......
......@@ -86,7 +86,7 @@ int main(int, char* argv[])
auto output = app->GetParameterImageBase("out");
output->Update();
float im_val = 0;
// We need to be carefull as we are taking the direct output of the underlying
// We need to be careful as we are taking the direct output of the underlying
// filter in the application
otb::VectorImage<float>* output_int = nullptr;
dyn_cast(output, output_int) im_val = output_int->GetPixel(index).GetElement(0);
......@@ -128,7 +128,7 @@ int main(int, char* argv[])
app->Execute();
output = app->GetParameterImageBase("out");
output->Update();
// We need to be carefull as we are taking the direct output of the underlying
// We need to be careful as we are taking the direct output of the underlying
// filter in the application
dyn_cast(output, output_int) im_val = output_int->GetPixel(index).GetElement(0);
if (im_val != 0)
......@@ -156,7 +156,7 @@ int main(int, char* argv[])
app->Execute();
output = app->GetParameterImageBase("out");
output->Update();
// We need to be carefull as we are taking the direct output of the underlying
// We need to be careful as we are taking the direct output of the underlying
// filter in the application
dyn_cast(output, output_int) im_val = output_int->GetPixel(index).GetElement(0);
if (im_val != 5)
......
......@@ -179,7 +179,7 @@ struct RetrieveOperator
*
* Provides the following:
* - OutputImageType : type of the output image
* - FilterType : correct instanciation of VariadicInputsImageFilter from
* - FilterType : correct instantiation of VariadicInputsImageFilter from
* - the operator() prototype
* - InputHasNeighborhood a tuple of N false_type or true_type to denote
* - if Ith arg of operator() expects a neighborhood.
......@@ -443,7 +443,7 @@ auto NewFunctorFilter(Functor f, itk::Size<2> radius)
* \brief This struct allows forwarding the operator of template
* parameter, while adding number of ouptut components service.
*
* Its purpose is to enable the use of lambda or functor witht
* Its purpose is to enable the use of lambda or functor with
* Outputsize() method with FunctorImageFilter.
*
* It is used internally in NewFunctorFilter version with
......
......@@ -33,7 +33,7 @@ namespace internal
* \struct tuple_index
* \brief retrieve index of a type in tuple if exists
*
* This struct allows to retrieve the index of the first occurence of type
* This struct allows to retrieve the index of the first occurrence of type
* Arg in tuple Tuple. If type Arg can not be found, compilation will
* end with a static_assert failing.
*
......
......@@ -280,7 +280,7 @@ private:
namespace otb
{
// Prevent implicit instanciation of common types to improve build performance
// Prevent implicit instantiation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class OTBImageBase_EXPORT_TEMPLATE Image<unsigned int, 2>;
extern template class OTBImageBase_EXPORT_TEMPLATE Image<int, 2>;
......
......@@ -221,7 +221,7 @@ private:
namespace otb
{
// Prevent implicit instanciation of common types to improve build performance
// Prevent implicit instantiation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned int, 2>;
extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<int, 2>;
......
......@@ -23,7 +23,7 @@
namespace otb
{
// Explicit instanciation of common types
// Explicit instantiation of common types
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<unsigned int, 2>;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<int, 2>;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<unsigned char, 2>;
......
......@@ -23,7 +23,7 @@
namespace otb
{
// Explicit instanciation of common types
// Explicit instantiation of common types
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<unsigned int, 2>;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<int, 2>;
template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<unsigned char, 2>;
......
......@@ -159,7 +159,7 @@ bool testMatchingFilter()
}
/** Generate a pair of images, one beeing slightly warped wrt the
/** Generate a pair of images, one being slightly warped wrt the
* other */
auto generateImagePair(const std::string& infname, double rotation, double scaling)
{
......
......@@ -206,7 +206,7 @@ private:
// Output correction models
RealVectorType m_OutputCorrectionModel;
// objective funciton type (enum)
// objective function type (enum)
ObjectiveFunctionType oft;
};
......
......@@ -39,7 +39,7 @@ namespace otb
* The otb::StreamingMosaicFilterBase allows to compute what the final
* mosaic of multiple input of otb::VectorImage is, and provide the requested
* regions of input images. There is a shift-scale mode which allows
* to shift-scale input images, which can be usefull e.g. color or
* to shift-scale input images, which can be useful e.g. color or
* radiometric harmonization of input set of images. The output
* spacing (SetOutputSpacing()), the start index (SetOutputIndex()) and
* the interpolator (SetInterpolator()) and the origin (SetOrigin())
......
......@@ -42,7 +42,7 @@ namespace otb
*
* The filter implements the multiband blending strategy. Laplacian
* of input images is computed, then each frequency is mosaiced using
* a StreamingFeatherMosaicFilter. Finaly the summing of all frequencies
* a StreamingFeatherMosaicFilter. Finally the summing of all frequencies
* is performed to get the final mosaic image.
*
* Mandatory inputs : images to mosaic + alpha channels
......
......@@ -97,8 +97,11 @@ public:
const RealValueType value = pixel[band];
const RealValueType sqValue = value * value;
UpdateValues(!m_UseNoDataValue || value != m_NoDataValue, value, sqValue, value, value, m_BandCount[band], m_Sum[band], m_SqSum[band], m_Min[band],
if(!m_UseNoDataValue || value != m_NoDataValue)
{
UpdateValues(1, value, sqValue, value, value, m_BandCount[band], m_Sum[band], m_SqSum[band], m_Min[band],
m_Max[band]);
}
}
}
......
......@@ -175,7 +175,7 @@ void PersistentStreamingStatisticsMapFromLabelImageFilter<TInputVectorImage, TLa
// Mean
mean[band] /= count;
// Unbiased standard deviation (not sure unbiased is usefull here)
// Unbiased standard deviation (not sure unbiased is useful here)
const double variance = (sqSum[band] - (sum[band] * mean[band])) / (count - 1);
std[band] = std::sqrt(variance);
}
......
......@@ -195,7 +195,7 @@ private:
namespace otb
{
// Prevent implicit instanciation of common types to improve build performance
// Prevent implicit instantiation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<unsigned int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<int, 2>>;
......
......@@ -297,7 +297,7 @@ private:
namespace otb
{
// Prevent implicit instanciation of common types to improve build performance
// Prevent implicit instantiation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<unsigned int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<int, 2>>;
......
......@@ -23,7 +23,7 @@
namespace otb
{
// Explicit instanciation of common types
// Explicit instantiation of common types
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned char, 2>>;
......
......@@ -23,7 +23,7 @@
namespace otb
{
// Explicit instanciation of common types
// Explicit instantiation of common types
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned char, 2>>;
......
......@@ -32,5 +32,5 @@ A more detailed description can be found on the project website:
http://tully.ups-tlse.fr/lassallep/grm
"
GIT_REPOSITORY https://github.com/orfeotoolbox/GRM
GIT_TAG 209161cc0b3fadad7999e80b83838868f430289e
GIT_TAG 043c523df522dd31fb2dfc460ef292e6a679a81f
)
......@@ -102,7 +102,7 @@ public:
protected:
/** The input requested region should be padded by a radius of 1 to use the
* neigbourhood iterator */
* neighbourhood iterator */
void GenerateInputRequestedRegion() override;
/** Threaded Generate Data : find the neighbours of each segments of size
......@@ -136,7 +136,7 @@ private:
/** Map containing at key i the mean of element of the segment labelled i */
LabelStatisticType m_LabelStatistic;
/** Neigbours maps for each thread */
/** Neighbours maps for each thread */
std::vector<NeigboursMapType> m_NeighboursMapsTmp;
/** LUT giving correspondance between labels in the original segmentation
......
......@@ -24,13 +24,14 @@
#include <itkObject.h>
#include "otbViewSettings.h"
#include "otbShader.h"
#include "OTBIceExport.h"
#include <string>
namespace otb
{
class OTBIce_EXPORT GlActor
class OTBIce_EXPORT GlActor
: public itk::Object
{
public:
......@@ -42,7 +43,7 @@ public:
itkSetObjectMacro(Settings,ViewSettings);
itkGetObjectMacro(Settings,ViewSettings);
itkGetConstObjectMacro(Settings,ViewSettings);
itkSetMacro(Visible,bool);
itkGetMacro(Visible,bool);
itkBooleanMacro(Visible);
......@@ -58,6 +59,9 @@ public:
itkGetMacro( Overlay, bool );
itkBooleanMacro( Overlay );
itkGetObjectMacro( Shader, Shader );
itkSetObjectMacro( Shader, Shader );
// Retrieve the full extent of the actor
virtual void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const = 0;
......@@ -70,15 +74,20 @@ public:
// Gl rendering of current state
virtual void Render() = 0;
/** create the shader (no shader created by default) */
virtual void CreateShader();
protected:
GlActor();
~GlActor() override;
Shader::Pointer m_Shader;
private:
// prevent implementation
GlActor(const Self&);
void operator=(const Self&);
GlActor( const Self & ) = delete;
void operator=( const Self & ) = delete;
ViewSettings::Pointer m_Settings;
......
/*
* Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otb_GlBufferObject_h
#define otb_GlBufferObject_h
#include "OTBIceExport.h"
#include "otbGlHandle.h"
#include "otbGlTypeTraits.h"
namespace otb { namespace gl {
/** OpenGL element-type of buffer-object.
*/
enum class element : GLenum
{
vertex = GL_ARRAY_BUFFER,
index = GL_ELEMENT_ARRAY_BUFFER,
};
/**
*/
template< element E >
struct BufferObjectPolicy
{
static
void
Generate( Id_t & id )
{
glGenBuffers( 1, &id );
}
static
void
Bind( Id_t id )
{
glBindBuffer( static_cast< GLenum >( E ), id );
}
static
void
Release( Id_t & id )
{
glDeleteBuffers( 1, &id );
}
};
/**
* @class OpenGL object.
*/
template< element E >
struct BufferObject
{
/** Buffer identifier type. */
using Id_t = otb::gl::Id_t;
/** @return element type. */
static constexpr
element
Element() noexcept
{
return E;
}
/** Default constructor. */
BufferObject() = default;
/** Construct and fill. */
template< typename T >
BufferObject( std::initializer_list< T > data,
std::size_t components = 1 ) :
m_Id(),
m_Count( data.size() ),
m_Size( sizeof( T ) ),
m_Components( components ),
m_GlType( TypeTraits< T >::value() )
{
assert( data.size() );
assert( components );
glBufferData(
static_cast< GLenum >( E ),
data.size() * sizeof( T ),
data.begin(),
GL_STATIC_DRAW
);
CheckError();
}
~BufferObject() = default;
BufferObject( BufferObject && ) = default;
BufferObject & operator = ( BufferObject && ) = default;
/** Cast operator. */
operator Id_t() const noexcept
{
return m_Id;
}
void
Bind( bool isEnabled = true ) const
{
m_Id.Bind( isEnabled );
}
GLenum
GlType() const noexcept
{
return m_GlType;
}
std::size_t
Size() const noexcept
{
return m_Size;
}
std::size_t
Stride( std::size_t components ) const noexcept
{
assert( m_Size>0 );
assert( m_Components>0 );
assert( components<=m_Components );
return m_Size * ( m_Components - components );
}
private:
Handle< BufferObjectPolicy< E > > m_Id;
std::size_t m_Count = 0;
std::size_t m_Size = 0;
std::size_t m_Components = 0;
GLenum m_GlType = GL_ZERO;
};
using VertexBufferObject = BufferObject< element::vertex >;
using IndexBufferObject = BufferObject< element::index >;
} // end namespace gl.