Commit 3bbab465 authored by Jan Möbius's avatar Jan Möbius
Browse files

Convert some functions to size_t

parent 0968ddc4
Pipeline #3242 canceled with stage
in 25 minutes and 21 seconds
......@@ -105,8 +105,8 @@ class ACGDLLEXPORT DrawMeshBase {
void fillInvVertexMap(size_t n_vertices, void *data);
public:
unsigned int getNumTris() const { return numTris_; }
unsigned int getNumVerts() const { return numVerts_; }
size_t getNumTris() const { return numTris_; }
size_t getNumVerts() const { return numVerts_; }
/** \brief get mesh compiler used to create the draw mesh
*/
......@@ -929,19 +929,19 @@ private:
//========================================================================
// write functions for flexible vertex format
void writeVertexElement(void* _dstBuf, unsigned int _vertex, unsigned int _stride, unsigned int _elementOffset, unsigned int _elementSize, const void* _elementData);
void writeVertexElement(void* _dstBuf, size_t _vertex, size_t _stride, size_t _elementOffset, size_t _elementSize, const void* _elementData);
void writePosition(unsigned int _vertex, const ACG::Vec3d& _p);
void writePosition(size_t _vertex, const ACG::Vec3d& _p);
void writeNormal(unsigned int _vertex, const ACG::Vec3d& _n);
void writeNormal(size_t _vertex, const ACG::Vec3d& _n);
void writeTexcoord(unsigned int _vertex, const ACG::Vec2f& _uv);
void writeTexcoord(size_t _vertex, const ACG::Vec2f& _uv);
void writeColor(unsigned int _vertex, unsigned int _color);
void writeColor(size_t _vertex, unsigned int _color);
void writeVertexProperty(unsigned int _vertex, const VertexElement* _elementDesc, const ACG::Vec4f& _propf);
void writeVertexProperty(size_t _vertex, const VertexElement* _elementDesc, const ACG::Vec4f& _propf);
void writeVertexProperty(unsigned int _vertex, const VertexElement* _elementDesc, const ACG::Vec4d& _propd);
void writeVertexProperty(size_t _vertex, const VertexElement* _elementDesc, const ACG::Vec4d& _propd);
/** \brief Read one vertex from the rendering vbo.
......
......@@ -2477,10 +2477,10 @@ typename Mesh::HalfedgeHandle ACG::DrawMeshT<Mesh>::mapToHalfedgeHandle(int _ver
template <class Mesh>
void ACG::DrawMeshT<Mesh>::writeVertexElement( void* _dstBuf, unsigned int _vertex, unsigned int _stride, unsigned int _elementOffset, unsigned int _elementSize, const void* _elementData )
void ACG::DrawMeshT<Mesh>::writeVertexElement( void* _dstBuf, size_t _vertex, size_t _stride, size_t _elementOffset, size_t _elementSize, const void* _elementData )
{
// byte offset
unsigned int offset = _vertex * _stride + _elementOffset;
size_t offset = _vertex * _stride + _elementOffset;
// write address
char* dst = static_cast<char*>(_dstBuf) + offset;
......@@ -2490,7 +2490,7 @@ void ACG::DrawMeshT<Mesh>::writeVertexElement( void* _dstBuf, unsigned int _vert
}
template <class Mesh>
void ACG::DrawMeshT<Mesh>::writePosition( unsigned int _vertex, const ACG::Vec3d& _n )
void ACG::DrawMeshT<Mesh>::writePosition( size_t _vertex, const ACG::Vec3d& _n )
{
// store float3 position
float f3[3] = {float(_n[0]), float(_n[1]), float(_n[2])};
......@@ -2499,7 +2499,7 @@ void ACG::DrawMeshT<Mesh>::writePosition( unsigned int _vertex, const ACG::Vec3d
}
template <class Mesh>
void ACG::DrawMeshT<Mesh>::writeNormal( unsigned int _vertex, const ACG::Vec3d& _n )
void ACG::DrawMeshT<Mesh>::writeNormal( size_t _vertex, const ACG::Vec3d& _n )
{
// store float3 normal
float f3[3] = {float(_n[0]), float(_n[1]), float(_n[2])};
......@@ -2509,22 +2509,22 @@ void ACG::DrawMeshT<Mesh>::writeNormal( unsigned int _vertex, const ACG::Vec3d&
template <class Mesh>
void ACG::DrawMeshT<Mesh>::writeTexcoord( unsigned int _vertex, const ACG::Vec2f& _uv )
void ACG::DrawMeshT<Mesh>::writeTexcoord( size_t _vertex, const ACG::Vec2f& _uv )
{
writeVertexElement(&vertices_[0], _vertex, vertexDecl_->getVertexStride(), offsetTexc_, 8, _uv.data());
}
template <class Mesh>
void ACG::DrawMeshT<Mesh>::writeColor( unsigned int _vertex, unsigned int _color )
void ACG::DrawMeshT<Mesh>::writeColor( size_t _vertex, unsigned int _color )
{
writeVertexElement(&vertices_[0], _vertex, vertexDecl_->getVertexStride(), offsetColor_, 4, &_color);
}
template <class Mesh>
void ACG::DrawMeshT<Mesh>::writeVertexProperty( unsigned int _vertex, const VertexElement* _elementDesc, const ACG::Vec4f& _propf )
void ACG::DrawMeshT<Mesh>::writeVertexProperty( size_t _vertex, const VertexElement* _elementDesc, const ACG::Vec4f& _propf )
{
unsigned int elementSize = VertexDeclaration::getElementSize(_elementDesc);
const size_t elementSize = VertexDeclaration::getElementSize(_elementDesc);
writeVertexElement(&vertices_[0], _vertex, vertexDecl_->getVertexStride(), _elementDesc->getByteOffset(), elementSize, _propf.data());
}
......
......@@ -307,9 +307,9 @@ unsigned int VertexDeclaration::getNumElements() const
}
unsigned int VertexDeclaration::getGLTypeSize(unsigned int _type)
size_t VertexDeclaration::getGLTypeSize(unsigned int _type)
{
unsigned int size = 0;
size_t size = 0;
switch (_type)
{
......@@ -341,7 +341,7 @@ unsigned int VertexDeclaration::getGLTypeSize(unsigned int _type)
unsigned int VertexDeclaration::getElementSize(const VertexElement* _pElement)
size_t VertexDeclaration::getElementSize(const VertexElement* _pElement)
{
return _pElement ? getGLTypeSize(_pElement->type_) * _pElement->numElements_ : 0;
}
......
......@@ -339,11 +339,11 @@ public:
/*! get size of GL_FLOAT, GL_INT ...
*/
static unsigned int getGLTypeSize(unsigned int _type);
static size_t getGLTypeSize(unsigned int _type);
/*! get size of one vertex element
*/
static unsigned int getElementSize(const VertexElement* _pElement);
static size_t getElementSize(const VertexElement* _pElement);
/*! Check hw support for streaming instance data from vbo
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment