00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * David Wong 00008 * Side Effects 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: TS_Ray (C++) 00015 * 00016 * COMMENTS: 00017 * 00018 */ 00019 00020 #ifndef _TS_Ray_h_ 00021 #define _TS_Ray_h_ 00022 00023 #include "TS_API.h" 00024 #include <UT/UT_Vector3.h> 00025 #include <UT/UT_Interval.h> 00026 #include <UT/UT_BoundingBox.h> 00027 00028 class TS_API TS_Ray { 00029 public: 00030 inline TS_Ray(const UT_Vector3 &xdir, const UT_Vector3 &xanchor, 00031 int threadNum = -1); 00032 int rayBoxHit(const UT_BoundingBox &box, UT_Interval &t) const; 00033 00034 // Sets up multiple ray counts for use by seperate threads 00035 static void setupThreads(int numThreads); 00036 public: 00037 UT_Vector3 dir; 00038 UT_Vector3 anchor; 00039 int index; 00040 static int rayCount; 00041 static int *threadedRayCounts; 00042 }; 00043 00044 inline TS_Ray::TS_Ray(const UT_Vector3 &pdir, const UT_Vector3 &panchor, 00045 int threadNum) 00046 { 00047 this->dir = pdir; this->anchor = panchor; 00048 00049 if (threadNum < 0) 00050 index = ++rayCount; 00051 else // No checking here, so things better be initialized properly 00052 index = ++threadedRayCounts[threadNum]; 00053 } 00054 00055 #endif
1.5.9