49 #define VOLUMEMESHOBJECTT_CC 53 #include "VolumeMeshObject.hh" 56 #include <ACG/Scenegraph/DrawModes.hh> 60 #include "VolumeMeshDrawModesContainer.hh" 62 #include <ACG/Scenegraph/BoundingBoxNode.hh> 71 statusAttrib_(*mesh_),
73 normalAttrib_(*mesh_),
74 texcoordAttrib_(*mesh_),
101 template<
class MeshT>
120 template<
class MeshT>
135 template<
class MeshT>
139 if(OpenFlipper::Options::nogui())
151 std::cerr <<
"Error when creating volume mesh object! Manipulator node is NULL!" << std::endl;
154 std::cerr <<
"Error when creating mesh object! Material node is NULL!" << std::endl;
158 QString shaderDir = OpenFlipper::Options::shaderDirStr() + OpenFlipper::Options::dirSeparator();
160 std::string shaderDirectory = std::string( shaderDir.toUtf8() );
161 shaderNode_->setShaderDir( shaderDirectory );
163 if(!OpenFlipper::Options::coreProfile())
165 if ( QFile( shaderDir +
"Phong/Vertex.glsl").exists() && QFile( shaderDir +
"Phong/Fragment.glsl" ).exists() )
167 shaderNode_->setShader(drawModes.cellsPhongShaded,
"Phong/Vertex.glsl" ,
"Phong/Fragment.glsl" );
168 shaderNode_->setShader(drawModes.facesPhongShaded,
"Phong/Vertex.glsl" ,
"Phong/Fragment.glsl" );
169 shaderNode_->setShader(drawModes.halffacesPhongShaded,
"Phong/Vertex.glsl" ,
"Phong/Fragment.glsl" );
172 std::cerr <<
"Shader Files for Phong not found!" << std::endl;
186 template<
class MeshT>
191 if(OpenFlipper::Options::nogui())
194 std::string meshnodename = std::string(
"VolumeMeshNode for mesh " + _name.toUtf8());
197 std::string shadernodename = std::string(
"ShaderNode for mesh " + _name.toUtf8());
200 std::string texturenodename = std::string(
"TextureNode for mesh " + _name.toUtf8());
211 template<
class MeshT>
216 template<
class MeshT>
225 template<
class MeshT>
229 if(OpenFlipper::Options::nogui())
256 template<
class MeshT>
265 template<
class MeshT>
276 template<
class MeshT>
284 template<
class MeshT>
293 template<
class MeshT>
300 template<
class MeshT>
306 template<
class MeshT>
312 template<
class MeshT>
324 template<
class MeshT>
331 template<
class MeshT>
334 _bbMin =
ACG::Vec3d(FLT_MAX, FLT_MAX, FLT_MAX);
335 _bbMax =
ACG::Vec3d(-FLT_MAX, -FLT_MAX, -FLT_MAX);
338 std::cerr <<
"Error: Bounding box computation via Scenegraph not available without gui." << std::endl;
351 template<
class MeshT>
355 output +=
"========================================================================\n";
359 output +=
"Object Contains Polyhedral Mesh : ";
362 output +=
"Object Contains Hexahedral Mesh : ";
364 output += QString::number(
mesh()->n_vertices()) +
" vertices\n";
365 output += QString::number(
mesh()->n_edges()) +=
" edges\n";
366 output += QString::number(
mesh()->n_halfedges()) +=
" half-edges\n";
367 output += QString::number(
mesh()->n_faces()) +=
" faces\n";
368 output += QString::number(
mesh()->n_halffaces()) +=
" half-faces\n";
369 output += QString::number(
mesh()->n_cells()) +=
" cells\n";
371 output +=
"========================================================================\n";
385 template<
class MeshT>
390 template<
class MeshT>
392 if(OpenFlipper::Options::nogui())
399 template<
class MeshT>
406 template<
class MeshT>
ACG::SceneGraph::ShaderNode ShaderNode
Simple Name for ShaderNode.
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode()
Get the Scenegraph Mesh Node.
Namespace providing different geometric functions concerning angles.
void enablePicking(bool _enable)
Enable or disable picking for this Node.
virtual QString getObjectinfo()
Get all Info for the Object as a string.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
ACG::SceneGraph::TextureNode * textureNode()
Return pointer to the texture node.
bool pickingEnabled()
Check if picking is enabled for this Node.
void enablePicking(bool _enable)
virtual void update(UpdateType _type=UPDATE_ALL)
Update the whole Object (Selection,Topology,...)
MaterialNode * materialNode()
get a pointer to the materialnode
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
void setDataType(DataType _type)
std::string name() const
Returns: name of node (needs not be unique)
void deleteData()
Delete all data attached to this object ( calls delete on each object )
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(1)<< 11)
Textures have changed.
NormalAttrib normalAttrib_
return a pointer to the mesh
QString getObjectinfo()
Get all Info for the Object as a string.
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
void update_face_normals()
Compute face normals.
StatusAttrib statusAttrib_
return a pointer to the mesh
void updateGeometry()
Update Geometry of all data structures.
BaseNode * primaryNode()
Scenegraph Mesh Node.
void setName(QString _name)
Set the name of the Object.
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
QString name() const
return the name of the object. The name defaults to NONAME if unset.
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax)
update bounding box
void updateColor()
Update Colors of all data structures.
ColorAttrib colorAttrib_
return a pointer to the mesh
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
VectorT< double, 3 > Vec3d
bool picked(unsigned int _node_idx)
detect if the node has been picked
bool contains(const UpdateType &_type) const
Check if this update contains the given UpdateType.
void setMainGLContext()
Set current GL Context to main context.
void boundingBox(ACG::Vec3d &_bbMin, typename ACG::Vec3d &_bbMax)
Get the BoundingBox of this object.
void updateTexture()
Update Texture of all data structures.
virtual void init()
Initialise current object, including all related nodes.
BoundingBoxNode * boundingBoxNode()
get a pointer to the bounding box node
VolumeMeshObject(const VolumeMeshObject &_object)
copy constructor
ptr::shared_ptr< MeshT > mesh_
return a pointer to the mesh
void set_point_size(float _sz)
set point size (default: 1.0)
void updateSelection()
Call this function to update the selection.
virtual ~VolumeMeshObject()
destructor
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
This class provides easy access to DrawModes supported by OpenVolumeMesh.
virtual void cleanup()
Reset current object, including all related nodes.
ACG::SceneGraph::ShaderNode * shaderNode()
Return pointer to the shader node.
void updateTopology()
Update Topology of all data structures.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
MeshT * mesh()
return a pointer to the mesh
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
DataType dataType() const
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
QtTranslationManipulatorNode * manipulatorNode()