50 #ifndef VOLUME_MESH_BUFFER_MANAGER_HH 51 #define VOLUME_MESH_BUFFER_MANAGER_HH 53 #include <ACG/GL/GLState.hh> 54 #include <ACG/Scenegraph/DrawModes.hh> 55 #include <ACG/Scenegraph/BaseNode.hh> 56 #include <ACG/GL/VertexDeclaration.hh> 58 #include "VolumeMeshDrawModesContainer.hh" 60 #include <OpenVolumeMesh/Attribs/StatusAttrib.hh> 61 #include <OpenVolumeMesh/Attribs/NormalAttrib.hh> 62 #include <OpenVolumeMesh/Attribs/ColorAttrib.hh> 63 #include <OpenVolumeMesh/Attribs/TexCoordAttrib.hh> 68 template<
class VolumeMesh>
79 typedef typename VolumeMesh::PointT Vertex;
93 PM_HALFFACES_ON_CELLS,
131 position(_p), normal(_n), xdirection(_x), ydirection(_y) {
324 bool is_inside(
const HalfEdgeHandle& _heh);
330 bool is_inside(
const HalfFaceHandle& _hfh);
429 const VolumeMesh& mMesh;
436 int mCurrentNumOfVertices;
438 unsigned int mVertexSize;
449 unsigned int mCurrentPickOffset;
452 unsigned int mGlobalPickOffset;
455 bool mGeometryChanged;
456 bool mNormalsChanged;
458 bool mTexCoordsChanged;
464 PrimitiveMode mPrimitiveMode;
465 NormalMode mNormalMode;
466 ColorMode mColorMode;
468 bool mSkipUnselected;
469 bool mShowIrregularInnerEdges;
470 bool mShowIrregularOuterValence2Edges;
471 bool mSkipRegularEdges;
474 PrimitiveMode mCurrentPrimitiveMode;
475 NormalMode mCurrentNormalMode;
476 ColorMode mCurrentColorMode;
478 bool mCurrentSkipUnselected;
479 bool mCurrentShowIrregularInnerEdges;
480 bool mCurrentShowIrregularOuterValence2Edges;
481 bool mCurrentSkipRegularEdges;
482 bool mCurrentBoundaryOnly;
484 unsigned char mCurrentVertexSize;
485 unsigned char mCurrentNormalOffset;
486 unsigned char mCurrentColorOffset;
488 std::vector<Plane> cut_planes_;
490 std::vector<ACG::Vec3d> mCogs;
492 std::vector<bool> mCellInsideness;
493 bool mCellInsidenessValid;
495 TexCoordMode mTexCoordMode;
496 TexCoordMode mCurrentTexCoordMode;
497 unsigned char mTexCoordOffset;
498 unsigned char mCurrentTexCoordOffset;
503 #if defined(INCLUDE_TEMPLATES) && !defined(VOLUMEMESHBUFFERMANAGERT_CC) 504 #include "VolumeMeshBufferManagerT.cc" 508 #endif // VOLUME_MESH_BUFFER_MANAGER_HH ACG::Vec4f getValenceColorCode(unsigned int _valence, bool _inner) const
Returns a color code for irregular edges.
This class provides easy access to DrawModes supported by OpenVolumeMesh.
double getScale() const
Return the scale used to shrink cells.
void invalidateColors()
Invalidates colors.
bool is_inside(const ACG::Vec3d &_p)
Tests whether the given point is inside w.r.t. all cut planes.
void disableColors()
Disables colors.
unsigned char getStride()
Returns the vertex stride.
void calculateCellInsideness()
Calculates for all cells whether they are inside w.r.t. all cut planes.
bool colorsNeedRebuild()
Checks whether colors need to be rebuild.
void enableVertexOnCellPrimitives()
Enables vertex primitives that are drawn on the cells.
bool normalsNeedRebuild()
Checks whether normals need to be rebuild.
void buildTexCoordBuffer(unsigned char *_buffer)
Adds texture coordinates to the buffer.
void enableEdgeOnCellPrimitives()
Enables edge primitives which are drawn on the cells.
void invalidate()
Invalidates the buffer.
void clearCutPlanes()
Removes all cut planes.
GLuint getBuffer()
Returns the name of the buffer.
void setOptionsFromDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Configures the buffer manager's options from a DrawMode.
void enablePerFaceColors()
Enables per face colors.
void saveOptions()
State that the current buffer was built with the current options.
void buildColorBuffer(unsigned char *_buffer)
Adds all colors to the buffer.
Class to define the vertex input layout.
void enablePerHalfedgeColors()
Enables per halfedge colors.
void invalidateNormals()
Invalidates normals.
void enableFacePrimitives()
Enables face primitives.
void enablePerHalffaceNormals()
Enables per halfface normals.
void addColorToBuffer(ACG::Vec4uc _color, unsigned char *_buffer, unsigned int _offset)
Adds a color to the buffer.
ACG::Vec3d getCOG(OpenVolumeMesh::CellHandle _ch)
Returns the center of gravity of the given cell.
int getNumOfIncidentCells(OpenVolumeMesh::FaceHandle _fh)
Returns the number of cells that are incident to the given face and also inside w.r.t. all cut planes.
unsigned char getColorOffset()
Returns the color's offset within the buffer.
bool positionsNeedRebuild()
Checks whether positions need to be rebuild.
void enableHalffaceOnCellPrimitives()
Enables halfface primitives which are drawn on the cells.
void buildNormalBuffer(unsigned char *_buffer)
Adds all normals to the buffer.
void addUCharToBuffer(unsigned char _value, unsigned char *&_buffer)
Adds an unsigned char to the buffer.
This class creates buffers that can be used to render open volume meshs.
GLuint getPickBuffer(ACG::GLState &_state, unsigned int _offset)
Returns the name of the pick buffer.
void enableFaceOnCellPrimitives()
Enables face primitives which are drawn on the cells.
void enablePerFaceNormals()
Enables per face normals.
void addNormalToBuffer(ACG::Vec3d _normal, unsigned char *_buffer, unsigned int _offset)
Adds a normal to the buffer.
bool selectionOnly()
Checks whether only selected primitives should be added to the buffer.
void free()
Deletes the buffers on the GPU.
unsigned char getTexCoordOffset()
Returns the texcoord's offset within the buffer.
void disableNormals()
Disables normals.
void addTexCoordToBuffer(ACG::Vec2f _texCoord, unsigned char *_buffer, unsigned int _offset)
Adds a texture coordnate to the buffer.
bool texCoordsNeedRebuild()
Checks whether texture coordinates need to be rebuild.
void calculateCOGs()
Calculates the center of gravity for all cells.
void disableTextures()
Disables textures.
unsigned char getNormalOffset()
Returns the normal's offset within the buffer.
void invalidateGeometry()
Invalidates geometry.
void addFloatToBuffer(float _value, unsigned char *&_buffer)
Adds a float to the buffer.
void enablePerCellColors()
Enables per cell colors.
void calculateVertexDeclaration()
Constructs a VertexDeclaration, the size and the offsets for the vertices stored in the buffer...
void countNumOfVertices()
Counts the number of vertices that need to be stored in the buffer.
void enablePickColors()
Enables picking colors.
void setScale(double _scale)
Sets the scale used to shrink cells.
void setSelectionOnly(bool _selectionOnly)
Set whether only selected primitves should be added to the buffer.
void setDefaultColor(ACG::Vec4f _defaultColor)
Sets the default color.
void enablePerEdgeColors()
Enables per edge colors.
void enableEdgePrimitives()
Enables edge primitves.
void enableHalfedgePrimitives()
Enables per halfedge primitives.
void buildPickColorBuffer(ACG::GLState &_state, unsigned int _offset, unsigned char *_buffer)
Adds all picking colors to the buffer.
void enablePerVertexNormals()
Enables per vertex normals.
void invalidateTexCoords()
Invalidates texture coordinates.
void addCutPlane(const typename VolumeMeshBufferManager< VolumeMesh >::Plane &_p)
Adds a cut plane.
void buildVertexBuffer(unsigned char *_buffer)
Adds all vertices to the buffer.
void addPositionToBuffer(ACG::Vec3d _position, unsigned char *_buffer, unsigned int _offset)
Adds a position to the buffer.
void enablePerHalffaceColors()
Enables per halfface colors.
const ACG::VertexDeclaration * getVertexDeclaration()
Returns a VertexDeclaration for the vertices stored in the buffer.
void setBoundaryOnly(bool _boundaryOnly)
Sets whether only the boundary primitves should be rendered.
void enableHalffacePrimitives()
Enables halfface primitves.
void enableVertexPrimitives()
Enables vertex primitives.
void disablePrimitives()
Disables primitives (nothing will be drawn)
unsigned int getNumOfVertices()
Returns the number of vertices stored in the buffer.
bool optionsChanged()
Tests whether the options were changed since the last time building the buffer.
void enableCellPrimitives()
Enables cell primitives.
void enableIrregularEdgePrimitives()
Enables edge primitives for irregular edges.
void enablePerVertexColors()
Enables per vertex colors.
void enableTextureSingle()
Enables textures.