~marten-r/widelands/feature-3d-rendering-open-gl-es-compat

« back to all changes in this revision

Viewing changes to src/graphic/rendertarget.cc

  • Committer: Marten Richter \
  • Date: 2013-12-07 16:34:54 UTC
  • Revision ID: marten.richter@freenet.de-20131207163454-ssy014khpxtrgvq9
Add z-Ordering for rendering, fix some drawing glitches, change api for 3d rendering

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
using Widelands::Player;
41
41
using Widelands::TCoords;
42
42
 
 
43
uint64_t RenderTarget::rend_number=0;
 
44
 
43
45
/**
44
46
 * Build a render target for the given surface.
45
47
 */
152
154
                m_surface->fill_rect(r, clr);
153
155
}
154
156
 
 
157
void RenderTarget::start_rendering3d(Vector z_proj)
 
158
{
 
159
        rend_number++;
 
160
        m_surface->start_rendering3d(z_proj);
 
161
}
 
162
 
 
163
void RenderTarget::end_rendering3d()
 
164
{
 
165
        m_surface->end_rendering3d();
 
166
}
 
167
 
155
168
void RenderTarget::draw_rect3d(Rect r,int32_t z, const RGBColor& clr)
156
169
{
157
 
        if (clip(r))
158
 
                m_surface->draw_rect3d(r,z, clr);
 
170
        //if (clip(r))
 
171
        m_surface->draw_rect3d(r,z, clr);
159
172
}
160
173
 
161
174
void RenderTarget::fill_rect3d(Rect r, int32_t z, const RGBAColor& clr)
162
175
{
163
 
        if (clip(r))
164
 
                m_surface->fill_rect3d(r,z, clr);
 
176
        //if (clip(r))
 
177
        m_surface->fill_rect3d(r,z, clr);
165
178
}
166
179
 
167
180
void RenderTarget::brighten_rect(Rect r, const int32_t factor)
412
425
        Rect srcrc(Point(0, 0), frame.width(), frame.height());
413
426
 
414
427
        //Correct isometric perspective, quick fix, to be replaced when using true imposters
415
 
        uint32_t corr_z= srcrc.h - hotspot.y;
 
428
        int32_t corr_z= frame.height() - hotspot.y;
 
429
        if (corr_z < 0) corr_z = 0;
416
430
        dst.y -= corr_z;
417
431
        dst.z -= corr_z*2;
418
432
        //Correct end