Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1191 - in trunk: CMake Engine/ImageTraversers Model/Readers/BART Model/Textures StandAlone SwigInterface SwigInterface/test
- Date: Tue, 26 Sep 2006 14:55:32 -0600 (MDT)
Author: bigler
Date: Tue Sep 26 14:55:31 2006
New Revision: 1191
Modified:
trunk/CMake/FindTeem.cmake
trunk/Engine/ImageTraversers/FilteredImageTraverser.h
trunk/Engine/ImageTraversers/TiledImageTraverser.cc
trunk/Model/Readers/BART/parse.cc
trunk/Model/Readers/BART/parse.h
trunk/Model/Textures/NormalTexture.cc
trunk/Model/Textures/NormalTexture.h
trunk/StandAlone/octvol_build.cc
trunk/SwigInterface/manta.i
trunk/SwigInterface/test/CMakeLists.txt
trunk/SwigInterface/test/child.cc
trunk/SwigInterface/test/child.h
trunk/SwigInterface/test/parent.h
trunk/SwigInterface/test/test.i
Log:
CMake/FindTeem.cmake
Additional path search that matches the Teem CMake build.
Engine/ImageTraversers/FilteredImageTraverser.h
Removed class name in member function declaration.
Engine/ImageTraversers/TiledImageTraverser.cc
Use SCIRun::Sqrt instead of sqrt.
Model/Readers/BART/parse.cc
Get rid of M_PI definition and use SCIRun's DtoR function.
Model/Readers/BART/parse.h
Put parsing function in Manta namespace.
Model/Textures/NormalTexture.cc
Model/Textures/NormalTexture.h
Move templated code to header file.
Added template specialization function declarations in header file.
Put template specialization function implementations in Manta
namespace.
StandAlone/octvol_build.cc
Cast the isomin and isomax parameters to the correct type.
SwigInterface/manta.i
Rename the global function "yield" in Thread.h to "yieldProcess" to
avoid python keyword.
SwigInterface/test/CMakeLists.txt
Missing closing } on variable.
SwigInterface/test/child.cc
SwigInterface/test/child.h
Added BadChild class for testing polymorphism stuff.
SwigInterface/test/parent.h
Added getSelf function.
SwigInterface/test/test.i
Pull code from child and parent modules into test's namespace.
Modified: trunk/CMake/FindTeem.cmake
==============================================================================
--- trunk/CMake/FindTeem.cmake (original)
+++ trunk/CMake/FindTeem.cmake Tue Sep 26 14:55:31 2006
@@ -5,8 +5,10 @@
# Look for library here before you look in Thirdparty path
SET(TEEM_INSTALL_PATH "" CACHE PATH "Default search path for Teem install")
-FIND_LIBRARY( FOUND_TEEM_LIB NAMES teem
- PATHS ${TEEM_INSTALL_PATH}/lib
${THIRD_PARTY_LIBRARY_PATH} /usr/local/lib /usr/lib
+# Also look in ${TEEM_INSTALL_PATH}/bin, because the teem CMake build
+# puts the libraries in there.
+FIND_LIBRARY( FOUND_TEEM_LIB NAMES teem
+ PATHS ${TEEM_INSTALL_PATH}/lib
${TEEM_INSTALL_PATH}/bin ${THIRD_PARTY_LIBRARY_PATH} /usr/local/lib /usr/lib
DOC "Teem library (This is a path.)" )
FIND_PATH ( FOUND_TEEM_INCLUDE teem/nrrd.h ${TEEM_INSTALL_PATH}/include
${THIRD_PARTY_INCLUDE_PATH} /usr/local/include /usr/include
DOC "Teem Include (This is a path.)" )
Modified: trunk/Engine/ImageTraversers/FilteredImageTraverser.h
==============================================================================
--- trunk/Engine/ImageTraversers/FilteredImageTraverser.h (original)
+++ trunk/Engine/ImageTraversers/FilteredImageTraverser.h Tue Sep 26
14:55:31 2006
@@ -56,7 +56,7 @@
virtual void setupFrame(const RenderContext& context);
virtual void renderImage(const RenderContext& context, Image* image);
- static ImageTraverser* FilteredImageTraverser::create(const
vector<string>& args);
+ static ImageTraverser* create(const vector<string>& args);
private:
FilteredImageTraverser(const FilteredImageTraverser&);
Modified: trunk/Engine/ImageTraversers/TiledImageTraverser.cc
==============================================================================
--- trunk/Engine/ImageTraversers/TiledImageTraverser.cc (original)
+++ trunk/Engine/ImageTraversers/TiledImageTraverser.cc Tue Sep 26 14:55:31
2006
@@ -30,6 +30,7 @@
#include <Engine/ImageTraversers/TiledImageTraverser.h>
#include <Core/Exceptions/IllegalArgument.h>
#include <Core/Math/MinMax.h>
+#include <Core/Math/Expon.h>
#include <Core/Thread/Mutex.h>
#include <Core/Util/Args.h>
#include <Core/Util/NotFinished.h>
@@ -61,7 +62,7 @@
throw IllegalArgument("TiledImageTraverser -tilesize", i, args);
} else if (arg == "-square") {
/*
- int sqrt_size = static_cast<int>(sqrt(RayPacket::MaxSize));
+ int sqrt_size = static_cast<int>(SCIRun::Sqrt(RayPacket::MaxSize));
if (sqrt_size * sqrt_size != RayPacket::MaxSize)
throw IllegalArgument("TiledImageTraverser -square
(RayPacket::MaxSize is not square",
i, args);
@@ -235,7 +236,7 @@
Fragment frag(Fragment::SquareShape, Fragment::ConstantEye);
// Square Shaped fragments of about RayPacket::MaxSize each
- static const int sqrt_size =
static_cast<int>(sqrt(RayPacket::MaxSize));
+ static const int sqrt_size =
static_cast<int>(SCIRun::Sqrt(RayPacket::MaxSize));
static const int full_size = sqrt_size * sqrt_size;
for(int eye = 0; eye < numEyes; eye++){
Modified: trunk/Model/Readers/BART/parse.cc
==============================================================================
--- trunk/Model/Readers/BART/parse.cc (original)
+++ trunk/Model/Readers/BART/parse.cc Tue Sep 26 14:55:31 2006
@@ -8,6 +8,7 @@
#include <Interface/Camera.h>
#include <Interface/LightSet.h>
+#include <Interface/Scene.h>
#include <Model/Lights/PointLight.h>
#include <Model/AmbientLights/ConstantAmbient.h>
#include <Model/Backgrounds/ConstantBackground.h>
@@ -22,20 +23,17 @@
#include <Model/Primitives/Sphere.h>
#include <Model/Primitives/Triangle.h>
#include <Core/Util/NotFinished.h>
+#include <Core/Math/Trig.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include "parse.h"
+#include <Model/Readers/BART/parse.h>
extern "C" {
#include "animation.h"
#include "texture.h"
}
-#ifndef M_PI
-#define M_PI 3.1415926535897932384626433
-#endif
-
#define X 0
#define Y 1
#define Z 2
@@ -1017,7 +1015,7 @@
RKeys[i].Rot.x = x;
RKeys[i].Rot.y = y;
RKeys[i].Rot.z = z;
- RKeys[i].Rot.angle = angle*M_PI/180.0;
+ RKeys[i].Rot.angle = DtoR(angle);
RKeys[i].tension = te;
RKeys[i].continuity = co;
RKeys[i].bias = bi;
@@ -1423,7 +1421,7 @@
Description:
parses the animation file
----------------------------------------------------------------------*/
-int viParseFile(FILE *f, Scene *scene)
+int Manta::viParseFile(FILE *f, Scene *scene)
{
if (scene != NULL) {
Modified: trunk/Model/Readers/BART/parse.h
==============================================================================
--- trunk/Model/Readers/BART/parse.h (original)
+++ trunk/Model/Readers/BART/parse.h Tue Sep 26 14:55:31 2006
@@ -2,13 +2,15 @@
* Purpose: simple parser for data files, includeing args parsing
*/
-#ifndef PARSE_H
-#define PARSE_H
+#ifndef MANTA_READERS_BART_PARSE_H
+#define MANTA_READERS_BART_PARSE_H
#include <stdio.h>
-#include <Interface/Scene.h>
-int viParseArgs(int argc, char *argv[], char **filename);
-int viParseFile(FILE *f, Manta::Scene *scene);
+namespace Manta {
+ class Scene;
+
+ int viParseFile(FILE *f, Scene *scene);
+}
-#endif
+#endif // MANTA_READERS_BART_PARSE_H
Modified: trunk/Model/Textures/NormalTexture.cc
==============================================================================
--- trunk/Model/Textures/NormalTexture.cc (original)
+++ trunk/Model/Textures/NormalTexture.cc Tue Sep 26 14:55:31 2006
@@ -33,9 +33,6 @@
#include <Core/Color/Color.h>
-#include <Model/Primitives/HeavyTriangle.h>
-#include <Model/Groups/KDTree.h>
-#include <Model/Textures/Constant.h>
using namespace Manta;
@@ -110,80 +107,47 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-template<class ScratchPadInfo, class ValueType>
-WireframeTexture<ScratchPadInfo, ValueType>::WireframeTexture( const
ValueType &color_, const ValueType &wire_value_ ) :
- wire_value( wire_value_ )
-{
- texture = new Constant<ValueType>( color_ );
-}
-
-template<>
-void
WireframeTexture<HeavyTriangle::TriangleHit,Color>::getBarycentricCoords(
RayPacket &rays, int which, Real &a, Real &b, Real &c ) const {
+// Implementations for specialized versions of the functions
- HeavyTriangle::TriangleHit &th =
- rays.scratchpad<HeavyTriangle::TriangleHit>(which);
+namespace Manta {
- a = th.a;
- b = th.b;
- c = ((Real)1.0 - th.a - th.b);
-}
-
-template<>
-void WireframeTexture<Kdtree::KDTree::ScratchPadInfo,Color>::
-getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real &c
) const {
-
- Kdtree::KDTree::ScratchPadInfo &info =
- rays.scratchpad<Kdtree::KDTree::ScratchPadInfo>(which);
-
- a = info.a;
- b = info.b;
- c = ((Real)1.0 - info.a - info.b);
-}
-
-template<>
-void WireframeTexture<Kdtree::KDTree::ScratchPadInfo,ColorComponent>::
-getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real &c
) const {
-
- Kdtree::KDTree::ScratchPadInfo &info =
- rays.scratchpad<Kdtree::KDTree::ScratchPadInfo>(which);
-
- a = info.a;
- b = info.b;
- c = ((Real)1.0 - info.a - info.b);
-}
-
-template<class ScratchPadInfo, class ValueType>
-void WireframeTexture<ScratchPadInfo,ValueType>::
-mapValues(Packet<ValueType>& results,
- const RenderContext& context,
- RayPacket& rays) const
-{
-
- // Compute the normal for each ray.
- rays.computeNormals( context );
-
- // Lookup dependent texture values.
- Packet<ValueType> texture_values;
- texture->mapValues( texture_values, context, rays );
-
- // Iterate over the packet and set the colors.
- for (int i=rays.begin();i<rays.end();++i) {
-
- // Lookup barycentric coordinates.
- Real a, b, c;
- getBarycentricCoords( rays, i, a, b, c );
+ template<>
+ void WireframeTexture<HeavyTriangle::TriangleHit,Color>::
+ getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real
&c ) const
+ {
- if ((a < 0.05) || (b < 0.05) || (c < 0.05)) {
- results.set(i, wire_value);
- }
- else {
- results.set(i, texture_values.get(i));
- }
+ HeavyTriangle::TriangleHit &th =
+ rays.scratchpad<HeavyTriangle::TriangleHit>(which);
+
+ a = th.a;
+ b = th.b;
+ c = ((Real)1.0 - th.a - th.b);
+ }
+ template<>
+ void WireframeTexture<Kdtree::KDTree::ScratchPadInfo,Color>::
+ getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real
&c ) const
+ {
+
+ Kdtree::KDTree::ScratchPadInfo &info =
+ rays.scratchpad<Kdtree::KDTree::ScratchPadInfo>(which);
+
+ a = info.a;
+ b = info.b;
+ c = ((Real)1.0 - info.a - info.b);
}
-}
+ template<>
+ void WireframeTexture<Kdtree::KDTree::ScratchPadInfo,ColorComponent>::
+ getBarycentricCoords( RayPacket &rays, int which, Real &a, Real &b, Real
&c ) const
+ {
+
+ Kdtree::KDTree::ScratchPadInfo &info =
+ rays.scratchpad<Kdtree::KDTree::ScratchPadInfo>(which);
+
+ a = info.a;
+ b = info.b;
+ c = ((Real)1.0 - info.a - info.b);
+ }
+} // end namespace Manta
-template class WireframeTexture<HeavyTriangle::TriangleHit,Color>;
-template class WireframeTexture<Kdtree::KDTree::ScratchPadInfo,Color>;
-template class
WireframeTexture<Kdtree::KDTree::ScratchPadInfo,ColorComponent>;
Modified: trunk/Model/Textures/NormalTexture.h
==============================================================================
--- trunk/Model/Textures/NormalTexture.h (original)
+++ trunk/Model/Textures/NormalTexture.h Tue Sep 26 14:55:31 2006
@@ -32,6 +32,9 @@
#include <Interface/Texture.h>
#include <Interface/RayPacket.h>
+#include <Model/Textures/Constant.h>
+#include <Model/Primitives/HeavyTriangle.h>
+#include <Model/Groups/KDTree.h>
// Abe Stephens
@@ -63,27 +66,77 @@
template<class ScratchPadInfo, class ValueType = Color >
class WireframeTexture : public Texture<ValueType> {
public:
- WireframeTexture( Texture<ValueType> *texture_, const ValueType
&wire_value_ ) :
- texture( texture_ ), wire_value( wire_value_ ) { };
- WireframeTexture( const ValueType &color_, const ValueType &wire_value_
);
+ WireframeTexture( Texture<ValueType> *texture_,
+ const ValueType &wire_value_ )
+ : texture( texture_ ), wire_value( wire_value_ )
+ { }
+
+ WireframeTexture( const ValueType &color_,
+ const ValueType &wire_value_ )
+ : wire_value( wire_value_ )
+ {
+ texture = new Constant<ValueType>( color_ );
+ }
+
virtual ~WireframeTexture() { }
- virtual void mapValues(Packet<ValueType>& results,
- const RenderContext&,
- RayPacket& rays) const;
+ virtual void mapValues(Packet<ValueType>& results,
+ const RenderContext&,
+ RayPacket& rays) const;
private:
///////////////////////////////////////////////////////////////////////////
- // Note: This method must be implemented for each possible template
parameter
- // type explicitly. It is responsible for copying the coordinates out of
the
- // ray packet scratch pad.
+ // Note: This method must be implemented for each possible
+ // template parameter type explicitly. It is responsible for
+ // copying the coordinates out of the ray packet scratch pad.
void getBarycentricCoords( RayPacket &rays, int which,
Real &a, Real &b, Real &c ) const;
ValueType wire_value;
Texture<ValueType> *texture;
- };
+ };
+
+ // Specialized versions of functions
+ template<>
+ void
WireframeTexture<HeavyTriangle::TriangleHit,Color>::getBarycentricCoords(
RayPacket &rays, int which, Real &a, Real &b, Real &c ) const;
+ template<>
+ void
WireframeTexture<Kdtree::KDTree::ScratchPadInfo,Color>::getBarycentricCoords(
RayPacket &rays, int which, Real &a, Real &b, Real &c ) const;
+ template<>
+ void
WireframeTexture<Kdtree::KDTree::ScratchPadInfo,ColorComponent>::getBarycentricCoords(
RayPacket &rays, int which, Real &a, Real &b, Real &c ) const;
+
+ // Non specialized template functions
+ template<class ScratchPadInfo, class ValueType>
+ void WireframeTexture<ScratchPadInfo,ValueType>::
+ mapValues(Packet<ValueType>& results,
+ const RenderContext& context,
+ RayPacket& rays) const
+ {
+
+ // Compute the normal for each ray.
+ rays.computeNormals( context );
+
+ // Lookup dependent texture values.
+ Packet<ValueType> texture_values;
+ texture->mapValues( texture_values, context, rays );
+
+ // Iterate over the packet and set the colors.
+ for (int i=rays.begin();i<rays.end();++i) {
+
+ // Lookup barycentric coordinates.
+ Real a, b, c;
+ getBarycentricCoords( rays, i, a, b, c );
+
+ if ((a < (Real)0.05) || (b < (Real)0.05) || (c < (Real)0.05)) {
+ results.set(i, wire_value);
+ }
+ else {
+ results.set(i, texture_values.get(i));
+ }
+
+ }
+ }
+
};
#endif
Modified: trunk/StandAlone/octvol_build.cc
==============================================================================
--- trunk/StandAlone/octvol_build.cc (original)
+++ trunk/StandAlone/octvol_build.cc Tue Sep 26 14:55:31 2006
@@ -100,7 +100,7 @@
return 0;
}
- OctreeVolume ov((char*)buildfrom_filename.c_str(), tstart, tend,
variance, kernel_width, (double)isomin, (double)isomax);
+ OctreeVolume ov((char*)buildfrom_filename.c_str(), tstart, tend,
variance, kernel_width, (Manta::ST)isomin, (Manta::ST)isomax);
return 0;
}
Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Tue Sep 26 14:55:31 2006
@@ -506,7 +506,13 @@
#include <SCIRun/Core/Thread/Thread.h>
%}
+// yield is a "future" reserved word for some versions of python.
+// This renames it to be something else.
+%rename(yieldProcess) yield;
+
%include <SCIRun/Core/Thread/Thread.h>
+
+%rename(yield) yield;
// namespace SCIRun {
// struct Thread {
Modified: trunk/SwigInterface/test/CMakeLists.txt
==============================================================================
--- trunk/SwigInterface/test/CMakeLists.txt (original)
+++ trunk/SwigInterface/test/CMakeLists.txt Tue Sep 26 14:55:31 2006
@@ -19,7 +19,7 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR/../../CMake/MantaUseSWIG.cmake)
+INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../../CMake/MantaUseSWIG.cmake)
MACRO(MANTA_BUILD_SWIG_MODULE module_name interface_file)
SET_SOURCE_FILES_PROPERTIES(${interface_file} PROPERTIES CPLUSPLUS ON)
Modified: trunk/SwigInterface/test/child.cc
==============================================================================
--- trunk/SwigInterface/test/child.cc (original)
+++ trunk/SwigInterface/test/child.cc Tue Sep 26 14:55:31 2006
@@ -13,3 +13,19 @@
void Child::whoami() {
cerr << "I am a Child with arg = "<<arg<<", and name = "<<name<<"\n";
}
+
+BadChild::BadChild(int arg): Parent("BadChild"), arg(arg*2)
+{
+ whoami();
+}
+
+void BadChild::whoami()
+{
+ cerr << "I am a BadChild with arg = "<<arg<<", and name = "<<name<<"\n";
+}
+
+void BadChild::doBadStuff()
+{
+ arg *= 2;
+}
+
Modified: trunk/SwigInterface/test/child.h
==============================================================================
--- trunk/SwigInterface/test/child.h (original)
+++ trunk/SwigInterface/test/child.h Tue Sep 26 14:55:31 2006
@@ -14,4 +14,14 @@
int arg;
};
+ class BadChild: public Parent {
+ public:
+ BadChild(int arg);
+ virtual void whoami();
+
+ void doBadStuff();
+ private:
+ int arg;
+ };
+
} // end namespace Test
Modified: trunk/SwigInterface/test/parent.h
==============================================================================
--- trunk/SwigInterface/test/parent.h (original)
+++ trunk/SwigInterface/test/parent.h Tue Sep 26 14:55:31 2006
@@ -13,6 +13,8 @@
virtual void whoami() {
cerr << "I am a Parent with name = "<<name<<"\n";
}
+
+ Parent* getSelf() { return this; }
protected:
string name;
};
Modified: trunk/SwigInterface/test/test.i
==============================================================================
--- trunk/SwigInterface/test/test.i (original)
+++ trunk/SwigInterface/test/test.i Tue Sep 26 14:55:31 2006
@@ -3,3 +3,12 @@
%import "parent.i"
%import "child.i"
+%pythoncode %{
+
+from parent import *
+from child import *
+
+%}
+
+
+
- [MANTA] r1191 - in trunk: CMake Engine/ImageTraversers Model/Readers/BART Model/Textures StandAlone SwigInterface SwigInterface/test, bigler, 09/26/2006
Archive powered by MHonArc 2.6.16.