| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- $#include "Octree.h"
- class Octree : public Component
- {
- void SetSize(const BoundingBox& box, unsigned numLevels);
- void Update(const FrameInfo& frame);
- void AddManualDrawable(Drawable* drawable);
- void RemoveManualDrawable(Drawable* drawable);
-
- // void GetDrawables(OctreeQuery& query) const;
- // void Raycast(RayOctreeQuery& query) const;
- tolua_outside void OctreeRaycast @ Raycast(PODVector<RayQueryResult> &result, const Ray& ray, RayQueryLevel level, float maxDistance, unsigned char drawableFlags) const;
- // void RaycastSingle(RayOctreeQuery& query) const;
- tolua_outside RayQueryResult OctreeRaycastSingle @ RaycastSingle(const Ray& ray, RayQueryLevel level, float maxDistance, unsigned char drawableFlags) const;
-
- unsigned GetNumLevels() const;
-
- void QueueUpdate(Drawable* drawable);
- void DrawDebugGeometry(bool depthTest);
- tolua_readonly tolua_property__get_set unsigned numLevels;
- };
- ${
- static RayQueryResult OctreeRaycastSingle(const Octree* octree, const Ray& ray, RayQueryLevel level, float maxDistance, unsigned char drawableFlags)
- {
- PODVector<RayQueryResult> result;
- RayOctreeQuery query(result, ray, level, maxDistance, drawableFlags);
- octree->RaycastSingle(query);
- if (!query.result_.Empty())
- return query.result_[0];
- else
- {
- RayQueryResult empty;
- empty.position_ = Vector3::ZERO;
- empty.normal_ = Vector3::ZERO;
- empty.distance_ = M_INFINITY;
- empty.subObject_ = 0;
- return empty;
- }
- }
- static void OctreeRaycast(const Octree* octree, PODVector<RayQueryResult> &result, const Ray& ray, RayQueryLevel level, float maxDistance, unsigned char drawableFlags)
- {
- RayOctreeQuery query(result,ray,level,maxDistance,drawableFlags);
- octree->Raycast(query);
- }
- $}
|