Commit 25aa4159 authored by Jan Möbius's avatar Jan Möbius
Browse files

Implement picking buffer security checks

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11722 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 472e45b0
......@@ -1302,7 +1302,7 @@ setTextureIndexPropertyName( std::string _indexPropertyName ) {
// Check if the given property exists
OpenMesh::FPropHandleT< int > textureIndexProperty;
if ( !mesh_.get_property_handle(textureIndexProperty,_indexPropertyName) ) {
std::cerr << "StripProcessor: Unable to get per face texture Index property named " << _indexPropertyName << std::endl;
std::cerr << "DrawMeshT: Unable to get per face texture Index property named " << _indexPropertyName << std::endl;
return;
}
......@@ -1325,7 +1325,7 @@ setPerFaceTextureCoordinatePropertyName( std::string _perFaceTextureCoordinatePr
// Check if the given property exists
OpenMesh::HPropHandleT< typename Mesh::TexCoord2D > perFaceTextureCoordinateProperty;
if ( !mesh_.get_property_handle(perFaceTextureCoordinateProperty,_perFaceTextureCoordinatePropertyName) ) {
std::cerr << "StripProcessor: Unable to get per face texture coordinate property named " << _perFaceTextureCoordinatePropertyName << std::endl;
std::cerr << "DrawMeshT: Unable to get per face texture coordinate property named " << _perFaceTextureCoordinatePropertyName << std::endl;
return;
}
......
......@@ -381,7 +381,14 @@ public:
*
* @return pointer to the first element of the picking buffer
*/
ACG::Vec4uc * pickVertexColorBuffer(){ return &(pickVertBuf_)[0]; };
ACG::Vec4uc * pickVertexColorBuffer(){
if ( pickVertBuf_.size() >0 )
return &(pickVertBuf_)[0];
else {
std::cerr << "Illegal request to pickVertexColorBuffer when buffer is empty!" << std::endl;
return 0;
}
};
private:
......@@ -411,9 +418,14 @@ public:
*
* @return pointer to the first element of the picking buffer
*/
ACG::Vec4uc * pickEdgeColorBuffer(){ return &(pickEdgeBuf_)[0]; };
ACG::Vec4uc * pickEdgeColorBuffer(){
if ( pickEdgeBuf_.size() >0 )
return &(pickEdgeBuf_)[0];
else {
std::cerr << "Illegal request to pickEdgeColorBuffer when buffer is empty!" << std::endl;
return 0;
}
}
private:
......@@ -437,7 +449,14 @@ public:
*
* @return pointer to the per face picking color buffer
*/
ACG::Vec4uc * pickFaceColorBuffer(){ return &(pickFaceColBuf_)[0]; };
ACG::Vec4uc * pickFaceColorBuffer(){
if ( pickFaceColBuf_.size() >0 )
return &(pickFaceColBuf_)[0];
else {
std::cerr << "Illegal request to pickFaceColorBuffer when buffer is empty!" << std::endl;
return 0;
}
}
/** \brief get a pointer to the per vertex picking color buffer
*
......@@ -447,7 +466,14 @@ public:
*
* @return pointer to the first element of the picking buffer
*/
ACG::Vec3f * pickFaceVertexBuffer(){ return &(pickFaceVertexBuf_)[0]; };
ACG::Vec3f * pickFaceVertexBuffer(){
if ( pickFaceVertexBuf_.size() >0 )
return &(pickFaceVertexBuf_)[0];
else {
std::cerr << "Illegal request to pickFaceVertexBuffer when buffer is empty!" << std::endl;
return 0;
}
}
private:
......@@ -473,7 +499,14 @@ public:
*
* @return Pointer to the first element of the picking buffer
*/
ACG::Vec4uc * pickAnyColorBuffer(){ return &(pickAnyBuf_)[0]; };
ACG::Vec4uc * pickAnyColorBuffer(){
if ( pickAnyBuf_.size() >0 )
return &(pickAnyBuf_)[0];
else {
std::cerr << "Illegal request to pickAnyColorBuffer when buffer is empty!" << std::endl;
return 0;
}
}
private:
......
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