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>
virtual QString getObjectinfo()
Get all Info for the Object as a string.
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(8))
Topology updated.
void deleteData()
Delete all data attached to this object ( calls delete on each object )
bool pickingEnabled()
Check if picking is enabled for this Node.
VolumeMeshObject(const VolumeMeshObject &_object)
copy constructor
virtual void cleanup()
Reset current object, including all related nodes.
virtual void setName(QString _name) override
path to the file from which the object is loaded ( defaults to "." )
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void enablePicking(bool _enable)
Enable or disable picking for this Node.
void updateTopology()
Update Topology of all data structures.
std::string name() const
Returns: name of node (needs not be unique)
Namespace providing different geometric functions concerning angles.
ACG::SceneGraph::TextureNode * textureNode_
Scenegraph Texture Node.
void updateGeometry()
Update Geometry of all data structures.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(16))
Selection updated.
ACG::SceneGraph::TextureNode * textureNode()
Return pointer to the texture node.
QString getObjectinfo()
Get all Info for the Object as a string.
void enablePicking(bool _enable)
TexCoordAttrib texcoordAttrib_
return a pointer to the mesh
This class provides easy access to DrawModes supported by OpenVolumeMesh.
virtual void update(UpdateType _type=UPDATE_ALL)
Update the whole Object (Selection,Topology,...)
const UpdateType UPDATE_TEXTURE(UpdateTypeSet(2048))
Textures have changed.
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode_
Scenegraph Mesh Node.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
QtTranslationManipulatorNode * manipulatorNode()
StatusAttrib statusAttrib_
return a pointer to the mesh
void boundingBox(ACG::Vec3d &_bbMin, typename ACG::Vec3d &_bbMax)
Get the BoundingBox of this object.
virtual void cleanup() override
void updateSelection()
Call this function to update the selection.
BoundingBoxNode * boundingBoxNode()
get a pointer to the bounding box node
ACG::SceneGraph::ShaderNode * shaderNode_
Scenegraph Shader Node.
virtual void init()
Initialise current object, including all related nodes.
NormalAttrib normalAttrib_
return a pointer to the mesh
void updateColor()
Update Colors of all data structures.
bool picked(unsigned int _node_idx)
detect if the node has been picked
QString name() const
return the name of the object. The name defaults to NONAME if unset.
MaterialNode * materialNode()
get a pointer to the materialnode
bool contains(const UpdateType &_type) const
Check if this update contains the given UpdateType.
ACG::SceneGraph::VolumeMeshNodeT< MeshT > * meshNode()
Get the Scenegraph Mesh Node.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1024))
Colors have changed.
void boundingBox(Vec3d &_bbMin, Vec3d &_bbMax) override
update bounding box
MeshT * mesh()
return a pointer to the mesh
BaseNode * primaryNode()
Scenegraph Mesh Node.
ACG::SceneGraph::ShaderNode * shaderNode()
Return pointer to the shader node.
void setMainGLContext()
Set current GL Context to main context.
void update_face_normals()
Compute face normals.
ptr::shared_ptr< MeshT > mesh_
return a pointer to the mesh
ColorAttrib colorAttrib_
return a pointer to the mesh
void setDataType(DataType _type)
virtual ~VolumeMeshObject()
destructor
ACG::SceneGraph::ShaderNode ShaderNode
Simple Name for ShaderNode.
DataType dataType() const
void set_point_size(float _sz)
set point size (default: 1.0)
void updateTexture()
Update Texture of all data structures.
DLLEXPORT DataType typeId(QString _name)
Given a dataType Identifier string this function will return the id of the datatype.
VectorT< double, 3 > Vec3d
void setName(QString _name)
Set the name of the Object.