-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Danny02/feature/valette-master
add vtk feature from valette
- Loading branch information
Showing
11 changed files
with
207 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
sudo: false | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- libgtk2.0-dev | ||
- freeglut3-dev | ||
|
||
language: cpp | ||
|
||
script: | ||
- make -f Makefile.linux | ||
- ./build-src.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
cmake_minimum_required(VERSION 2.6) | ||
cmake_policy(SET CMP0012 NEW) | ||
cmake_minimum_required(VERSION 2.8) | ||
project(vtkOpenCTM) | ||
|
||
# Workaround target_compile_options for cmake < 2.8.12 | ||
if(${CMAKE_VERSION} VERSION_LESS "2.8.12") | ||
function(target_compile_options target scope) | ||
set(args ${ARGV}) | ||
list(REMOVE_AT args 0 1) | ||
string(REPLACE ";" " " CFLAGS_STRING "${args}") | ||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${CFLAGS_STRING}") | ||
endfunction() | ||
endif() | ||
FIND_PACKAGE(VTK REQUIRED) | ||
INCLUDE(${VTK_USE_FILE}) | ||
|
||
INCLUDE_DIRECTORIES(lib) | ||
INCLUDE_DIRECTORIES(lib/liblzma) | ||
INCLUDE_DIRECTORIES(tools/rply) | ||
INCLUDE_DIRECTORIES(tools/tinyxml) | ||
|
||
project(OpenCTM) | ||
AUX_SOURCE_DIRECTORY(lib ctm) | ||
AUX_SOURCE_DIRECTORY(lib/liblzma lzma) | ||
AUX_SOURCE_DIRECTORY(tools/rply rply) | ||
AUX_SOURCE_DIRECTORY(tools/tinyxml tinyxml) | ||
|
||
option(BUILD_TOOLSET "Build tools: ctmconv, ctmviewer" ON) | ||
option(BUILD_DOCUMENTATION "Build documentation: manpages" ON) | ||
ADD_DEFINITIONS (-D VTKINCLUDED) | ||
|
||
ADD_EXECUTABLE(mesh2ctm | ||
tools/ctmconv.cpp | ||
tools/convoptions.cpp | ||
tools/systimer.cpp | ||
tools/mesh.cpp | ||
tools/meshio.cpp | ||
tools/ctm.cpp | ||
tools/meshio.cpp | ||
tools/ply.cpp | ||
tools/stl.cpp | ||
tools/3ds.cpp | ||
tools/dae.cpp | ||
tools/lwo.cpp | ||
tools/obj.cpp | ||
tools/off.cpp | ||
tools/wrl.cpp | ||
tools/common.cpp | ||
${ctm} ${lzma} ${rply} ${tinyxml} | ||
) | ||
TARGET_LINK_LIBRARIES(mesh2ctm ${VTK_LIBRARIES}) | ||
|
||
add_subdirectory(lib) | ||
if(${BUILD_TOOLSET}) | ||
add_subdirectory(tools) | ||
endif() | ||
if(${BUILD_DOCUMENTATION}) | ||
add_subdirectory(doc) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//----------------------------------------------------------------------------- | ||
// Product: OpenCTM tools | ||
// File: vtk.h | ||
// Description: Interface for the vtk file format importer/exporter. | ||
//----------------------------------------------------------------------------- | ||
|
||
#ifndef __VTK_H_ | ||
#define __VTK_H_ | ||
|
||
#include <stdlib.h> | ||
#include <iostream> | ||
#include "mesh.h" | ||
#include "convoptions.h" | ||
|
||
#ifdef VTKINCLUDED | ||
|
||
#include <vtkPointData.h> | ||
#include <vtkPolyData.h> | ||
#include <vtkPolyDataReader.h> | ||
|
||
/// Import a VTK file from a file. | ||
void Import_VTK(const char * aFileName, Mesh * aMesh) { | ||
// Clear the mesh | ||
aMesh->Clear(); | ||
|
||
// Open the VTK file | ||
vtkPolyDataReader *reader = vtkPolyDataReader::New(); | ||
reader->SetFileName(aFileName); | ||
reader->Update(); | ||
|
||
vtkPolyData *mesh = reader->GetOutput(); | ||
|
||
int faceCount = mesh->GetNumberOfCells(); | ||
int vertexCount = mesh->GetNumberOfPoints(); | ||
|
||
double p[3]; | ||
for (int i = 0; i < mesh->GetNumberOfPoints(); i++) { | ||
mesh->GetPoint(i, p); | ||
aMesh->mVertices.push_back(Vector3(p[0], p[1], p[2])); | ||
} | ||
|
||
vtkIdType *vertices, nVertices; | ||
mesh->BuildCells(); | ||
for (int i = 0; i < mesh->GetNumberOfCells(); i++) { | ||
mesh->GetCellPoints(i, nVertices, vertices); | ||
for (int j = 0; j < 3; j++) { | ||
aMesh->mIndices.push_back(vertices[j]); | ||
} | ||
} | ||
|
||
vtkDataArray *pointData = mesh->GetPointData()->GetScalars(); | ||
if (!pointData) { | ||
return; | ||
} | ||
|
||
aMesh->attributesName = pointData->GetName(); | ||
|
||
for (int i = 0; i < mesh->GetNumberOfPoints(); i++) { | ||
aMesh->mAttributes.push_back(Vector4(pointData->GetTuple1(i), 0, 0, 1)); | ||
} | ||
|
||
|
||
} | ||
#else | ||
|
||
/// Import a VTK file from a file. | ||
void Import_VTK(const char * aFileName, Mesh * aMesh) { | ||
std::cout << "error : vtk is not included in this library" << std::endl; | ||
exit(1); | ||
} | ||
|
||
#endif | ||
|
||
#endif // __PLY_H_ |