20 #if defined(_DEBUG) && defined(_WINDOWS)
21 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
28 : m_upper_left(upper_left),
30 m_logo_color(logo_color),
31 m_text_color(text_color),
42 : m_upper_left(rhs.m_upper_left),
43 m_height(rhs.m_height),
44 m_logo_color(rhs.m_logo_color),
45 m_text_color(rhs.m_text_color),
52 Logo temp(rhs.m_upper_left, rhs.m_height, rhs.m_logo_color, rhs.m_text_color);
54 std::swap(m_upper_left, temp.m_upper_left);
56 std::swap(m_logo_color, temp.m_logo_color);
57 std::swap(m_text_color, temp.m_text_color);
68 return Point2f(upper_left.
x , upper_left.
y );
70 Point2f Logo::get_p10(
const Point2f &upper_left,
const float &
height) {
71 return Point2f(upper_left.x + 0.34f * height, upper_left.y );
73 Point2f Logo::get_p20(
const Point2f &upper_left,
const float &
height) {
74 return Point2f(upper_left.x + 0.68f * height, upper_left.y );
76 Point2f Logo::get_p01(
const Point2f &upper_left,
const float &
height) {
77 return Point2f(upper_left.x , upper_left.y + 0.5f * height);
79 Point2f Logo::get_p11(
const Point2f &upper_left,
const float &
height) {
80 return Point2f(upper_left.x + 0.34f * height, upper_left.y + 0.5f * height);
82 Point2f Logo::get_p21(
const Point2f &upper_left,
const float &
height) {
83 return Point2f(upper_left.x + 0.68f * height, upper_left.y + 0.5f * height);
85 Point2f Logo::get_p02(
const Point2f &upper_left,
const float &
height) {
86 return Point2f(upper_left.x , upper_left.y + 1.0f * height);
88 Point2f Logo::get_p12(
const Point2f &upper_left,
const float &
height) {
89 return Point2f(upper_left.x + 0.34f * height, upper_left.y + 1.0f * height);
91 Point2f Logo::get_p22(
const Point2f &upper_left,
const float &
height) {
92 return Point2f(upper_left.x + 0.68f * height, upper_left.y + 1.0f * height);
94 float Logo::get_thickness(
const float &
height) {
95 return 0.68f / 12.0f *
height;
98 void Logo::create_all() {
99 create_z(Point2f(m_upper_left.
x - 0.99f * m_height, m_upper_left.
y + 0.25f * m_height), 0.5f * m_height);
100 create_e(Point2f(m_upper_left.
x - 0.55f * m_height, m_upper_left.
y + 0.25f * m_height), 0.5f * m_height);
101 create_n(Point2f(m_upper_left.
x - 0.11f * m_height, m_upper_left.
y + 0.25f * m_height), 0.5f * m_height);
102 create_i(Point2f(m_upper_left.
x + 0.33f * m_height, m_upper_left.
y + 0.25f * m_height), 0.5f * m_height);
103 create_p(Point2f(m_upper_left.
x + 0.77f * m_height, m_upper_left.
y + 0.25f * m_height), 0.5f * m_height);
104 create_e(Point2f(m_upper_left.
x + 1.21f * m_height, m_upper_left.
y + 0.25f * m_height), 0.5f * m_height);
105 create_x(Point2f(m_upper_left.
x + 1.65f * m_height, m_upper_left.
y + 0.25f * m_height), 0.5f * m_height);
106 create_logo(m_upper_left, m_height);
109 void Logo::create_logo(
const Point2f &upper_left,
const float &
height) {
110 const Point2f p30(upper_left.x + 0.500f * height, upper_left.y );
111 const Point2f p02(upper_left.x , upper_left.y + 0.333f * height);
112 const Point2f p42(upper_left.x + 0.666f * height, upper_left.y + 0.333f * height);
113 const Point2f p06(upper_left.x , upper_left.y + height);
114 const Point2f p26(upper_left.x + 0.333f * height, upper_left.y + height);
115 const Point2f p66(upper_left.x + height, upper_left.y + height);
116 const float thickness = 0.68f / 30.0f *
height;
118 create_thick_line(p30, p06, thickness, m_logo_color);
119 create_thick_line(p30, p66, thickness, m_logo_color);
120 create_thick_line(p02, p42, thickness, m_logo_color);
121 create_thick_line(p06, p26, thickness, m_logo_color);
122 create_circle(p30, thickness, m_logo_color, 18);
123 create_circle(p02, thickness, m_logo_color, 18);
124 create_circle(p06, thickness, m_logo_color, 18);
125 create_circle(p26, thickness, m_logo_color, 18);
126 create_circle(p66, thickness, m_logo_color, 18);
129 void Logo::create_z(
const Point2f &upper_left,
const float &
height) {
130 const Point2f p00 = get_p00(upper_left, height);
131 const Point2f p20 = get_p20(upper_left, height);
132 const Point2f p02 = get_p02(upper_left, height);
133 const Point2f p22 = get_p22(upper_left, height);
134 const float thickness = get_thickness(height);
136 create_thick_line(p00, p20, thickness, m_text_color);
137 create_thick_line(p20, p02, thickness, m_text_color);
138 create_thick_line(p02, p22, thickness, m_text_color);
139 create_circle(p00, thickness, m_text_color, 12);
140 create_circle(p20, thickness, m_text_color, 12);
141 create_circle(p02, thickness, m_text_color, 12);
142 create_circle(p22, thickness, m_text_color, 12);
145 void Logo::create_e(
const Point2f &upper_left,
const float &
height) {
146 const Point2f p00 = get_p00(upper_left, height);
147 const Point2f p20 = get_p20(upper_left, height);
148 const Point2f p01 = get_p01(upper_left, height);
149 const Point2f p21 = get_p21(upper_left, height);
150 const Point2f p02 = get_p02(upper_left, height);
151 const Point2f p22 = get_p22(upper_left, height);
152 const float thickness = get_thickness(height);
154 create_thick_line(p00, p20, thickness, m_text_color);
155 create_thick_line(p00, p02, thickness, m_text_color);
156 create_thick_line(p01, p21, thickness, m_text_color);
157 create_thick_line(p02, p22, thickness, m_text_color);
158 create_circle(p00, thickness, m_text_color, 12);
159 create_circle(p20, thickness, m_text_color, 12);
160 create_circle(p21, thickness, m_text_color, 12);
161 create_circle(p02, thickness, m_text_color, 12);
162 create_circle(p22, thickness, m_text_color, 12);
165 void Logo::create_n(
const Point2f &upper_left,
const float &
height) {
166 const Point2f p00 = get_p00(upper_left, height);
167 const Point2f p20 = get_p20(upper_left, height);
168 const Point2f p02 = get_p02(upper_left, height);
169 const Point2f p22 = get_p22(upper_left, height);
170 const float thickness = get_thickness(height);
172 create_thick_line(p00, p02, thickness, m_text_color);
173 create_thick_line(p00, p22, thickness, m_text_color);
174 create_thick_line(p20, p22, thickness, m_text_color);
175 create_circle(p00, thickness, m_text_color, 12);
176 create_circle(p20, thickness, m_text_color, 12);
177 create_circle(p02, thickness, m_text_color, 12);
178 create_circle(p22, thickness, m_text_color, 12);
181 void Logo::create_i(
const Point2f &upper_left,
const float &
height) {
182 const Point2f p00 = get_p00(upper_left, height);
183 const Point2f p10 = get_p10(upper_left, height);
184 const Point2f p20 = get_p20(upper_left, height);
185 const Point2f p02 = get_p02(upper_left, height);
186 const Point2f p12 = get_p12(upper_left, height);
187 const Point2f p22 = get_p22(upper_left, height);
188 const float thickness = get_thickness(height);
190 create_thick_line(p00, p20, thickness, m_text_color);
191 create_thick_line(p10, p12, thickness, m_text_color);
192 create_thick_line(p02, p22, thickness, m_text_color);
193 create_circle(p00, thickness, m_text_color, 12);
194 create_circle(p20, thickness, m_text_color, 12);
195 create_circle(p02, thickness, m_text_color, 12);
196 create_circle(p22, thickness, m_text_color, 12);
199 void Logo::create_p(
const Point2f &upper_left,
const float &
height) {
200 const Point2f p00 = get_p00(upper_left, height);
201 const Point2f p10 = get_p10(upper_left, height);
202 const Point2f p01 = get_p01(upper_left, height);
203 const Point2f p11 = get_p11(upper_left, height);
204 const Point2f p02 = get_p02(upper_left, height);
205 const Point2f phc(p10.x, 0.5f * (p10.y + p11.y));
206 const float thickness = get_thickness(height);
208 create_thick_line(p00, p10, thickness, m_text_color);
209 create_thick_line(p00, p02, thickness, m_text_color);
210 create_thick_line(p01, p11, thickness, m_text_color);
211 create_circle(p00, thickness, m_text_color, 12);
212 create_circle(p02, thickness, m_text_color, 12);
213 create_hollow_ellipse(phc, Point2f(0.167
f * m_height - thickness, 0.125
f * m_height - thickness), Point2f(0.167
f * m_height + thickness, 0.125
f * m_height + thickness), m_text_color, 36, 18);
216 void Logo::create_x(
const Point2f &upper_left,
const float &height) {
217 const Point2f p00 = get_p00(upper_left, height);
218 const Point2f p20 = get_p20(upper_left, height);
219 const Point2f p02 = get_p02(upper_left, height);
220 const Point2f p22 = get_p22(upper_left, height);
221 const float thickness = get_thickness(height);
223 create_thick_line(p00, p22, thickness, m_text_color);
224 create_thick_line(p02, p20, thickness, m_text_color);
225 create_circle(p00, thickness, m_text_color, 12);
226 create_circle(p20, thickness, m_text_color, 12);
227 create_circle(p02, thickness, m_text_color, 12);
228 create_circle(p22, thickness, m_text_color, 12);
231 void Logo::create_thick_line(
const Point2f &p0,
const Point2f &p1,
const float &thickness,
const Color &
color) {
232 const Vector3f
n = (
Global::vector_k % (Vector3f(p1.x, p1.y, 0.0f) - Vector3f(p0.x, p0.y, 0.0f))).normalized() * thickness;
233 Quadrilateral<Vertex2f_Color>
q( (Vertex2f_Color(Point2f(p0.x - n.x, p0.y - n.y), color)) ,
234 (Vertex2f_Color(Point2f(p0.x + n.x, p0.y + n.y), color)) ,
235 (Vertex2f_Color(Point2f(p1.x + n.x, p1.y + n.y), color)) ,
236 (Vertex2f_Color(Point2f(p1.x - n.x, p1.y - n.y), color)) );
237 Material
m(
"", color);
242 void Logo::create_circle(
const Point2f &
p,
const float &radius,
const Color &color,
const size_t &segments,
const size_t &begin,
const size_t &
end) {
243 const float arc = 2.0f *
Global::pi / float(segments);
244 Triangle<Vertex2f_Color>
t(Vertex2f_Color(p, color),
245 Vertex2f_Color(Point2f(), color),
246 Vertex2f_Color(Point2f(), color));
247 Material
m(
"", color);
250 for(
size_t i = begin;
i != segments &&
i !=
end; ++
i) {
251 const float float_i = float(
i);
252 t.b.position.x = p.x - radius * float(
sin(arc * float_i));
253 t.b.position.y = p.y - radius * float(
cos(arc * float_i));
254 t.c.position.x = p.x - radius * float(
sin(arc * (float_i + 1)));
255 t.c.position.y = p.y - radius * float(
cos(arc * (float_i + 1)));
260 void Logo::create_hollow_ellipse(
const Point2f &p,
const Point2f &inner_radius,
const Point2f &outer_radius,
const Color &color,
const size_t &segments,
const size_t &begin,
const size_t &end) {
261 const float arc = 2.0f *
Global::pi / float(segments);
262 Quadrilateral<Vertex2f_Color>
q(Vertex2f_Color(p, color),
263 Vertex2f_Color(p, color),
264 Vertex2f_Color(p, color),
265 Vertex2f_Color(p, color));
266 Material
m(
"", color);
269 for(
size_t i = begin;
i != segments &&
i !=
end; ++
i) {
270 const float float_i = float(
i);
271 q.a.position.x = p.x - inner_radius.x * float(
sin(arc * float_i));
272 q.a.position.y = p.y - inner_radius.y * float(
cos(arc * float_i));
273 q.b.position.x = p.x - outer_radius.x * float(
sin(arc * float_i));
274 q.b.position.y = p.y - outer_radius.y * float(
cos(arc * float_i));
275 q.c.position.x = p.x - outer_radius.x * float(
sin(arc * (float_i + 1)));
276 q.c.position.y = p.y - outer_radius.y * float(
cos(arc * (float_i + 1)));
277 q.d.position.x = p.x - inner_radius.x * float(
sin(arc * (float_i + 1)));
278 q.d.position.y = p.y - inner_radius.y * float(
cos(arc * (float_i + 1)));
Logo & operator=(const Logo &rhs)
EGLSurface EGLint EGLint EGLint EGLint height
Logo(const Point2f &upper_left, const float &height, const Color &logo_color, const Color &text_color)
const Vector3f vector_k(0, 0, 1)
k == Vector3f(0, 0, 1)
const float pi
pi == 3.1415926...
void fax_Quadrilateral(const Quadrilateral< Vertex2f_Color > *const &quadrilateral)
Give the Vertex_Buffer a copy of a Quadrilateral.
A Vertex_Buffer that accepts Triangle and Quadrilaterals.
void fax_Triangle(const Triangle< Vertex2f_Color > *const &triangle)
Give the Vertex_Buffer a copy of a Triangle.
void swap(Zeni::String &lhs, Zeni::String &rhs)
GLdouble GLdouble GLdouble GLdouble q
void render()
Render the Vertex_Buffer.
A 2D Point represented with floats.