44#include <ACG/GL/GLState.hh>
45#include <ACG/Scenegraph/DrawModes.hh>
46#include <ACG/Scenegraph/BaseNode.hh>
47#include <ACG/GL/VertexDeclaration.hh>
49#include "VolumeMeshDrawModesContainer.hh"
51#include <OpenVolumeMesh/Attribs/StatusAttrib.hh>
52#include <OpenVolumeMesh/Attribs/NormalAttrib.hh>
53#include <OpenVolumeMesh/Attribs/ColorAttrib.hh>
54#include <OpenVolumeMesh/Attribs/TexCoordAttrib.hh>
55#include <ACG/Geometry/Types/PlaneType.hh>
60template<
class VolumeMesh>
71 typedef typename VolumeMesh::PointT Vertex;
87 PM_HALFFACES_ON_CELLS,
302 bool is_inside(
const HalfEdgeHandle& _heh);
308 bool is_inside(
const HalfFaceHandle& _hfh);
319 bool should_render(
const VertexHandle& _vh);
320 bool should_render(
const HalfEdgeHandle& _heh);
321 bool should_render(
const EdgeHandle& _eh);
322 bool should_render(
const HalfFaceHandle& _hfh);
323 bool should_render(
const FaceHandle& _fh);
324 bool should_render(
const CellHandle& _ch);
414 const VolumeMesh& mMesh;
421 int mCurrentNumOfVertices;
423 unsigned int mVertexSize;
434 unsigned int mCurrentPickOffset;
437 unsigned int mGlobalPickOffset;
440 bool mGeometryChanged;
441 bool mNormalsChanged;
443 bool mTexCoordsChanged;
449 PrimitiveMode mPrimitiveMode;
450 NormalMode mNormalMode;
451 ColorMode mColorMode;
453 bool mSkipUnselected;
454 bool mShowIrregularInnerEdges;
455 bool mShowIrregularOuterValence2Edges;
456 bool mSkipRegularEdges;
459 PrimitiveMode mCurrentPrimitiveMode;
460 NormalMode mCurrentNormalMode;
461 ColorMode mCurrentColorMode;
463 bool mCurrentSkipUnselected;
464 bool mCurrentShowIrregularInnerEdges;
465 bool mCurrentShowIrregularOuterValence2Edges;
466 bool mCurrentSkipRegularEdges;
467 bool mCurrentBoundaryOnly;
469 unsigned char mCurrentVertexSize;
470 unsigned char mCurrentNormalOffset;
471 unsigned char mCurrentColorOffset;
473 std::vector<ACG::Geometry::Plane> cut_planes_;
475 std::vector<ACG::Vec3d> mCogs;
477 std::vector<bool> mCellInsideness;
478 bool mCellInsidenessValid;
480 TexCoordMode mTexCoordMode;
481 TexCoordMode mCurrentTexCoordMode;
482 unsigned char mTexCoordOffset;
483 unsigned char mCurrentTexCoordOffset;
488#if defined(INCLUDE_TEMPLATES) && !defined(VOLUMEMESHBUFFERMANAGERT_CC)
489#include "VolumeMeshBufferManagerT_impl.hh"
Class to define the vertex input layout.
This class creates buffers that can be used to render open volume meshs.
void buildNormalBuffer(unsigned char *_buffer)
Adds all normals to the buffer.
double getScale() const
Return the scale used to shrink cells.
void enableCellPrimitives()
Enables cell primitives.
void setSelectionOnly(bool _selectionOnly)
Set whether only selected primitves should be added to the buffer.
void free()
Deletes the buffers on the GPU.
bool texCoordsNeedRebuild()
Checks whether texture coordinates need to be rebuild.
void saveOptions()
State that the current buffer was built with the current options.
void setDefaultColor(ACG::Vec4f _defaultColor)
Sets the default color.
unsigned char getNormalOffset()
Returns the normal's offset within the buffer.
void enableVertexOnCellPrimitives()
Enables vertex primitives that are drawn on the cells.
void calculateCellInsideness()
Calculates for all cells whether they are inside w.r.t. all cut planes.
bool optionsChanged()
Tests whether the options were changed since the last time building the buffer.
void enablePickColors()
Enables picking colors.
bool positionsNeedRebuild()
Checks whether positions need to be rebuild.
void enablePerHalffaceColors()
Enables per halfface colors.
void enablePerCellColors()
Enables per cell colors.
void enablePerFaceColors()
Enables per face colors.
void addPositionToBuffer(ACG::Vec3d _position, unsigned char *_buffer, unsigned int _offset)
Adds a position to the buffer.
bool normalsNeedRebuild()
Checks whether normals need to be rebuild.
void calculateVertexDeclaration()
Constructs a VertexDeclaration, the size and the offsets for the vertices stored in the buffer.
int getNumOfIncidentCells(OpenVolumeMesh::FaceHandle _fh)
Returns the number of cells that are incident to the given face and also inside w....
void buildPickColorBuffer(ACG::GLState &_state, unsigned int _offset, unsigned char *_buffer)
Adds all picking colors to the buffer.
ACG::Vec3d getCOG(OpenVolumeMesh::CellHandle _ch)
Returns the center of gravity of the given cell.
unsigned int getNumOfVertices()
Returns the number of vertices stored in the buffer.
void enableHalffacePrimitives()
Enables halfface primitves.
void addCutPlane(const ACG::Geometry::Plane &_p)
Adds a cut plane.
void disableColors()
Disables colors.
void setBoundaryOnly(bool _boundaryOnly)
Sets whether only the boundary primitves should be rendered.
void enablePerHalfedgeColors()
Enables per halfedge colors.
void clearCutPlanes()
Removes all cut planes.
void enableTextureSingle()
Enables textures.
void invalidateColors()
Invalidates colors.
GLuint getBuffer()
Returns the name of the buffer.
void enableEdgeOnCellPrimitives()
Enables edge primitives which are drawn on the cells.
void buildTexCoordBuffer(unsigned char *_buffer)
Adds texture coordinates to the buffer.
bool colorsNeedRebuild()
Checks whether colors need to be rebuild.
void addNormalToBuffer(ACG::Vec3d _normal, unsigned char *_buffer, unsigned int _offset)
Adds a normal to the buffer.
void invalidateNormals()
Invalidates normals.
void enableHalfedgePrimitives()
Enables per halfedge primitives.
void disableNormals()
Disables normals.
void enablePerVertexNormals()
Enables per vertex normals.
void enableFacePrimitives()
Enables face primitives.
void invalidate()
Invalidates the buffer.
void disablePrimitives()
Disables primitives (nothing will be drawn)
void invalidateTexCoords()
Invalidates texture coordinates.
void addFloatToBuffer(float _value, unsigned char *&_buffer)
Adds a float to the buffer.
bool selectionOnly()
Checks whether only selected primitives should be added to the buffer.
void enableHalffaceOnCellPrimitives()
Enables halfface primitives which are drawn on the cells.
unsigned char getTexCoordOffset()
Returns the texcoord's offset within the buffer.
void addColorToBuffer(ACG::Vec4uc _color, unsigned char *_buffer, unsigned int _offset)
Adds a color to the buffer.
const ACG::VertexDeclaration * getVertexDeclaration()
Returns a VertexDeclaration for the vertices stored in the buffer.
void calculateCOGs()
Calculates the center of gravity for all cells.
void enableIrregularEdgePrimitives()
Enables edge primitives for irregular edges.
void enableVertexPrimitives()
Enables vertex primitives.
void countNumOfVertices()
Counts the number of vertices that need to be stored in the buffer.
void enablePerHalffaceNormals()
Enables per halfface normals.
void disableTextures()
Disables textures.
unsigned char getStride()
Returns the vertex stride.
void enableFaceOnCellPrimitives()
Enables face primitives which are drawn on the cells.
void setScale(double _scale)
Sets the scale used to shrink cells.
void buildColorBuffer(unsigned char *_buffer)
Adds all colors to the buffer.
unsigned char getColorOffset()
Returns the color's offset within the buffer.
void addTexCoordToBuffer(ACG::Vec2f _texCoord, unsigned char *_buffer, unsigned int _offset)
Adds a texture coordnate to the buffer.
void enableEdgePrimitives()
Enables edge primitves.
void setOptionsFromDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Configures the buffer manager's options from a DrawMode.
GLuint getPickBuffer(ACG::GLState &_state, unsigned int _offset)
Returns the name of the pick buffer.
bool is_inside(const ACG::Vec3d &_p)
Tests whether the given point is inside w.r.t. all cut planes.
void invalidateGeometry()
Invalidates geometry.
void enablePerVertexColors()
Enables per vertex colors.
void enablePerFaceNormals()
Enables per face normals.
ACG::Vec4f getValenceColorCode(unsigned int _valence, bool _inner) const
Returns a color code for irregular edges.
void buildVertexBuffer(unsigned char *_buffer)
Adds all vertices to the buffer.
void addUCharToBuffer(unsigned char _value, unsigned char *&_buffer)
Adds an unsigned char to the buffer.
void enablePerEdgeColors()
Enables per edge colors.
This class provides easy access to DrawModes supported by OpenVolumeMesh.