1
// $Id: scene_context.hpp 3096 2007-09-06 16:12:02Z grumbel $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#ifndef HEADER_SCENE_CONTEXT_HXX
21
#define HEADER_SCENE_CONTEXT_HXX
24
#include "drawing_context.hpp"
26
class SceneContextImpl;
28
/** The SceneContext maintains all the different drawing layers to
29
which a game object can draw. Each drawing layer serves a
30
different purporse and all are combined in the end to form the
36
SceneContext(const Rect& rect);
39
/** The main drawing context, also known as color buffer, to this
40
you draw all normal graphics, sprites and enemies, as you would
41
do with a normal framebuffer */
42
DrawingContext& color();
44
/** This is the lightmap, to this you draw all lights, meaning that
45
a color of white will result in a area that is completly
46
visible, while a value of black will mean that the area will be
47
not lighted at all and be completly black. This lightmap is
48
multiplied with the color buffer to get the light effect */
49
DrawingContext& light();
51
/** The highlight map is usefull for all objects that are extremly
52
bright so that they generate a lenseflare or a glow. The
53
highlight map doesn't light the scenario itself, but gets
54
additionally rendered above the color and light buffer, thus its
55
allows to add glow without risking to losing it in an area of
57
DrawingContext& highlight();
59
/** Translate the drawing context */
60
void translate(float x, float y);
62
/** Set the rotation of the drawing context */
63
void rotate(float angel);
65
/** Set the scaling of the drawing context */
66
void scale(float x, float y);
68
void push_modelview();
70
void reset_modelview();
72
void set_cliprect(const Rect& rect);
73
void reset_cliprect();
75
/** Takes all the buffers and combines them to form the final image
76
that will be shown on the screen */
77
void render(SDL_Surface* gc, const Rect& rect);
81
SceneContextImpl* impl;
83
SceneContext (const SceneContext&);
84
SceneContext& operator= (const SceneContext&);
87
class SceneContextDrawingRequest : public DrawingRequest
93
SceneContextDrawingRequest(SceneContext* sc, const Vector3f& pos_ = Vector3f(0,0,0));
94
virtual ~SceneContextDrawingRequest();
95
void render(SDL_Surface* gc, const Rect& render);