GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
Functions.hh
Go to the documentation of this file.
1
2#include "Effect.hh"
3#include "Graph.hh"
4#include <typeinfo>
5
13
14struct FLine
15{
16public:
19};
20
21struct FPlane
22{
23public:
26};
27
29{
30public:
31 float dist_left;
33 //float height;
34 float left_angle;
36 //float top_angle;
37 //float bottom_angle;
38};
39
51
52
53void cube(Matrix m, FaceStore &s);
54void sphere(Matrix m, int numfaces, int numfaces2, FaceStore &s);
55void cone(Matrix m, int numfaces, Point p1, Point p2, float rad1, float rad2, FaceStore &s);
56void rectangle(Matrix m, float x, float y, FaceStore &s);
57void texture_rectangle(Matrix m, TexturePlugin *plugin, FaceStore &s);
58
59void cylinder(Matrix m, int numfaces, FaceStore &s);
60void disk(Matrix m, int numfaces, float disk_pos, FaceStore &s);
61void color(BoxableFaceCollection &coll, unsigned int color, FaceStore &s);
64void ring(Matrix m, const PointVectorCollection &points, float x, int steps, FaceStore &s);
65
66void color_poly(Point2d p1, Point2d p2, Point2d p3, Color c1, Color c2, int x, int y, BitmapStore<Color> &s);
67
68
69void floor(const FCube &pos, FLine &l1, FLine &l2, FLine &l3, FLine &l4, FPlane &pl, FaceStore &s);
70
71void linetocube(const FLine &line, FCube &cube);
72
73void flexcube(const FPlane &pl,
74 const FFlexCube &args,
75 FCube2 &res);
76
77void flexcube(const FPlane &pl, float dist_left, float dist_right, float left_angle, float right_angle, FCube2 &res);
78
79void plane_cube_blit(const FPlane &pl, FaceStore &s);
80
81void cubeplane_t(const FCube2 &res, FPlane &pl);
82void cubeplane_l(const FCube2 &res, FPlane &pl);
83void cubeplane_r(const FCube2 &res, FPlane &pl);
84void cubeplane_f(const FCube2 &res, FPlane &pl);
85
87void plane_dup(const FPlane &pl, FPlane &pl1);
88
89void tunnel_end(const FPlane &pl, FaceStore &s);
90
92void chessboard(const FPlane &pl, FaceStore &s);
93
95{
96public:
97 FuncEffect(Render *render);
98 void Init();
99 bool Frame(float time);
100private:
101 //int tex_index;
102};
103
105{
106public:
107 FunctionPointerFrameAnim(Render *render, void (*fptr)(FaceStore &s)) : FrameAnimPlugins(render), fptr(fptr) { }
108 void Init();
109 void Cleanup();
110 bool Frame(float time);
111private:
112 void (*fptr)(FaceStore &s);
113};
114
116
118{
119public:
120 void Alloc(int bytescount, int objcount2) { buffer = new char[bytescount]; ptrs=new char*[objcount2]; widths = new int[objcount2]; bufferbytes = bytescount; objcount = objcount2; }
121 void ResizeObjs(int newobjcount)
122 {
123 char **p = new char*[newobjcount];
124 int *w = new int[newobjcount];
125 std::type_info **i = new std::type_info*[newobjcount];
126 std::copy(ptrs,ptrs+objcount,p);
127 std::copy(widths, widths+objcount, w);
128 std::copy(infos, infos+objcount, i);
129 delete [] ptrs;
130 delete [] widths;
131 delete [] infos;
132 ptrs = p;
133 widths = w;
134 infos = i;
135 objcount = newobjcount;
136 }
137 void ResizeBytes(int newcount)
138 {
139 char *buf = new char[newcount];
140 std::copy(buffer, buffer+bufferbytes, buf);
141 delete [] buffer;
142 buffer = buf;
143 bufferbytes = newcount;
144 }
145
146
147 #if 0
148 template<class T>
149 T *GetObj(int obj)
150 {
151 if (*(infos[obj])!=typeid(T)) return 0;
152 return (T*)ptrs[obj];
153 }
154 #endif
155
156 template<class T>
157 void AllocObj(int obj)
158 {
159 if (obj > objcount) ResizeObjs(obj+20);
160 if (ptrs[obj] != 0)
161 {
162 T *ptr = (T*)&ptrs[obj];
163 ptr->~T();
164 }
165 if (allocated_bytes + sizeof(T) >= bufferbytes) ResizeBytes(allocated_bytes + sizeof(T)*20);
166 T* ptr = new(buffer+allocated_bytes)T;
167 ptrs[obj] = ptr;
168 widths[obj] = sizeof(T);
169 // infos[obj] = new std::type_info;
170 //TODO *(infos[obj]) = typeid(T);
171 allocated_bytes+=sizeof(T);
172 }
173private:
174 char *buffer;
175 int bufferbytes;
176 char **ptrs;
177 int *widths;
178 std::type_info **infos;
179 int objcount;
180
181 int allocated_bytes;
182};
void cube(Matrix m, FaceStore &s)
Definition Functions.cc:10
void cubeplane_r(const FCube2 &res, FPlane &pl)
Definition Functions.cc:186
void plane_dup(const FPlane &pl, FPlane &pl1)
Definition Functions.cc:225
FPlane plane_init()
Definition Functions.cc:202
void disk(Matrix m, int numfaces, float disk_pos, FaceStore &s)
Definition Functions.cc:44
void chessboard_test(FaceStore &s)
Definition Functions.cc:336
void tunnel_end(const FPlane &pl, FaceStore &s)
Definition Functions.cc:213
void flexcube(const FPlane &pl, const FFlexCube &args, FCube2 &res)
Definition Functions.cc:142
void ring(Matrix m, const PointVectorCollection &points, float x, int steps, FaceStore &s)
Definition Functions.cc:73
void matrix(BoxableFaceCollection &coll, Matrix m, FaceStore &s)
Definition Functions.cc:56
void color_poly(Point2d p1, Point2d p2, Point2d p3, Color c1, Color c2, int x, int y, BitmapStore< Color > &s)
Definition Functions.cc:82
void plane_cube_blit(const FPlane &pl, FaceStore &s)
Definition Functions.cc:89
void floor(const FCube &pos, FLine &l1, FLine &l2, FLine &l3, FLine &l4, FPlane &pl, FaceStore &s)
Definition Functions.cc:95
void cube(Matrix m, FaceStore &s)
Definition Functions.cc:10
void andnot(BoxableFaceCollection &coll, BoxableFaceCollection &coll2, FaceStore &s)
Definition Functions.cc:61
void cubeplane_t(const FCube2 &res, FPlane &pl)
Definition Functions.cc:169
void rectangle(Matrix m, float x, float y, FaceStore &s)
Definition Functions.cc:66
void cylinder(Matrix m, int numfaces, FaceStore &s)
Definition Functions.cc:38
void cone(Matrix m, int numfaces, Point p1, Point p2, float rad1, float rad2, FaceStore &s)
Definition Functions.cc:22
void linetocube(const FLine &line, FCube &cube)
int chessboard_bitmap(FrameAnimPlugins *fa)
Definition Functions.cc:266
void cubeplane_f(const FCube2 &res, FPlane &pl)
Definition Functions.cc:194
void chessboard(const FPlane &pl, FaceStore &s)
Definition Functions.cc:273
void sphere(Matrix m, int numfaces, int numfaces2, FaceStore &s)
Definition Functions.cc:16
void cubeplane_l(const FCube2 &res, FPlane &pl)
Definition Functions.cc:178
void texture_rectangle(Matrix m, TexturePlugin *plugin, FaceStore &s)
Definition Functions.cc:29
Definition Graph.hh:1500
Definition Effect.hh:67
Definition VectorTools.hh:380
Definition Effect.hh:5849
Definition Effect.hh:2388
FrameAnimPlugins(Render *render)
Definition Effect.hh:2390
FuncEffect(Render *render)
Definition Functions.cc:233
bool Frame(float time)
Definition Functions.cc:252
void Init()
Definition Functions.cc:238
void Cleanup()
Definition Functions.cc:298
FunctionPointerFrameAnim(Render *render, void(*fptr)(FaceStore &s))
Definition Functions.hh:107
bool Frame(float time)
Definition Functions.cc:304
void Init()
Definition Functions.cc:290
Definition VectorTools.hh:279
Definition Effect.hh:3039
Definition Functions.hh:118
void ResizeObjs(int newobjcount)
Definition Functions.hh:121
void ResizeBytes(int newcount)
Definition Functions.hh:137
void AllocObj(int obj)
Definition Functions.hh:157
void Alloc(int bytescount, int objcount2)
Definition Functions.hh:120
Definition Effect.hh:9514
Definition VectorTools.hh:125
background color
Definition gameapi_example.php:46
Definition Functions.hh:41
Point trb
Definition Functions.hh:43
Point brb
Definition Functions.hh:45
Point tlb
Definition Functions.hh:42
Point tlf
Definition Functions.hh:46
Point blb
Definition Functions.hh:44
Point trf
Definition Functions.hh:47
Point blf
Definition Functions.hh:48
Point brf
Definition Functions.hh:49
Definition Functions.hh:7
Vector u_x
Definition Functions.hh:9
Vector u_z
Definition Functions.hh:11
Vector u_y
Definition Functions.hh:10
Point p
Definition Functions.hh:8
Definition Functions.hh:29
float left_angle
Definition Functions.hh:34
float dist_left
Definition Functions.hh:31
float right_angle
Definition Functions.hh:35
float dist_right
Definition Functions.hh:32
Definition Functions.hh:15
Point p1
Definition Functions.hh:17
Point p2
Definition Functions.hh:17
Vector u_y
Definition Functions.hh:18
Vector u_x
Definition Functions.hh:18
Definition Functions.hh:22
Point p3
Definition Functions.hh:24
Point p2
Definition Functions.hh:24
Vector u
Definition Functions.hh:25
Point p1
Definition Functions.hh:24
Point p4
Definition Functions.hh:24
Definition VectorTools.hh:910
Definition Parser.cc:60
Definition GameApi.h:42