2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file RAS_BucketManager.h
32 #ifndef __RAS_BUCKETMANAGER_H__
33 #define __RAS_BUCKETMANAGER_H__
35 #include "MT_Transform.h"
36 #include "RAS_MaterialBucket.h"
41 class RAS_BucketManager
43 typedef std::vector<class RAS_MaterialBucket*> BucketList;
44 BucketList m_SolidBuckets;
45 BucketList m_AlphaBuckets;
47 struct sortedmeshslot;
53 virtual ~RAS_BucketManager();
55 void Renderbuckets(const MT_Transform & cameratrans,
56 RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools);
58 RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial * material, bool &bucketCreated);
59 void OptimizeBuckets(MT_Scalar distance);
61 void ReleaseDisplayLists(RAS_IPolyMaterial * material = NULL);
62 void ReleaseMaterials(RAS_IPolyMaterial * material = NULL);
64 void RemoveMaterial(RAS_IPolyMaterial * mat); // freeing scenes only
67 void MergeBucketManager(RAS_BucketManager *other, SCA_IScene *scene);
68 BucketList & GetSolidBuckets() {return m_SolidBuckets;}
69 BucketList & GetAlphaBuckets() {return m_AlphaBuckets;}
71 /*void PrintStats(int verbose_level) {
72 printf("\nMappings...\n");
73 printf("\t m_SolidBuckets: %d\n", m_SolidBuckets.size());
74 printf("\t\t m_SolidBuckets: %d\n", m_SolidBuckets.size());
75 printf("\t m_AlphaBuckets: %d\n", m_AlphaBuckets.size());
80 void OrderBuckets(const MT_Transform& cameratrans, BucketList& buckets, vector<sortedmeshslot>& slots, bool alpha);
82 void RenderSolidBuckets(const MT_Transform& cameratrans,
83 RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools);
84 void RenderAlphaBuckets(const MT_Transform& cameratrans,
85 RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools);
87 #ifdef WITH_CXX_GUARDEDALLOC
89 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_BucketManager"); }
90 void operator delete( void *mem ) { MEM_freeN(mem); }
94 #endif //__RAS_BUCKETMANAGER_H__