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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
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_LINE_H_
#define _CORE_MATH_LINE_H_

#include "MathUtil.h"

namespace Divide {

class Line {
    public:
    Line() : _widthStart(1.0f),
             _widthEnd(1.0f)
    {
    }

    Line(const vec3<F32> &startPoint,
         const vec3<F32> &endPoint,
         const UColour& colour)
        : Line(startPoint, endPoint, colour, colour)
    {
    }

    Line(const vec3<F32> &startPoint,
         const vec3<F32> &endPoint,
         const UColour& colour,
         F32 width)
        : Line(startPoint, endPoint, colour, colour, width)
    {
    }

    Line(const vec3<F32> &startPoint,
         const vec3<F32> &endPoint,
         const UColour& colourStart,
         const UColour& colourEnd)
        : Line(startPoint, endPoint, colourStart, colourEnd, 1.0f)
    {
    }

    Line(const vec3<F32> &startPoint,
         const vec3<F32> &endPoint,
         const UColour& colourStart,
         const UColour& colourEnd,
         F32 width)
        : Line(startPoint, endPoint, colourStart, colourEnd, width, width)
    {
    }

    Line(const vec3<F32> &startPoint,
         const vec3<F32> &endPoint,
         const UColour& colourStart,
         const UColour& colourEnd,
         F32 widthStart,
         F32 widthEnd)
        : _startPoint(startPoint),
          _endPoint(endPoint),
          _colourStart(colourStart),
          _colourEnd(colourEnd),
          _widthStart(widthStart),
          _widthEnd(widthEnd)
    {
    }

    inline void colour(U8 r, U8 g, U8 b, U8 a) {
        colour(r, g, b, a,
              r, g, b, a);
    }

    inline void colour(U8 startR, U8 startG, U8 startB, U8 startA,
                      U8 endR,   U8 endG,   U8 endB,   U8 endA) {
        _colourStart.set(startR, startG, startB, startA);
        _colourEnd.set(endR, endG, endB, endA);
    }

    inline void width(F32 w) {
        width(w, w);
    }

    inline void width(F32 widthStart, F32 widthEnd) {
        _widthStart = widthStart;
        _widthEnd = widthEnd;
    }

    void segment(F32 startX, F32 startY, F32 startZ,
                 F32 endX, F32 endY, F32 endZ) {
        _startPoint.set(startX, startY, startZ);
        _endPoint.set(endX, endY, endZ);
    }

    inline const vec3<F32>& startPoint() const {
        return _startPoint;
    }

    inline const vec3<F32>& endPoint() const {
        return _endPoint;
    }

    inline const UColour& colourStart() const {
        return _colourStart;
    }

    inline const UColour& colourEnd() const {
        return _colourEnd;
    }

    inline F32 widthStart() const {
        return _widthStart;
    }

    inline F32 widthEnd() const {
        return _widthEnd;
    }

public:
    vec3<F32> _startPoint;
    vec3<F32> _endPoint;
    UColour   _colourStart;
    UColour   _colourEnd;
    F32       _widthStart;
    F32       _widthEnd;
};

}; //namespace Divide

#endif //_CORE_MATH_LINE_H_

Commits for Divide-Framework/trunk/Source Code/Core/Math/Headers/Line.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

1004 Diff Diff IonutCava picture IonutCava Wed 20 Dec, 2017 17:16:32 +0000

[Ionut]
- More GUI cleanup (added multiple GUIButton events)
- Typedef vec4<U8> and vec4<F32> to UColour and FColour respectively for easier to read code.

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

[IonutCava]
- Update copyright notice

721 Diff Diff IonutCava picture IonutCava Wed 08 Jun, 2016 15:47:49 +0000

[IonutCava]
- Spelling: change all references from our code of “color” to the PROPER British version of “colour” because it sounds 100x better

720 Diff Diff IonutCava picture IonutCava Mon 06 Jun, 2016 15:51:06 +0000

[IonutCava]
- PVS-Studio guided static analysis fixes and optimizations
- Added a flag to SceneState to bypass the Save/Load system not needed for certain types of scenes (menus, cinematics, etc)

686 Diff Diff IonutCava picture IonutCava Thu 21 Apr, 2016 16:24:19 +0000

[IonutCava]
- Refactor the scene self-registering system to prevent linker related issues
- Add a SGNRelationshipCache class that can quickly verify if any 2 given nodes are related in any way
— This should speed up Octree updates by a lot

note: The template refactoring code has significantly slowed down performance for reasons yet unknown. Investigating.

685 IonutCava picture IonutCava Wed 20 Apr, 2016 20:44:52 +0000

[IonutCava]
- Missed a file in the previous commit
- Added a SceneFactory class to aid in scene registration