Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

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
/*
   Copyright (c) 2018 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_BOUNDINGSPHERE_H_
#define _CORE_MATH_BOUNDINGVOLUMES_BOUNDINGSPHERE_H_

#include "BoundingBox.h"

#include "Core/Math/Headers/Ray.h"

namespace Divide {
namespace Attorney {
    class BoundingSphereEditor;
};

class PropertyWindow;
class BoundingSphere {
    friend class Attorney::BoundingSphereEditor;

   public:
    BoundingSphere() noexcept;
    BoundingSphere(const vec3<F32>& center, F32 radius) noexcept;
    BoundingSphere(const vectorImpl<vec3<F32>>& points) noexcept;

    BoundingSphere(const BoundingSphere& s) noexcept;
    void operator=(const BoundingSphere& s) noexcept;

    void fromBoundingBox(const BoundingBox& bBox);
    void fromBoundingSphere(const BoundingSphere& bSphere);
    bool containsPoint(const vec3<F32>& point) const;
    bool containsBoundingBox(const BoundingBox& AABB) const;

    // https://code.google.com/p/qe3e/source/browse/trunk/src/BoundingSphere.h?r=28
    void add(const BoundingSphere& bSphere);
    void add(const vec3<F32>& point);
    void addRadius(const BoundingSphere& bSphere);
    void addRadius(const vec3<F32>& point);

    void createFromPoints(const vectorImpl<vec3<F32>>& points);

    void setRadius(F32 radius) noexcept;
    void setCenter(const vec3<F32>& center) noexcept;

    const vec3<F32>& getCenter() const noexcept;
    F32 getRadius() const noexcept;
    F32 getDiameter() const noexcept;

    F32 getDistanceFromPoint(const vec3<F32>& point) const;

    void reset();
    vec4<F32> asVec4() const;

    bool collision(const BoundingSphere& sphere2) const;

   private:
    bool _visibility, _dirty;
    vec3<F32> _center;
    F32 _radius;
    //mutable SharedLock _lock;
};

namespace Attorney {
    class BoundingSphereEditor {
        private:
        static F32* center(BoundingSphere& bs) {
            return bs._center._v;
        }
        static F32& radius(BoundingSphere& bs) {
            return bs._radius;
        }
        friend class Divide::PropertyWindow;
    };
}; //namespace Attorney

};  // namespace Divide

#endif  //_CORE_MATH_BOUNDINGVOLUMES_BOUNDINGSPHERE_H_

#include "BoundingSphere.inl"

Commits for Divide-Framework/trunk/Source Code/Core/Math/BoundingVolumes/Headers/BoundingSphere.h

Diff revisions: vs.
Revision Author Commited Message
1029 Diff Diff IonutCava picture IonutCava Tue 30 Jan, 2018 17:28:39 +0000

[Ionut]
- Update copyright notices

1026 Diff Diff IonutCava picture IonutCava Mon 29 Jan, 2018 17:43:26 +0000

[Ionut]
- More work on editor:
— Initial implementation of component listing and editing

993 Diff Diff IonutCava picture IonutCava Sun 10 Dec, 2017 20:07:57 +0000

[Ionut]
- Finished initial port of the old scene graph system to the new ECS based system.
- Finished converting 2 components to the new ECS system: Transform and RigidBody
- Fixed the “Deploy” build error with the CEGUI OpenGL renderer.
- Compilation now needs C++14 support (it’s sufficiently wide-spread now)

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

719 Diff Diff IonutCava picture IonutCava Fri 03 Jun, 2016 16:20:08 +0000

[IonutCava]
- More SceneManager – ScenePool splitting of responsibilities
- DefaultScene will be the first scene loaded by the application. If nothing is specified in XML, it will default to "DefaultScene"

648 Diff Diff IonutCava picture IonutCava Sun 21 Feb, 2016 16:32:52 +0000

[IonutCava]
- Update copyright notice
- Move BoundingBox and BoundingSphere to a new BoundsComponent
— Add a temp hack in SceneGraphNode to update these

600 Diff Diff IonutCava picture IonutCava Tue 08 Dec, 2015 17:22:11 +0000

[IonutCava]
- Cleanup SceneGraphNode class
- Rework AABB calculation and update system and fix various AABB problems (e.g. light AABB, parent mesh AABB, etc)
- Create a list of closest shadow casting lights for faster shadow map generation
- Texture creation bug fixed (related to descriptor enum value)
- Better FPS and Frametime calculation system

595 Diff Diff IonutCava picture IonutCava Fri 04 Dec, 2015 16:34:07 +0000

[IonutCava]
- Initial Octree code (unused)
- Improve mouse picking performance by checking only visible nodes (Z_PRE_PASS nodes as they are already sorted)

548 Diff Diff IonutCava picture IonutCava Wed 04 Nov, 2015 17:23:15 +0000

[IonutCava]
- More work on improving cascaded shadow maps

543 IonutCava picture IonutCava Fri 30 Oct, 2015 17:18:18 +0000

[IonutCava]
- More profile guided optimizations
- Attempt to render all CSM splits in a single pass using geometry shader based instancing (unfinished)