$#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; // 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 result; RayOctreeQuery query(result, ray, level, maxDistance, drawableFlags); octree->RaycastSingle(query); if (!query.result_.Empty()) return query.result_[0]; else { RayQueryResult empty; empty.drawable_ = 0; empty.node_ = 0; empty.distance_ = M_INFINITY; empty.subObject_ = 0; return empty; } } $}