ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/entity.h
(Generate patch)

Comparing libgender/entity.h (file contents):
Revision 1.25 by root, Sun Oct 17 09:43:07 2004 UTC vs.
Revision 1.35 by root, Tue Aug 9 23:58:43 2005 UTC

1#ifndef ENTITY_H 1#ifndef ENTITY_H
2#define ENTITY_H 2#define ENTITY_H
3 3
4#include <vector> 4#include <vector>
5 5
6#include <iostream>
6#include "opengl.h" 7#include "opengl.h"
7 8
8#include "util.h" 9#include "util.h"
9#include "oct.h" 10#include "oct.h"
10#include "view.h" 11#include "view.h"
77 void set (); 78 void set ();
78}; 79};
79 80
80struct geometry_sphere : geometry 81struct geometry_sphere : geometry
81{ 82{
83 material *m;
82 GLfloat radius; 84 GLfloat radius;
83 85
84 void update (); 86 void update ();
85 void draw (view &ctx); 87 void draw (view &ctx);
86 geometry_sphere (GLfloat radius) : radius(radius) { update (); }; 88 geometry_sphere (material *m, GLfloat radius) : m(m), radius(radius) { update (); };
89};
90
91struct geometry_indexed_2d : geometry
92{
93 material *m;
94
95 GLenum type;
96
97 vertex_buffer vb;
98 index_buffer ib;
99
100 void draw (view &ctx);
101
102 template <typename vertex, typename index>
103 geometry_indexed_2d (material *m, GLenum type, const vector<vertex> &v, const vector<index> &i)
104 : m(m), type(type)
105 {
106 vb.set (v);
107 ib.set (i);
108
109 bbox.reset ();
110 for (typename vector<vertex>::const_iterator i = v.begin () ; i != v.end (); ++i)
111 bbox.add (i->v);
112 }
113
87}; 114};
88 115
89///////////////////////////////////////////////////////////////////////////// 116/////////////////////////////////////////////////////////////////////////////
90 117
91struct geometry_filter : geometry 118struct geometry_filter : geometry
141struct entity : geometry_filter 168struct entity : geometry_filter
142{ 169{
143 sector orig; 170 sector orig;
144 point p; 171 point p;
145 sector a, b; // bounding box corners 172 sector a, b; // bounding box corners
146 gl::vertex_buffer_object vb_bbox;
147 173
148 vector<octant *> o; 174 vector<octant *> o;
149 175
150 void update (); 176 void update ();
151 void draw (view &ctx); 177 void draw (view &ctx);
157 183
158 entity (geometry *g = 0); 184 entity (geometry *g = 0);
159 ~entity (); 185 ~entity ();
160}; 186};
161 187
162struct light : entity 188struct entity_moveable : entity
163{ 189{
164 point p; 190 vec3 v;
165 colour c; 191 entity_moveable (geometry *g = 0) : entity (g) { }
166 GLfloat intensity; 192
167 GLfloat radius; 193 void perform_step (double t);
194};
195
196struct entity_light : entity
197{
198 light *lview;
199};
200
201/////////////////////////////////////////////////////////////////////////////
202// not the final API(!)
203
204struct skybox
205{
206 texture *tex[6];
207
208 skybox (
209 const char *left,
210 const char *front,
211 const char *right,
212 const char *back,
213 const char *top,
214 const char *bottom
215 );
216
217 ~skybox ();
218
219 void draw (view &ctx);
220};
221
222/////////////////////////////////////////////////////////////////////////////
223//
224// VERY EXPERIMENTAL HEIGHTMAP
225
226struct geometry_heightfield : geometry
227{
228 struct node;
229
230 node *tree;
231
232 GLfloat sx, sy, sm;
233
234 void update ();
235 void draw (view &ctx);
236 geometry_heightfield (GLfloat sx, GLfloat sy);
168}; 237};
169 238
170#endif 239#endif
171 240
172 241

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines