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> 60 template<
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" void enableFaceOnCellPrimitives()
Enables face primitives which are drawn on the cells.
void invalidateGeometry()
Invalidates geometry.
void enableTextureSingle()
Enables textures.
void enableHalfedgePrimitives()
Enables per halfedge primitives.
void setScale(double _scale)
Sets the scale used to shrink cells.
bool positionsNeedRebuild()
Checks whether positions need to be rebuild.
void enableCellPrimitives()
Enables cell primitives.
void invalidateColors()
Invalidates colors.
void countNumOfVertices()
Counts the number of vertices that need to be stored in the buffer.
void buildColorBuffer(unsigned char *_buffer)
Adds all colors to the buffer.
void enablePerVertexColors()
Enables per vertex colors.
void setSelectionOnly(bool _selectionOnly)
Set whether only selected primitves should be added to the buffer.
void saveOptions()
State that the current buffer was built with the current options.
void buildPickColorBuffer(ACG::GLState &_state, unsigned int _offset, unsigned char *_buffer)
Adds all picking colors to the buffer.
Class to define the vertex input layout.
void buildTexCoordBuffer(unsigned char *_buffer)
Adds texture coordinates to the buffer.
void enableVertexOnCellPrimitives()
Enables vertex primitives that are drawn on the cells.
This class provides easy access to DrawModes supported by OpenVolumeMesh.
void clearCutPlanes()
Removes all cut planes.
void enableHalffacePrimitives()
Enables halfface primitves.
unsigned char getNormalOffset()
Returns the normal's offset within the buffer.
void enablePerHalfedgeColors()
Enables per halfedge colors.
void addNormalToBuffer(ACG::Vec3d _normal, unsigned char *_buffer, unsigned int _offset)
Adds a normal to the buffer.
void addColorToBuffer(ACG::Vec4uc _color, unsigned char *_buffer, unsigned int _offset)
Adds a color to the buffer.
void addFloatToBuffer(float _value, unsigned char *&_buffer)
Adds a float to the buffer.
void addUCharToBuffer(unsigned char _value, unsigned char *&_buffer)
Adds an unsigned char to the buffer.
void disablePrimitives()
Disables primitives (nothing will be drawn)
unsigned char getTexCoordOffset()
Returns the texcoord's offset within the buffer.
void setOptionsFromDrawMode(ACG::SceneGraph::DrawModes::DrawMode _drawMode)
Configures the buffer manager's options from a DrawMode.
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.
void calculateVertexDeclaration()
Constructs a VertexDeclaration, the size and the offsets for the vertices stored in the buffer...
GLuint getPickBuffer(ACG::GLState &_state, unsigned int _offset)
Returns the name of the pick buffer.
void disableNormals()
Disables normals.
const ACG::VertexDeclaration * getVertexDeclaration()
Returns a VertexDeclaration for the vertices stored in the buffer.
void disableColors()
Disables colors.
void invalidateNormals()
Invalidates normals.
void calculateCellInsideness()
Calculates for all cells whether they are inside w.r.t. all cut planes.
bool selectionOnly()
Checks whether only selected primitives should be added to the buffer.
void setBoundaryOnly(bool _boundaryOnly)
Sets whether only the boundary primitves should be rendered.
void invalidateTexCoords()
Invalidates texture coordinates.
unsigned char getStride()
Returns the vertex stride.
void enablePerCellColors()
Enables per cell colors.
void enablePickColors()
Enables picking colors.
void enablePerHalffaceNormals()
Enables per halfface normals.
void invalidate()
Invalidates the buffer.
void addTexCoordToBuffer(ACG::Vec2f _texCoord, unsigned char *_buffer, unsigned int _offset)
Adds a texture coordnate to the buffer.
void setDefaultColor(ACG::Vec4f _defaultColor)
Sets the default color.
void buildVertexBuffer(unsigned char *_buffer)
Adds all vertices to the buffer.
unsigned char getColorOffset()
Returns the color's offset within the buffer.
ACG::Vec4f getValenceColorCode(unsigned int _valence, bool _inner) const
Returns a color code for irregular edges.
void enableEdgeOnCellPrimitives()
Enables edge primitives which are drawn on the cells.
void enableIrregularEdgePrimitives()
Enables edge primitives for irregular edges.
unsigned int getNumOfVertices()
Returns the number of vertices stored in the buffer.
void free()
Deletes the buffers on the GPU.
This class creates buffers that can be used to render open volume meshs.
bool normalsNeedRebuild()
Checks whether normals need to be rebuild.
void enableFacePrimitives()
Enables face primitives.
void disableTextures()
Disables textures.
void enablePerVertexNormals()
Enables per vertex normals.
double getScale() const
Return the scale used to shrink cells.
void addPositionToBuffer(ACG::Vec3d _position, unsigned char *_buffer, unsigned int _offset)
Adds a position to the buffer.
bool is_inside(const ACG::Vec3d &_p)
Tests whether the given point is inside w.r.t. all cut planes.
bool colorsNeedRebuild()
Checks whether colors need to be rebuild.
void enablePerEdgeColors()
Enables per edge colors.
bool optionsChanged()
Tests whether the options were changed since the last time building the buffer.
void calculateCOGs()
Calculates the center of gravity for all cells.
bool texCoordsNeedRebuild()
Checks whether texture coordinates need to be rebuild.
void enablePerFaceColors()
Enables per face colors.
void enablePerHalffaceColors()
Enables per halfface colors.
ACG::Vec3d getCOG(OpenVolumeMesh::CellHandle _ch)
Returns the center of gravity of the given cell.
void buildNormalBuffer(unsigned char *_buffer)
Adds all normals to the buffer.
void enableVertexPrimitives()
Enables vertex primitives.
void enablePerFaceNormals()
Enables per face normals.
void addCutPlane(const ACG::Geometry::Plane &_p)
Adds a cut plane.
void enableHalffaceOnCellPrimitives()
Enables halfface primitives which are drawn on the cells.
void enableEdgePrimitives()
Enables edge primitves.
GLuint getBuffer()
Returns the name of the buffer.