Mercurial > fife-parpg
annotate engine/core/view/renderers/instancerenderer.cpp @ 661:e3140f01749d
* Merged the light branch back into trunk.
* Modified the demos so they work with the new loaders and setting.
author | helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 05 Nov 2010 15:21:10 +0000 |
parents | 378b588216d6 |
children | 61a5f86a0db3 |
rev | line source |
---|---|
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 /*************************************************************************** |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 * Copyright (C) 2005-2008 by the FIFE team * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 * http://www.fifengine.de * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 * This file is part of FIFE. * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@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:
39
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:
39
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:
39
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:
39
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@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:
39
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@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:
39
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:
39
diff
changeset
|
14 * Lesser General Public License for more details. * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@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:
39
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:
39
diff
changeset
|
17 * License along with this library; if not, write to the * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@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:
39
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 ***************************************************************************/ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 // Standard C++ library includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 // 3rd party library includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 // FIFE includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 // These includes are split up in two parts, separated by one empty line |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 // First block: files included from the FIFE root src directory |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 // Second block: files included from the same folder |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 #include "video/renderbackend.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 #include "video/image.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 #include "video/sdl/sdlimage.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 #include "video/imagepool.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 #include "video/animation.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 #include "video/animationpool.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 #include "util/math/fife_math.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 #include "util/log/logger.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
38 #include "model/metamodel/grids/cellgrid.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
39 #include "model/metamodel/action.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
40 #include "model/structures/instance.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
41 #include "model/structures/layer.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 #include "model/structures/location.h" |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
43 #include "video/opengl/fife_opengl.h" |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
44 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 #include "view/camera.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
46 #include "view/visual.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
47 #include "instancerenderer.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
48 |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
49 |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
50 namespace { |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
51 unsigned int scale(unsigned int val, double factor) { |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
52 return static_cast<unsigned int>(ceil(static_cast<double>(val) * factor)); |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
53 } |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
54 } |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
56 namespace FIFE { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
57 static Logger _log(LM_VIEWVIEW); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
59 InstanceRenderer::OutlineInfo::OutlineInfo(): |
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
60 r(0), |
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
61 g(0), |
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
62 b(0), |
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
63 width(1), |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
64 dirty(false), |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
65 outline(NULL), |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
66 curimg(NULL) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
67 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 InstanceRenderer::ColoringInfo::ColoringInfo(): |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
69 r(0), |
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
70 g(0), |
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
71 b(0), |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
72 dirty(false), |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 overlay(NULL), |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
74 curimg(NULL) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
76 |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
77 InstanceRenderer::AreaInfo::AreaInfo(): |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
78 instance(NULL), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
79 groups(), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
80 w(1), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
81 h(1), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
82 trans(0), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
83 front(true), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
84 z(0) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
85 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
86 |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
87 InstanceRenderer::OutlineInfo::~OutlineInfo() { |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 delete outline; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
90 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
91 InstanceRenderer::ColoringInfo::~ColoringInfo() { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 delete overlay; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
94 |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
95 InstanceRenderer::AreaInfo::~AreaInfo() { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
96 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
97 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 InstanceRenderer* InstanceRenderer::getInstance(IRendererContainer* cnt) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 return dynamic_cast<InstanceRenderer*>(cnt->getRenderer("InstanceRenderer")); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
101 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
102 InstanceRenderer::InstanceRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
103 RendererBase(renderbackend, position), |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 m_imagepool(imagepool), |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
105 m_animationpool(animpool), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
106 m_area_layer(false) { |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 setEnabled(true); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
110 InstanceRenderer::InstanceRenderer(const InstanceRenderer& old): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
111 RendererBase(old), |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
112 m_imagepool(old.m_imagepool), |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
113 m_animationpool(old.m_animationpool), |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
114 m_area_layer(old.m_area_layer) { |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
115 setEnabled(true); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
116 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
117 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 RendererBase* InstanceRenderer::clone() { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 return new InstanceRenderer(*this); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
120 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 InstanceRenderer::~InstanceRenderer() { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
124 |
482
16c2b3ee59ce
* Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
356
diff
changeset
|
125 void InstanceRenderer::render(Camera* cam, Layer* layer, RenderList& instances) { |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 FL_DBG(_log, "Iterating layer..."); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
127 CellGrid* cg = layer->getCellGrid(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
128 if (!cg) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
129 FL_WARN(_log, "No cellgrid assigned to layer, cannot draw instances"); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
130 return; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
131 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
132 |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
133 const bool any_effects = !(m_instance_outlines.empty() && m_instance_colorings.empty()); |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
134 const bool unlit = !m_unlit_groups.empty(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
135 unsigned int lm = m_renderbackend->getLightingModel(); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
136 |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
137 m_area_layer = false; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
138 if(!m_instance_areas.empty()) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
139 InstanceToAreas_t::iterator area_it = m_instance_areas.begin(); |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
140 for(;area_it != m_instance_areas.end(); area_it++) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
141 AreaInfo& info = area_it->second; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
142 if(info.instance->getLocation().getLayer() == layer) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
143 if(info.front) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
144 DoublePoint3D instance_posv = cam->toVirtualScreenCoordinates(info.instance->getLocation().getMapCoordinates()); |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
145 info.z = instance_posv.z; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
146 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
147 m_area_layer = true; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
148 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
149 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
150 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
151 |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
152 RenderList::iterator instance_it = instances.begin(); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
153 for (;instance_it != instances.end(); ++instance_it) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
154 FL_DBG(_log, "Iterating instances..."); |
482
16c2b3ee59ce
* Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
356
diff
changeset
|
155 Instance* instance = (*instance_it)->instance; |
16c2b3ee59ce
* Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
356
diff
changeset
|
156 RenderItem& vc = **instance_it; |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
157 |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
158 if(m_area_layer) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
159 InstanceToAreas_t::iterator areas_it = m_instance_areas.begin(); |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
160 for(;areas_it != m_instance_areas.end(); areas_it++) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
161 AreaInfo& infoa = areas_it->second; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
162 if(infoa.front) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
163 if(infoa.z >= vc.screenpoint.z) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
164 continue; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
165 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
166 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
167 |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
168 std::string str_name = instance->getObject()->getNamespace(); |
591
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
169 std::list<std::string>::iterator group_it = infoa.groups.begin(); |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
170 for(;group_it != infoa.groups.end(); ++group_it) { |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
171 if(str_name.find((*group_it)) != -1) { |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
172 ScreenPoint p; |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
173 Rect rec; |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
174 p = cam->toScreenCoordinates(infoa.instance->getLocation().getMapCoordinates()); |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
175 rec.x = p.x - infoa.w / 2; |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
176 rec.y = p.y - infoa.h / 2; |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
177 rec.w = infoa.w; |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
178 rec.h = infoa.h; |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
179 if(infoa.instance != instance && vc.dimensions.intersects(rec)) { |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
180 vc.transparency = 255 - infoa.trans; |
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
181 } |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
182 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
183 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
184 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
185 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
186 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
187 FL_DBG(_log, LMsg("Instance layer coordinates = ") << instance->getLocationRef().getLayerCoordinates()); |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
188 |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
189 if (any_effects) { |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
190 InstanceToOutlines_t::iterator outline_it = m_instance_outlines.find(instance); |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
191 if (outline_it != m_instance_outlines.end()) { |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
192 if (lm != 0) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
193 m_renderbackend->disableLighting(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
194 m_renderbackend->setStencilTest(255, 2, 7); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
195 m_renderbackend->setAlphaTest(0.0); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
196 bindOutline(outline_it->second, vc, cam)->render(vc.dimensions, vc.transparency); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
197 m_renderbackend->enableLighting(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
198 m_renderbackend->setStencilTest(0, 2, 7); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
199 vc.image->render(vc.dimensions, vc.transparency); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
200 m_renderbackend->disableAlphaTest(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
201 m_renderbackend->disableStencilTest(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
202 continue; |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
203 } |
573
716fbe02140a
* Moved the layer visibility and transparency, from instancerenderer.cpp to layercache.cpp and improved it.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
572
diff
changeset
|
204 bindOutline(outline_it->second, vc, cam)->render(vc.dimensions, vc.transparency); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
205 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
206 |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
207 InstanceToColoring_t::iterator coloring_it = m_instance_colorings.find(instance); |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
208 if (coloring_it != m_instance_colorings.end()) { |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
209 m_renderbackend->disableLighting(); |
573
716fbe02140a
* Moved the layer visibility and transparency, from instancerenderer.cpp to layercache.cpp and improved it.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
572
diff
changeset
|
210 bindColoring(coloring_it->second, vc, cam)->render(vc.dimensions, vc.transparency); |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
211 m_renderbackend->enableLighting(); |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
212 continue; // Skip normal rendering after drawing overlay |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
213 } |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
214 } |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
215 if(lm != 0) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
216 if(unlit) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
217 bool found = false; |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
218 std::string lit_name = instance->getObject()->getNamespace(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
219 std::list<std::string>::iterator unlit_it = m_unlit_groups.begin(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
220 for(;unlit_it != m_unlit_groups.end(); ++unlit_it) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
221 if(lit_name.find(*unlit_it) != -1) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
222 m_renderbackend->setStencilTest(255, 2, 7); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
223 found = true; |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
224 break; |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
225 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
226 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
227 // This is very expensiv, we have to change it |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
228 if(!found) |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
229 m_renderbackend->setStencilTest(0, 1, 7); |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
230 |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
231 m_renderbackend->setAlphaTest(0.0); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
232 vc.image->render(vc.dimensions, vc.transparency); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
233 continue; |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
234 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
235 } |
573
716fbe02140a
* Moved the layer visibility and transparency, from instancerenderer.cpp to layercache.cpp and improved it.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
572
diff
changeset
|
236 vc.image->render(vc.dimensions, vc.transparency); |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
237 |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
238 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
239 if(lm != 0) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
240 m_renderbackend->disableAlphaTest(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
241 m_renderbackend->disableStencilTest(); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
242 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
243 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
244 |
482
16c2b3ee59ce
* Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
356
diff
changeset
|
245 Image* InstanceRenderer::bindOutline(OutlineInfo& info, RenderItem& vc, Camera* cam) { |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
246 if (!info.dirty && info.curimg == vc.image) { |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
247 // optimization for outline that has not changed |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
248 return info.outline; |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
249 } else { |
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
250 info.curimg = vc.image; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
251 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
252 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
253 if (info.outline) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
254 delete info.outline; // delete old mask |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
255 info.outline = NULL; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
256 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
257 SDL_Surface* surface = vc.image->getSurface(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
258 SDL_Surface* outline_surface = SDL_ConvertSurface(surface, surface->format, surface->flags); |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
259 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
260 // needs to use SDLImage here, since GlImage does not support drawing primitives atm |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
261 SDLImage* img = new SDLImage(outline_surface); |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
262 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
263 // TODO: optimize... |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
264 uint8_t r, g, b, a = 0; |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
265 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
266 // vertical sweep |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
267 for (unsigned int x = 0; x < img->getWidth(); x ++) { |
39
4e68022ed545
fix some pixels wrongly highlighted in outlines
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
268 uint8_t prev_a = 0; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
269 for (unsigned int y = 0; y < img->getHeight(); y ++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
270 vc.image->getPixelRGBA(x, y, &r, &g, &b, &a); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
271 if ((a == 0 || prev_a == 0) && (a != prev_a)) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
272 if (a < prev_a) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
273 for (unsigned int yy = y; yy < y + info.width; yy++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
274 img->putPixel(x, yy, info.r, info.g, info.b); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
275 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
276 } else { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
277 for (unsigned int yy = y - info.width; yy < y; yy++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
278 img->putPixel(x, yy, info.r, info.g, info.b); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
279 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
280 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
281 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
282 prev_a = a; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
283 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
284 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
285 // horizontal sweep |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
286 for (unsigned int y = 0; y < img->getHeight(); y ++) { |
39
4e68022ed545
fix some pixels wrongly highlighted in outlines
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
287 uint8_t prev_a = 0; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
288 for (unsigned int x = 0; x < img->getWidth(); x ++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
289 vc.image->getPixelRGBA(x, y, &r, &g, &b, &a); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
290 if ((a == 0 || prev_a == 0) && (a != prev_a)) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
291 if (a < prev_a) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
292 for (unsigned int xx = x; xx < x + info.width; xx++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
293 img->putPixel(xx, y, info.r, info.g, info.b); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
294 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
295 } else { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
296 for (unsigned int xx = x - info.width; xx < x; xx++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
297 img->putPixel(xx, y, info.r, info.g, info.b); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
298 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
299 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
300 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
301 prev_a = a; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
302 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
303 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
304 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
305 // In case of OpenGL backend, SDLImage needs to be converted |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
306 info.outline = m_renderbackend->createImage(img->detachSurface()); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
307 delete img; |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
308 |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
309 if (info.outline) { |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
310 // mark outline as not dirty since we created it here |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
311 info.dirty = false; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
312 } |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
313 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
314 return info.outline; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
315 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
316 |
482
16c2b3ee59ce
* Merged the view performance branch back into trunk. fixes[ticket:419]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
356
diff
changeset
|
317 Image* InstanceRenderer::bindColoring(ColoringInfo& info, RenderItem& vc, Camera* cam) { |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
318 if (!info.dirty && info.curimg == vc.image) { |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
319 // optimization for coloring overlay that has not changed |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
320 return info.overlay; |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
321 } |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
322 else { |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
323 info.curimg = vc.image; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
324 } |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
325 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
326 if (info.overlay) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
327 delete info.overlay; // delete old mask |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
328 info.overlay = NULL; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
329 } |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
330 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
331 SDL_Surface* surface = vc.image->getSurface(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
332 SDL_Surface* overlay_surface = SDL_ConvertSurface(surface, surface->format, surface->flags); |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
333 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
334 // needs to use SDLImage here, since GlImage does not support drawing primitives atm |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
335 SDLImage* img = new SDLImage(overlay_surface); |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
336 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
337 uint8_t r, g, b, a = 0; |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
338 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
339 for (unsigned int x = 0; x < img->getWidth(); x ++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
340 for (unsigned int y = 0; y < img->getHeight(); y ++) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
341 vc.image->getPixelRGBA(x, y, &r, &g, &b, &a); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
342 if (a > 0) { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
343 img->putPixel(x, y, (r + info.r) >> 1, (g + info.g) >> 1, (b + info.b) >> 1); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
344 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
345 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
346 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
347 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
348 // In case of OpenGL backend, SDLImage needs to be converted |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
349 info.overlay = m_renderbackend->createImage(img->detachSurface()); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
350 delete img; |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
351 |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
352 if (info.overlay) { |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
353 // mark overlay coloring as not dirty since we created it here |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
354 info.dirty = false; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
355 } |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
356 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
357 return info.overlay; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
358 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
359 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
360 void InstanceRenderer::addOutlined(Instance* instance, int r, int g, int b, int width) { |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
361 OutlineInfo newinfo; |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
362 newinfo.r = r; |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
363 newinfo.g = g; |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
364 newinfo.b = b; |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
365 newinfo.width = width; |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
366 newinfo.dirty = true; |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
367 |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
368 // attempts to insert the element into the outline map |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
369 // will return false in the second value of the pair if the instance already exists |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
370 // in the map and the first value of the pair will then be an iterator to the |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
371 // existing data for the instance |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
372 std::pair<InstanceToOutlines_t::iterator, bool> insertiter = m_instance_outlines.insert(std::make_pair(instance, newinfo)); |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
373 |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
374 if (insertiter.second == false) { |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
375 // the insertion did not happen because the instance |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
376 // already exists in the map so lets just update its outline info |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
377 OutlineInfo& info = insertiter.first->second; |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
378 |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
379 if (info.r != r || info.g != g || info.b != b || info.width != width) { |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
380 // only update the outline info if its changed since the last call |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
381 // flag the outline info as dirty so it will get processed during rendering |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
382 info.r = r; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
383 info.b = b; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
384 info.g = g; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
385 info.width = width; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
386 info.dirty = true; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
387 } |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
388 } |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
389 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
390 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
391 void InstanceRenderer::addColored(Instance* instance, int r, int g, int b) { |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
392 ColoringInfo newinfo; |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
393 newinfo.r = r; |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
394 newinfo.g = g; |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
395 newinfo.b = b; |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
396 newinfo.dirty = true; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
397 |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
398 // attempts to insert the element into the coloring map |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
399 // will return false in the second value of the pair if the instance already exists |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
400 // in the map and the first value of the pair will then be an iterator to the |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
401 // existing data for the instance |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
402 std::pair<InstanceToColoring_t::iterator, bool> insertiter = m_instance_colorings.insert(std::make_pair(instance, newinfo)); |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
403 |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
404 if (insertiter.second == false) { |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
405 // the insertion did not happen because the instance |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
406 // already exists in the map so lets just update its coloring info |
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
407 ColoringInfo& info = insertiter.first->second; |
571
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
408 |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
409 if (info.r != r || info.g != g || info.b != b) { |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
410 // only update the coloring info if its changed since the last call |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
411 // flag the coloring info as dirty so it will get processed during rendering |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
412 info.r = r; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
413 info.b = b; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
414 info.g = g; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
415 info.dirty = true; |
edc9efe969c2
This commit should fix the coloring overlay bug exposed by the commit in revision 3386. The InstanceRenderer was caching the overlays based on whether the current image had changed. The fix takes into account the current image as well as the overlay color to decide whether or not the overlay needs to be reproduced.
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
564
diff
changeset
|
416 } |
564
7d88eddd2ec7
Modified the addColored and addOutlined methods in the InstanceRenderer class to fix a memory leak. The new code attempts to insert the information in the proper map and if it already exists it will explicitly update the reference to the existing information. The new code no longer relies on the bracket operator of the std::map which was implicitly calling the equals operator of the ColoringInfo and OutlineInfo and causing the memory leak. fixes[ticket:472]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
553
diff
changeset
|
417 } |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
418 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
419 |
591
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
420 void InstanceRenderer::addTransparentArea(Instance* instance, const std::list<std::string> &groups, unsigned int w, unsigned int h, unsigned char trans, bool front) { |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
421 AreaInfo newinfo; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
422 newinfo.instance = instance; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
423 newinfo.groups = groups; |
591
378b588216d6
* Improved addTransparentArea(). Now you can set a list with namespaces.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
589
diff
changeset
|
424 |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
425 newinfo.w = w; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
426 newinfo.h = h; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
427 newinfo.trans = trans; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
428 newinfo.front = front; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
429 |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
430 |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
431 // attempts to insert the element into the area map |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
432 // will return false in the second value of the pair if the instance already exists |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
433 // in the map and the first value of the pair will then be an iterator to the |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
434 // existing data for the instance |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
435 std::pair<InstanceToAreas_t::iterator, bool> insertiter = m_instance_areas.insert(std::make_pair(instance, newinfo)); |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
436 |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
437 if (insertiter.second == false) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
438 // the insertion did not happen because the instance |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
439 // already exists in the map so lets just update its area info |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
440 AreaInfo& info = insertiter.first->second; |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
441 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
442 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
443 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
444 void InstanceRenderer::removeOutlined(Instance* instance) { |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
445 m_instance_outlines.erase(instance); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
446 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
447 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
448 void InstanceRenderer::removeColored(Instance* instance) { |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
449 m_instance_colorings.erase(instance); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
450 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
451 |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
452 void InstanceRenderer::removeTransparentArea(Instance* instance) { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
453 m_instance_areas.erase(instance); |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
454 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
455 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
456 void InstanceRenderer::removeAllOutlines() { |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
457 m_instance_outlines.clear(); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
458 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
459 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
460 void InstanceRenderer::removeAllColored() { |
95
0b6998fde366
speedup instance renderer; now instances can change their layer, old optimisation made wrong asumption... (fix by yonibear)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
461 m_instance_colorings.clear(); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
462 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
463 |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
464 void InstanceRenderer::removeAllTransparentAreas() { |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
465 m_instance_areas.clear(); |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
466 } |
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
467 |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
468 void InstanceRenderer::addIgnoreLight(const std::list<std::string> &groups) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
469 std::list<std::string>::const_iterator group_it = groups.begin(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
470 for(;group_it != groups.end(); ++group_it) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
471 m_unlit_groups.push_back(*group_it); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
472 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
473 m_unlit_groups.sort(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
474 m_unlit_groups.unique(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
475 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
476 |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
477 void InstanceRenderer::removeIgnoreLight(const std::list<std::string> &groups) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
478 std::list<std::string>::const_iterator group_it = groups.begin(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
479 for(;group_it != groups.end(); ++group_it) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
480 std::list<std::string>::iterator unlit_it = m_unlit_groups.begin(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
481 for(;unlit_it != m_unlit_groups.end(); ++unlit_it) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
482 if((*group_it).find(*unlit_it) != -1) { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
483 m_unlit_groups.remove(*unlit_it); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
484 break; |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
485 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
486 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
487 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
488 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
489 |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
490 void InstanceRenderer::removeAllIgnoreLight() { |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
491 m_unlit_groups.clear(); |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
492 } |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
493 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
494 void InstanceRenderer::reset() { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
495 removeAllOutlines(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
496 removeAllColored(); |
589
d1df6cf5ff23
* Fixed a bug in RenderBackendSDL, the clip area was not properly set.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
573
diff
changeset
|
497 removeAllTransparentAreas(); |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
591
diff
changeset
|
498 removeAllIgnoreLight(); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
499 } |
356
ab41334e8a57
Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
135
diff
changeset
|
500 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
501 } |