annotate engine/core/view/renderers/genericrenderer.cpp @ 591:378b588216d6

* Improved addTransparentArea(). Now you can set a list with namespaces.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 13 Aug 2010 20:28:52 +0000
parents a2dde16ddc62
children e3140f01749d
rev   line source
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 /***************************************************************************
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2 * Copyright (C) 2005-2008 by the FIFE team *
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3 * http://www.fifengine.de *
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4 * This file is part of FIFE. *
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 * *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
6 * FIFE is free software; you can redistribute it and/or *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
7 * modify it under the terms of the GNU Lesser General Public *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
8 * License as published by the Free Software Foundation; either *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
9 * version 2.1 of the License, or (at your option) any later version. *
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 * *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
11 * This library is distributed in the hope that it will be useful, *
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
14 * Lesser General Public License for more details. *
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 * *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
16 * You should have received a copy of the GNU Lesser General Public *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
17 * License along with this library; if not, write to the *
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 * Free Software Foundation, Inc., *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 36
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 ***************************************************************************/
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22 // Standard C++ library includes
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 // 3rd party library includes
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26 // FIFE includes
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27 // These includes are split up in two parts, separated by one empty line
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28 // First block: files included from the FIFE root src directory
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29 // Second block: files included from the same folder
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 #include "video/renderbackend.h"
27
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
31 #include "video/imagepool.h"
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
32 #include "video/animation.h"
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
33 #include "video/animationpool.h"
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
34 #include "video/fonts/abstractfont.h"
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
35 #include "video/image.h"
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36 #include "util/math/fife_math.h"
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 #include "util/log/logger.h"
181
56ac89189bc4 fixed time handling in fife:
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 105
diff changeset
38 #include "util/time/timemanager.h"
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39 #include "model/metamodel/grids/cellgrid.h"
31
9a9f4447af7c add animation renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 30
diff changeset
40 #include "model/metamodel/timeprovider.h"
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
41 #include "model/structures/instance.h"
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
42 #include "model/structures/layer.h"
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
43 #include "model/structures/location.h"
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
44
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
45 #include "view/camera.h"
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
46 #include "genericrenderer.h"
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
47
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
48
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
49 namespace FIFE {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
50 static Logger _log(LM_VIEWVIEW);
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
51
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
52 GenericRendererNode::GenericRendererNode(Instance* attached_instance, const Location &relative_location, Layer* relative_layer, const Point &relative_point):
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
53 m_instance(attached_instance),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
54 m_location(relative_location),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
55 m_layer(relative_layer),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
56 m_point(relative_point) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
57 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
58 GenericRendererNode::GenericRendererNode(Instance* attached_instance, const Location &relative_location, const Point &relative_point):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
59 m_instance(attached_instance),
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
60 m_location(relative_location),
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
61 m_layer(NULL),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
62 m_point(relative_point) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
63 }
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
64 GenericRendererNode::GenericRendererNode(Instance* attached_instance, Layer* relative_layer, const Point &relative_point):
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
65 m_instance(attached_instance),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
66 m_location(NULL),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
67 m_layer(relative_layer),
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
68 m_point(relative_point) {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
69 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
70 GenericRendererNode::GenericRendererNode(Instance* attached_instance, const Point &relative_point):
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
71 m_instance(attached_instance),
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
72 m_location(NULL),
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
73 m_layer(NULL),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
74 m_point(relative_point) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
75 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
76 GenericRendererNode::GenericRendererNode(const Location &attached_location, Layer* relative_layer, const Point &relative_point):
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
77 m_instance(NULL),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
78 m_location(attached_location),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
79 m_layer(relative_layer),
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
80 m_point(relative_point) {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
81 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
82 GenericRendererNode::GenericRendererNode(const Location &attached_location, const Point &relative_point):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
83 m_instance(NULL),
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
84 m_location(attached_location),
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
85 m_layer(NULL),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
86 m_point(relative_point) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
87 }
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
88 GenericRendererNode::GenericRendererNode(Layer* attached_layer, const Point &relative_point):
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
89 m_instance(NULL),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
90 m_location(NULL),
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
91 m_layer(attached_layer),
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
92 m_point(relative_point) {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
93 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
94 GenericRendererNode::GenericRendererNode(const Point &attached_point):
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
95 m_instance(NULL),
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
96 m_location(NULL),
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
97 m_layer(NULL),
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
98 m_point(attached_point) {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
99 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
100 GenericRendererNode::~GenericRendererNode() {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
101 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
102
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
103 void GenericRendererNode::setAttached(Instance* attached_instance, const Location &relative_location, const Point &relative_point) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
104 m_instance = attached_instance;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
105 m_location = relative_location;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
106 m_point = relative_point;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
107 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
108 void GenericRendererNode::setAttached(Instance* attached_instance, const Location &relative_location) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
109 m_instance = attached_instance;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
110 m_location = relative_location;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
111 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
112 void GenericRendererNode::setAttached(Instance* attached_instance, const Point &relative_point) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
113 m_instance = attached_instance;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
114 m_point = relative_point;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
115 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
116 void GenericRendererNode::setAttached(Instance* attached_instance) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
117 m_instance = attached_instance;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
118 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
119 void GenericRendererNode::setAttached(const Location &attached_location, const Point &relative_point) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
120 m_instance = NULL;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
121 m_location = attached_location;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
122 m_point = relative_point;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
123 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
124 void GenericRendererNode::setAttached(const Location &attached_location) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
125 m_instance = NULL;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
126 m_location = attached_location;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
127 }
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
128 void GenericRendererNode::setAttached(Layer* attached_layer) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
129 m_layer = attached_layer;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
130 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
131 void GenericRendererNode::setAttached(const Point &attached_point) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
132 m_instance = NULL;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
133 m_location = NULL;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
134 m_point = attached_point;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
135 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
136
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
137 void GenericRendererNode::setRelative(const Location &relative_location) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
138 if(m_instance == NULL) {
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
139 throw NotSupported("No instance attached.");
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
140 }
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
141 m_location = relative_location;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
142 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
143 void GenericRendererNode::setRelative(const Location &relative_location, Point relative_point) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
144 if(m_instance == NULL) {
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
145 throw NotSupported("No instance attached.");
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
146 }
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
147 m_location = relative_location;
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
148 m_point = relative_point;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
149 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
150 void GenericRendererNode::setRelative(const Point &relative_point) {
36
6f1227f4932b Fixed and's and or's.
aldart@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 32
diff changeset
151 if(m_instance == NULL || m_location == NULL) {
25
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
152 throw NotSupported("No instance or location attached.");
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
153 }
fc6713d72b80 add setter for nodes
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 24
diff changeset
154 m_point = relative_point;
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
155 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
156
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
157 Instance* GenericRendererNode::getAttachedInstance() {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
158 if(m_instance == NULL) {
24
cb87d40e9342 fix exceptions and cleanup code
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 23
diff changeset
159 throw NotSupported("No instance attached.");
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
160 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
161 return m_instance;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
162 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
163 Location GenericRendererNode::getAttachedLocation() {
36
6f1227f4932b Fixed and's and or's.
aldart@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 32
diff changeset
164 if(m_instance != NULL || m_location == NULL) {
24
cb87d40e9342 fix exceptions and cleanup code
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 23
diff changeset
165 throw NotSupported("No location attached.");
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
166 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
167 return m_location;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
168 }
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
169 Layer* GenericRendererNode::getAttachedLayer() {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
170 if(m_layer == NULL) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
171 throw NotSupported("No layer attached.");
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
172 }
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
173 return m_layer;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
174 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
175 Point GenericRendererNode::getAttachedPoint() {
36
6f1227f4932b Fixed and's and or's.
aldart@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 32
diff changeset
176 if(m_instance != NULL || m_location != NULL) {
24
cb87d40e9342 fix exceptions and cleanup code
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 23
diff changeset
177 throw NotSupported("No point attached.");
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
178 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
179 return m_point;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
180 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
181
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
182 Location GenericRendererNode::getOffsetLocation() {
36
6f1227f4932b Fixed and's and or's.
aldart@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 32
diff changeset
183 if(m_instance == NULL || m_location == NULL) {
24
cb87d40e9342 fix exceptions and cleanup code
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 23
diff changeset
184 throw NotSupported("No location as offset used.");
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
185 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
186 return m_location;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
187 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
188 Point GenericRendererNode::getOffsetPoint() {
36
6f1227f4932b Fixed and's and or's.
aldart@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 32
diff changeset
189 if(m_instance == NULL && m_location == NULL) {
24
cb87d40e9342 fix exceptions and cleanup code
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 23
diff changeset
190 throw NotSupported("No point as offset used.");
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
191 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
192 return m_point;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
193 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
194
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
195 Instance* GenericRendererNode::getInstance() {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
196 return m_instance;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
197 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
198 Location GenericRendererNode::getLocation() {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
199 return m_location;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
200 }
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
201 Layer* GenericRendererNode::getLayer() {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
202 return m_layer;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
203 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
204 Point GenericRendererNode::getPoint() {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
205 return m_point;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
206 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
207
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
208 Point GenericRendererNode::getCalculatedPoint(Camera* cam, Layer* layer) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
209 ScreenPoint p;
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
210 if(m_instance != NULL) {
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
211 if(m_layer == NULL) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
212 m_layer = m_instance->getLocation().getLayer();
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
213 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
214 if(m_location != NULL) {
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
215 p = cam->toScreenCoordinates(m_instance->getLocationRef().getMapCoordinates() + m_location.getMapCoordinates());
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
216 } else {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
217 p = cam->toScreenCoordinates(m_instance->getLocation().getMapCoordinates());
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
218 }
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
219 } else if(m_location != NULL) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
220 if(m_layer == NULL) {
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
221 m_layer = m_location.getLayer();
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
222 }
584
a2dde16ddc62 * Fixed the location segfault of the genericrenderer. fixes[ticket:446]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 583
diff changeset
223 p = cam->toScreenCoordinates(m_location.getMapCoordinates());
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
224 } else if(m_layer == NULL) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
225 const std::list<Layer*>& layers = cam->getRenderer("GenericRenderer")->getActiveLayers();
579
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
226 std::list<Layer*>::const_reverse_iterator layer_it = layers.rbegin();
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
227 setAttached(*layer_it);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
228 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
229 return Point(m_point.x + p.x, m_point.y + p.y);
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
230 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
231
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
232 GenericRendererLineInfo::GenericRendererLineInfo(GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b, uint8_t a):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
233 GenericRendererElementInfo(),
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
234 m_edge1(n1),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
235 m_edge2(n2),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
236 m_red(r),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
237 m_green(g),
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
238 m_blue(b),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
239 m_alpha(a) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
240 }
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
241 void GenericRendererLineInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
242 Point p1 = m_edge1.getCalculatedPoint(cam, layer);
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
243 Point p2 = m_edge2.getCalculatedPoint(cam, layer);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
244 if(m_edge1.getLayer() == layer) {
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
245 renderbackend->drawLine(p1, p2, m_red, m_green, m_blue, m_alpha);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
246 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
247 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
248
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
249 GenericRendererPointInfo::GenericRendererPointInfo(GenericRendererNode anchor, uint8_t r, uint8_t g, uint8_t b, uint8_t a):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
250 GenericRendererElementInfo(),
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
251 m_anchor(anchor),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
252 m_red(r),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
253 m_green(g),
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
254 m_blue(b),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
255 m_alpha(a) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
256 }
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
257 void GenericRendererPointInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
258 Point p = m_anchor.getCalculatedPoint(cam, layer);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
259 if(m_anchor.getLayer() == layer) {
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
260 renderbackend->putPixel(p.x, p.y, m_red, m_green, m_blue, m_alpha);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
261 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
262 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
263
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
264 GenericRendererTriangleInfo::GenericRendererTriangleInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, uint8_t r, uint8_t g, uint8_t b, uint8_t a):
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
265 GenericRendererElementInfo(),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
266 m_edge1(n1),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
267 m_edge2(n2),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
268 m_edge3(n3),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
269 m_red(r),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
270 m_green(g),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
271 m_blue(b),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
272 m_alpha(a) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
273 }
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
274 void GenericRendererTriangleInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
275 Point p1 = m_edge1.getCalculatedPoint(cam, layer);
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
276 Point p2 = m_edge2.getCalculatedPoint(cam, layer);
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
277 Point p3 = m_edge3.getCalculatedPoint(cam, layer);
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
278 if(m_edge1.getLayer() == layer) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
279 renderbackend->drawTriangle(p1, p2, p3, m_red, m_green, m_blue, m_alpha);
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
280 }
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
281 }
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
282
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
283 GenericRendererQuadInfo::GenericRendererQuadInfo(GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b, uint8_t a):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
284 GenericRendererElementInfo(),
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
285 m_edge1(n1),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
286 m_edge2(n2),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
287 m_edge3(n3),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
288 m_edge4(n4),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
289 m_red(r),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
290 m_green(g),
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
291 m_blue(b),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
292 m_alpha(a) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
293 }
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
294 void GenericRendererQuadInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
295 Point p1 = m_edge1.getCalculatedPoint(cam, layer);
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
296 Point p2 = m_edge2.getCalculatedPoint(cam, layer);
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
297 Point p3 = m_edge3.getCalculatedPoint(cam, layer);
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
298 Point p4 = m_edge4.getCalculatedPoint(cam, layer);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
299 if(m_edge1.getLayer() == layer) {
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
300 renderbackend->drawQuad(p1, p2, p3, p4, m_red, m_green, m_blue, m_alpha);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
301 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
302 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
303
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
304 GenericRendererVertexInfo::GenericRendererVertexInfo(GenericRendererNode center, int size, uint8_t r, uint8_t g, uint8_t b, uint8_t a):
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
305 GenericRendererElementInfo(),
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
306 m_center(center),
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
307 m_size(size),
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
308 m_red(r),
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
309 m_green(g),
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
310 m_blue(b),
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
311 m_alpha(a) {
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
312 }
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
313 void GenericRendererVertexInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
314 Point p = m_center.getCalculatedPoint(cam, layer);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
315 if(m_center.getLayer() == layer) {
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
316 renderbackend->drawVertex(p, m_size, m_red, m_green, m_blue, m_alpha);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
317 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
318 }
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
319
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
320 GenericRendererImageInfo::GenericRendererImageInfo(GenericRendererNode anchor, int image):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
321 GenericRendererElementInfo(),
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
322 m_anchor(anchor),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
323 m_image(image) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
324 }
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
325 void GenericRendererImageInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
326 Point p = m_anchor.getCalculatedPoint(cam, layer);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
327 if(m_anchor.getLayer() == layer) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
328 Image* img = &imagepool->getImage(m_image);
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
329 Rect r;
579
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
330 Rect viewport = cam->getViewPort();
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
331 r.x = p.x-img->getWidth()/2;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
332 r.y = p.y-img->getHeight()/2;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
333 r.w = img->getWidth();
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
334 r.h = img->getHeight();
579
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
335 if(r.intersects(viewport))
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
336 img->render(r);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
337 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
338 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
339
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
340 GenericRendererAnimationInfo::GenericRendererAnimationInfo(GenericRendererNode anchor, int animation):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
341 GenericRendererElementInfo(),
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
342 m_anchor(anchor),
31
9a9f4447af7c add animation renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 30
diff changeset
343 m_animation(animation),
181
56ac89189bc4 fixed time handling in fife:
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 105
diff changeset
344 m_start_time(TimeManager::instance()->getTime()),
31
9a9f4447af7c add animation renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 30
diff changeset
345 m_time_scale(1.0) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
346 }
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
347 void GenericRendererAnimationInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
348 Point p = m_anchor.getCalculatedPoint(cam, layer);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
349 if(m_anchor.getLayer() == layer) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
350 Animation& animation = animpool->getAnimation(m_animation);
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
351 int animtime = scaleTime(m_time_scale, TimeManager::instance()->getTime() - m_start_time) % animation.getDuration();
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
352 Image* img = animation.getFrameByTimestamp(animtime);
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
353 Rect r;
579
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
354 Rect viewport = cam->getViewPort();
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
355 r.x = p.x-img->getWidth()/2;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
356 r.y = p.y-img->getHeight()/2;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
357 r.w = img->getWidth();
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
358 r.h = img->getHeight();
579
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
359 if(r.intersects(viewport))
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
360 img->render(r);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
361 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
362 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
363
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
364 GenericRendererTextInfo::GenericRendererTextInfo(GenericRendererNode anchor, AbstractFont* font, std::string text):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
365 GenericRendererElementInfo(),
29
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
366 m_anchor(anchor),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
367 m_font(font),
0cb049f291e1 make members private and prefix with m_
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 27
diff changeset
368 m_text(text) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
369 }
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
370 void GenericRendererTextInfo::render(Camera* cam, Layer* layer, RenderList& instances, RenderBackend* renderbackend, ImagePool* imagepool, AnimationPool* animpool) {
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
371 Point p = m_anchor.getCalculatedPoint(cam, layer);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
372 if(m_anchor.getLayer() == layer) {
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
373 Image* img = m_font->getAsImageMultiline(m_text);
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
374 Rect r;
579
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
375 Rect viewport = cam->getViewPort();
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
376 r.x = p.x-img->getWidth()/2;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
377 r.y = p.y-img->getHeight()/2;
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
378 r.w = img->getWidth();
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
379 r.h = img->getHeight();
579
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
380 if(r.intersects(viewport))
b2feacaed53c * Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 482
diff changeset
381 img->render(r);
445
f855809822cf * Fixed GenericRenderer, now it only render to a specific layer. If the node is only a point then it used the last active layer. fixes #[ticket:458]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 430
diff changeset
382 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
383 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
384
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
385 GenericRenderer* GenericRenderer::getInstance(IRendererContainer* cnt) {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
386 return dynamic_cast<GenericRenderer*>(cnt->getRenderer("GenericRenderer"));
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
387 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
388
27
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
389 GenericRenderer::GenericRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool):
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
390 RendererBase(renderbackend, position),
27
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
391 m_imagepool(imagepool),
788cb9525b2f add image and text renderer to generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 26
diff changeset
392 m_animationpool(animpool),
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
393 m_groups() {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
394 setEnabled(false);
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
395 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
396
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
397 GenericRenderer::GenericRenderer(const GenericRenderer& old):
30
9c3f37432a28 fix clone constructor
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 29
diff changeset
398 RendererBase(old),
9c3f37432a28 fix clone constructor
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 29
diff changeset
399 m_imagepool(old.m_imagepool),
9c3f37432a28 fix clone constructor
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 29
diff changeset
400 m_animationpool(old.m_animationpool),
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
401 m_groups() {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
402 setEnabled(false);
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
403 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
404
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
405 RendererBase* GenericRenderer::clone() {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
406 return new GenericRenderer(*this);
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
407 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
408
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
409 GenericRenderer::~GenericRenderer() {
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
410 }
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
411 void GenericRenderer::addLine(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
412 GenericRendererElementInfo* info = new GenericRendererLineInfo(n1, n2, r, g, b, a);
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
413 m_groups[group].push_back(info);
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
414 }
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
415 void GenericRenderer::addPoint(const std::string &group, GenericRendererNode n, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
416 GenericRendererElementInfo* info = new GenericRendererPointInfo(n, r, g, b, a);
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
417 m_groups[group].push_back(info);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
418 }
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
419 void GenericRenderer::addTriangle(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
420 GenericRendererElementInfo* info = new GenericRendererTriangleInfo(n1, n2, n3, r, g, b, a);
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
421 m_groups[group].push_back(info);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
422 }
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
423 void GenericRenderer::addQuad(const std::string &group, GenericRendererNode n1, GenericRendererNode n2, GenericRendererNode n3, GenericRendererNode n4, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
424 GenericRendererElementInfo* info = new GenericRendererQuadInfo(n1, n2, n3, n4, r, g, b, a);
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
425 m_groups[group].push_back(info);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
426 }
583
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
427 void GenericRenderer::addVertex(const std::string &group, GenericRendererNode n, int size, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
47b49b9b0c0a * Improved the floatingtextrenderer. Now you can set an alpha value for font, background quad and border. Splited quad and border into own commands.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 579
diff changeset
428 GenericRendererElementInfo* info = new GenericRendererVertexInfo(n, size, r, g, b, a);
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
429 m_groups[group].push_back(info);
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
430 }
105
2241b0d5379e use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
431 void GenericRenderer::addText(const std::string &group, GenericRendererNode n, AbstractFont* font, const std::string &text) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
432 GenericRendererElementInfo* info = new GenericRendererTextInfo(n, font, text);
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
433 m_groups[group].push_back(info);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
434 }
105
2241b0d5379e use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
435 void GenericRenderer::addImage(const std::string &group, GenericRendererNode n, int image) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
436 GenericRendererElementInfo* info = new GenericRendererImageInfo(n, image);
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
437 m_groups[group].push_back(info);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
438 }
105
2241b0d5379e use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
439 void GenericRenderer::addAnimation(const std::string &group, GenericRendererNode n, int animation) {
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
440 GenericRendererElementInfo* info = new GenericRendererAnimationInfo(n, animation);
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
441 m_groups[group].push_back(info);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
442 }
430
ad1f09d954f9 Added the ability to render a vertex on the screen. The vertex is represented by a small square. fixes[t:455]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 181
diff changeset
443
105
2241b0d5379e use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
444 void GenericRenderer::removeAll(const std::string &group) {
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
445 std::vector<GenericRendererElementInfo*>::const_iterator info_it = m_groups[group].begin();
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
446 for (;info_it != m_groups[group].end(); ++info_it) {
24
cb87d40e9342 fix exceptions and cleanup code
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 23
diff changeset
447 delete *info_it;
cb87d40e9342 fix exceptions and cleanup code
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 23
diff changeset
448 }
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
449 m_groups[group].clear();
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
450 m_groups.erase(group);
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
451 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
452
482
16c2b3ee59ce * Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 445
diff changeset
453 void GenericRenderer::render(Camera* cam, Layer* layer, RenderList& instances) {
105
2241b0d5379e use strings as grouping in generic renderer, easier for the clients...
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
454 std::map<std::string, std::vector<GenericRendererElementInfo*> >::iterator group_it = m_groups.begin();
32
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
455 for(; group_it != m_groups.end(); ++group_it) {
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
456 std::vector<GenericRendererElementInfo*>::const_iterator info_it = group_it->second.begin();
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
457 for (;info_it != group_it->second.end(); ++info_it) {
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
458 (*info_it)->render(cam, layer, instances, m_renderbackend, m_imagepool, m_animationpool);
75b6394ced14 * remove geometric renderer, its not replaced by the more functional generic renderern
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 31
diff changeset
459 }
23
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
460 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
461 }
e5e2fec68834 add generic renderer
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
462 }