00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00032 #ifndef __SO3_RAYCAST_H__
00033 #define __SO3_RAYCAST_H__
00034
00035 #include "../SCOLBasic/SO3Std.h"
00036
00037 namespace SO3
00038 {
00039
00043 class SRaycastResult
00044 {
00045 public:
00046 SScene* scene;
00047 std::string sceneName;
00048 SViewPort* viewport;
00049 SEntity* entity;
00050 std::string entityName;
00051 SMaterial* material;
00052 float closestDistance;
00053 Ogre::Vector3 point;
00054 int indexFace;
00055 Ogre::Vector3 v1;
00056 Ogre::Vector3 v2;
00057 Ogre::Vector3 v3;
00058 Ogre::Vector2 pReal1;
00059 Ogre::Vector2 pReal2;
00060 Ogre::Vector2 pReal3;
00061 Ogre::Vector2 uvResult;
00062 protected:
00063 private:
00064
00065 public:
00069 SRaycastResult();
00070
00074 SRaycastResult(const SRaycastResult& copiedRaycast);
00075 protected:
00076 private:
00077 };
00078
00081 class SRaycast
00082 {
00083 public:
00084 protected:
00085 private:
00086
00087 public:
00091 static SRaycastResult Cast(SCamera* camera, float relativePosX, float relativePosY, Ogre::SubEntity* subEntity, bool getUvCoordonate=false);
00092 protected:
00093 private:
00097 SRaycast();
00098
00101 static void GetSubEntityInformation(Ogre::SubEntity* subEntity, size_t &vertex_count, Ogre::Vector3* &vertices, size_t &index_count, unsigned long* &indices);
00102
00105 static Ogre::Vector3 GetBarycentricCoordinates(const Ogre::Vector3& P1, const Ogre::Vector3& P2, const Ogre::Vector3& P3, const Ogre::Vector3& P);
00106 };
00107
00108 }
00109
00110 #endif