GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
Containment.hh
Go to the documentation of this file.
1//
2// Copyright (C) 2009 Tero Pulkkinen
3// Released under LGPL License.
4//
5// This file is part of Polygon.
6//
7// Polygon is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Polygon is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU Library General Public License
18// along with Polygon. If not, see <http://www.gnu.org/licenses/>.
19//
20
21#include "Tree.hh"
22#include "Effect.hh"
23
24class Container;
25
26class Elem
27{
28public:
29 virtual Container *Parent() const=0;
30
31};
32
34{
35public:
36 virtual Array<int, Elem*> *Children() const=0;
37};
38
39class Portal
40{
41public:
42 virtual PortalPeer *First() const=0;
43 virtual PortalPeer *Second() const=0;
44};
45
47{
48public:
49 virtual Matrix Position() const=0;
50 virtual int PortalNum() const=0;
51};
52
53class Room
54{
55public:
56 virtual ObjectTree *Drawables() const=0;
57 virtual Array<int, PortalPeer*> *Portals() const=0;
58};
59class World : public Array<int, Room*>
60{
61public:
62 virtual Array<int, Portal*> *Portals() const=0;
63};
65{
66public:
67 virtual void Render() const=0;
68};
69
70class WorldRenderer : public Renderer
71{
72public:
73 WorldRenderer(World &world) : world(world) { }
75 {
76 for(int i=0;i<world.Size();i++)
77 {
78 Room *r = world.Index(i);
79 ObjectTree *drawable = r->Drawables();
80 treestates[i] = new TreeState;
81 PrepareTree(*drawable, *treestates[i]);
82 }
83 }
84 void RenderOne(int roomnum, Matrix pos, float time) const
85 {
86 Room *currentroom = world.Index(roomnum);
87 ObjectTree *drawable = currentroom->Drawables();
88 RenderTree(*drawable, time, treestates[roomnum]);
89 }
90private:
91 World &world;
92 std::map<roomnum, TreeState*> treestates;
93};
char world[]
Definition test.cpp:7
Definition EffectI.hh:22
Definition Containment.hh:34
virtual Array< int, Elem * > * Children() const =0
Definition Containment.hh:27
virtual Container * Parent() const =0
Definition VectorTools.hh:279
Definition Containment.hh:47
virtual int PortalNum() const =0
virtual Matrix Position() const =0
Definition Containment.hh:40
virtual PortalPeer * First() const =0
virtual PortalPeer * Second() const =0
Definition Containment.hh:65
virtual void Render() const =0
Definition Containment.hh:54
virtual ObjectTree * Drawables() const =0
virtual Array< int, PortalPeer * > * Portals() const =0
void PrepareWorld()
Definition Containment.hh:74
void RenderOne(int roomnum, Matrix pos, float time) const
Definition Containment.hh:84
WorldRenderer(World &world)
Definition Containment.hh:73
Definition Containment.hh:60
virtual Array< int, Portal * > * Portals() const =0