Ignore:
Timestamp:
04/21/06 19:56:55 (18 years ago)
Author:
igarcia
Message:
 
Location:
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include
Files:
2 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCUtil.h

    r751 r778  
    55 
    66namespace BBC { 
     7 
     8const Ogre::Real EPSILON_INTERSECT = 0.00000001; 
    79 
    810class _BBCExport Util 
     
    3537        } 
    3638 
     39        // Calculate the line segment PaPb that is the shortest route between 
     40        // two lines P1P2 and P3P4. Calculate also the values of mua and mub where 
     41        //   Pa = P1 + mua (P2 - P1) 
     42        //       Pb = P3 + mub (P4 - P3) 
     43        // Return false if no solution exists. 
     44 
     45        static int lineLineIntersect( 
     46                Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, Ogre::Vector3 p4, Ogre::Vector3 *pa, Ogre::Vector3 *pb, 
     47                Ogre::Real *mua, Ogre::Real *mub) 
     48        { 
     49                Ogre::Vector3 p13,p43,p21; 
     50                Ogre::Real d1343,d4321,d1321,d4343,d2121; 
     51                Ogre::Real numer,denom; 
     52 
     53                p13.x = p1.x - p3.x; 
     54                p13.y = p1.y - p3.y; 
     55                p13.z = p1.z - p3.z; 
     56                p43.x = p4.x - p3.x; 
     57                p43.y = p4.y - p3.y; 
     58                p43.z = p4.z - p3.z; 
     59                if (Ogre::Math::Abs(p43.x)  < EPSILON_INTERSECT && Ogre::Math::Abs(p43.y)  < EPSILON_INTERSECT && Ogre::Math::Abs(p43.z)  < EPSILON_INTERSECT) 
     60                { 
     61                        return(false); 
     62                } 
     63                p21.x = p2.x - p1.x; 
     64                p21.y = p2.y - p1.y; 
     65                p21.z = p2.z - p1.z; 
     66                if (Ogre::Math::Abs(p21.x)  < EPSILON_INTERSECT && Ogre::Math::Abs(p21.y)  < EPSILON_INTERSECT && Ogre::Math::Abs(p21.z)  < EPSILON_INTERSECT) 
     67                { 
     68                        return(false); 
     69                } 
     70 
     71                d1343 = p13.x * p43.x + p13.y * p43.y + p13.z * p43.z; 
     72                d4321 = p43.x * p21.x + p43.y * p21.y + p43.z * p21.z; 
     73                d1321 = p13.x * p21.x + p13.y * p21.y + p13.z * p21.z; 
     74                d4343 = p43.x * p43.x + p43.y * p43.y + p43.z * p43.z; 
     75                d2121 = p21.x * p21.x + p21.y * p21.y + p21.z * p21.z; 
     76 
     77                denom = d2121 * d4343 - d4321 * d4321; 
     78                if (Ogre::Math::Abs(denom) < EPSILON_INTERSECT) 
     79                { 
     80                        return(false); 
     81                } 
     82                numer = d1343 * d4321 - d1321 * d4343; 
     83 
     84                *mua = numer / denom; 
     85                *mub = (d1343 + d4321 * (*mua)) / d4343; 
     86 
     87                pa->x = p1.x + *mua * p21.x; 
     88                pa->y = p1.y + *mua * p21.y; 
     89                pa->z = p1.z + *mua * p21.z; 
     90                pb->x = p3.x + *mub * p43.x; 
     91                pb->y = p3.y + *mub * p43.y; 
     92                pb->z = p3.z + *mub * p43.z; 
     93 
     94                return(true); 
     95        } 
    3796}; 
    3897 
    3998/* 
    40 extern "C" _BBCExport double fround(double n, unsigned d) 
     99extern "C" _BBCExport Ogre::Real fround(Ogre::Real n, unsigned d) 
    41100{  
    42         return floor(n * pow((double)10.,(int) d) + .5) / pow((double)10.,(int) d); 
     101        return floor(n * pow((Ogre::Real)10.,(int) d) + .5) / pow((Ogre::Real)10.,(int) d); 
    43102} 
    44103 
    45 extern "C" _BBCExport int iround(double x) 
     104extern "C" _BBCExport int iround(Ogre::Real x) 
    46105{ 
    47106      return (int)floor(x + 0.5); 
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBC.h

    r745 r778  
    1010#include <LBBCClusterViewMode.h> 
    1111#include <LBBCEntityTextureAtlasViewMode.h> 
    12 #include <LBBCBillboardCloudTextureViewMode.h> 
     12#include <LBBCBillboardCloudDiffuseColorTextureViewMode.h> 
     13#include <LBBCBillboardCloudIndirectTextureViewMode.h> 
    1314#endif 
Note: See TracChangeset for help on using the changeset viewer.