1 #ifndef _OCME_DISKLOADER_
2 #define _OCME_DISKLOADER_
3 
4 #include "cell.h"
5 
6 
7 #include <cache/cache.h>
8 #include <cache/controller.h>
9 
10 struct OCME;
11 
12 /*
13   A token is a whole cell (next version: tokens with finer granularity: single chunks of vertices)
14   */
15 struct CellToken : public Token<float> {
CellTokenCellToken16 	CellToken(CellKey _ck, float _priority):ck(_ck){this->setPriority(_priority);}
17 	CellKey ck;
18 	int sizeinRAM;
19 };
20 
21 class RenderCache: public Cache<CellToken>{
22 public:	OCME * ocme;
23 };
24 
25 class CellDisk: public RenderCache {
26  public:
27   int get(CellToken *token);
28   int drop(CellToken *token);
29   int size(CellToken *token) ;
30 };
31 
32 class CellRAM: public RenderCache {
33  public:
34   int get(CellToken *token);
35   int drop(CellToken *token);
36   int size(CellToken *token) ;
37 };
38 
39 class CellVideo: public RenderCache {
40  public:
41   int get(CellToken *token);
42   int drop(CellToken *token);
43   int size(CellToken *token);
44 };
45 
46 
47 class RenderCachesController {
48 public:
49 	RenderCachesController() ;
~RenderCachesController()50 	~RenderCachesController() {};
51 	void Req(Cell * c , float priority);
Init(OCME * o)52 	void Init(OCME * o){ cellRAM.ocme = cellVideo.ocme = o;}
Start()53 	void Start(){controller.start();}
54 	void Finish();
55 	Controller<CellToken> controller;
56 
57 	CellDisk cellDisk;
58 	CellRAM cellRAM;
59 	CellVideo cellVideo;
60 
61 };
62 
63 
64 #endif
65