Divide-Framework
This repository has no backups
This repository's network speed is throttled to 100KB/sec
Upgrade your account to fix these warnings, or use backups.vc for automated backups
Divide-Framework / trunk / Source Code / Core / Math / BoundingVolumes / Headers / BoundingBox.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
/* Copyright (c) 2014 DIVIDE-Studio Copyright (c) 2009 Ionut Cava This file is part of DIVIDE Framework. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _CORE_MATH_BOUNDINGVOLUMES_BOUNDINGBOX_H_ #define _CORE_MATH_BOUNDINGVOLUMES_BOUNDINGBOX_H_ #include "Core/Math/Headers/Ray.h" #include "Utility/Headers/GUIDWrapper.h" #include <algorithm> namespace Divide { class BoundingBox : public GUIDWrapper { public: BoundingBox(); BoundingBox(const vec3<F32>& min, const vec3<F32>& max); BoundingBox(vectorImpl<vec3<F32> >& points); ~BoundingBox(); BoundingBox(const BoundingBox& b); void operator=(const BoundingBox& b); bool ContainsPoint(const vec3<F32>& point) const; bool Collision(const BoundingBox& AABB2) const; bool Compare(const BoundingBox& bb) const; bool operator == (const BoundingBox& B) const; bool operator != (const BoundingBox& B) const; /// Optimized method bool Intersect(const Ray &r, F32 t0, F32 t1) const; void CreateFromPoints(vectorImpl<vec3<F32>>& points); void Add(const vec3<F32>& v); void Add(const BoundingBox& bb); void Translate(const vec3<F32>& v); void Multiply(F32 factor); void Multiply(const vec3<F32>& v); void MultiplyMax(const vec3<F32>& v); void MultiplyMin(const vec3<F32>& v); bool Transform(const BoundingBox& initialBoundingBox, const mat4<F32>& mat, bool force = false); void setComputed(bool state); bool isComputed() const; const vec3<F32>& getMin() const; const vec3<F32>& getMax() const; vec3<F32> getCenter() const; vec3<F32> getExtent() const; vec3<F32> getHalfExtent() const; F32 getWidth() const; F32 getHeight() const; F32 getDepth() const; void set(const BoundingBox& bb); void set(const vec3<F32>& min, const vec3<F32>& max); void setMin(const vec3<F32>& min); void setMax(const vec3<F32>& max); void reset(); const vec3<F32>* getPoints() const; F32 nearestDistanceFromPointSquared(const vec3<F32> &pos) const; F32 nearestDistanceFromPoint(const vec3<F32> &pos) const; protected: void ComputePoints() const; private: bool _computed; vec3<F32> _min, _max; mat4<F32> _oldMatrix; // This is is very limited in scope so mutable should be ok mutable bool _pointsDirty; mutable vec3<F32> _points[8]; mutable vec3<F32> _cacheVector; }; }; //namespace Divide #endif //_CORE_MATH_BOUNDINGVOLUMES_BOUNDINGBOX_H_ #include "BoundingBox.inl" |
Commits for Divide-Framework/trunk/Source Code/Core/Math/BoundingVolumes/Headers/BoundingBox.h
Revision | Author | Commited | Message |
---|---|---|---|
337 Diff | IonutCava | Wed 17 Dec, 2014 17:25:16 +0000 | [Ionut] |
324 Diff | IonutCava | Sun 14 Sep, 2014 14:01:39 +0000 | [Ionut] - Added SRGB support (part 1) - Sky is now loaded via the ResourceCache system |
322 Diff | IonutCava | Sat 06 Sep, 2014 20:33:47 +0000 | [Ionut] |
318 Diff | IonutCava | Sat 30 Aug, 2014 17:35:53 +0000 | [Ionut] |
307 Diff | IonutCava | Tue 12 Aug, 2014 19:45:12 +0000 | [Ionut] |
302 Diff | IonutCava | Wed 06 Aug, 2014 22:09:55 +0000 | [Ionut] |
270 Diff | IonutCava | Thu 05 Jun, 2014 19:08:07 +0000 | [Ionut][[BR]] |
264 Diff | k1ngp1n | Tue 27 May, 2014 13:04:38 +0000 | [Ionut] [[BR]] |
260 Diff | k1ngp1n | Sat 03 May, 2014 19:33:41 +0000 | [Ionut] [[BR]] |
259 | k1ngp1n | Sun 27 Apr, 2014 18:24:52 +0000 | [Ionut][[BR]] |