2 Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.
\r
5 Physics Effects is open software; you can redistribute it and/or
\r
6 modify it under the terms of the BSD License.
\r
8 Physics Effects is distributed in the hope that it will be useful,
\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
11 See the BSD License for more details.
\r
13 A copy of the BSD License is distributed with
\r
14 Physics Effects under the filename: physics_effects_license.txt
\r
17 #include "../../../include/physics_effects/base_level/collision/pfx_shape.h"
\r
18 #include "../../base_level/collision/pfx_intersect_ray_box.h"
\r
19 #include "../../base_level/collision/pfx_intersect_ray_sphere.h"
\r
20 #include "../../base_level/collision/pfx_intersect_ray_capsule.h"
\r
21 #include "../../base_level/collision/pfx_intersect_ray_cylinder.h"
\r
22 #include "../../base_level/collision/pfx_intersect_ray_convex.h"
\r
23 #include "../../base_level/collision/pfx_intersect_ray_large_tri_mesh.h"
\r
24 #include "pfx_intersect_ray_func.h"
\r
28 namespace PhysicsEffects {
\r
31 ///////////////////////////////////////////////////////////////////////////////
\r
32 // Ray Intersection Function Table
\r
34 PfxBool intersectRayFuncDummy(
\r
35 const PfxRayInput &ray,PfxRayOutput &out,
\r
36 const PfxShape &shape,const PfxTransform3 &transform)
\r
38 (void)ray,(void)out,(void)shape,(void)transform;
\r
42 PfxBool intersectRayFuncBox(
\r
43 const PfxRayInput &ray,PfxRayOutput &out,
\r
44 const PfxShape &shape,const PfxTransform3 &transform)
\r
46 return pfxIntersectRayBox(ray,out,shape.getBox(),transform);
\r
49 PfxBool intersectRayFuncSphere(
\r
50 const PfxRayInput &ray,PfxRayOutput &out,
\r
51 const PfxShape &shape,const PfxTransform3 &transform)
\r
53 return pfxIntersectRaySphere(ray,out,shape.getSphere(),transform);
\r
56 PfxBool intersectRayFuncCapsule(
\r
57 const PfxRayInput &ray,PfxRayOutput &out,
\r
58 const PfxShape &shape,const PfxTransform3 &transform)
\r
60 return pfxIntersectRayCapsule(ray,out,shape.getCapsule(),transform);
\r
63 PfxBool intersectRayFuncCylinder(
\r
64 const PfxRayInput &ray,PfxRayOutput &out,
\r
65 const PfxShape &shape,const PfxTransform3 &transform)
\r
67 return pfxIntersectRayCylinder(ray,out,shape.getCylinder(),transform);
\r
70 PfxBool intersectRayFuncConvex(
\r
71 const PfxRayInput &ray,PfxRayOutput &out,
\r
72 const PfxShape &shape,const PfxTransform3 &transform)
\r
74 const PfxConvexMesh *convex = shape.getConvexMesh();
\r
76 PfxBool ret = pfxIntersectRayConvex(ray,out,(const void*)convex,transform);
\r
82 PfxBool intersectRayFuncLargeTriMesh(
\r
83 const PfxRayInput &ray,PfxRayOutput &out,
\r
84 const PfxShape &shape,const PfxTransform3 &transform)
\r
86 const PfxLargeTriMesh *lmesh = shape.getLargeTriMesh();
\r
88 PfxBool ret = pfxIntersectRayLargeTriMesh(ray,out,(const void*)lmesh,transform);
\r
94 PfxIntersectRayFunc funcTbl_intersectRay[kPfxShapeCount] = {
\r
95 intersectRayFuncSphere,
\r
96 intersectRayFuncBox,
\r
97 intersectRayFuncCapsule,
\r
98 intersectRayFuncCylinder,
\r
99 intersectRayFuncConvex,
\r
100 intersectRayFuncLargeTriMesh,
\r
101 intersectRayFuncDummy,
\r
102 intersectRayFuncDummy,
\r
103 intersectRayFuncDummy,
\r
104 intersectRayFuncDummy,
\r
105 intersectRayFuncDummy,
\r
106 intersectRayFuncDummy,
\r
109 ///////////////////////////////////////////////////////////////////////////////
\r
110 // Ray Intersection Function Table Interface
\r
112 PfxIntersectRayFunc pfxGetIntersectRayFunc(PfxUInt8 shapeType)
\r
114 return funcTbl_intersectRay[shapeType];
\r
117 PfxInt32 pfxSetIntersectRayFunc(PfxUInt8 shapeType,PfxIntersectRayFunc func)
\r
119 if(shapeType >= kPfxShapeCount) {
\r
120 return SCE_PFX_ERR_OUT_OF_RANGE;
\r
123 funcTbl_intersectRay[shapeType] = func;
\r
128 } //namespace PhysicsEffects
\r