56 #define VOLUMEMESHOBJECTT_CC 60 #include "VolumeMeshObject.hh" 63 #include <ACG/Scenegraph/DrawModes.hh> 67 #include "VolumeMeshDrawModesContainer.hh" 76 statusAttrib_(*mesh_),
78 normalAttrib_(*mesh_),
79 texcoordAttrib_(*mesh_),
106 template<
class MeshT>
125 template<
class MeshT>
140 template<
class MeshT>
144 if(OpenFlipper::Options::nogui())
156 std::cerr <<
"Error when creating volume mesh object! Manipulator node is NULL!" << std::endl;
159 std::cerr <<
"Error when creating mesh object! Material node is NULL!" << std::endl;
163 QString shaderDir = OpenFlipper::Options::shaderDirStr() + OpenFlipper::Options::dirSeparator();
165 std::string shaderDirectory = std::string( shaderDir.toUtf8() );
166 shaderNode_->setShaderDir( shaderDirectory );
168 if ( QFile( shaderDir +
"Phong/Vertex.glsl").exists() && QFile( shaderDir +
"Phong/Fragment.glsl" ).exists() )
170 shaderNode_->setShader(drawModes.cellsPhongShaded,
"Phong/Vertex.glsl" ,
"Phong/Fragment.glsl" );
171 shaderNode_->setShader(drawModes.facesPhongShaded,
"Phong/Vertex.glsl" ,
"Phong/Fragment.glsl" );
172 shaderNode_->setShader(drawModes.halffacesPhongShaded,
"Phong/Vertex.glsl" ,
"Phong/Fragment.glsl" );
175 std::cerr <<
"Shader Files for Phong not found!" << std::endl;
189 template<
class MeshT>
194 if(OpenFlipper::Options::nogui())
197 std::string meshnodename = std::string(
"VolumeMeshNode for mesh " + _name.toUtf8());
200 std::string shadernodename = std::string(
"ShaderNode for mesh " + _name.toUtf8());
203 std::string texturenodename = std::string(
"TextureNode for mesh " + _name.toUtf8());
214 template<
class MeshT>
223 template<
class MeshT>
227 if(OpenFlipper::Options::nogui())
254 template<
class MeshT>
263 template<
class MeshT>
274 template<
class MeshT>
282 template<
class MeshT>
291 template<
class MeshT>
298 template<
class MeshT>
304 template<
class MeshT>
310 template<
class MeshT>
322 template<
class MeshT>
329 template<
class MeshT>
332 _bbMin =
ACG::Vec3d(FLT_MAX, FLT_MAX, FLT_MAX);
333 _bbMax =
ACG::Vec3d(-FLT_MAX, -FLT_MAX, -FLT_MAX);
336 std::cerr <<
"Error: Bounding box computation via Scenegraph not available without gui." << std::endl;
349 template<
class MeshT>
353 output +=
"========================================================================\n";
357 output +=
"Object Contains Polyhedral Mesh : ";
360 output +=
"Object Contains Hexahedral Mesh : ";
362 output += QString::number(
mesh()->n_vertices()) +
" vertices\n";
363 output += QString::number(
mesh()->n_edges()) +=
" edges\n";
364 output += QString::number(
mesh()->n_halfedges()) +=
" half-edges\n";
365 output += QString::number(
mesh()->n_faces()) +=
" faces\n";
366 output += QString::number(
mesh()->n_halffaces()) +=
" half-faces\n";
367 output += QString::number(
mesh()->n_cells()) +=
" cells\n";
369 output +=
"========================================================================\n";
383 template<
class MeshT>
388 template<
class MeshT>
390 if(OpenFlipper::Options::nogui())
397 template<
class MeshT>
404 template<
class MeshT>
void setMainGLContext()
Set current GL Context to main context.
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
void update_face_normals()
Compute face normals.
void updateSelection()
Call this function to update the selection.
This class provides easy access to DrawModes supported by OpenVolumeMesh.
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
update bounding box
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
void setDataType(DataType _type)
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode()
Get the Scenegraph Mesh Node.
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(1)<< 11)
Textures have changed.
ColorAttrib colorAttrib_
return a pointer to the mesh
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
void boundingBox(ACG::Vec3d &_bbMin, typename ACG::Vec3d &_bbMax)
Get the BoundingBox of this object.
void updateTopology()
Update Topology of all data structures.
void enablePicking(bool _enable)
Enable or disable picking for this Node.
ACG::SceneGraph::ShaderNode ShaderNode
Simple Name for ShaderNode.
BoundingBoxNode * boundingBoxNode()
get a pointer to the bounding box node
MeshT * mesh()
return a pointer to the mesh
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
QtTranslationManipulatorNode * manipulatorNode()
virtual void update(UpdateType _type=UPDATE_ALL)
Update the whole Object (Selection,Topology,...)
MaterialNode * materialNode()
get a pointer to the materialnode
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
virtual ~VolumeMeshObject()
destructor
virtual void init()
Initialise current object, including all related nodes.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
NormalAttrib normalAttrib_
return a pointer to the mesh
void enablePicking(bool _enable)
bool contains(const UpdateType &_type) const
Check if this update contains the given UpdateType.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
void updateGeometry()
Update Geometry of all data structures.
VolumeMeshObject(const VolumeMeshObject &_object)
copy constructor
void deleteData()
Delete all data attached to this object ( calls delete on each object )
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
ACG::SceneGraph::TextureNode * textureNode()
Return pointer to the texture node.
bool pickingEnabled()
Check if picking is enabled for this Node.
std::string name() const
Returns: name of node (needs not be unique)
Namespace providing different geometric functions concerning angles.
virtual void cleanup()
Reset current object, including all related nodes.
QString getObjectinfo()
Get all Info for the Object as a string.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
ACG::SceneGraph::ShaderNode * shaderNode()
Return pointer to the shader node.
BaseNode * primaryNode()
Scenegraph Mesh Node.
virtual QString getObjectinfo()
Get all Info for the Object as a string.
ptr::shared_ptr< MeshT > mesh_
return a pointer to the mesh
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void updateColor()
Update Colors of all data structures.
VectorT< double, 3 > Vec3d
bool picked(unsigned int _node_idx)
detect if the node has been picked
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
DataType dataType() const
StatusAttrib statusAttrib_
return a pointer to the mesh
void setName(QString _name)
Set the name of the Object.
void updateTexture()
Update Texture of all data structures.
void set_point_size(float _sz)
set point size (default: 1.0)