Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1410 - in trunk: CMake Core/Color Core/Geometry Core/Math Core/Util Engine/Factory Interface Model/AmbientLights Model/Backgrounds Model/Cameras Model/Groups Model/Materials Model/Textures UserInterface
- Date: Thu, 7 Jun 2007 14:01:31 -0600 (MDT)
Author: bigler
Date: Thu Jun 7 14:01:28 2007
New Revision: 1410
Modified:
trunk/CMake/ConfigCompilerFlags.cmake
trunk/Core/Color/RegularColorMap.cc
trunk/Core/Geometry/Vector.h
trunk/Core/Math/ReflectRefract.h
trunk/Core/Math/SSEDefs.h
trunk/Core/Util/Endian.h
trunk/Core/Util/ThreadStorage.cc
trunk/Engine/Factory/Factory.h
trunk/Interface/CameraPath.cc
trunk/Interface/Scene.cc
trunk/Interface/Scene.h
trunk/Model/AmbientLights/ConstantAmbient.cc
trunk/Model/Backgrounds/EnvMapBackground.cc
trunk/Model/Cameras/EnvironmentCamera.cc
trunk/Model/Cameras/FisheyeCamera.cc
trunk/Model/Cameras/OrthogonalCamera.cc
trunk/Model/Cameras/PinholeCamera.cc
trunk/Model/Groups/BVH.cc
trunk/Model/Groups/Build_Approx_cc.cc
trunk/Model/Groups/Build_OnLogn_cc.cc
trunk/Model/Groups/KDTree.cc
trunk/Model/Groups/KDTree.h
trunk/Model/Groups/KDTreeLoader.cc
trunk/Model/Groups/ObjGroup.cc
trunk/Model/Materials/MaterialTable.cc
trunk/Model/Materials/MaterialTable.h
trunk/Model/Textures/ImageTexture.h
trunk/UserInterface/XWindowUI.cc
Log:
CMake/ConfigCompilerFlags.cmake
Comments for debugging.
Core/Math/ReflectRefract.h
Fix math in comment.
Core/Math/SSEDefs.h
Changed parameter names for mask functions.
Added fracSSE and floorSSE.
Interface/Scene.cc
Interface/Scene.h
Added currentBookmark function (changing member variable
currentBookmark to currentBookmark_id).
currentBookmark_id is now unsigned instead of signed.
Model/Cameras/EnvironmentCamera.cc
Model/Cameras/FisheyeCamera.cc
Model/Cameras/OrthogonalCamera.cc
Model/Cameras/PinholeCamera.cc
Use Scene::currentBookmark instead of nextBookmark.
UserInterface/XWindowUI.cc
Move manta window down 100x100 pixels.
Core/Color/RegularColorMap.cc
Core/Geometry/Vector.h
Core/Util/Endian.h
Core/Util/ThreadStorage.cc
Engine/Factory/Factory.h
Interface/CameraPath.cc
Model/AmbientLights/ConstantAmbient.cc
Model/Backgrounds/EnvMapBackground.cc
Model/Groups/BVH.cc
Model/Groups/Build_Approx_cc.cc
Model/Groups/Build_OnLogn_cc.cc
Model/Groups/KDTree.cc
Model/Groups/KDTree.h
Model/Groups/KDTreeLoader.cc
Model/Groups/ObjGroup.cc
Model/Materials/MaterialTable.cc
Model/Materials/MaterialTable.h
Model/Textures/ImageTexture.h
Warning rampage.
Modified: trunk/CMake/ConfigCompilerFlags.cmake
==============================================================================
--- trunk/CMake/ConfigCompilerFlags.cmake (original)
+++ trunk/CMake/ConfigCompilerFlags.cmake Thu Jun 7 14:01:28 2007
@@ -241,6 +241,17 @@
## Set the defaults
##############################################################
+# MESSAGE("CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}")
+# MESSAGE("CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
+
+# MESSAGE("USING_GCC = ${USING_GCC}")
+# MESSAGE("USING_GPP = ${USING_GPP}")
+# MESSAGE("USING_ICC = ${USING_ICC}")
+# MESSAGE("USING_ICPC = ${USING_ICPC}")
+# MESSAGE("CMAKE version =
${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
+# MESSAGE("CMAKE_SYSTEM = ${CMAKE_SYSTEM}")
+# MESSAGE("CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
+
MACRO(ADD_COMPILER_FLAG COMPILER FLAGS NEW_FLAG)
IF(${COMPILER})
PREPEND_TO_STRING(${FLAGS} ${${NEW_FLAG}})
Modified: trunk/Core/Color/RegularColorMap.cc
==============================================================================
--- trunk/Core/Color/RegularColorMap.cc (original)
+++ trunk/Core/Color/RegularColorMap.cc Thu Jun 7 14:01:28 2007
@@ -14,8 +14,8 @@
using namespace Manta;
-RegularColorMap::RegularColorMap(const char* filename, unsigned int size) :
- blended(size), new_blended(size)
+RegularColorMap::RegularColorMap(const char* filename, unsigned int size)
+ : blended(size), new_blended(size)
{
if (!fillColor(filename, colors)) {
cerr<<"RegularColorMap::RegularColorMap("<<filename
@@ -27,15 +27,15 @@
lookup.setResultsPtr(&blended);
}
-RegularColorMap::RegularColorMap(Array1<Color>& colors, unsigned int size) :
- colors(colors), blended(size), new_blended(size)
+RegularColorMap::RegularColorMap(Array1<Color>& colors, unsigned int size)
+ : blended(size), colors(colors), new_blended(size)
{
fillBlendedColors(blended);
lookup.setResultsPtr(&blended);
}
-RegularColorMap::RegularColorMap(unsigned int type, unsigned int size) :
- blended(size), new_blended(size)
+RegularColorMap::RegularColorMap(unsigned int type, unsigned int size)
+ : blended(size), new_blended(size)
{
fillColor(type, colors);
fillBlendedColors(blended);
@@ -170,7 +170,7 @@
if (max>1) {
cerr<<me<<": Renormalizing colors for range of 0 to 255\n";
Real inv255=1/static_cast<Real>(255);
- for (unsigned int i=0; i < new_colors.size(); ++i)
+ for (int i=0; i < new_colors.size(); ++i)
new_colors[i]=new_colors[i] * inv255;
}
@@ -186,7 +186,7 @@
my_lookup.setResultsPtr(&colors);
my_lookup.scale(0, blended.size() - 1);
- for (unsigned int i=0; i < blended.size(); ++i)
+ for (int i=0; i < blended.size(); ++i)
blended[i]=my_lookup.interpolate(i);
}
Modified: trunk/Core/Geometry/Vector.h
==============================================================================
--- trunk/Core/Geometry/Vector.h (original)
+++ trunk/Core/Geometry/Vector.h Thu Jun 7 14:01:28 2007
@@ -414,10 +414,10 @@
Vector findPerpendicular() const {
Vector result;
+#if 0
float a0 = SCIRun::Abs(data[0]);
float a1 = SCIRun::Abs(data[1]);
float a2 = SCIRun::Abs(data[2]);
-#if 0
if(a0 < a1){
if(a0 < a2){
// 0 smallest
Modified: trunk/Core/Math/ReflectRefract.h
==============================================================================
--- trunk/Core/Math/ReflectRefract.h (original)
+++ trunk/Core/Math/ReflectRefract.h Thu Jun 7 14:01:28 2007
@@ -7,7 +7,7 @@
// eta_inverse = eta_i/eta_t (or eta1/eta2)
// r0 = (1 - eta_inverse) / (1 + eta_inverse);
// r0 = (eta - 1) / (1 + eta);
- // r0 = (eta_t - eta_i) / (eta_t - eta_i);
+ // r0 = (eta_t - eta_i) / (eta_t + eta_i);
//
// Note that because r0 is squared, eta_t and eta_i can be swapped and
// get the same result.
Modified: trunk/Core/Math/SSEDefs.h
==============================================================================
--- trunk/Core/Math/SSEDefs.h (original)
+++ trunk/Core/Math/SSEDefs.h Thu Jun 7 14:01:28 2007
@@ -39,6 +39,7 @@
#define unpacklo _mm_unpacklo_ps // (a,b) => [a0, b0, a1, b1]
#define unpackhi _mm_unpackhi_ps // (a,b) => [a2, b2, a3, b3]
#define zero4 _mm_setzero_ps
+#define zero4i _mm_setzero_si128
#define getmask4 _mm_movemask_ps
#define maskmove4i _mm_maskmoveu_si128 // destination need not be aligned
#define cmp4_ge _mm_cmpge_ps
@@ -58,8 +59,8 @@
#define convert4_f2i _mm_cvttps_epi32
#define convert4_i2f _mm_cvtepi32_ps
#define sqrt4 _mm_sqrt_ps
-#define shift_right4int _mm_srli_epi32
-#define shift_left4int _mm_slli_epi32
+#define shift_right4int _mm_srli_epi32 // >>
+#define shift_left4int _mm_slli_epi32 // <<
namespace std {
std::ostream& operator<<(std::ostream& os, __m128);
@@ -112,8 +113,8 @@
static const MANTA_ALIGN(16) sse_t _mm_epsilon = _mm_set_ps1(1e-5);
static const MANTA_ALIGN(16) sse_t _mm_one = _mm_set_ps1(1.f);
static const MANTA_ALIGN(16) sse_int_t _mm_one_si128 = _mm_set1_epi32(1);
- static const MANTA_ALIGN(16) sse_t _mm_zero = _mm_set_ps1(0.f);
- static const MANTA_ALIGN(16) sse_int_t _mm_zero_si128 =
_mm_set1_epi32(0);
+ static const MANTA_ALIGN(16) sse_t _mm_zero = _mm_setzero_ps();
+ static const MANTA_ALIGN(16) sse_int_t _mm_zero_si128
=_mm_setzero_si128();
static const MANTA_ALIGN(16) sse_t _mm_one_half = _mm_set_ps1(0.5f);
static const MANTA_ALIGN(16) sse_t _mm_two = _mm_set_ps1(2.f);
static const MANTA_ALIGN(16) sse_t _mm_256 = _mm_set_ps1(256);
@@ -145,21 +146,21 @@
_mm_mul_ps(vz,oz));
}
- //equivalent to mask ? dest : src
- inline sse_t mask4(const sse_t &mask, const sse_t &dest, const sse_t
&src)
+ //equivalent to mask ? newD : oldD
+ inline sse_t mask4(const sse_t &mask, const sse_t &newD, const sse_t
&oldD)
{
- return or4(and4(mask,dest),andnot4(mask,src));
+ return or4(and4(mask,newD),andnot4(mask,oldD));
}
- //equivalent to ~mask ? dest : src
- inline sse_t masknot4(const sse_t &mask, const sse_t &dest, const sse_t
&src)
+ //equivalent to ~mask ? newD : oldD
+ inline sse_t masknot4(const sse_t &mask, const sse_t &newD, const sse_t
&oldD)
{
- return or4(andnot4(mask,dest),and4(mask,src));
+ return or4(andnot4(mask,newD),and4(mask,oldD));
}
- inline sse_int_t mask4i(const sse_int_t &mask, const sse_int_t &dest,
const sse_int_t &src)
+ inline sse_int_t mask4i(const sse_int_t &mask, const sse_int_t &newD,
const sse_int_t &oldD)
{
- return or4i(and4i(mask,dest),andnot4i(mask,src));
+ return or4i(and4i(mask,newD),andnot4i(mask,oldD));
}
inline sse_t abs4(const sse_t &v)
@@ -351,23 +352,55 @@
inline int count_nonzeros(sse_t t)
{
- int mask = _mm_movemask_ps(t);
- int nonzeros = 0;
- #pragma unroll(4)
- for(int i=0; i<4; i++)
- nonzeros += (mask & (1 << i)) ? 1 : 0;
- return nonzeros;
+ int mask = _mm_movemask_ps(t);
+ // Isolate each bit with a mask, then shift it down to the one's
+ // spot. Look, ma. No branches!
+ int nonzeros = (((mask & (1 << 0)) >> 0) +
+ ((mask & (1 << 1)) >> 1) +
+ ((mask & (1 << 2)) >> 2) +
+ ((mask & (1 << 3)) >> 3));
+ return nonzeros;
}
inline int count_zeros(sse_t t)
{
- int mask = _mm_movemask_ps(t);
- int zeros = 0;
- #pragma unroll(4)
- for(int i=0; i<4; i++)
- zeros += (mask & (1 << i)) ? 0 : 1;
- return zeros;
- }
+ // You can use this if your compiler isn't stupid.
+ // return 4-count_nonzeros(t);
+
+ // But most compilers are stupid, so we'll manually inline it:
+ int mask = _mm_movemask_ps(t);
+ // Isolate each bit with a mask, then shift it down to the one's
+ // spot. Look, ma. No branches!
+ int nonzeros = (((mask & (1 << 0)) >> 0) +
+ ((mask & (1 << 1)) >> 1) +
+ ((mask & (1 << 2)) >> 2) +
+ ((mask & (1 << 3)) >> 3));
+ return 4-nonzeros;
+ }
+
+ // The sse code below is based off of this algorithm
+
+ // float frac = d-(int)d;
+ // if (frac < 0)
+ // return frac+1;
+ // else
+ // return frac;
+
+ inline __m128 fracSSE(__m128 val)
+ {
+ __m128 fract_val = _mm_sub_ps(val,
_mm_cvtepi32_ps(_mm_cvttps_epi32(val)));
+ return _mm_add_ps(fract_val, _mm_and_ps(_mm_cmplt_ps(fract_val,
_mm_set_ps1(0.f)), _mm_set_ps1(1.f)));
+ }
+
+ // This is based off of:
+ //
+ // floor(val) = val - frac(val);
+ inline __m128 floorSSE(__m128 val)
+ {
+ __m128 fract_val = _mm_sub_ps(val,
_mm_cvtepi32_ps(_mm_cvttps_epi32(val)));
+ return _mm_sub_ps(val, _mm_add_ps(fract_val,
_mm_and_ps(_mm_cmplt_ps(fract_val, _mm_set_ps1(0.f)), _mm_set_ps1(1.f))));
+ }
+
};
Modified: trunk/Core/Util/Endian.h
==============================================================================
--- trunk/Core/Util/Endian.h (original)
+++ trunk/Core/Util/Endian.h Thu Jun 7 14:01:28 2007
@@ -42,7 +42,7 @@
char const * const pin = (char *)∈
char * const pout = (char *)&out;
- for (int i=0;i<sizeof(T);++i) {
+ for (unsigned int i=0;i<sizeof(T);++i) {
pout[i] = pin[sizeof(T)-1-i];
}
Modified: trunk/Core/Util/ThreadStorage.cc
==============================================================================
--- trunk/Core/Util/ThreadStorage.cc (original)
+++ trunk/Core/Util/ThreadStorage.cc Thu Jun 7 14:01:28 2007
@@ -36,8 +36,8 @@
: storage( *context.storage_allocator ), proc( context.proc ), token(
token_ ) { }
ThreadStorage::ThreadStorage( int num_procs_ ) :
- requested( 0 ),
- num_procs( num_procs_ )
+ num_procs( num_procs_ ),
+ requested( 0 )
{
// Pad the array up to a cache line.
size_t bytes = (num_procs_*sizeof(char *));
Modified: trunk/Engine/Factory/Factory.h
==============================================================================
--- trunk/Engine/Factory/Factory.h (original)
+++ trunk/Engine/Factory/Factory.h Thu Jun 7 14:01:28 2007
@@ -65,6 +65,7 @@
manta_interface( interface_ ) {
if (AutoRegisterKnownComponents) registerKnownComponents( this );
}
+ virtual ~Factory() {}
typedef vector<string> listType;
Modified: trunk/Interface/CameraPath.cc
==============================================================================
--- trunk/Interface/CameraPath.cc (original)
+++ trunk/Interface/CameraPath.cc Thu Jun 7 14:01:28 2007
@@ -12,7 +12,7 @@
CameraPath::CameraPath(MantaInterface* interface, string const& fname,
IOMode mode, LoopMode loop, int max_count, int
offset) :
interface(interface), fname(fname), loop(loop), max_count(max_count),
offset(offset), handle(0),
- frame(0), max_frame(0), anim(false)
+ anim(false), frame(0), max_frame(0)
{
if (mode==ReadKnots) {
readKnots();
Modified: trunk/Interface/Scene.cc
==============================================================================
--- trunk/Interface/Scene.cc (original)
+++ trunk/Interface/Scene.cc Thu Jun 7 14:01:28 2007
@@ -18,13 +18,11 @@
return idx;
}
-void Scene::selectBookmark(int bookmark)
+void Scene::selectBookmark(unsigned int bookmark)
{
- currentBookmark = bookmark;
- if(currentBookmark < 0)
- currentBookmark = 0;
- if(bookmarks.size() > 0 && currentBookmark >= bookmarks.size())
- currentBookmark = bookmarks.size()-1;
+ currentBookmark_id = bookmark;
+ if(bookmarks.size() > 0 && currentBookmark_id >= bookmarks.size())
+ currentBookmark_id = bookmarks.size()-1;
}
const BasicCameraData* Scene::nextBookmark()
@@ -32,9 +30,18 @@
if(bookmarks.size() == 0)
return 0;
- currentBookmark++;
- if(currentBookmark >= bookmarks.size())
- currentBookmark = 0;
+ ++currentBookmark_id;
+ if(currentBookmark_id >= bookmarks.size())
+ currentBookmark_id = 0;
- return &bookmarks[currentBookmark]->cameradata;
+ return currentBookmark();
}
+
+const BasicCameraData* Scene::currentBookmark()
+{
+ if(bookmarks.size() == 0)
+ return NULL;
+
+ return &bookmarks[currentBookmark_id]->cameradata;
+}
+
Modified: trunk/Interface/Scene.h
==============================================================================
--- trunk/Interface/Scene.h (original)
+++ trunk/Interface/Scene.h Thu Jun 7 14:01:28 2007
@@ -18,7 +18,7 @@
{
object = 0;
bg = 0;
- currentBookmark = -1;
+ currentBookmark_id = 0;
}
const Object* getObject() const
@@ -70,8 +70,9 @@
int addBookmark(const std::string& name, const Vector& eye, const
Vector& lookat,
const Vector& up, double hfov);
int addBookmark(const std::string& name, const BasicCameraData& cam);
- void selectBookmark(int bookmark);
+ void selectBookmark(unsigned int bookmark);
const BasicCameraData* nextBookmark();
+ const BasicCameraData* currentBookmark();
private:
Object* object;
@@ -83,7 +84,7 @@
BasicCameraData cameradata;
};
std::vector<Bookmark*> bookmarks;
- int currentBookmark;
+ unsigned int currentBookmark_id;
};
}
Modified: trunk/Model/AmbientLights/ConstantAmbient.cc
==============================================================================
--- trunk/Model/AmbientLights/ConstantAmbient.cc (original)
+++ trunk/Model/AmbientLights/ConstantAmbient.cc Thu Jun 7 14:01:28
2007
@@ -41,7 +41,6 @@
for(int j=0;j<Color::NumComponents;j++)
ambient[j][i] = color[j];
}
- RayPacketData* data = rays.data;
for(;i<e;i+=4){
_mm_store_ps(&ambient[0][i], _mm_set1_ps(color[0]));
_mm_store_ps(&ambient[1][i], _mm_set1_ps(color[1]));
Modified: trunk/Model/Backgrounds/EnvMapBackground.cc
==============================================================================
--- trunk/Model/Backgrounds/EnvMapBackground.cc (original)
+++ trunk/Model/Backgrounds/EnvMapBackground.cc Thu Jun 7 14:01:28 2007
@@ -10,7 +10,7 @@
static Real OneOverPi=static_cast<Real>(1/M_PI);
static Real OneOverTwoPi=static_cast<Real>(1/(2*M_PI));
-static Real PiOverTwo=static_cast<Real>(M_PI/2);
+//static Real PiOverTwo=static_cast<Real>(M_PI/2);
EnvMapBackground::EnvMapBackground(const std::string& filename,
const Vector& right, const Vector& up)
@@ -93,6 +93,6 @@
Packet<Color> colors;
image->mapValues(colors, context, rays);
- for (unsigned int i=rays.begin(); i<rays.end(); ++i)
+ for (int i=rays.begin(); i<rays.end(); ++i)
rays.setColor(i, colors.get(i));
}
Modified: trunk/Model/Cameras/EnvironmentCamera.cc
==============================================================================
--- trunk/Model/Cameras/EnvironmentCamera.cc (original)
+++ trunk/Model/Cameras/EnvironmentCamera.cc Thu Jun 7 14:01:28 2007
@@ -77,7 +77,7 @@
{
Scene* scene = context.manta_interface->getScene();
if(!haveCamera){
- const BasicCameraData* bookmark = scene->nextBookmark();
+ const BasicCameraData* bookmark = scene->currentBookmark();
if(bookmark){
setBasicCameraData(*bookmark);
haveCamera = true;
Modified: trunk/Model/Cameras/FisheyeCamera.cc
==============================================================================
--- trunk/Model/Cameras/FisheyeCamera.cc (original)
+++ trunk/Model/Cameras/FisheyeCamera.cc Thu Jun 7 14:01:28 2007
@@ -24,7 +24,7 @@
FisheyeCamera::FisheyeCamera(const Vector& eye_, const Vector& lookat_,
const Vector& up_, Real hfov_)
- : eye( eye_ ), up( up_ ), lookat( lookat_ ), hfov( hfov_ )
+ : eye( eye_ ), lookat( lookat_ ), up( up_ ), hfov( hfov_ )
{
haveCamera = true;
setup();
@@ -224,7 +224,7 @@
{
Scene* scene = context.manta_interface->getScene();
if(!haveCamera){
- const BasicCameraData* bookmark = scene->nextBookmark();
+ const BasicCameraData* bookmark = scene->currentBookmark();
if(bookmark){
setBasicCameraData(*bookmark);
haveCamera = true;
Modified: trunk/Model/Cameras/OrthogonalCamera.cc
==============================================================================
--- trunk/Model/Cameras/OrthogonalCamera.cc (original)
+++ trunk/Model/Cameras/OrthogonalCamera.cc Thu Jun 7 14:01:28 2007
@@ -213,7 +213,7 @@
{
Scene* scene = context.manta_interface->getScene();
if(!haveCamera){
- const BasicCameraData* bookmark = scene->nextBookmark();
+ const BasicCameraData* bookmark = scene->currentBookmark();
if(bookmark){
setBasicCameraData(*bookmark);
haveCamera = true;
Modified: trunk/Model/Cameras/PinholeCamera.cc
==============================================================================
--- trunk/Model/Cameras/PinholeCamera.cc (original)
+++ trunk/Model/Cameras/PinholeCamera.cc Thu Jun 7 14:01:28 2007
@@ -455,7 +455,7 @@
{
Scene* scene = context.manta_interface->getScene();
if(!haveCamera){
- const BasicCameraData* bookmark = scene->nextBookmark();
+ const BasicCameraData* bookmark = scene->currentBookmark();
if(bookmark){
setBasicCameraData(*bookmark);
haveCamera = true;
Modified: trunk/Model/Groups/BVH.cc
==============================================================================
--- trunk/Model/Groups/BVH.cc (original)
+++ trunk/Model/Groups/BVH.cc Thu Jun 7 14:01:28 2007
@@ -33,7 +33,7 @@
BVH::BVH(const vector<string>& args)
{
buildMode="naive";
- for(int i=0; i<args.size(); i++){
+ for(int i=0; i<static_cast<int>(args.size()); i++){
string arg = args[i];
if(arg == "-table"){
buildMode = "table";
Modified: trunk/Model/Groups/Build_Approx_cc.cc
==============================================================================
--- trunk/Model/Groups/Build_Approx_cc.cc (original)
+++ trunk/Model/Groups/Build_Approx_cc.cc Thu Jun 7 14:01:28 2007
@@ -103,7 +103,7 @@
const Real interval1 = node_bounds[1][axis];
const Real delta = (interval1 - interval0) / (Real)total_candidates;
- for (int index=0;index<indices.size();++index) {
+ for (Integer index=0;index<indices.size();++index) {
const BBox &bounds = geometry[ indices[index] ];
const Real &bounds_min = bounds[0][axis];
@@ -112,7 +112,7 @@
Real candidate_split = interval0;
// Iterate over the candidates.
- for (int i=0;i<total_candidates;++i) {
+ for (Integer i=0;i<total_candidates;++i) {
// Check the left and right split candidates.
left_side[i] += ((bounds_min <= candidate_split));
@@ -131,7 +131,7 @@
// Iterate back over the candidates.
Real candidate_split = interval0;
- for (int i=0;i<total_candidates;++i) {
+ for (Integer i=0;i<total_candidates;++i) {
const Real left_probability =
((candidate_split - interval0) * cross_section + ends_area) *
node_area_inv;
@@ -177,7 +177,7 @@
Integer left_count = 0;
Integer right_count = 0;
- for (int i=0;i<source.size();++i) {
+ for (unsigned int i=0;i<source.size();++i) {
const Integer &index = source[i];
@@ -270,7 +270,7 @@
// Copy inital indices into root frame's index_list.
root_frame->index_list.resize( bounds_list.size() );
- for (int i=0;i<bounds_list.size();++i) {
+ for (unsigned int i=0;i<bounds_list.size();++i) {
root_frame->index_list[i] = i;
}
Modified: trunk/Model/Groups/Build_OnLogn_cc.cc
==============================================================================
--- trunk/Model/Groups/Build_OnLogn_cc.cc (original)
+++ trunk/Model/Groups/Build_OnLogn_cc.cc Thu Jun 7 14:01:28 2007
@@ -616,8 +616,8 @@
// Copy inital indices into root frame's index_list.
root_frame->index_list.resize( bounds_list.size() );
- for (int i=0;i<bounds_list.size();++i) {
- root_frame->index_list[i] = i;
+ for (size_t i=0;i<bounds_list.size();++i) {
+ root_frame->index_list[i] = static_cast<int>(i);
}
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/Model/Groups/KDTree.cc
==============================================================================
--- trunk/Model/Groups/KDTree.cc (original)
+++ trunk/Model/Groups/KDTree.cc Thu Jun 7 14:01:28 2007
@@ -190,7 +190,7 @@
travStack[entryPos].node = startNode;
// Check for the case that the minimum intersection point is behind
// the origin.
- travStack[entryPos].t = minDist < 0 ? 0 : minDist;
+ travStack[entryPos].t = minDist < 0.f ? 0.f : minDist;
travStack[entryPos].prev = 1;
travStack[exitPos].node = NULL;
@@ -225,6 +225,8 @@
// Check to see if entry and exit are on the
// same side of the split.
if (exitPos_coord_on_axis <= split) {
+ // Ingo suggested a fudge factor, but I'm not sure it works
+ //if (exitPos_coord_on_axis + 1e-3 < split) {
// Same side of the split, so the original interval is ok.
nearNode = nearNode->left();
@@ -239,6 +241,8 @@
else {
// Check to see if entry and exit are on the same side.
if (exitPos_coord_on_axis >= split) {
+ // Ingo suggested a fudge factor, but I'm not sure it works.
+ //if (exitPos_coord_on_axis - 1e-3 > split) {
nearNode = nearNode->right();
continue;
}
Modified: trunk/Model/Groups/KDTree.h
==============================================================================
--- trunk/Model/Groups/KDTree.h (original)
+++ trunk/Model/Groups/KDTree.h Thu Jun 7 14:01:28 2007
@@ -258,23 +258,34 @@
tris ( 0 ),
normals ( 0 ),
texcoords ( 0 ),
- __pickingEnabled( true ),
- pickingEnabled( false ),
- pickedTri( -1 ),
- pickedFlag( PICK_HIGHLIGHT ),
+ // Group name list
triToGroupMap( 0 ),
groupToNameMap( 0 ),
- groupNames( 0 )
+ groupNames( 0 ),
+
+ // Selection
+ __pickingEnabled( true ),
+ pickingEnabled( false ),
+ pickedTri( -1 ),
+ pickedFlag( PICK_HIGHLIGHT )
{ }
KDTreeData( const KDTreeData *kdtree_ ) :
+ bbox ( kdtree_->bbox ),
+
rootNode ( kdtree_->rootNode ),
triIndices( kdtree_->triIndices ),
tris ( kdtree_->tris ),
normals ( kdtree_->normals ),
texcoords ( kdtree_->texcoords ),
+ // Group name list
+ triToGroupMap( kdtree_->triToGroupMap ),
+ groupToNameMap( kdtree_->groupToNameMap ),
+ groupNames( kdtree_->groupNames ),
+
+ // Selection
__pickingEnabled ( kdtree_->__pickingEnabled ),
pickingEnabled ( kdtree_->pickingEnabled ),
pickedTri ( kdtree_->pickedTri ),
@@ -282,14 +293,10 @@
pickedEndIndex ( kdtree_->pickedEndIndex ),
pickedSavedColors( kdtree_->pickedSavedColors ),
triFlags ( kdtree_->triFlags ),
- pickedFlag ( kdtree_->pickedFlag ),
+ pickedFlag ( kdtree_->pickedFlag )
- triToGroupMap( kdtree_->triToGroupMap ),
- groupToNameMap( kdtree_->groupToNameMap ),
- groupNames( kdtree_->groupNames ),
-
- bbox ( kdtree_->bbox ) { }
+ { }
/////////////////////////////////////////////////////////////////////////
// SELECTION
Modified: trunk/Model/Groups/KDTreeLoader.cc
==============================================================================
--- trunk/Model/Groups/KDTreeLoader.cc (original)
+++ trunk/Model/Groups/KDTreeLoader.cc Thu Jun 7 14:01:28 2007
@@ -65,7 +65,7 @@
long long toRead = remaining>chunkSize?chunkSize:remaining;
long long result;
if ((result = fread(ptr, toRead, 1, stream)) != 1) {
- fprintf(stderr, "read error: %ld != %ld",
+ fprintf(stderr, "read error: %lld != %lld",
toRead, result);
return 0;
}
@@ -519,18 +519,6 @@
Vectorf min, max;
};
-static float endianness_swap( float in ) {
- float out;
- char *ci = (char *)∈
- char *co = (char *)&out;
- co[3] = ci[0];
- co[2] = ci[1];
- co[1] = ci[2];
- co[0] = ci[3];
-
- return out;
-}
-
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD LOAD
LOAD
@@ -584,8 +572,8 @@
// Read in the whole tree.
size_t nread = fread_64(buffer, 1, fileSize, f);
if (nread != fileSize) {
- fprintf(stderr, "error reading file %s (size: %lld read:
%lld)\n",
- filename, fileSize, nread);
+ fprintf(stderr, "error reading file %s (size: %llu read:
%llu)\n",
+ filename, (unsigned long long)fileSize, (unsigned long
long)nread);
}
// Close the file.
@@ -645,8 +633,8 @@
time_begin = Time::currentSeconds();
nread = fread_64(indices->getArray(), sizeof(int), nInt, f);
if (nread != nInt) {
- fprintf(stderr, "error reading file %s (size: %lld read:
%lld)\n",
- filename, fileSize, nread);
+ fprintf(stderr, "error reading file %s (size: %llu read:
%llu)\n",
+ filename, (unsigned long long)fileSize, (unsigned long
long)nread);
return 0;
}
fclose(f);
@@ -659,7 +647,7 @@
// Swap the indicies, if necessary.
if (is_big_endian()) {
- for (int i=0;i<nInt;++i) {
+ for (size_t i=0;i<nInt;++i) {
(*indices)[i] = endian_swap( (*indices)[i] );
}
}
Modified: trunk/Model/Groups/ObjGroup.cc
==============================================================================
--- trunk/Model/Groups/ObjGroup.cc (original)
+++ trunk/Model/Groups/ObjGroup.cc Thu Jun 7 14:01:28 2007
@@ -65,7 +65,7 @@
// Path to the model for loading textures.
string model_path = model->pathname;
- int pos = model_path.rfind( '/' );
+ size_t pos = model_path.rfind( '/' );
if (pos != string::npos) {
model_path = model_path.substr( 0, pos+1 );
}
@@ -74,7 +74,7 @@
material_array_size = model->nummaterials;
// Read in the materials.
- for (int i=0;i<model->nummaterials;++i) {
+ for (unsigned int i=0;i<model->nummaterials;++i) {
//////////////////////////////////////////////////////////////////////
// Copy out material attributes.
@@ -94,9 +94,9 @@
float Ns = model->materials[i].shininess;
float Tr = model->materials[i].refraction;
- float alpha = model->materials[i].alpha;
+ //float alpha = model->materials[i].alpha;
float reflectivity = model->materials[i].reflectivity;
- int shader = model->materials[i].shader;
+ //int shader = model->materials[i].shader;
// Copy out texture names.
// string ambient_map_name = (model->materials[i].ambient_map[0]
!= '\0') ?
@@ -119,8 +119,8 @@
if (Tr != 1 && Tr != 0) {
// Constant textures for refraction parameters.
- Texture<Real> *n = new Constant<Real>( 1.6 );
- Texture<Real> *nt = new Constant<Real>( 1.0 );
+ //Texture<Real> *n = new Constant<Real>( 1.6 );
+ //Texture<Real> *nt = new Constant<Real>( 1.0 );
Texture<Color> *diffuse_map = check_for_texture( model_path,
diffuse_map_name, diffuse , diffuse_map_scaling);
// Create a dielectric shader.
@@ -175,7 +175,7 @@
Material *material;
// Determine the material for this group.
- int material_index = group->material;
+ unsigned int material_index = group->material;
if (material_index < model->nummaterials) {
material = material_array[material_index];
}
Modified: trunk/Model/Materials/MaterialTable.cc
==============================================================================
--- trunk/Model/Materials/MaterialTable.cc (original)
+++ trunk/Model/Materials/MaterialTable.cc Thu Jun 7 14:01:28 2007
@@ -38,7 +38,7 @@
MaterialTable::~MaterialTable() {
// Delete all of the owned materials.
- for (int i=0;i<material_table.size();++i) {
+ for (size_t i=0;i<material_table.size();++i) {
if (material_table[i].material && material_table[i].owned) {
delete material_table[i].material;
}
@@ -48,7 +48,7 @@
void MaterialTable::preprocess(const PreprocessContext& context) {
// Call preprocess on each material.
- for (int i=0;i<material_table.size();++i) {
+ for (size_t i=0;i<material_table.size();++i) {
if (material_table[i].material) {
material_table[i].material->preprocess( context );
}
@@ -78,7 +78,7 @@
}
}
-void MaterialTable::setMaterial( int material_id, Material *material, bool
owned ) {
+void MaterialTable::setMaterial(unsigned int material_id, Material
*material, bool owned ) {
// Check to see that the table size is correct.
if (material_id >= material_table.size()) {
material_table.resize( material_id+1, Entry( 0, false ) );
@@ -96,7 +96,7 @@
material_table[material_id].owned = owned;
}
-Material *MaterialTable::getMaterial( int material_id ) {
+Material *MaterialTable::getMaterial( unsigned int material_id ) {
return material_table[material_id].material;
}
Modified: trunk/Model/Materials/MaterialTable.h
==============================================================================
--- trunk/Model/Materials/MaterialTable.h (original)
+++ trunk/Model/Materials/MaterialTable.h Thu Jun 7 14:01:28 2007
@@ -50,8 +50,9 @@
virtual void shade(const RenderContext& context, RayPacket& rays) const;
// Accessors.
- void setMaterial( int material_id, Material *material, bool owned = true
);
- Material* getMaterial( int material_id );
+ void setMaterial(unsigned int material_id, Material *material,
+ bool owned = true );
+ Material* getMaterial( unsigned int material_id );
private:
// Texture to obtain table entry id's from.
Modified: trunk/Model/Textures/ImageTexture.h
==============================================================================
--- trunk/Model/Textures/ImageTexture.h (original)
+++ trunk/Model/Textures/ImageTexture.h Thu Jun 7 14:01:28 2007
@@ -187,6 +187,7 @@
result = val%size + size-1;
break;
case Clamp:
+ default:
result = SCIRun::Clamp(val, 0, size-1);
break;
}
Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc (original)
+++ trunk/UserInterface/XWindowUI.cc Thu Jun 7 14:01:28 2007
@@ -335,7 +335,7 @@
int flags=CWEventMask;
atts.event_mask=StructureNotifyMask|ExposureMask|ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|KeyPressMask|KeyReleaseMask;
Window parent = RootWindow(dpy, screen);
- window->window = XCreateWindow(dpy, parent, 0, 0,
+ window->window = XCreateWindow(dpy, parent, 100, 100,
window->xres, window->yres, 0,
DefaultDepth(dpy, screen), InputOutput,
DefaultVisual(dpy, screen), flags, &atts);
- [MANTA] r1410 - in trunk: CMake Core/Color Core/Geometry Core/Math Core/Util Engine/Factory Interface Model/AmbientLights Model/Backgrounds Model/Cameras Model/Groups Model/Materials Model/Textures UserInterface, bigler, 06/07/2007
Archive powered by MHonArc 2.6.16.