The CHICKEN VTK example was way too big. Will be in a seperate project.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4335 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
975fddd474
commit
27a2eec3d8
13 changed files with 0 additions and 6077 deletions
|
|
@ -1 +0,0 @@
|
||||||
example_wrap.c
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
@SET_MAKE@
|
|
||||||
|
|
||||||
srcdir = @srcdir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
VPATH = @srcdir@
|
|
||||||
SOURCE_DIR = $(top_srcdir)/Examples/chicken/vtk
|
|
||||||
TOP = ../..
|
|
||||||
CC = @CC@
|
|
||||||
CXX = @CXX@
|
|
||||||
OBJEXT = @OBJEXT@
|
|
||||||
EXEEXT = @EXEEXT@
|
|
||||||
CMAKEVER = cmake-1.6.2
|
|
||||||
THISDIR = $(PWD)
|
|
||||||
VTKVER = 40
|
|
||||||
VTKHOME = $(PWD)/vtklocal
|
|
||||||
SWIG = $(TOP)/../swig$(EXEEXT)
|
|
||||||
CHICKGEN = example_wrap.$(OBJEXT) csi.$(OBJEXT) precsi.$(OBJEXT) \
|
|
||||||
oexample.$(OBJEXT)
|
|
||||||
CHICKSRC = csi.c precsi.c oexample.c
|
|
||||||
SRCS = $(CHICKGEN)
|
|
||||||
TARGET = vtk$(EXEEXT)
|
|
||||||
INCLUDE = -I$(SOURCE_DIR) -I$(VTKHOME)/include/vtk
|
|
||||||
EXTRALIBS = -lgdi32 -lopengl32
|
|
||||||
LIBS = -L$(VTKHOME)/lib/vtk -lvtkRendering -lvtkIO -lvtkGraphics \
|
|
||||||
-lvtkImaging -lvtkFiltering -lvtkCommon -lvtkjpeg -lvtkpng \
|
|
||||||
-lvtkzlib $(EXTRALIBS)
|
|
||||||
SWIGOPT = -mixed $(INCLUDE)
|
|
||||||
BTXETX = vtkFieldData.i vtkDataSetAttributes.i
|
|
||||||
|
|
||||||
# Symbols used for using shared libraries
|
|
||||||
SO = @SO@
|
|
||||||
LDSHARED = @LDSHARED@
|
|
||||||
CXXSHARED = @CXXSHARED@
|
|
||||||
|
|
||||||
# This is used for building shared libraries with a number of C++
|
|
||||||
# compilers. If it doesn't work, comment it out.
|
|
||||||
@TRYLINKINGWITHCXX@
|
|
||||||
|
|
||||||
all:: $(TARGET) example_generic.scm example_clos.scm
|
|
||||||
|
|
||||||
.SUFFIXES: .cxx
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(INCLUDE) $(CFLAGS) -c -o $*.o $<
|
|
||||||
|
|
||||||
.cxx.o:
|
|
||||||
$(CXX) $(INCLUDE) $(CFLAGS) -c -o $*.o $<
|
|
||||||
|
|
||||||
csi.c:
|
|
||||||
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
|
|
||||||
INTERFACE='precsi' chicken_csi
|
|
||||||
|
|
||||||
precsi.c: $(SOURCE_DIR)/precsi.scm
|
|
||||||
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
|
|
||||||
INTERFACE='$<' chicken
|
|
||||||
|
|
||||||
example_wrap.cxx example.scm example_generic.scm example_clos.scm: $(SOURCE_DIR)/example.i $(BTXETX)
|
|
||||||
(test $< -nt example.i && cp -p $< example.i) || echo example.i is up-to-date
|
|
||||||
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
|
|
||||||
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_cpp
|
|
||||||
|
|
||||||
oexample.c: example.scm
|
|
||||||
$(MAKE) -f $(TOP)/Makefile TARGET='oexample.c' \
|
|
||||||
INTERFACE='$<' chicken
|
|
||||||
|
|
||||||
$(TARGET): $(SRCS)
|
|
||||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
|
||||||
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
|
|
||||||
LIBS='$(LIBS)' INTERFACE='$(INTERFACE)' chicken_cpp_static
|
|
||||||
|
|
||||||
clean::
|
|
||||||
rm -f *_wrap* *.o core *~ *.so *.stackdump STACKTRACE
|
|
||||||
rm -f $(CHICKGEN) $(CHICKSRC)
|
|
||||||
rm -f $(BTXETX) example.scm example_generic.scm example_clos.scm
|
|
||||||
rm -f $(TARGET) c-sphere$(EXEEXT) c-quadric$(EXEEXT)
|
|
||||||
@echo
|
|
||||||
@echo You can clean VTK with: cd vtk$(VTKVER)/VTK '&&' make clean
|
|
||||||
@echo You can clean CMake with: cd $(CMAKEVER) '&&' make clean
|
|
||||||
|
|
||||||
check:
|
|
||||||
|
|
||||||
btx-etx::
|
|
||||||
@sed "s^//BTX^#if 0\/* start BTX <-> ETX */^g ;\
|
|
||||||
s^//ETX^#endif /* end BTX <-> ETX */^g" \
|
|
||||||
$(SOURCE) > $(DEST)
|
|
||||||
|
|
||||||
vtkFieldData.i: $(VTKHOME)/include/vtk/vtkFieldData.h
|
|
||||||
$(MAKE) SOURCE="$<" DEST="$@" btx-etx
|
|
||||||
|
|
||||||
vtkDataSetAttributes.i: $(VTKHOME)/include/vtk/vtkDataSetAttributes.h
|
|
||||||
$(MAKE) SOURCE="$<" DEST="$@" btx-etx
|
|
||||||
|
|
||||||
cmake: $(CMAKEVER).tar.gz
|
|
||||||
gunzip -d -c $(CMAKEVER).tar.gz | tar xvf - && \
|
|
||||||
cd $(CMAKEVER) && \
|
|
||||||
./configure --prefix $(THISDIR)/cmakelocal && \
|
|
||||||
make && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
vtkunix: vtk$(VTKVER)Src.tar.gz
|
|
||||||
mkdir vtk$(VTKVER) || echo Rebuilding VTK
|
|
||||||
cd vtk$(VTKVER) && \
|
|
||||||
gunzip -d -c ../vtk$(VTKVER)Src.tar.gz | tar xvf - && \
|
|
||||||
rm -f VTK/CMakeCache.txt && \
|
|
||||||
cd VTK && \
|
|
||||||
mv Utilities/Doxygen/doxyfile.in Utilities/Doxygen/doxyfile.in.orig && \
|
|
||||||
sed 's^GENERATE_\([A-Z]*[ ]*=[ ]*\)YES^GENERATE_\1NO^; $$ a GENERATE_XML = YES' Utilities/Doxygen/doxyfile.in.orig > Utilities/Doxygen/doxyfile.in && \
|
|
||||||
cmake . \
|
|
||||||
-DCMAKE_C_COMPILER:FILEPATH="$(CC)" \
|
|
||||||
-DCMAKE_C_LINK_SHARED:STRING="$(LDSHARED)" \
|
|
||||||
-DCMAKE_CXX_COMPILER:FILEPATH="$(CXX)" \
|
|
||||||
-DCMAKE_CXX_LINK_SHARED:STRING="$(CXXSHARED)" \
|
|
||||||
-DCMAKE_CXX_SHLIB_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_CXX_MODULE_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_MODULE_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_MODULE_SUFFIX:STRING="$(SO)" \
|
|
||||||
-DCMAKE_SHLIB_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_SHLIB_SUFFIX:STRING="$(SO)" \
|
|
||||||
-DCMAKE_MAKE_PROGRAM:FILEPATH="$(MAKE)" \
|
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH="$(THISDIR)/vtklocal" \
|
|
||||||
-DCMAKE_BACKWARDS_COMPATIBILITY:STRING=1.2 \
|
|
||||||
-DBUILD_DOCUMENTATION:BOOL=ON \
|
|
||||||
-DBUILD_SHARED_LIBS:BOOL=ON \
|
|
||||||
-DBUILD_EXAMPLES:BOOL=ON && \
|
|
||||||
make && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
# cygwin has OpenGL from the Windows API and X. We force it to use
|
|
||||||
# the Windows API so there is no conflict.
|
|
||||||
vtkcygwin: vtk$(VTKVER)Src.tar.gz
|
|
||||||
mkdir vtk$(VTKVER) || echo Rebuilding VTK
|
|
||||||
cd vtk$(VTKVER) && \
|
|
||||||
gunzip -d -c ../vtk$(VTKVER)Src.tar.gz | tar xvf - && \
|
|
||||||
rm -f VTK/CMakeCache.txt && \
|
|
||||||
cd VTK && \
|
|
||||||
mv Utilities/Doxygen/doxyfile.in Utilities/Doxygen/doxyfile.in.orig && \
|
|
||||||
sed 's^GENERATE_\([A-Z]*[ ]*=[ ]*\)YES^GENERATE_\1NO^; $$ a GENERATE_XML = YES' Utilities/Doxygen/doxyfile.in.orig > Utilities/Doxygen/doxyfile.in && \
|
|
||||||
mv Common/vtkViewport.h Common/vtkViewport.h.orig && \
|
|
||||||
sed -f ../../cygwin_viewport.sed Common/vtkViewport.h.orig > Common/vtkViewport.h && \
|
|
||||||
cmake . \
|
|
||||||
-DCMAKE_C_COMPILER:FILEPATH="$(CC)" \
|
|
||||||
-DCMAKE_C_LINK_SHARED:STRING="$(LDSHARED)" \
|
|
||||||
-DCMAKE_CXX_COMPILER:FILEPATH="$(CXX)" \
|
|
||||||
-DCMAKE_CXX_LINK_SHARED:STRING="$(CXXSHARED)" \
|
|
||||||
-DCMAKE_CXX_SHLIB_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_CXX_MODULE_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_MODULE_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_MODULE_SUFFIX:STRING="$(SO)" \
|
|
||||||
-DCMAKE_SHLIB_BUILD_FLAGS:STRING= \
|
|
||||||
-DCMAKE_SHLIB_SUFFIX:STRING="$(SO)" \
|
|
||||||
-DCMAKE_MAKE_PROGRAM:FILEPATH="$(MAKE)" \
|
|
||||||
-DCMAKE_X_CFLAGS:STRING=" -I/usr/include/w32api -I/usr/X11R6/include " \
|
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH="$(THISDIR)/vtklocal" \
|
|
||||||
-DCMAKE_BACKWARDS_COMPATIBILITY:STRING=1.2 \
|
|
||||||
-DBUILD_DOCUMENTATION:BOOL=ON \
|
|
||||||
-DBUILD_SHARED_LIBS:BOOL=ON \
|
|
||||||
-DBUILD_EXAMPLES:BOOL=ON && \
|
|
||||||
make && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
vtkdoc: vtk$(VTKVER)/VTK/Utilities/Doxygen/Makefile
|
|
||||||
$(MAKE) -f $< DoxygenDoc
|
|
||||||
|
|
||||||
c: c-sphere$(EXEEXT) c-quadric$(EXEEXT)
|
|
||||||
|
|
||||||
c-sphere$(EXEEXT): c-sphere.o
|
|
||||||
$(CXX) $< $(LIBS) -o $@
|
|
||||||
|
|
||||||
c-quadric$(EXEEXT): c-quadric.o
|
|
||||||
$(CXX) $< $(LIBS) -o $@
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
||||||
Wrappers for the Visualization Toolkit (VTK).
|
|
||||||
|
|
||||||
VTK must be installed first.
|
|
||||||
|
|
||||||
VTK Installation Instructions
|
|
||||||
-----------------------------
|
|
||||||
|
|
||||||
Warning to GCC users:
|
|
||||||
|
|
||||||
GCC version 3 cannot be used to compile VTK; you may check the version
|
|
||||||
of gcc with "gcc -version". GCC version 3 is the default compiler on
|
|
||||||
recent cygwin systems, and is used on some other newer systems as
|
|
||||||
well. Be sure that you have another compiler or GCC version 2 on your
|
|
||||||
system (for example, the package "gcc2" on cygwin). You will specify
|
|
||||||
your other compiler on *ALL* commands that start with "make". For
|
|
||||||
example, if you have the "gcc2" package on cygwin, when you get to the
|
|
||||||
following VTK build instruction:
|
|
||||||
|
|
||||||
make VTKVER=40 vtkcygwin
|
|
||||||
|
|
||||||
use instead:
|
|
||||||
|
|
||||||
make VTKVER=40 CC="gcc-2" CXX="c++-2" LDSHARED="gcc-2 -shared" CXXSHARED="c++-2 -shared" vtkcygwin
|
|
||||||
|
|
||||||
On non-cygwin system, the VTK build instruction:
|
|
||||||
|
|
||||||
make VTKVER=40 vtkunix
|
|
||||||
|
|
||||||
would be replaced by:
|
|
||||||
|
|
||||||
make VTKVER=40 CC="<path to non-gcc3 C compiler>" CXX="<path to non-gcc3 C++ compiler>" LDSHARED="<path to non-gcc3 C shared linker>" CXXSHARED="<path to non-gcc3 C++ shared linker>" vtkunix
|
|
||||||
|
|
||||||
and so on ...
|
|
||||||
|
|
||||||
GENERAL NOTE: At this moment, Common/vtkViewport.o is not included in
|
|
||||||
libCommon.a for VTK 4.0. This causes problems and is an obvious
|
|
||||||
mistake. So the Makefile looks for vtkViewport.o in the
|
|
||||||
vtk40/VTK/Common directory when building this SWIG example. So only
|
|
||||||
Method 3 is an option right now (or Method 2 if you copy vtkViewport.o
|
|
||||||
to .../chicken/vtk/vtk40/VTK/Common/).
|
|
||||||
|
|
||||||
|
|
||||||
-- Method 1 (Win32 with mingw) --
|
|
||||||
|
|
||||||
Download vtk40Core.exe and vtkCpp.exe from
|
|
||||||
http://public.kitware.com/VTK/get-software.php.
|
|
||||||
|
|
||||||
Run vtk40Core.exe and install to wherever (I will assume you
|
|
||||||
installed to the default "C:\Program Files\vtk4.0").
|
|
||||||
|
|
||||||
Run vtkCpp.exe and install to the same directory you install
|
|
||||||
vtk40Core.
|
|
||||||
|
|
||||||
Before building this SWIG example, set
|
|
||||||
VTKHOME=C:\Program Files\vtk4.0
|
|
||||||
|
|
||||||
and then run "make" in this chicken/vtk directory using Mingw32 (that
|
|
||||||
is, run Cygwin shell, and set the PATH to .../mingw/bin).
|
|
||||||
|
|
||||||
-- Method 2 --
|
|
||||||
|
|
||||||
Download a source archive (either vtk40Src.zip or vtk40Src.tar.gz)
|
|
||||||
from http://public.kitware.com/VTK/get-software.php and follow the
|
|
||||||
instructions using "README.html" (which is inside vtk40Src).
|
|
||||||
|
|
||||||
-- Method 3 (Unix or Cygwin) --
|
|
||||||
|
|
||||||
If you do not have "cmake" installed on your system, do the following
|
|
||||||
and it will be installed in chicken/vtk/cmakelocal:
|
|
||||||
|
|
||||||
Download
|
|
||||||
|
|
||||||
cmake-1.6.2.tar.gz from
|
|
||||||
http://www.cmake.org/HTML/Download.html
|
|
||||||
|
|
||||||
and place it in this chicken/vtk directory.
|
|
||||||
|
|
||||||
Type:
|
|
||||||
make CMAKEVER=cmake-1.6.2 cmake
|
|
||||||
PATH=${PWD}/cmakelocal/bin:$PATH
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
If you do not have "vtk" installed on your system, do the following
|
|
||||||
and it will be installed in chicken/vtk/vtklocal:
|
|
||||||
|
|
||||||
Download
|
|
||||||
|
|
||||||
vtk40Src.tar.gz from
|
|
||||||
http://public.kitware.com/VTK/get-software.php
|
|
||||||
|
|
||||||
and place it in this chicken/vtk directory.
|
|
||||||
|
|
||||||
Type (for cygwin):
|
|
||||||
make VTKVER=40 vtkcygwin
|
|
||||||
|
|
||||||
(for everyone else):
|
|
||||||
make VTKVER=40 vtkunix
|
|
||||||
|
|
||||||
VTK SWIG Example
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Make sure that VTK is installed. If you followed the previous
|
|
||||||
instructions, then VTK will be installed in .../chicken/vtk/vtklocal.
|
|
||||||
The following instructions will assume ${PWD}/vtklocal; if you
|
|
||||||
installed VTK elsewhere, use the correct installation path
|
|
||||||
(ie. /usr/local instead of ${PWD}/vtklocal).
|
|
||||||
|
|
||||||
First, test to make sure VTK is working ...
|
|
||||||
|
|
||||||
cygwin:
|
|
||||||
make EXTRALIBS="-lgdi32 -lopengl32" VTKHOME=${PWD}/vtklocal c
|
|
||||||
./c-sphere.exe
|
|
||||||
./c-quadric.exe
|
|
||||||
|
|
||||||
other Unixes:
|
|
||||||
make EXTRALIBS="-L/usr/X11R6/lib -lGL -lGLU -lGLw" VTKHOME=${PWD}/vtklocal c
|
|
||||||
./c-sphere
|
|
||||||
./c-quadric
|
|
||||||
|
|
||||||
|
|
||||||
You should see a blue sphere that you can manipulate with the mouse
|
|
||||||
buttons.
|
|
||||||
|
|
||||||
Second, test to make sure the SWIG wrappers can be generated and work
|
|
||||||
for VTK ...
|
|
||||||
|
|
||||||
cygwin:
|
|
||||||
make EXTRALIBS="-lgdi32 -lopengl32" VTKHOME=${PWD}/vtklocal
|
|
||||||
./vtk test-vtk-sphere.scm
|
|
||||||
./vtk test-vtk-quadric.scm
|
|
||||||
|
|
||||||
other Unixes:
|
|
||||||
make EXTRALIBS="-L/usr/X11R6/lib -lGL -lGLU -lGLw" VTKHOME=${PWD}/vtklocal
|
|
||||||
./vtk test-vtk-sphere.scm
|
|
||||||
./vtk test-vtk-quadric.scm
|
|
||||||
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
#include "vtkQuadric.h"
|
|
||||||
#include "vtkSampleFunction.h"
|
|
||||||
#include "vtkContourFilter.h"
|
|
||||||
#include "vtkOutlineFilter.h"
|
|
||||||
#include "vtkPolyDataMapper.h"
|
|
||||||
#include "vtkActor.h"
|
|
||||||
#include "vtkRenderWindow.h"
|
|
||||||
#include "vtkRenderer.h"
|
|
||||||
#include "vtkRenderWindowInteractor.h"
|
|
||||||
|
|
||||||
void main ()
|
|
||||||
{
|
|
||||||
// -- create the quadric function object --
|
|
||||||
|
|
||||||
// create the quadric function definition
|
|
||||||
vtkQuadric *quadric = vtkQuadric::New();
|
|
||||||
quadric->SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0);
|
|
||||||
|
|
||||||
// sample the quadric function
|
|
||||||
vtkSampleFunction *sample = vtkSampleFunction::New();
|
|
||||||
sample->SetSampleDimensions(50,50,50);
|
|
||||||
sample->SetImplicitFunction(quadric);
|
|
||||||
|
|
||||||
// Create five surfaces F(x,y,z) = constant between range specified
|
|
||||||
vtkContourFilter *contours = vtkContourFilter::New();
|
|
||||||
contours->SetInput(sample->GetOutput());
|
|
||||||
contours->GenerateValues(5, 0.0, 1.2);
|
|
||||||
|
|
||||||
// map the contours to graphical primitives
|
|
||||||
vtkPolyDataMapper *contMapper = vtkPolyDataMapper::New();
|
|
||||||
contMapper->SetInput(contours->GetOutput());
|
|
||||||
contMapper->SetScalarRange(0.0, 1.2);
|
|
||||||
|
|
||||||
// create an actor for the contours
|
|
||||||
vtkActor *contActor = vtkActor::New();
|
|
||||||
contActor->SetMapper(contMapper);
|
|
||||||
|
|
||||||
// -- create a box around the function to indicate the sampling volume --
|
|
||||||
|
|
||||||
// create outline
|
|
||||||
vtkOutlineFilter *outline = vtkOutlineFilter::New();
|
|
||||||
outline->SetInput(sample->GetOutput());
|
|
||||||
|
|
||||||
// map it to graphics primitives
|
|
||||||
vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();
|
|
||||||
outlineMapper->SetInput(outline->GetOutput());
|
|
||||||
|
|
||||||
// create an actor for it
|
|
||||||
vtkActor *outlineActor = vtkActor::New();
|
|
||||||
outlineActor->SetMapper(outlineMapper);
|
|
||||||
outlineActor->GetProperty()->SetColor(0,0,0);
|
|
||||||
|
|
||||||
// -- render both of the objects --
|
|
||||||
|
|
||||||
// a renderer and render window
|
|
||||||
vtkRenderer *ren1 = vtkRenderer::New();
|
|
||||||
vtkRenderWindow *renWin = vtkRenderWindow::New();
|
|
||||||
renWin->AddRenderer(ren1);
|
|
||||||
|
|
||||||
// an interactor
|
|
||||||
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
|
|
||||||
iren->SetRenderWindow(renWin);
|
|
||||||
|
|
||||||
// add the actors to the scene
|
|
||||||
ren1->AddActor(contActor);
|
|
||||||
ren1->AddActor(outlineActor);
|
|
||||||
ren1->SetBackground(1,1,1); // Background color white
|
|
||||||
|
|
||||||
// render an image (lights and cameras are created automatically)
|
|
||||||
renWin->Render();
|
|
||||||
|
|
||||||
// begin mouse interaction
|
|
||||||
iren->Start();
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
#include "vtkSphereSource.h"
|
|
||||||
#include "vtkPolyDataMapper.h"
|
|
||||||
#include "vtkActor.h"
|
|
||||||
#include "vtkRenderWindow.h"
|
|
||||||
#include "vtkRenderer.h"
|
|
||||||
#include "vtkRenderWindowInteractor.h"
|
|
||||||
|
|
||||||
int main ()
|
|
||||||
{
|
|
||||||
|
|
||||||
// create sphere geometry
|
|
||||||
vtkSphereSource *sphere = vtkSphereSource::New();
|
|
||||||
sphere->SetRadius(1.0);
|
|
||||||
sphere->SetThetaResolution(18);
|
|
||||||
sphere->SetPhiResolution(18);
|
|
||||||
|
|
||||||
// map to graphics library
|
|
||||||
vtkPolyDataMapper *map = vtkPolyDataMapper::New();
|
|
||||||
map->SetInput(sphere->GetOutput());
|
|
||||||
|
|
||||||
// actor coordinates geometry, properties, transformation
|
|
||||||
vtkActor *aSphere = vtkActor::New();
|
|
||||||
aSphere->SetMapper(map);
|
|
||||||
aSphere->GetProperty()->SetColor(0,0,1); // sphere color blue
|
|
||||||
|
|
||||||
// a renderer and render window
|
|
||||||
vtkRenderer *ren1 = vtkRenderer::New();
|
|
||||||
vtkRenderWindow *renWin = vtkRenderWindow::New();
|
|
||||||
renWin->AddRenderer(ren1);
|
|
||||||
|
|
||||||
// an interactor
|
|
||||||
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
|
|
||||||
iren->SetRenderWindow(renWin);
|
|
||||||
|
|
||||||
// add the actor to the scene
|
|
||||||
ren1->AddActor(aSphere);
|
|
||||||
ren1->SetBackground(1,1,1); // Background color white
|
|
||||||
|
|
||||||
// render an image (lights and cameras are created automatically)
|
|
||||||
renWin->Render();
|
|
||||||
|
|
||||||
// begin mouse interaction
|
|
||||||
iren->Start();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
/class VTK_COMMON_EXPORT vtkViewport/ {
|
|
||||||
i /* cygwin: /usr/include/w32api/winuser.h redefines RemoveProp */\
|
|
||||||
#ifdef RemoveProp\
|
|
||||||
#undef RemoveProp\
|
|
||||||
#endif\
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,335 +0,0 @@
|
||||||
/* File : example.i */
|
|
||||||
%module example
|
|
||||||
|
|
||||||
/* STANDARD VTK CLASSES */
|
|
||||||
|
|
||||||
%{
|
|
||||||
/* Put headers and other declarations here. SWIG does not parse this
|
|
||||||
section. */
|
|
||||||
#include "vtkConfigure.h"
|
|
||||||
#include "vtkSystemIncludes.h"
|
|
||||||
#ifdef VTK_MAJOR_VERSION
|
|
||||||
/* only defined since Nov 19 2002, just after 4.0 release */
|
|
||||||
#include "vtkObjectBase.h"
|
|
||||||
#endif
|
|
||||||
#include "vtkIndent.h"
|
|
||||||
#include "vtkTimeStamp.h"
|
|
||||||
#include "vtkSetGet.h"
|
|
||||||
#include "vtkObject.h"
|
|
||||||
#include "vtkCommand.h"
|
|
||||||
#include "vtkDataArray.h"
|
|
||||||
#include "vtkIdList.h"
|
|
||||||
#include "vtkFieldData.h"
|
|
||||||
#include "vtkDataObject.h"
|
|
||||||
#include "vtkDataSetAttributes.h"
|
|
||||||
#include "vtkCellData.h"
|
|
||||||
#include "vtkPointData.h"
|
|
||||||
#include "vtkCell.h"
|
|
||||||
#include "vtkGenericCell.h"
|
|
||||||
#include "vtkCellTypes.h"
|
|
||||||
#include "vtkDataSet.h"
|
|
||||||
#include "vtkLocator.h"
|
|
||||||
#include "vtkPoints.h"
|
|
||||||
#include "vtkPointLocator.h"
|
|
||||||
#include "vtkPointSet.h"
|
|
||||||
#include "vtkCellArray.h"
|
|
||||||
#include "vtkCellLinks.h"
|
|
||||||
#include "vtkProcessObject.h"
|
|
||||||
#include "vtkSource.h"
|
|
||||||
#include "vtkPolyData.h"
|
|
||||||
#include "vtkPolyDataSource.h"
|
|
||||||
#include "vtkSphereSource.h"
|
|
||||||
#include "vtkCollection.h"
|
|
||||||
#include "vtkImplicitFunction.h"
|
|
||||||
#include "vtkPlane.h"
|
|
||||||
#include "vtkPlaneCollection.h"
|
|
||||||
#include "vtkPlanes.h"
|
|
||||||
#include "vtkTimerLog.h"
|
|
||||||
#include "vtkAbstractMapper.h"
|
|
||||||
#include "vtkAbstractMapper3D.h"
|
|
||||||
#include "vtkScalarsToColors.h"
|
|
||||||
#include "vtkMapper.h"
|
|
||||||
#include "vtkQuadric.h"
|
|
||||||
#include "vtkImageSource.h"
|
|
||||||
#include "vtkImageData.h"
|
|
||||||
#include "vtkStructuredPoints.h"
|
|
||||||
#include "vtkStructuredPointsSource.h"
|
|
||||||
#include "vtkSampleFunction.h"
|
|
||||||
#include "vtkDataSetToPolyDataFilter.h"
|
|
||||||
#include "vtkContourValues.h"
|
|
||||||
#include "vtkContourFilter.h"
|
|
||||||
#include "vtkOutlineFilter.h"
|
|
||||||
#include "vtkPolyDataMapper.h"
|
|
||||||
#include "vtkProp.h"
|
|
||||||
#include "vtkProp3D.h"
|
|
||||||
#include "vtkProperty.h"
|
|
||||||
#include "vtkTexture.h"
|
|
||||||
#include "vtkActor.h"
|
|
||||||
#include "vtkWindow.h"
|
|
||||||
#include "vtkRendererCollection.h"
|
|
||||||
#include "vtkGraphicsFactory.h"
|
|
||||||
#include "vtkRenderWindow.h"
|
|
||||||
#include "vtkMatrix4x4.h"
|
|
||||||
#include "vtkLightCollection.h"
|
|
||||||
#include "vtkPropCollection.h"
|
|
||||||
#include "vtkVolumeCollection.h"
|
|
||||||
#include "vtkCullerCollection.h"
|
|
||||||
#include "vtkCamera.h"
|
|
||||||
#include "vtkActor2D.h"
|
|
||||||
#include "vtkViewport.h"
|
|
||||||
#include "vtkActorCollection.h"
|
|
||||||
#include "vtkRenderer.h"
|
|
||||||
#include "vtkRenderWindowInteractor.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include typemaps.i
|
|
||||||
|
|
||||||
#define VTK_COMMON_EXPORT
|
|
||||||
#define VTK_FILTERING_EXPORT
|
|
||||||
#define VTK_GRAPHICS_EXPORT
|
|
||||||
#define VTK_IMAGING_EXPORT
|
|
||||||
#define VTK_RENDERING_EXPORT
|
|
||||||
|
|
||||||
|
|
||||||
/* We need a way to convert the input and output arguments that are
|
|
||||||
VTK objects into TinyCLOS objects, and vice versa. We can use the
|
|
||||||
clos_in and clos_out typemaps for this. Just specify the typemaps
|
|
||||||
for classes that are at the top of the inheritance tree.
|
|
||||||
|
|
||||||
We have things quite easy because VTK handles object deletion with
|
|
||||||
reference counting (so we don't have to make a finalizer procedure
|
|
||||||
for the garbage collector), and because most of the classes derive
|
|
||||||
from vtkObjectBase or vtkObject.
|
|
||||||
|
|
||||||
In post VTK 4.0 releases, most things derive from vtkObjectBase.
|
|
||||||
In other releases, things come from vtkObject. */
|
|
||||||
#ifdef VTK_MAJOR_VERSION
|
|
||||||
/* only defined since Nov 19 2002, just after 4.0 release */
|
|
||||||
%typemap("clos_in") vtkObjectBase * = SIMPLE_CLOS_OBJECT *;
|
|
||||||
%typemap("clos_out") vtkObjectBase * = SIMPLE_CLOS_OBJECT *;
|
|
||||||
#else
|
|
||||||
%typemap("clos_in") vtkObject * = SIMPLE_CLOS_OBJECT *;
|
|
||||||
%typemap("clos_out") vtkObject * = SIMPLE_CLOS_OBJECT *;
|
|
||||||
#endif
|
|
||||||
%apply SIMPLE_CLOS_OBJECT * {
|
|
||||||
vtkIndent*, vtkTimeStamp*, vtkCollectionElement*, vtkTimerLogEntry*,
|
|
||||||
vtkCommand*, _vtkLink_s*
|
|
||||||
};
|
|
||||||
|
|
||||||
/* We have one problem with the above typemaps ... they assume that
|
|
||||||
SWIG can know that a given class is derived from one of the above
|
|
||||||
superclasses (like derived from vtkObjectBase). However, sometimes
|
|
||||||
SWIG will get to a function or member declaration that relies some
|
|
||||||
object that was forward declared. For example,
|
|
||||||
|
|
||||||
class vtkRenderer;
|
|
||||||
class vtkRenderWindow {
|
|
||||||
// ...
|
|
||||||
virtual void AddRenderer (vtkRenderer *rendererArg);
|
|
||||||
// ...
|
|
||||||
};
|
|
||||||
|
|
||||||
In this case, SWIG cannot know that vtkRenderer is derived from
|
|
||||||
vtkObject, and hence will not put a TinyCLOS clos_in/clos_out
|
|
||||||
converter around "rendererArg" (instead, you will have to pass in a
|
|
||||||
low-level SWIG CHICKEN object pointer).
|
|
||||||
|
|
||||||
To help SWIG out, we explicitly define clos_in/clos_out typemaps
|
|
||||||
for some of the classes that are forward declared.
|
|
||||||
*/
|
|
||||||
%apply SIMPLE_CLOS_OBJECT * {
|
|
||||||
vtkRenderer*
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The -mixed command line argument for SWIG will screw up on esoteric
|
|
||||||
names (with two upcase characters in a row) like below. Example:
|
|
||||||
GetMTime becomes get-mt-ime, but if we rename it to Get_M_Time, it
|
|
||||||
becomes get-m-time. So we help it along by putting in
|
|
||||||
underscores. */
|
|
||||||
%rename GetMTime Get_M_Time;
|
|
||||||
%rename SetMTime Set_M_Time;
|
|
||||||
%rename ShouldIReleaseData Should_I_Release_Data;
|
|
||||||
%rename SetPipelineMTime Set_Pipeline_M_Time;
|
|
||||||
%rename GetPipelineMTime Get_Pipeline_M_Time;
|
|
||||||
%rename SetActiveTCoords Set_Active_T_Coords;
|
|
||||||
%rename GetActiveTCoords Get_Active_T_Coords;
|
|
||||||
%rename SetTCoords Set_T_Coords;
|
|
||||||
%rename GetTCoords Get_T_Coords;
|
|
||||||
%rename SetCopyTCoords Set_Copy_T_Coords;
|
|
||||||
%rename GetCopyTCoords Get_Copy_T_Coords;
|
|
||||||
%rename HitBBox Hit_B_Box;
|
|
||||||
%rename IsARenderIntoImageMapper Is_A_Render_Into_Image_Mapper;
|
|
||||||
%rename IsARayCastMapper Is_A_Ray_Cast_Mapper;
|
|
||||||
%rename GetRedrawMTime Get_Redraw_M_Time;
|
|
||||||
%rename SetRedrawMTime Set_Redraw_M_Time;
|
|
||||||
%rename GetXRange Get_X_Range;
|
|
||||||
%rename SetXRange Set_X_Range;
|
|
||||||
%rename GetYRange Get_Y_Range;
|
|
||||||
%rename SetYRange Set_Y_Range;
|
|
||||||
%rename GetZRange Get_Z_Range;
|
|
||||||
%rename SetZRange Set_Z_Range;
|
|
||||||
%rename GetDPIMinValue Get_DPI_Min_Value;
|
|
||||||
%rename SetDPIMinValue Set_DPI_Min_Value;
|
|
||||||
%rename GetDPIMaxValue Get_DPI_Max_Value;
|
|
||||||
%rename SetDPIMaxValue Set_DPI_Max_Value;
|
|
||||||
%rename GetRGBAPixelData Get_RGBA_Pixel_Data;
|
|
||||||
%rename SetRGBAPixelData Set_RGBA_Pixel_Data;
|
|
||||||
%rename GetRGBACharPixelData Get_RGBA_Char_Pixel_Data;
|
|
||||||
%rename SetRGBACharPixelData Set_RGBA_Char_Pixel_Data;
|
|
||||||
%rename GetAAFrames Get_AA_Frames;
|
|
||||||
%rename SetAAFrames Set_AA_Frames;
|
|
||||||
%rename GetFDFrames Get_FD_Frames;
|
|
||||||
%rename SetFDFrames Set_FD_Frames;
|
|
||||||
|
|
||||||
/* Things that are too difficult to wrap: We have 2 general mechanisms
|
|
||||||
to exclude the difficult classes and/or methods from SWIG.
|
|
||||||
|
|
||||||
1. Write an SWIG interface file (we use a .i suffix) that is a
|
|
||||||
copy of the header file with the difficult parts removed.
|
|
||||||
|
|
||||||
2. Use "%ignore" directives, before SWIG parses the relevant
|
|
||||||
class/method/function/variable declaration. Example:
|
|
||||||
|
|
||||||
%ignore vtkDataSet::POINT_DATA_FIELD;
|
|
||||||
%ignore someVariable;
|
|
||||||
%ignore someFunction;
|
|
||||||
%ignore someMethod;
|
|
||||||
%ignore someClass;
|
|
||||||
%ignore someClass::someMethod;
|
|
||||||
|
|
||||||
Now it so happens that VTK already comes with its own
|
|
||||||
Python/TCL/Java wrapper modules, and the difficult sections have
|
|
||||||
already been marked in the header files. VTK uses //BTX to mark
|
|
||||||
the beginning of a difficult section, and //ETX to mark the end.
|
|
||||||
So we use a simple 'sed' script to change //BTX to "#if 0" and
|
|
||||||
//ETX to "#endif", and place the result in a .i file. This is done
|
|
||||||
by the "btx-etx" Makefile target.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
%include "vtkConfigure.h"
|
|
||||||
%include "vtkSystemIncludes.h"
|
|
||||||
#ifdef VTK_MAJOR_VERSION
|
|
||||||
/* only defined since Nov 19 2002, just after 4.0 release */
|
|
||||||
%include "vtkObjectBase.h"
|
|
||||||
#endif
|
|
||||||
%include "vtkIndent.h"
|
|
||||||
%include "vtkTimeStamp.h"
|
|
||||||
%include "vtkSetGet.h"
|
|
||||||
%include "vtkCommand.h"
|
|
||||||
%include "vtkObject.h"
|
|
||||||
%include "vtkDataArray.h"
|
|
||||||
%include "vtkIdList.h"
|
|
||||||
%include "vtkFieldData.i"
|
|
||||||
%include "vtkDataObject.h"
|
|
||||||
%include "vtkDataSetAttributes.i"
|
|
||||||
%include "vtkCellData.h"
|
|
||||||
%include "vtkPointData.h"
|
|
||||||
%include "vtkCell.h"
|
|
||||||
%include "vtkGenericCell.h"
|
|
||||||
%include "vtkCellTypes.h"
|
|
||||||
%include "vtkDataSet.h"
|
|
||||||
%include "vtkLocator.h"
|
|
||||||
%include "vtkPoints.h"
|
|
||||||
%include "vtkPointLocator.h"
|
|
||||||
%include "vtkPointSet.h"
|
|
||||||
%include "vtkCellArray.h"
|
|
||||||
%include "vtkCellLinks.h"
|
|
||||||
%include "vtkProcessObject.h"
|
|
||||||
%include "vtkSource.h"
|
|
||||||
%include "vtkPolyData.h"
|
|
||||||
%include "vtkPolyDataSource.h"
|
|
||||||
%include "vtkSphereSource.h"
|
|
||||||
%include "vtkCollection.h"
|
|
||||||
%include "vtkImplicitFunction.h"
|
|
||||||
%include "vtkPlane.h"
|
|
||||||
%include "vtkPlaneCollection.h"
|
|
||||||
%include "vtkPlanes.h"
|
|
||||||
%include "vtkTimerLog.h"
|
|
||||||
%include "vtkAbstractMapper.h"
|
|
||||||
%include "vtkAbstractMapper3D.h"
|
|
||||||
%include "vtkScalarsToColors.h"
|
|
||||||
%include "vtkMapper.h"
|
|
||||||
%include "vtkQuadric.h"
|
|
||||||
%include "vtkImageSource.h"
|
|
||||||
%include "vtkImageData.h"
|
|
||||||
%include "vtkStructuredPoints.h"
|
|
||||||
%include "vtkStructuredPointsSource.h"
|
|
||||||
%include "vtkSampleFunction.h"
|
|
||||||
%include "vtkDataSetToPolyDataFilter.h"
|
|
||||||
%include "vtkContourValues.h"
|
|
||||||
%include "vtkContourFilter.h"
|
|
||||||
%include "vtkOutlineFilter.h"
|
|
||||||
%include "vtkPolyDataMapper.h"
|
|
||||||
%include "vtkProp.h"
|
|
||||||
%include "vtkProp3D.h"
|
|
||||||
%include "vtkProperty.h"
|
|
||||||
%include "vtkTexture.h"
|
|
||||||
%include "vtkActor.h"
|
|
||||||
%include "vtkWindow.h"
|
|
||||||
%include "vtkRendererCollection.h"
|
|
||||||
%include "vtkGraphicsFactory.h"
|
|
||||||
%include "vtkRenderWindow.h"
|
|
||||||
%include "vtkMatrix4x4.h"
|
|
||||||
%include "vtkLightCollection.h"
|
|
||||||
%include "vtkPropCollection.h"
|
|
||||||
%include "vtkVolumeCollection.h"
|
|
||||||
%include "vtkCullerCollection.h"
|
|
||||||
%include "vtkCamera.h"
|
|
||||||
%include "vtkActor2D.h"
|
|
||||||
%include "vtkViewport.h"
|
|
||||||
%include "vtkActorCollection.h"
|
|
||||||
%include "vtkRenderer.h"
|
|
||||||
%include "vtkRenderWindowInteractor.h"
|
|
||||||
|
|
||||||
/* VTK CALLBACKS */
|
|
||||||
|
|
||||||
/* We want lambda procedures to be used as callbacks in VTK. To do
|
|
||||||
this, we must create a subclass of vtkCommand and let it's Execute
|
|
||||||
method call our Scheme lambda procedures. */
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include "vtkChickenCommand.h"
|
|
||||||
vtkObject * pointerToVtkObject (C_word obj) {
|
|
||||||
if (!C_swig_is_ptr(obj)) return 0;
|
|
||||||
return (vtkObject*)C_pointer_address(obj);
|
|
||||||
}
|
|
||||||
vtkCommand* pointerToVtkCommand (C_word obj) {
|
|
||||||
if (!C_swig_is_ptr(obj)) return 0;
|
|
||||||
return (vtkCommand*)C_pointer_address(obj);
|
|
||||||
}
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "vtkChickenCommand.h"
|
|
||||||
extern vtkObject * pointerToVtkObject (C_word obj);
|
|
||||||
extern vtkCommand* pointerToVtkCommand (C_word obj);
|
|
||||||
|
|
||||||
%insert(chicken) {
|
|
||||||
(define-external
|
|
||||||
(execute_vtk_chicken_command
|
|
||||||
(c-pointer thisCommand) ;; vtkCommand *
|
|
||||||
(scheme-object continuation)
|
|
||||||
(c-pointer caller) ;; vtkObject *
|
|
||||||
(unsigned-long eventId)
|
|
||||||
(c-pointer callData) ;; void *
|
|
||||||
)
|
|
||||||
void
|
|
||||||
(continuation (+example-pointer-to-vtk-command+ thisCommand)
|
|
||||||
(+example-pointer-to-vtk-object+ caller) eventId callData)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DEBUGGING CLASSES */
|
|
||||||
|
|
||||||
%{
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
istream *std_cin = &cin;
|
|
||||||
ostream *std_cout = &cout;
|
|
||||||
ostream *std_cerr = &cerr;
|
|
||||||
|
|
||||||
%}
|
|
||||||
|
|
||||||
extern istream *std_cin;
|
|
||||||
extern ostream *std_cout;
|
|
||||||
extern ostream *std_cerr;
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
(declare (unit precsi))
|
|
||||||
(declare (uses example))
|
|
||||||
|
|
||||||
(if (not (member "-quiet" (cdr (argv))))
|
|
||||||
(begin
|
|
||||||
;; display prelude to csi
|
|
||||||
(display "vtk\n\n")
|
|
||||||
|
|
||||||
(display " A SWIG example for the CHICKEN compiler\n")
|
|
||||||
(display " Author: Jonah Beckford, January 2003\n\n")
|
|
||||||
|
|
||||||
(display "C++ Classes:\n")
|
|
||||||
(display " See http://www.vtk.org/doc/nightly/html/\n")
|
|
||||||
|
|
||||||
(display "\n")
|
|
||||||
|
|
||||||
(display "Scheme Procedures:\n")
|
|
||||||
(display " There are way too many to document.\n")
|
|
||||||
(display " Examples:
|
|
||||||
vtkSphereSource::SetRadius (float radius) is
|
|
||||||
(example-vtk-sphere-source-set-radius %sphere %radius)
|
|
||||||
")
|
|
||||||
|
|
||||||
(display "\n")
|
|
||||||
|
|
||||||
(display "TinyCLOS Classes:\n")
|
|
||||||
(display " There are way too many to document.\n")
|
|
||||||
(display " Examples:
|
|
||||||
vtkSphereSource::SetRadius (float radius) is
|
|
||||||
(-SetRadius- %sphereObject %radius)
|
|
||||||
")
|
|
||||||
|
|
||||||
(display "\n")))
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
;; run with './vtk test-vtk-sphere.scm'
|
|
||||||
|
|
||||||
;; All generic methods must be included first
|
|
||||||
(include "example_generic")
|
|
||||||
|
|
||||||
;; After generic are defined, can include TinyCLOS code
|
|
||||||
(include "example_clos")
|
|
||||||
|
|
||||||
;; -----------------
|
|
||||||
;; Creating a sphere
|
|
||||||
;; -----------------
|
|
||||||
|
|
||||||
;; create sphere geometry
|
|
||||||
(define sphere (+example-vtk-sphere-source-new+))
|
|
||||||
(-SetRadius- sphere 1.0)
|
|
||||||
(-SetThetaResolution- sphere 18)
|
|
||||||
(-SetPhiResolution- sphere 18)
|
|
||||||
|
|
||||||
;; create an observer
|
|
||||||
(define printStatus
|
|
||||||
(lambda (thisCommand caller eventId data)
|
|
||||||
(display "Received an event!\n")
|
|
||||||
(display "event: ")
|
|
||||||
(display (example-vtk-command-get-string-from-event-id
|
|
||||||
(exact->inexact eventId)))
|
|
||||||
(display "\n")
|
|
||||||
(display "caller: class ")
|
|
||||||
(display (-GetClassName- caller))
|
|
||||||
(display "\n")
|
|
||||||
(-PrintSelf- caller (example-std-cout) (make <example-vtk-indent> 4))
|
|
||||||
(display "data: ")
|
|
||||||
(display data)
|
|
||||||
(display "\n\n")))
|
|
||||||
(define printStatusObserver (example-vtk-chicken-command-new printStatus))
|
|
||||||
|
|
||||||
;; attach observer to sphere's Start event
|
|
||||||
(-AddObserver- sphere (exact->inexact (example-vtk-command-start-event))
|
|
||||||
printStatusObserver)
|
|
||||||
|
|
||||||
;; map to graphics library
|
|
||||||
(define mymap (+example-vtk-poly-data-mapper-new+))
|
|
||||||
(-SetInput- mymap (-GetOutput- sphere))
|
|
||||||
|
|
||||||
;; actor coordinates geometry, properties, transformation
|
|
||||||
(define aSphere (+example-vtk-actor-new+))
|
|
||||||
(-SetMapper- aSphere mymap)
|
|
||||||
(-SetColor- (-GetProperty- aSphere) 0. 0. 1.) ;; sphere color blue
|
|
||||||
|
|
||||||
;; a renderer and render window
|
|
||||||
(define ren1 (+example-vtk-renderer-new+))
|
|
||||||
(define renWin (+example-vtk-render-window-new+))
|
|
||||||
(-AddRenderer- renWin ren1)
|
|
||||||
|
|
||||||
;; an interactor
|
|
||||||
(define iren (+example-vtk-render-window-interactor-new+))
|
|
||||||
(-SetRenderWindow- iren renWin)
|
|
||||||
|
|
||||||
;; attach observer to interactor's User event
|
|
||||||
(-AddObserver- iren (exact->inexact (example-vtk-command-user-event))
|
|
||||||
printStatusObserver)
|
|
||||||
|
|
||||||
;; add the actor to the scene
|
|
||||||
(-AddActor- ren1 aSphere)
|
|
||||||
(-SetBackground- ren1 1. 1. 1.) ;; Background color white
|
|
||||||
|
|
||||||
;; render an image (lights and cameras are created automatically)
|
|
||||||
(-Render- renWin)
|
|
||||||
|
|
||||||
;; begin mouse interaction
|
|
||||||
(display "Press 'u' for user event, and 'q' to quit ...\n\n")
|
|
||||||
(-Start- iren)
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
;; run with './vtk test-vtk-quadric.scm'
|
|
||||||
|
|
||||||
;; All generic methods must be included first
|
|
||||||
(include "example_generic")
|
|
||||||
|
|
||||||
;; After generic are defined, can include TinyCLOS code
|
|
||||||
(include "example_clos")
|
|
||||||
|
|
||||||
;; ------------------------------
|
|
||||||
;; Visualizing a Quadric Function
|
|
||||||
;; ------------------------------
|
|
||||||
|
|
||||||
;; -- create the quadric function object --
|
|
||||||
|
|
||||||
;; create the quadric function definition
|
|
||||||
(define quadric (+example-vtk-quadric-new+))
|
|
||||||
(-SetCoefficients- quadric 0.5 1.0 0.2 0. 0.1 0. 0. 0.2 0. 0.)
|
|
||||||
|
|
||||||
;; sample the quadric function
|
|
||||||
(define sample (+example-vtk-sample-function-new+))
|
|
||||||
(-SetSampleDimensions- sample 50 50 50)
|
|
||||||
(-SetImplicitFunction- sample quadric)
|
|
||||||
|
|
||||||
;; Create five surfaces F(x,y,z) = constant between range specified
|
|
||||||
(define contours (+example-vtk-contour-filter-new+))
|
|
||||||
(-SetInput- contours (-GetOutput- sample));
|
|
||||||
(-GenerateValues- contours 5 0.0 1.2)
|
|
||||||
|
|
||||||
;; map the contours to graphical primitives
|
|
||||||
(define contMapper (+example-vtk-poly-data-mapper-new+))
|
|
||||||
(-SetInput- contMapper (-GetOutput- contours));
|
|
||||||
(-SetScalarRange- contMapper 0.0 1.2)
|
|
||||||
|
|
||||||
;; create an actor for the contours
|
|
||||||
(define contActor (+example-vtk-actor-new+))
|
|
||||||
(-SetMapper- contActor contMapper)
|
|
||||||
|
|
||||||
;; -- create a box around the function to indicate the sampling volume --
|
|
||||||
|
|
||||||
;; create outline
|
|
||||||
(define outline (+example-vtk-outline-filter-new+))
|
|
||||||
(-SetInput- outline (-GetOutput- sample));
|
|
||||||
|
|
||||||
;; map it to graphics primitives
|
|
||||||
(define outlineMapper (+example-vtk-poly-data-mapper-new+))
|
|
||||||
(-SetInput- outlineMapper (-GetOutput- outline));
|
|
||||||
|
|
||||||
;; create an actor for it
|
|
||||||
(define outlineActor (+example-vtk-actor-new+))
|
|
||||||
(-SetMapper- outlineActor outlineMapper)
|
|
||||||
(-SetColor- (-GetProperty- outlineActor) 0. 0. 0.)
|
|
||||||
|
|
||||||
;; -- render both of the objects --
|
|
||||||
|
|
||||||
;; a renderer and render window
|
|
||||||
(define ren1 (+example-vtk-renderer-new+))
|
|
||||||
(define renwin (+example-vtk-render-window-new+))
|
|
||||||
(-AddRenderer- renwin ren1)
|
|
||||||
|
|
||||||
;; an interactor
|
|
||||||
(define iren (+example-vtk-render-window-interactor-new+))
|
|
||||||
(-SetRenderWindow- iren renwin)
|
|
||||||
|
|
||||||
;; add the actors to the scene
|
|
||||||
(-AddActor- ren1 contActor)
|
|
||||||
(-AddActor- ren1 outlineActor)
|
|
||||||
(-SetBackground- ren1 1. 1. 1.) ;; Background color white
|
|
||||||
|
|
||||||
;; render an image (lights and cameras are created automatically)
|
|
||||||
(-Render- renwin)
|
|
||||||
|
|
||||||
;; begin mouse interaction
|
|
||||||
(display "Press 'q' to quit ...\n\n")
|
|
||||||
(-Start- iren)
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
;; run with './vtk test-vtk-sphere.scm'
|
|
||||||
|
|
||||||
;; All generic methods must be included first
|
|
||||||
(include "example_generic")
|
|
||||||
|
|
||||||
;; After generic are defined, can include TinyCLOS code
|
|
||||||
(include "example_clos")
|
|
||||||
|
|
||||||
;; -----------------
|
|
||||||
;; Creating a sphere
|
|
||||||
;; -----------------
|
|
||||||
|
|
||||||
;; create sphere geometry
|
|
||||||
(define sphere (+example-vtk-sphere-source-new+))
|
|
||||||
(-SetRadius- sphere 1.0)
|
|
||||||
(-SetThetaResolution- sphere 18)
|
|
||||||
(-SetPhiResolution- sphere 18)
|
|
||||||
|
|
||||||
;; map to graphics library
|
|
||||||
(define mymap (+example-vtk-poly-data-mapper-new+))
|
|
||||||
(-SetInput- mymap (-GetOutput- sphere))
|
|
||||||
|
|
||||||
;; actor coordinates geometry, properties, transformation
|
|
||||||
(define aSphere (+example-vtk-actor-new+))
|
|
||||||
(-SetMapper- aSphere mymap)
|
|
||||||
(-SetColor- (-GetProperty- aSphere) 0. 0. 1.) ;; sphere color blue
|
|
||||||
|
|
||||||
;; a renderer and render window
|
|
||||||
(define ren1 (+example-vtk-renderer-new+))
|
|
||||||
(define renWin (+example-vtk-render-window-new+))
|
|
||||||
(-AddRenderer- renWin ren1)
|
|
||||||
|
|
||||||
;; an interactor
|
|
||||||
(define iren (+example-vtk-render-window-interactor-new+))
|
|
||||||
(-SetRenderWindow- iren renWin)
|
|
||||||
|
|
||||||
;; add the actor to the scene
|
|
||||||
(-AddActor- ren1 aSphere)
|
|
||||||
(-SetBackground- ren1 1. 1. 1.) ;; Background color white
|
|
||||||
|
|
||||||
;; render an image (lights and cameras are created automatically)
|
|
||||||
(-Render- renWin)
|
|
||||||
|
|
||||||
;; begin mouse interaction
|
|
||||||
(display "Press 'q' to quit ...\n\n")
|
|
||||||
(-Start- iren)
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,28 +0,0 @@
|
||||||
#ifndef __vtkChickenCommand_h
|
|
||||||
#define __vtkChickenCommand_h
|
|
||||||
|
|
||||||
#include "vtkCommand.h"
|
|
||||||
|
|
||||||
extern "C" void
|
|
||||||
execute_vtk_chicken_command (void *, C_word, void *, unsigned long, void *);
|
|
||||||
|
|
||||||
class vtkChickenCommand : public vtkCommand {
|
|
||||||
public:
|
|
||||||
virtual void Execute (vtkObject *caller, unsigned long eventId,
|
|
||||||
void *callData) {
|
|
||||||
execute_vtk_chicken_command (this, continuation, caller,
|
|
||||||
eventId, callData);
|
|
||||||
}
|
|
||||||
|
|
||||||
static vtkChickenCommand * New(C_word continuation) {
|
|
||||||
return new vtkChickenCommand (continuation);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
C_word continuation;
|
|
||||||
|
|
||||||
vtkChickenCommand (C_word continuation_) : continuation (continuation_)
|
|
||||||
{ }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue