Client: Remove unused code.

This commit is contained in:
UnknownShadow200 2016-09-22 15:26:54 +10:00
parent 77c3ce331f
commit 49a99f1a30
2 changed files with 20 additions and 56 deletions

View file

@ -31,71 +31,41 @@ namespace ClassicalSharp {
float tmin, tmax, tymin, tymax, tzmin, tzmax;
float invDirX = 1 / dir.X;
if( invDirX >= 0 ) {
tmin = ( min.X - origin.X ) * invDirX;
tmax = ( max.X - origin.X ) * invDirX;
tmin = (min.X - origin.X) * invDirX;
tmax = (max.X - origin.X) * invDirX;
} else {
tmin = ( max.X - origin.X ) * invDirX;
tmax = ( min.X - origin.X ) * invDirX;
tmin = (max.X - origin.X) * invDirX;
tmax = (min.X - origin.X) * invDirX;
}
float invDirY = 1 / dir.Y;
if( invDirY >= 0 ) {
tymin = ( min.Y - origin.Y ) * invDirY;
tymax = ( max.Y - origin.Y ) * invDirY;
tymin = (min.Y - origin.Y) * invDirY;
tymax = (max.Y - origin.Y) * invDirY;
} else {
tymin = ( max.Y - origin.Y ) * invDirY;
tymax = ( min.Y - origin.Y ) * invDirY;
tymin = (max.Y - origin.Y) * invDirY;
tymax = (min.Y - origin.Y) * invDirY;
}
if( tmin > tymax || tymin > tmax )
return false;
if( tymin > tmin )
tmin = tymin;
if( tymax < tmax )
tmax = tymax;
if( tmin > tymax || tymin > tmax ) return false;
if( tymin > tmin ) tmin = tymin;
if( tymax < tmax ) tmax = tymax;
float invDirZ = 1 / dir.Z;
if( invDirZ >= 0 ) {
tzmin = ( min.Z - origin.Z ) * invDirZ;
tzmax = ( max.Z - origin.Z ) * invDirZ;
tzmin = (min.Z - origin.Z) * invDirZ;
tzmax = (max.Z - origin.Z) * invDirZ;
} else {
tzmin = ( max.Z - origin.Z ) * invDirZ;
tzmax = ( min.Z - origin.Z ) * invDirZ;
tzmin = (max.Z - origin.Z) * invDirZ;
tzmax = (min.Z - origin.Z) * invDirZ;
}
if( tmin > tzmax || tzmin > tmax )
return false;
if( tzmin > tmin )
tmin = tzmin;
if( tzmax < tmax )
tmax = tzmax;
if( tmin > tzmax || tzmin > tmax ) return false;
if( tzmin > tmin ) tmin = tzmin;
if( tzmax < tmax ) tmax = tzmax;
t0 = tmin;
t1 = tmax;
return true;
}
//http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/raytri/raytri.c
/// <summary> Calculates the intersection point of a ray and a triangle. </summary>
public static bool RayTriangleIntersect( Vector3 orig, Vector3 dir, Vector3 p0, Vector3 p1, Vector3 p2, out Vector3 intersect ) {
Vector3 edge1 = p1 - p0;
Vector3 edge2 = p2 - p0;
intersect = Vector3.Zero;
Vector3 p = Vector3.Cross( dir, edge2 );
float det = Vector3.Dot( edge1, p );
if( det > -0.000001f && det < 0.000001f ) return false;
float invDet = 1 / det;
Vector3 s = orig - p0;
float u = Vector3.Dot( s, p ) * invDet;
if( u < 0 || u > 1 ) return false;
Vector3 q = Vector3.Cross( s, edge1 );
float v = Vector3.Dot( dir, q ) * invDet;
if( v < 0 || u + v > 1 ) return false;
float t = Vector3.Dot( edge2, q ) * invDet;
intersect = orig + dir * t;
return t > 0.000001f;
}
}
}

View file

@ -29,12 +29,6 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Other function licenses
=======================
Ray-triangle intersection algorithm comes from:
"Fast, Minimum Storage Ray/Triangle Intersection, Möller & Trumbore. Journal of Graphics Tools, 1997."
C source at http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/raytri/raytri.c, according to Möller's code page,
(http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/code/), the code is public domain.
Ray-box intersection algorithm comes from:
"An efficient and robust ray-box intersection algorithm", Williams, Barrus, Morley & Shirley, Journal of Graphics Tools, 2005"
C++ source at http://www.cs.utah.edu/~awilliam/box/ does not appear to have an attached license.