1 // Billboard helper class
3 // Written by Harald JOHNSEN, started April 2005.
5 // Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
29 #include <simgear/screen/extensions.hxx>
30 #include <simgear/screen/RenderTexture.h>
39 // creation frame number for debug only
41 // last time this entry was used
45 void freeTextureMemory(void);
46 bool allocTextureMemory(int count, int textureDimension);
48 // a list of impostors
54 // for debug only, stats
56 // count of generated BB during the current frame
67 // call this first to initialize everything, cacheCount is the number of texture to allocate
68 void init(int cacheCount);
70 // free one cache slot, usualy when the cached object is destroyed
71 void free(int bbId, int cldId);
73 // allocate a new texture, return an index in the cache
76 // give the texture name to use
77 GLuint QueryTexID(int cldId, int bbId);
79 // save the rendered texture from the current context to a new texture
80 void setTextureData(int bbId);
82 // start the rendering of a billboard in the RTT context
83 void beginCapture(void);
85 // adjust the projection matrix of the RTT context to the size of the object
86 void setRadius(float radius, float dist_center);
88 // forget the RTT and go back to the previous rendering context
89 void endCapture(void);
91 // for debugging only, give the number of frames since the inpostor was built
92 int queryImpostorAge(int bbId);
94 // can we still use this impostor ?
95 bool isBbValid( int cloudId, int bbId, float angleY, float angleX);
97 // save view angles of this billboard
98 void setReference( int cloudId, int bbId, float angleY, float angleX);
100 // prepare the cache for the rendering of a new frame
101 void startNewFrame(void);
103 // alloc the impostors texture memory given the size of the memory pool
104 // if sizeKb == 0 then the memory pool is freed and impostors are disabled
105 bool setCacheSize(int sizeKb);
107 // alloc the impostors texture memory given the count and size of texture
108 // if count == 0 then the memory pool is freed and impostors are disabled
109 bool setCacheSize(int count, int textureDimension);
111 // return the size of the memory pool used by texture impostors
112 int queryCacheSize(void);
114 int maxImpostorRegenFrame;
117 #endif // _BBCACHE_HXX