diff --git a/.gitmodules b/.gitmodules index 7e62cd666037381d087c574aca426084d11cf334..43b841cdaecb3c4a1cfada8025743cef26ac47fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "ThirdParty/VtkFbxConverter"] path = ThirdParty/VtkFbxConverter url = https://github.com/bilke/VtkFbxConverter.git +[submodule "ThirdParty/VtkOsgConverter"] + path = ThirdParty/VtkOsgConverter + url = https://github.com/bilke/VtkOsgConverter.git diff --git a/Gui/CMakeLists.txt b/Gui/CMakeLists.txt index 457b4679edcca1430c278f82b92a498a48cdf656..e76f98f339780e8e619b29b698e051254531a123 100644 --- a/Gui/CMakeLists.txt +++ b/Gui/CMakeLists.txt @@ -10,6 +10,11 @@ IF(VTKFBXCONVERTER_FOUND) INCLUDE_DIRECTORIES(${VTKFBXCONVERTER_INCLUDE_DIRS}) ENDIF() +IF(VTKOSGCONVERTER_FOUND) + ADD_DEFINITIONS(-DVTKOSGCONVERTER_FOUND) + INCLUDE_DIRECTORIES(${VTKOSGCONVERTER_INCLUDE_DIRS}) +ENDIF() + # Add subprojects ADD_SUBDIRECTORY( Base ) ADD_SUBDIRECTORY( DataView/StratView ) @@ -17,9 +22,6 @@ ADD_SUBDIRECTORY( DataView ) ADD_SUBDIRECTORY( DataView/DiagramView ) ADD_SUBDIRECTORY( VtkVis ) ADD_SUBDIRECTORY( VtkAct ) -IF (OGS_USE_OPENSG) - ADD_SUBDIRECTORY( OpenSG ) -ENDIF (OGS_USE_OPENSG) IF(VRPN_FOUND AND OGS_USE_VRPN) ADD_SUBDIRECTORY( Vrpn ) ENDIF() diff --git a/Gui/DataExplorer.cmake b/Gui/DataExplorer.cmake index aeb46fb1154b9f2de0bd8344c2691d3f60264580..30f400f9c7ca8ecdbf4a1324a415f05467f68583 100644 --- a/Gui/DataExplorer.cmake +++ b/Gui/DataExplorer.cmake @@ -118,11 +118,9 @@ IF(OGS_BUILD_INFO) ENDIF() # OGS_BUILD_INFO ### OpenSG support ### -IF (OGS_USE_OPENSG) - USE_OPENSG(ogs-gui) - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Gui/OpenSG ) - TARGET_LINK_LIBRARIES( ogs-gui OgsOpenSG ) -ENDIF (OGS_USE_OPENSG) +IF (VTKOSGCONVERTER_FOUND) + TARGET_LINK_LIBRARIES( ogs-gui ${VTKOSGCONVERTER_LIBRARIES} ) +ENDIF () IF(VTKFBXCONVERTER_FOUND) TARGET_LINK_LIBRARIES(ogs-gui ${VTKFBXCONVERTER_LIBRARIES}) @@ -151,7 +149,7 @@ IF (OGS_PACKAGING) INCLUDE(GetPrerequisites) if (EXISTS ${OGS_GUI_EXE}) - GET_PREREQUISITES(${OGS_GUI_EXE} OGS_GUI_DEPENDENCIES 1 1 "/usr/local/lib;/;${VTK_DIR};${OpenSG_LIBRARY_DIRS}" "") + GET_PREREQUISITES(${OGS_GUI_EXE} OGS_GUI_DEPENDENCIES 1 1 "/usr/local/lib;/;${VTK_DIR};" "") MESSAGE (STATUS "ogs-gui depends on:") FOREACH(DEPENDENCY ${OGS_GUI_DEPENDENCIES}) IF(NOT ${DEPENDENCY} STREQUAL "not") # Some bug on Linux? diff --git a/Gui/DataView/CMakeLists.txt b/Gui/DataView/CMakeLists.txt index fb0e89bd894347f2f8e2be220de07b8abd36e063..c520b4bde9392b3531728079f7866785ee74d6a3 100644 --- a/Gui/DataView/CMakeLists.txt +++ b/Gui/DataView/CMakeLists.txt @@ -147,9 +147,9 @@ IF(VRPN_FOUND) INCLUDE_DIRECTORIES( ../Vrpn ${VRPN_INCLUDE_DIRS} ) ENDIF() -IF (OGS_USE_OPENSG) - INCLUDE_DIRECTORIES( ${OpenSG_INCLUDE_DIRS} ) -ENDIF (OGS_USE_OPENSG) +IF (VTKOSGCONVERTER_FOUND) + INCLUDE_DIRECTORIES( ${VTKOSGCONVERTER_INCLUDE_DIRS} ) +ENDIF (VTKOSGCONVERTER_FOUND) IF (libgeotiff_FOUND) INCLUDE_DIRECTORIES( ${libgeotiff_INCLUDE_DIR} ${libgeotiff_INCLUDE_DIR}/libxtiff ${VTK_DIR}/../Utilities/vtktiff ) diff --git a/Gui/OpenSG/CMakeLists.txt b/Gui/OpenSG/CMakeLists.txt deleted file mode 100644 index c0bccd811f4fb7871a6a8ac613dffe210bcc62c8..0000000000000000000000000000000000000000 --- a/Gui/OpenSG/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# 24/08/2010 LB Initial implementation -# CMake file for OgsOpenSG - -### Source files ### -SET( SOURCES - vtkOsgConverter.cpp -) - -### Header files ### -SET( HEADERS - vtkOsgConverter.h -) - -### Include directories ### -INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/Gui/OpenSG -) - -### Create the library ### -ADD_LIBRARY( OgsOpenSG STATIC - ${SOURCES} - ${HEADERS} -) - -USE_OPENSG(OgsOpenSG) - -set_property(TARGET OgsOpenSG PROPERTY FOLDER "DataExplorer") \ No newline at end of file diff --git a/Gui/OpenSG/vtkOsgConverter.cpp b/Gui/OpenSG/vtkOsgConverter.cpp deleted file mode 100644 index 297bc9b2cda26803c622bd21781f3080f412e148..0000000000000000000000000000000000000000 --- a/Gui/OpenSG/vtkOsgConverter.cpp +++ /dev/null @@ -1,958 +0,0 @@ -/** - * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.net) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.net/LICENSE.txt - * - * \file vtkOsgConverter.cpp - * - * Created on 2011-07-27 by Lars Bilke - */ - -// ** INCLUDES ** -#include "vtkOsgConverter.h" - -#include <vtkActor.h> -#include <vtkCellArray.h> -#include <vtkCellData.h> -#include <vtkCompositeDataGeometryFilter.h> -#include <vtkDataArray.h> -#include <vtkDataSet.h> -#include <vtkDataSetMapper.h> -#include <vtkGeometryFilter.h> -#include <vtkImageData.h> -#include <vtkMapper.h> -#include <vtkPointData.h> -#include <vtkPolyData.h> -#include <vtkPolyDataMapper.h> -#include <vtkProperty.h> -#include <vtkSmartPointer.h> -#include <vtkTexture.h> -#include <vtkUnsignedCharArray.h> -#include <vtkCellDataToPointData.h> -#include <vtkLookupTable.h> -#include <vtkDiscretizableColorTransferFunction.h> - -#include <OpenSG/OSGGeoFunctions.h> -#include <OpenSG/OSGGroup.h> -#include <OpenSG/OSGImage.h> -#include <OpenSG/OSGLineChunk.h> -#include <OpenSG/OSGMaterialChunk.h> -#include <OpenSG/OSGMatrix.h> -#include <OpenSG/OSGPointChunk.h> -#include <OpenSG/OSGPolygonChunk.h> -#include <OpenSG/OSGSimpleGeometry.h> -#include <OpenSG/OSGTwoSidedLightingChunk.h> -#include <OpenSG/OSGTextureChunk.h> -#include <OpenSG/OSGGL.h> - -OSG_USING_NAMESPACE - -vtkOsgConverter::vtkOsgConverter(vtkActor* actor) : - _actor(actor), - _verbose(true), - _osgRoot(NullFC), - _osgTransform(NullFC) -{ - TransformPtr tptr; - _osgRoot = makeCoredNode<osg::Transform>(&tptr); - _osgTransform = tptr; -} - -vtkOsgConverter::~vtkOsgConverter(void) -{ - _osgRoot = NullFC; -} - -bool vtkOsgConverter::WriteAnActor() -{ - vtkMapper* actorMapper = _actor->GetMapper(); - // see if the actor has a mapper. it could be an assembly - if (actorMapper == NULL) - return false; - // dont export when not visible - if (_actor->GetVisibility() == 0) - return false; - - vtkDataObject* inputDO = actorMapper->GetInputDataObject(0, 0); - if (inputDO == NULL) - return false; - - // Get PolyData. Convert if necessary becasue we only want polydata - vtkSmartPointer<vtkPolyData> pd; - if(inputDO->IsA("vtkCompositeDataSet")) - { - vtkCompositeDataGeometryFilter* gf = vtkCompositeDataGeometryFilter::New(); - gf->SetInput(inputDO); - gf->Update(); - pd = gf->GetOutput(); - gf->Delete(); - } - else if(inputDO->GetDataObjectType() != VTK_POLY_DATA) - { - vtkGeometryFilter* gf = vtkGeometryFilter::New(); - gf->SetInput(inputDO); - gf->Update(); - pd = gf->GetOutput(); - gf->Delete(); - } - else - pd = static_cast<vtkPolyData*>(inputDO); - - // Get the color range from actors lookup table - double range[2]; - vtkLookupTable* actorLut = static_cast<vtkLookupTable*>(actorMapper->GetLookupTable()); - actorLut->GetTableRange(range); - - // Copy mapper to a new one - vtkPolyDataMapper* pm = vtkPolyDataMapper::New(); - // Convert cell data to point data - // NOTE: Comment this out to export a mesh - if (actorMapper->GetScalarMode() == VTK_SCALAR_MODE_USE_CELL_DATA || - actorMapper->GetScalarMode() == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA) - { - vtkCellDataToPointData* cellDataToPointData = vtkCellDataToPointData::New(); - cellDataToPointData->PassCellDataOff(); - cellDataToPointData->SetInput(pd); - cellDataToPointData->Update(); - pd = cellDataToPointData->GetPolyDataOutput(); - cellDataToPointData->Delete(); - - pm->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA); - } - else - pm->SetScalarMode(actorMapper->GetScalarMode()); - - pm->SetInput(pd); - pm->SetScalarVisibility(actorMapper->GetScalarVisibility()); - - vtkLookupTable* lut = NULL; - // ParaView OpenSG Exporter - if (dynamic_cast<vtkDiscretizableColorTransferFunction*>(actorMapper->GetLookupTable())) - lut = actorLut; - // Clone the lut in OGS because otherwise the original lut gets destroyed - else - { - lut = vtkLookupTable::New(); - lut->DeepCopy(actorLut); - lut->Build(); - } - pm->SetLookupTable(lut); - pm->SetScalarRange(range); - pm->Update(); - - if(pm->GetScalarMode() == VTK_SCALAR_MODE_USE_POINT_FIELD_DATA || - pm->GetScalarMode() == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ) - { - if(actorMapper->GetArrayAccessMode() == VTK_GET_ARRAY_BY_ID ) - pm->ColorByArrayComponent(actorMapper->GetArrayId(), - actorMapper->GetArrayComponent()); - else - pm->ColorByArrayComponent(actorMapper->GetArrayName(), - actorMapper->GetArrayComponent()); - } - - - vtkPointData* pntData = pd->GetPointData(); - bool hasTexCoords = false; - vtkUnsignedCharArray* vtkColors = pm->MapScalars(1.0); - - // ARRAY SIZES - vtkIdType m_iNumPoints = pd->GetNumberOfPoints(); - if (m_iNumPoints == 0) - return false; - vtkIdType m_iNumGLPoints = pd->GetVerts()->GetNumberOfCells(); - vtkIdType m_iNumGLLineStrips = pd->GetLines()->GetNumberOfCells(); - vtkIdType m_iNumGLPolygons = pd->GetPolys()->GetNumberOfCells(); - vtkIdType m_iNumGLTriStrips = pd->GetStrips()->GetNumberOfCells(); - vtkIdType m_iNumGLPrimitives = m_iNumGLPoints + m_iNumGLLineStrips + m_iNumGLPolygons + - m_iNumGLTriStrips; - bool lit = !(m_iNumGLPolygons == 0 && m_iNumGLTriStrips == 0); - - if (_verbose) - { - std::cout << "Array sizes:" << std::endl; - std::cout << " number of vertices: " << m_iNumPoints << std::endl; - std::cout << " number of GL_POINTS: " << m_iNumGLPoints << std::endl; - std::cout << " number of GL_LINE_STRIPS: " << m_iNumGLLineStrips << std::endl; - std::cout << " number of GL_POLYGON's: " << m_iNumGLPolygons << std::endl; - std::cout << " number of GL_TRIANGLE_STRIPS: " << m_iNumGLTriStrips << std::endl; - std::cout << " number of primitives: " << m_iNumGLPrimitives << std::endl; - } - - // NORMALS - vtkDataArray* vtkNormals = NULL; - int m_iNormalType = NOT_GIVEN; - if (_actor->GetProperty()->GetInterpolation() == VTK_FLAT) - { - vtkNormals = pd->GetCellData()->GetNormals(); - if (vtkNormals != NULL) - m_iNormalType = PER_CELL; - } - else - { - vtkNormals = pntData->GetNormals(); - if (vtkNormals != NULL) - m_iNormalType = PER_VERTEX; - } - if (_verbose) - { - std::cout << "Normals:" << std::endl; - if (m_iNormalType != NOT_GIVEN) - { - std::cout << " number of normals: " << vtkNormals->GetNumberOfTuples() << - std::endl; - std::cout << " normals are given: "; - std::cout << - ((m_iNormalType == PER_VERTEX) ? "per vertex" : "per cell") << std::endl; - } - else - std::cout << " no normals are given" << std::endl; - } - - // COLORS - int m_iColorType = NOT_GIVEN; - if(pm->GetScalarVisibility()) - { - int iScalarMode = pm->GetScalarMode(); - if(vtkColors == NULL) - { - m_iColorType = NOT_GIVEN; - std::cout << "WARNING: MapScalars(1.0) did not return array!" << std::endl; - } - else if(iScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA) - m_iColorType = PER_CELL; - else if(iScalarMode == VTK_SCALAR_MODE_USE_POINT_DATA) - m_iColorType = PER_VERTEX; - else if(iScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA) - { - std::cout << - "WARNING TO BE REMOVED: Can not process colours with scalar mode using cell field data!" - << std::endl; - m_iColorType = PER_CELL; - } - else if(iScalarMode == VTK_SCALAR_MODE_USE_POINT_FIELD_DATA) - { - std::cout << - "WARNING TO BE REMOVED: Can not process colours with scalar mode using point field data!" - << std::endl; - m_iColorType = PER_VERTEX; - } - else if(iScalarMode == VTK_SCALAR_MODE_DEFAULT) - { - //Bummer, we do not know what it is. may be we can make a guess - int numColors = vtkColors->GetNumberOfTuples(); - if (numColors == 0) - { - m_iColorType = NOT_GIVEN; - std::cout << "WARNING: No colors found!" << std::endl; - } - else if (numColors == m_iNumPoints) - m_iColorType = PER_VERTEX; - else if (numColors == m_iNumGLPrimitives) - m_iColorType = PER_CELL; - else - { - m_iColorType = NOT_GIVEN; - std::cout << - "WARNING: Number of colors do not match number of points / cells!" - << std::endl; - } - } - } - if (_verbose) - { - std::cout << "Colors:" << std::endl; - if (m_iColorType != NOT_GIVEN) - { - std::cout << " number of colors: " << vtkColors->GetNumberOfTuples() << - std::endl; - std::cout << " colors are given: " << - ((m_iColorType == PER_VERTEX) ? "per vertex" : "per cell") << std::endl; - } - else - std::cout << " no colors are given" << std::endl; - } - - // TEXCOORDS - vtkDataArray* vtkTexCoords = pntData->GetTCoords(); - if (_verbose) - { - std::cout << "Tex-coords:" << std::endl; - if (vtkTexCoords) - { - std::cout << " Number of tex-coords: " << - vtkTexCoords->GetNumberOfTuples() << std::endl; - hasTexCoords = true; - } - else - std::cout << " No tex-coords where given" << std::endl; - } - - // TRANSFORMATION - double scaling[3]; - double translation[3]; - // double rotation[3]; - - _actor->GetPosition(translation); - _actor->GetScale(scaling); - //_actor->GetRotation(rotation[0], rotation[1], rotation[2]); - - if (_verbose) - std::cout << "set scaling: " << scaling[0] << " " << scaling[1] << " " << - scaling[2] << std::endl; - - osg::Matrix m; - m.setIdentity(); - m.setTranslate(translation[0], translation[1], translation[2]); - m.setScale(scaling[0], scaling[1], scaling[2]); - // TODO QUATERNION m.setRotate(rotation[0], rotation[1], rotation[2]) - beginEditCP(_osgTransform); - _osgTransform->setMatrix(m); - endEditCP(_osgTransform); - - //pm->Update(); - - // Get the converted OpenSG node - NodePtr osgGeomNode = Node::create(); - GeometryPtr osgGeometry = Geometry::create(); - beginEditCP(osgGeomNode); - osgGeomNode->setCore(osgGeometry); - endEditCP(osgGeomNode); - - bool osgConversionSuccess = false; - - GeoPTypesPtr osgTypes = GeoPTypesUI8::create(); - GeoPLengthsPtr osgLengths = GeoPLengthsUI32::create(); - GeoIndicesUI32Ptr osgIndices = GeoIndicesUI32::create(); - GeoPositions3fPtr osgPoints = GeoPositions3f::create(); - GeoNormals3fPtr osgNormals = GeoNormals3f::create(); - GeoColors3fPtr osgColors = GeoColors3f::create(); - GeoTexCoords2dPtr osgTexCoords = GeoTexCoords2d::create(); - - //Rendering with OpenSG simple indexed geometry - if (((m_iNormalType == PER_VERTEX) || (m_iNormalType == NOT_GIVEN)) && - ((m_iColorType == PER_VERTEX) || (m_iColorType == NOT_GIVEN))) - { - if (_verbose) - std::cout << "Start ProcessGeometryNormalsAndColorsPerVertex()" << std::endl; - - //getting the vertices: - beginEditCP(osgPoints); - { - for (int i = 0; i < m_iNumPoints; i++) - { - double* aVertex = pd->GetPoint(i); - osgPoints->addValue(Vec3f(aVertex[0], aVertex[1], aVertex[2])); - } - } endEditCP(osgPoints); - - //possibly getting the normals - if (m_iNormalType == PER_VERTEX) - { - vtkIdType iNumNormals = vtkNormals->GetNumberOfTuples(); - beginEditCP(osgNormals); - { - double* aNormal; - for (int i = 0; i < iNumNormals; i++) - { - aNormal = vtkNormals->GetTuple(i); - osgNormals->addValue(Vec3f(aNormal[0], aNormal[1], aNormal[2])); - } - } endEditCP(osgNormals); - if (iNumNormals != m_iNumPoints) - { - std::cout << - "WARNING: CVtkActorToOpenSG::ProcessGeometryNormalsAndColorsPerVertex() number of normals" - << std::endl; - std::cout << "should equal the number of vertices (points)!" << std::endl << std::endl; - } - } - - //possibly getting the colors - if (m_iColorType == PER_VERTEX) - { - vtkIdType iNumColors = vtkColors->GetNumberOfTuples(); - beginEditCP(osgColors); - { - unsigned char aColor[4]; - for (int i = 0; i < iNumColors; i++) - { - vtkColors->GetTupleValue(i, aColor); - float r = ((float) aColor[0]) / 255.0f; - float g = ((float) aColor[1]) / 255.0f; - float b = ((float) aColor[2]) / 255.0f; - osgColors->addValue(Color3f(r, g, b)); - } - } endEditCP(osgColors); - if (iNumColors != m_iNumPoints) - { - std::cout << - "WARNING: CVtkActorToOpenSG::ProcessGeometryNormalsAndColorsPerVertex() number of colors" - << std::endl; - std::cout << "should equal the number of vertices (points)!" << std::endl << std::endl; - } - } - - //possibly getting the texture coordinates. These are alwary per vertex - if (vtkTexCoords != NULL) - { - int numTuples = vtkTexCoords->GetNumberOfTuples(); - for (int i = 0; i < numTuples; i++) - { - double texCoords[3]; - vtkTexCoords->GetTuple(i, texCoords); - osgTexCoords->addValue(Vec2f(texCoords[0], texCoords[1])); - } - } - - //getting the cells - beginEditCP(osgTypes); - beginEditCP(osgLengths); - beginEditCP(osgIndices); - { - vtkCellArray* pCells; - vtkIdType npts, * pts; - int prim; - - prim = 0; - pCells = pd->GetVerts(); - if (pCells->GetNumberOfCells() > 0) - for (pCells->InitTraversal(); pCells->GetNextCell(npts, pts); - prim++) - { - osgLengths->addValue(npts); - osgTypes->addValue(GL_POINTS); - for (int i = 0; i < npts; i++) - osgIndices->addValue(pts[i]); - } - - prim = 0; - pCells = pd->GetLines(); - if (pCells->GetNumberOfCells() > 0) - for (pCells->InitTraversal(); pCells->GetNextCell(npts, pts); - prim++) - { - osgLengths->addValue(npts); - osgTypes->addValue(GL_LINE_STRIP); - for (int i = 0; i < npts; i++) - osgIndices->addValue(pts[i]); - } - - prim = 0; - pCells = pd->GetPolys(); - if (pCells->GetNumberOfCells() > 0) - for (pCells->InitTraversal(); pCells->GetNextCell(npts, pts); - prim++) - { - osgLengths->addValue(npts); - osgTypes->addValue(GL_POLYGON); - for (int i = 0; i < npts; i++) - osgIndices->addValue(pts[i]); - } - - prim = 0; - pCells = pd->GetStrips(); - if (pCells->GetNumberOfCells() > 0) - for (pCells->InitTraversal(); pCells->GetNextCell(npts, pts); prim++) - { - osgLengths->addValue(npts); - osgTypes->addValue(GL_TRIANGLE_STRIP); - for (int i = 0; i < npts; i++) - osgIndices->addValue(pts[i]); - } - } endEditCP(osgIndices); - endEditCP(osgLengths); - endEditCP(osgTypes); - - ChunkMaterialPtr material = CreateMaterial(lit, hasTexCoords); - beginEditCP(osgGeometry); - { - osgGeometry->setPositions(osgPoints); - osgGeometry->setTypes(osgTypes); - osgGeometry->setLengths(osgLengths); - osgGeometry->setIndices(osgIndices); - osgGeometry->setMaterial(material); - - if (m_iNormalType == PER_VERTEX) - osgGeometry->setNormals(osgNormals); - if (m_iColorType == PER_VERTEX) - osgGeometry->setColors(osgColors); - if (osgTexCoords->getSize() > 0) - osgGeometry->setTexCoords(osgTexCoords); - } endEditCP(osgGeometry); - - osgConversionSuccess = true; - - if (_verbose) - std::cout << " End ProcessGeometryNormalsAndColorsPerVertex()" << - std::endl; - } - else - { - //Rendering with OpenSG non indexed geometry by copying a lot of attribute data - if (_verbose) - std::cout << - "Start ProcessGeometryNonIndexedCopyAttributes(int gl_primitive_type)" << - std::endl; - int gl_primitive_type = -1; - if(m_iNumGLPolygons > 0) - { - if(m_iNumGLPolygons != m_iNumGLPrimitives) - std::cout << "WARNING: vtkActor contains different kind of primitives" << std::endl; - gl_primitive_type = GL_POLYGON; - //osgConversionSuccess = this->ProcessGeometryNonIndexedCopyAttributes(GL_POLYGON, pd, osgGeometry); - } - else if(m_iNumGLLineStrips > 0) - { - if (m_iNumGLLineStrips != m_iNumGLPrimitives) - std::cout << "WARNING: vtkActor contains different kind of primitives" << std::endl; - gl_primitive_type = GL_LINE_STRIP; - //osgConversionSuccess = this->ProcessGeometryNonIndexedCopyAttributes(GL_LINE_STRIP, pd osgGeometry); - } - else if(m_iNumGLTriStrips > 0) - { - if (m_iNumGLTriStrips != m_iNumGLPrimitives) - std::cout << "WARNING: vtkActor contains different kind of primitives" << std::endl; - gl_primitive_type = GL_TRIANGLE_STRIP; - //osgConversionSuccess = this->ProcessGeometryNonIndexedCopyAttributes(GL_TRIANGLE_STRIP, pd osgGeometry); - } - else if (m_iNumGLPoints > 0) - { - if (m_iNumGLPoints != m_iNumGLPrimitives) - std::cout << "WARNING: vtkActor contains different kind of primitives" << std::endl; - gl_primitive_type = GL_POINTS; - //osgConversionSuccess = this->ProcessGeometryNonIndexedCopyAttributes(GL_POINTS, pd osgGeometry); - } - if(gl_primitive_type != -1) - { - vtkCellArray* pCells; - if (gl_primitive_type == GL_POINTS) - pCells = pd->GetVerts(); - else if (gl_primitive_type == GL_LINE_STRIP) - pCells = pd->GetLines(); - else if (gl_primitive_type == GL_POLYGON) - pCells = pd->GetPolys(); - else if (gl_primitive_type == GL_TRIANGLE_STRIP) - pCells = pd->GetStrips(); - else - { - std::cout << - "CVtkActorToOpenSG::ProcessGeometryNonIndexedCopyAttributes(int gl_primitive_type)" - << std::endl << " was called with non implemented gl_primitive_type!" << std::endl; - } - - beginEditCP(osgTypes); - beginEditCP(osgLengths); - beginEditCP(osgPoints); - beginEditCP(osgColors); - beginEditCP(osgNormals); - { - int prim = 0; - if (pCells->GetNumberOfCells() > 0) - { - vtkIdType npts, * pts; - for (pCells->InitTraversal(); pCells->GetNextCell(npts, pts); - prim++) - { - osgLengths->addValue(npts); - osgTypes->addValue(GL_POLYGON); - for (int i = 0; i < npts; i++) - { - double* aVertex; - double* aNormal; - unsigned char aColor[4]; - - aVertex = pd->GetPoint(pts[i]); - osgPoints->addValue(Vec3f(aVertex[0], aVertex[1], aVertex[2])); - - if (m_iNormalType == PER_VERTEX) - { - aNormal = - vtkNormals->GetTuple(pts[i]); - osgNormals->addValue(Vec3f(aNormal[0], aNormal[1], aNormal[2])); - } - else if (m_iNormalType == PER_CELL) - { - aNormal = vtkNormals->GetTuple(prim); - osgNormals->addValue(Vec3f(aNormal[0], aNormal[1], aNormal[2])); - } - - if (m_iColorType == PER_VERTEX) - { - vtkColors->GetTupleValue(pts[i], aColor); - float r = ((float) aColor[0]) / 255.0f; - float g = ((float) aColor[1]) / 255.0f; - float b = ((float) aColor[2]) / 255.0f; - osgColors->addValue(Color3f(r, g, b)); - } - else if (m_iColorType == PER_CELL) - { - vtkColors->GetTupleValue(prim, - aColor); - float r = ((float) aColor[0]) / 255.0f; - float g = ((float) aColor[1]) / 255.0f; - float b = ((float) aColor[2]) / 255.0f; - osgColors->addValue(Color3f(r, g, b)); - } - } - } - } - } endEditCP(osgTypes); - endEditCP(osgLengths); - endEditCP(osgPoints); - endEditCP(osgColors); - endEditCP(osgNormals); - - //possibly getting the texture coordinates. These are always per vertex - vtkPoints* points = pd->GetPoints(); - if ((vtkTexCoords != NULL) && (points != NULL)) - { - int numPoints = points->GetNumberOfPoints(); - int numTexCoords = vtkTexCoords->GetNumberOfTuples(); - if (numPoints == numTexCoords) - { - beginEditCP(osgTexCoords); - { - int numTuples = vtkTexCoords->GetNumberOfTuples(); - for (int i = 0; i < numTuples; i++) - { - double texCoords[3]; - vtkTexCoords->GetTuple(i, texCoords); - osgTexCoords->addValue(Vec2f(texCoords[0], texCoords[1])); - } - } endEditCP(osgTexCoords); - } - } - - ChunkMaterialPtr material = CreateMaterial(lit, hasTexCoords); - //GeometryPtr geo = Geometry::create(); - beginEditCP(osgGeometry); - { - osgGeometry->setPositions(osgPoints); - osgGeometry->setTypes(osgTypes); - osgGeometry->setLengths(osgLengths); - osgGeometry->setMaterial(material); - - if (m_iNormalType != NOT_GIVEN) - osgGeometry->setNormals(osgNormals); - if (m_iColorType != NOT_GIVEN) - osgGeometry->setColors(osgColors); - if (osgTexCoords->getSize() > 0) - osgGeometry->setTexCoords(osgTexCoords); - //geo->setMaterial(getDefaultMaterial()); - } endEditCP(osgGeometry); - - osgConversionSuccess = true; - } - if (_verbose) - std::cout << - " End ProcessGeometryNonIndexedCopyAttributes(int gl_primitive_type)" << - std::endl; - } - - if(!osgConversionSuccess) - { - std::cout << "OpenSG converter was not able to convert this actor." << std::endl; - return false; - } - - if(m_iNormalType == NOT_GIVEN) - { - //GeometryPtr newGeometryPtr = GeometryPtr::dcast(newNodePtr->getCore()); - if((osgGeometry != NullFC) && (m_iColorType == PER_VERTEX)) - { - std::cout << - "WARNING: Normals are missing in the vtk layer, calculating normals per vertex!" - << std::endl; - calcVertexNormals(osgGeometry); - } - else if ((osgGeometry != NullFC) && (m_iColorType == PER_CELL)) - { - std::cout << - "WARNING: Normals are missing in the vtk layer, calculating normals per face!" - << std::endl; - calcFaceNormals(osgGeometry); - } - else if (osgGeometry != NullFC) - { - std::cout << - "WARNING: Normals are missing in the vtk layer, calculating normals per vertex!" - << std::endl; - calcVertexNormals(osgGeometry); - } - } - - std::cout << "Conversion finished." << std::endl; - - // Add node to root - beginEditCP(_osgRoot); - _osgRoot->addChild(osgGeomNode); - endEditCP(_osgRoot); - - pm->Delete(); - - return true; -} - -void vtkOsgConverter::SetVerbose(bool value) -{ - _verbose = value; -} - -NodePtr vtkOsgConverter::GetOsgNode() -{ - return _osgRoot; -} - -TextureChunkPtr vtkOsgConverter::CreateTexture(vtkTexture* vtkTexture) -{ - if(_verbose) - std::cout << "Calling CreateTexture()" << std::endl; - - // if(! m_bTextureHasChanged) - // { - // if (_verbose) - // { - // std::cout << " ... nothing to do" << std::endl; - // std::cout << " End CreateTexture()" << std::endl; - // } - // //can we check if the actual image has been updated, even if the texture is the same? - // return; - // } - // else if(m_pvtkTexture == NULL) - // { - // if (_verbose) - // { - // std::cout << " ... texture is (still ?) NULL" << std::endl; - // std::cout << " EndCreateTexture()" << std::endl; - // } - // //the texture has changed but it is NULL now. We should remove the texture from the material - // return; - // } - // m_bTextureHasChanged = false; - - vtkImageData* imgData = vtkTexture->GetInput(); - int iImgDims[3]; - imgData->GetDimensions(iImgDims); - - vtkPointData* imgPointData = imgData->GetPointData(); - vtkCellData* imgCellData = imgData->GetCellData(); - - vtkDataArray* data = NULL; - - if (imgPointData != NULL) - if (NULL != imgPointData->GetScalars()) - { - data = imgPointData->GetScalars(); - if (_verbose) - std::cout << " Found texture data in point data" << std::endl; - } - - if (imgCellData != NULL) - if (NULL != imgCellData->GetScalars()) - { - data = imgCellData->GetScalars(); - if (_verbose) - std::cout << " Found texture data in cell data" << std::endl; - } - - if (data == NULL) - { - std::cout << " could not load texture data" << std::endl; - return NullFC; - } - - int iImgComps = data->GetNumberOfComponents(); - int iImgPixels = data->GetNumberOfTuples(); - if (iImgPixels != (iImgDims[0] * iImgDims[1] * iImgDims[2])) - { - std::cout << "Number of pixels in data array seems to be wrong!" << std::endl; - return NullFC; - } - - UInt8* newImageData = new UInt8[iImgDims[0] * iImgDims[1] * iImgDims[2] * iImgComps]; - vtkUnsignedCharArray* oldImageUChar = NULL; - oldImageUChar = dynamic_cast<vtkUnsignedCharArray*>(data); - int ucharCounter = 0; - if (oldImageUChar != NULL) - for (int i = 0; i < iImgPixels; i++) - { - unsigned char pixel[4]; - oldImageUChar->GetTupleValue(i, pixel); - for (int j = 0; j < iImgComps; j++) - newImageData[ucharCounter + j] = pixel[j]; - ucharCounter += iImgComps; - } - else - std::cout << "Pixel data come in unsupported vtk type" << std::endl; - - ImagePtr osgImage = Image::create(); - beginEditCP(osgImage); - { - osgImage->setWidth(iImgDims[0]); - osgImage->setHeight(iImgDims[1]); - osgImage->setDepth(iImgDims[2]); - osgImage->setDataType(Image::OSG_UINT8_IMAGEDATA); - if (iImgComps == 1) - osgImage->setPixelFormat(Image::OSG_L_PF); - else if (iImgComps == 2) - osgImage->setPixelFormat(Image::OSG_LA_PF); - else if (iImgComps == 3) - osgImage->setPixelFormat(Image::OSG_RGB_PF); - else if (iImgComps == 4) - osgImage->setPixelFormat(Image::OSG_RGBA_PF); - else - { - std::cout << "Unsupported image type!" << std::endl; - delete [] newImageData; - return NullFC; - } - osgImage->setData(newImageData); - } endEditCP(osgImage); - - TextureChunkPtr osgTextureChunk = TextureChunk::create(); - beginEditCP(osgTextureChunk); - { - osgTextureChunk->setImage(osgImage); - } endEditCP(osgTextureChunk); - - if (_verbose) - { - std::cout << " Loading image with " << iImgDims[0] << " x " << iImgDims[1] << - " x " << iImgDims[2] << " pixels." << std::endl; - std::cout << " Components: " << iImgComps << std::endl; - std::cout << "End CreateTexture()" << std::endl; - } - - return osgTextureChunk; -} - -ChunkMaterialPtr vtkOsgConverter::CreateMaterial(bool lit, bool hasTexCoords) -{ - if (_verbose) - std::cout << "Start CreateMaterial()" << std::endl; - - vtkProperty* prop = _actor->GetProperty(); - double* diffuseColor = prop->GetDiffuseColor(); - double* ambientColor = prop->GetAmbientColor(); - double* specularColor = prop->GetSpecularColor(); - double specularPower = prop->GetSpecularPower(); - - double diffuse = prop->GetDiffuse(); - double ambient = prop->GetAmbient(); - double specular = prop->GetSpecular(); - double opacity = prop->GetOpacity(); - - float pointSize = prop->GetPointSize(); - float lineWidth = prop->GetLineWidth(); - // int lineStipplePattern = prop->GetLineStipplePattern(); - - int representation = prop->GetRepresentation(); - - if (_verbose) - { - std::cout << " Colors:" << std::endl; - std::cout << " diffuse " << diffuse << " * " << diffuseColor[0] << " " << - diffuseColor[1] << " " << diffuseColor[2] << std::endl; - std::cout << " ambient " << ambient << " * " << ambientColor[0] << " " << - ambientColor[1] << " " << ambientColor[2] << std::endl; - std::cout << " specular " << specular << " * " << specularColor[0] << " " << - specularColor[1] << " " << specularColor[2] << std::endl; - } - - PolygonChunkPtr polygonChunk = PolygonChunk::create(); - beginEditCP(polygonChunk); - { - if (representation == VTK_SURFACE) - { - polygonChunk->setFrontMode(GL_FILL); - polygonChunk->setBackMode(GL_FILL); - } - else if (representation == VTK_WIREFRAME) - { - polygonChunk->setFrontMode(GL_LINE); - polygonChunk->setBackMode(GL_LINE); - } - else - { - polygonChunk->setFrontMode(GL_POINT); - polygonChunk->setBackMode(GL_POINT); - } - } endEditCP(polygonChunk); - - MaterialChunkPtr osgMaterialChunk = MaterialChunk::create(); - beginEditCP(osgMaterialChunk); - { - osgMaterialChunk->setDiffuse(Color4f(diffuseColor[0] * diffuse, diffuseColor[1] * - diffuse, diffuseColor[2] * diffuse, opacity)); - osgMaterialChunk->setSpecular(Color4f(specularColor[0] * specular, - specularColor[1] * specular, - specularColor[2] * specular, 1.0)); - osgMaterialChunk->setAmbient(Color4f(ambientColor[0] * ambient, ambientColor[1] * - ambient, ambientColor[2] * ambient, opacity)); - osgMaterialChunk->setShininess(specularPower); - - //if(opacity < 1.0) - //{ - // osgMaterialChunk->setColorMaterial(GL_AMBIENT); // HACK: Opacity does not work with GL_AMBIENT_AND_DIFFUSE - //osgMaterialChunk->setTransparency(1.0f - opacity); - //} - //else - osgMaterialChunk->setColorMaterial(GL_AMBIENT_AND_DIFFUSE); - - // On objects consisting only of points or lines, dont lit - if(!lit) - osgMaterialChunk->setLit(false); - } endEditCP(osgMaterialChunk); - - ChunkMaterialPtr osgChunkMaterial = ChunkMaterial::create(); - beginEditCP(osgChunkMaterial); - { - osgChunkMaterial->addChunk(osgMaterialChunk); - osgChunkMaterial->addChunk(TwoSidedLightingChunk::create()); - osgChunkMaterial->addChunk(polygonChunk); - - if(pointSize > 1.0f) - { - PointChunkPtr pointChunk = PointChunk::create(); - pointChunk->setSize(pointSize); - osgChunkMaterial->addChunk(pointChunk); - } - - if(lineWidth > 1.0f) - { - LineChunkPtr lineChunk = LineChunk::create(); - lineChunk->setWidth(lineWidth); - osgChunkMaterial->addChunk(lineChunk); - } - - // TEXTURE - if (hasTexCoords) - { - vtkTexture* vtkTexture = _actor->GetTexture(); - if (vtkTexture) - { - TextureChunkPtr osgTextureChunk = NullFC; - osgTextureChunk = CreateTexture(vtkTexture); - - if(osgTextureChunk != NullFC) - { - if (_verbose) - std::cout << " Add TextureChunk" << std::endl; - osgChunkMaterial->addChunk(osgTextureChunk); - } - - // Per default EnvMode is set to GL_REPLACE which does not lit the surface - beginEditCP(osgTextureChunk); - osgTextureChunk->setEnvMode(GL_MODULATE); - endEditCP(osgTextureChunk); - } - } - } endEditCP(osgChunkMaterial); - - if (_verbose) - std::cout << "End CreateMaterial()" << std::endl; - - return osgChunkMaterial; -} diff --git a/Gui/OpenSG/vtkOsgConverter.h b/Gui/OpenSG/vtkOsgConverter.h deleted file mode 100644 index eca341df0a1227348534bc11262f0ef5a4404e71..0000000000000000000000000000000000000000 --- a/Gui/OpenSG/vtkOsgConverter.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.net) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.net/LICENSE.txt - * - * \file vtkOsgConverter.h - * - * Created on 2011-07-27 by Lars Bilke - * Derived from class vtkOsgActor from Bjoern Zehner - */ - -#ifndef VTKOSGCONVERTER_H -#define VTKOSGCONVERTER_H - -#include <OpenSG/OSGChunkMaterial.h> -#include <OpenSG/OSGNode.h> -#include <OpenSG/OSGRefPtr.h> -#include <OpenSG/OSGTextureChunk.h> -#include <OpenSG/OSGTransform.h> - -class vtkActor; -class vtkMapper; -class vtkTexture; - -/// @brief Converts a vtkActor to an OpenSG-Node. -/// Example usage: -/// -/// @code -/// vtkOsgConverter* osgConverter = new vtkOsgConverter(aVtkActor); -/// if(osgConverter->WriteAnActor()) -/// { -/// beginEditCP(rootNode); -/// rootNode->addChild(osgConverter->GetOsgNode()); -/// endEditCP(rootNode); -/// } -/// @endcode -class vtkOsgConverter -{ -public: - vtkOsgConverter(vtkActor* actor); - virtual ~vtkOsgConverter(); - - bool WriteAnActor(); - void SetVerbose(bool value); - OSG::NodePtr GetOsgNode(); - -protected: - -private: - vtkActor* _actor; - - enum {NOT_GIVEN, PER_VERTEX, PER_CELL}; - bool _verbose; - - //For the translation to OpenSG - OSG::RefPtr<OSG::NodePtr> _osgRoot; - OSG::RefPtr<OSG::TransformPtr> _osgTransform; - - OSG::TextureChunkPtr CreateTexture(vtkTexture* vtkTexture); - OSG::ChunkMaterialPtr CreateMaterial(bool lit, bool hasTexCoords); -}; - -#endif // VTKOSGCONVERTER_H \ No newline at end of file diff --git a/Gui/VtkVis/CMakeLists.txt b/Gui/VtkVis/CMakeLists.txt index 5b48f3692c31a586c03006d74b67dd616007a1e8..69e8834a3b31d4a0f684ceae9d20da8759e3fe26 100644 --- a/Gui/VtkVis/CMakeLists.txt +++ b/Gui/VtkVis/CMakeLists.txt @@ -166,9 +166,9 @@ IF(OGS_USE_VRPN) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Gui/Vrpn) ENDIF() # OGS_USE_VRPN -IF (OGS_USE_OPENSG) +IF (VTKOSGCONVERTER_FOUND) USE_OPENSG(VtkVis) - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Gui/OpenSG ) -ENDIF (OGS_USE_OPENSG) + INCLUDE_DIRECTORIES( ${VTKOSGCONVERTER_INCLUDE_DIRS} ) +ENDIF () set_property(TARGET VtkVis PROPERTY FOLDER "DataExplorer") \ No newline at end of file diff --git a/Gui/VtkVis/VtkVisPipelineItem.cpp b/Gui/VtkVis/VtkVisPipelineItem.cpp index 7d6684d06c3ae7b3ac67599648e023d8a6b49226..0861ec59eb1b9bf7f9205c2679502f10a1ef4275 100644 --- a/Gui/VtkVis/VtkVisPipelineItem.cpp +++ b/Gui/VtkVis/VtkVisPipelineItem.cpp @@ -30,7 +30,7 @@ #include <QMessageBox> -#ifdef OGS_USE_OPENSG +#ifdef VTKOSGCONVERTER_FOUND #include "vtkOsgConverter.h" #include <OpenSG/OSGSceneFileHandler.h> #endif @@ -117,13 +117,13 @@ int VtkVisPipelineItem::writeToFile(const std::string &filename) const { if (filename.substr(filename.size() - 4).find("os") != std::string::npos) { -#ifdef OGS_USE_OPENSG +#ifdef VTKOSGCONVERTER_FOUND if(!dynamic_cast<vtkImageActor*>(_actor)) { vtkOsgConverter osgConverter(static_cast<vtkActor*>(_actor)); - if(osgConverter.WriteAnActor()) + if(osgConverter.convert()) OSG::SceneFileHandler::the().write( - osgConverter.GetOsgNode(), filename.c_str()); + osgConverter.getNode(), filename.c_str()); } else QMessageBox::warning(NULL, "Conversion to OpenSG not possible", diff --git a/Gui/main.cpp b/Gui/main.cpp index a8c40cec051a7ab97ac038659fc880df4c5be5af..6fb1a4470ed6a361c1d37325dcfd0e562cd7e5a6 100644 --- a/Gui/main.cpp +++ b/Gui/main.cpp @@ -1,7 +1,7 @@ #include "Configure.h" #include "mainwindow.h" #include <QtGui/QApplication> -#ifdef OGS_USE_OPENSG +#ifdef VTKOSGCONVERTER_FOUND #include <OpenSG/OSGBaseFunctions.h> #endif #include "logog/include/logog.hpp" @@ -15,7 +15,7 @@ FbxScene* lScene = NULL; int main(int argc, char* argv[]) { -#ifdef OGS_USE_OPENSG +#ifdef VTKOSGCONVERTER_FOUND OSG::osgInit(argc, argv); #endif #ifdef VTKFBXCONVERTER_FOUND @@ -42,9 +42,9 @@ int main(int argc, char* argv[]) #ifdef VTKFBXCONVERTER_FOUND DestroySdkObjects(lSdkManager); #endif -#ifdef OGS_USE_OPENSG +#ifdef VTKOSGCONVERTER_FOUND OSG::osgExit(); -#endif // OGS_USE_OPENSG +#endif return returncode; } diff --git a/Gui/mainwindow.cpp b/Gui/mainwindow.cpp index e38ffd0e3b1a548f7517e6ef374513d8c661724a..3845c3c21214e547a22189799573c5f6195d3a18 100644 --- a/Gui/mainwindow.cpp +++ b/Gui/mainwindow.cpp @@ -99,7 +99,7 @@ #include <vtkRenderer.h> #include <vtkVRMLExporter.h> -#ifdef OGS_USE_OPENSG +#ifdef VTKOSGCONVERTER_FOUND #include "vtkOsgConverter.h" #include <OpenSG/OSGCoredNodePtr.h> #include <OpenSG/OSGGroup.h> @@ -735,7 +735,7 @@ QMenu* MainWindow::createImportFilesMenu() QAction* rasterFiles = importFiles->addAction("&Raster Files..."); connect(rasterFiles, SIGNAL(triggered()), _signal_mapper, SLOT(map())); _signal_mapper->setMapping(rasterFiles, ImportFileType::RASTER); -#if defined OGS_USE_OPENSG || defined VTKFBXCONVERTER_FOUND +#if defined VTKOSGCONVERTER_FOUND || defined VTKFBXCONVERTER_FOUND QAction* rasterPolyFiles = importFiles->addAction("R&aster Files as PolyData..."); connect(rasterPolyFiles, SIGNAL(triggered()), this, SLOT(map())); _signal_mapper->setMapping(rasterPolyFiles, ImportFileType::POLYRASTER); @@ -1249,7 +1249,7 @@ void MainWindow::on_actionExportObj_triggered(bool checked /*= false*/) void MainWindow::on_actionExportOpenSG_triggered(bool checked /*= false*/) { Q_UNUSED(checked) -#ifdef OGS_USE_OPENSG +#ifdef VTKOSGCONVERTER_FOUND QSettings settings; QString filename = QFileDialog::getSaveFileName( this, "Export scene to OpenSG binary file", settings.value( @@ -1266,10 +1266,10 @@ void MainWindow::on_actionExportOpenSG_triggered(bool checked /*= false*/) { VtkVisPipelineItem* item = static_cast<VtkVisPipelineItem*>(*it); vtkOsgConverter converter(static_cast<vtkActor*>(item->actor())); - if(converter.WriteAnActor()) + if(converter.convert()) { beginEditCP(root); - root->addChild(converter.GetOsgNode()); + root->addChild(converter.getNode()); endEditCP(root); } ++it; @@ -1277,7 +1277,7 @@ void MainWindow::on_actionExportOpenSG_triggered(bool checked /*= false*/) OSG::SceneFileHandler::the().write(root, filename.toStdString().c_str()); } -#else // ifdef OGS_USE_OPENSG +#else // ifdef VTKOSGCONVERTER_FOUND QMessageBox::warning(this, "Functionality not implemented", "Sorry but this progam was not compiled with OpenSG support."); #endif diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index db423b9c620c6108e3d2fbefc5e99abb80dc53f3..d1fae9237227e221f1c32451fd456243884d18c8 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -11,8 +11,11 @@ ADD_SUBDIRECTORY(zlib) ADD_SUBDIRECTORY(gtest) # VtkFbxConverter -#SET(VtkFbxConverter_DIR ${CMAKE_CURRENT_SOURCE_DIR}/VtkFbxConverter) IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VtkFbxConverter/CMakeLists.txt) ADD_SUBDIRECTORY(VtkFbxConverter) - SET(VTKFBXCONVERTER_FOUND ON CACHE BOOL "Is the VtkFbxConverter submodule checked out?") +ENDIF() + +# VtkOsgConverter +IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VtkOsgConverter/CMakeLists.txt) + ADD_SUBDIRECTORY(VtkOsgConverter) ENDIF() \ No newline at end of file diff --git a/ThirdParty/VtkOsgConverter b/ThirdParty/VtkOsgConverter new file mode 160000 index 0000000000000000000000000000000000000000..89c42475f24099b810789944fa953394d273d25c --- /dev/null +++ b/ThirdParty/VtkOsgConverter @@ -0,0 +1 @@ +Subproject commit 89c42475f24099b810789944fa953394d273d25c diff --git a/Utils/FileConverter/CMakeLists.txt b/Utils/FileConverter/CMakeLists.txt index 86c19a276c0a664b07192635296be5eeff5ab289..8ebd46c76330abedadc776560974b2cce073dfc8 100644 --- a/Utils/FileConverter/CMakeLists.txt +++ b/Utils/FileConverter/CMakeLists.txt @@ -38,24 +38,6 @@ IF (Shapelib_FOUND) ENDIF (Shapelib_FOUND) -## VTK to OpenSG file converter ## -IF (OGS_USE_OPENSG AND VTK_FOUND AND Boost_FOUND) - - INCLUDE( ${VTK_USE_FILE} ) - - ADD_EXECUTABLE (ConvertVtkToOsg ConvertVtkToOsg.cpp) - SET_TARGET_PROPERTIES(ConvertVtkToOsg PROPERTIES FOLDER Utilities) - - USE_OPENSG ( ConvertVtkToOsg ) - INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/Gui/OpenSG ${Boost_INCLUDE_DIRS} ) - TARGET_LINK_LIBRARIES ( ConvertVtkToOsg OgsOpenSG vtkRendering vtkIO ${Boost_LIBRARIES} ) - - IF (OGS_PACKAGING) - INSTALL ( TARGETS ConvertVtkToOsg RUNTIME DESTINATION bin COMPONENT ConvertVtkToOsg ) - ENDIF (OGS_PACKAGING) - -ENDIF () # OGS_USE_OPENSG AND VTK_FOUND AND Boost_FOUND - ## Gli to VTK file converter ## IF(VTK_FOUND AND Boost_FOUND)