Panda3D
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
panda
src
gobj
textureStagePool.h
1
// Filename: textureStagePool.h
2
// Created by: drose (03May10)
3
//
4
////////////////////////////////////////////////////////////////////
5
//
6
// PANDA 3D SOFTWARE
7
// Copyright (c) Carnegie Mellon University. All rights reserved.
8
//
9
// All use of this software is subject to the terms of the revised BSD
10
// license. You should have received a copy of this license along
11
// with this source code in a file named "LICENSE."
12
//
13
////////////////////////////////////////////////////////////////////
14
15
#ifndef TEXTURESTAGEPOOL_H
16
#define TEXTURESTAGEPOOL_H
17
18
#include "pandabase.h"
19
#include "textureStage.h"
20
#include "pointerTo.h"
21
#include "pmutex.h"
22
#include "pset.h"
23
24
////////////////////////////////////////////////////////////////////
25
// Class : TextureStagePool
26
// Description : The TextureStagePool (there is only one in the universe)
27
// serves to unify different pointers to the same
28
// TextureStage, mainly to help developers use a common
29
// pointer to access things that are loaded from
30
// different model files.
31
//
32
// It runs in one of three different modes, according to
33
// set_mode(). See that method for more information.
34
////////////////////////////////////////////////////////////////////
35
class
EXPCL_PANDA_GOBJ
TextureStagePool
{
36
PUBLISHED:
37
enum
Mode {
38
M_none,
39
M_name,
40
M_unique,
41
};
42
43
INLINE
static
TextureStage
*get_stage(
TextureStage
*temp);
44
INLINE
static
void
release_stage(
TextureStage
*temp);
45
INLINE
static
void
release_all_stages();
46
47
INLINE
static
void
set_mode(Mode mode);
48
INLINE
static
Mode get_mode();
49
50
INLINE
static
int
garbage_collect();
51
INLINE
static
void
list_contents(ostream &out);
52
static
void
write(ostream &out);
53
54
private
:
55
TextureStagePool
();
56
57
TextureStage
*ns_get_stage(
TextureStage
*temp);
58
void
ns_release_stage(
TextureStage
*temp);
59
void
ns_release_all_stages();
60
61
void
ns_set_mode(Mode mode);
62
Mode ns_get_mode();
63
64
int
ns_garbage_collect();
65
void
ns_list_contents(ostream &out)
const
;
66
67
static
TextureStagePool
*get_global_ptr();
68
69
static
TextureStagePool
*_global_ptr;
70
71
Mutex
_lock;
72
73
// We store a map of CPT(TextureStage) to PT(TextureStage). These are two
74
// equivalent structures, but different pointers. The first pointer
75
// never leaves this class. If the second pointer changes value,
76
// we'll notice it and return a new one.
77
typedef
pmap<CPT(TextureStage), PT(TextureStage), indirect_compare_to<const TextureStage *>
>
StagesByProperties
;
78
StagesByProperties
_stages_by_properties;
79
80
typedef
pmap<string, PT(TextureStage) >
StagesByName
;
81
StagesByName
_stages_by_name;
82
83
Mode _mode;
84
};
85
86
EXPCL_PANDA_GOBJ ostream &operator << (ostream &out, TextureStagePool::Mode mode);
87
EXPCL_PANDA_GOBJ istream &operator >> (istream &in, TextureStagePool::Mode &mode);
88
89
#include "textureStagePool.I"
90
91
#endif
92
93
pmap
This is our own Panda specialization on the default STL map.
Definition:
pmap.h:52
Mutex
A standard mutex, or mutual exclusion lock.
Definition:
pmutex.h:44
TextureStagePool
The TextureStagePool (there is only one in the universe) serves to unify different pointers to the sa...
Definition:
textureStagePool.h:35
TextureStage
Defines the properties of a named stage of the multitexture pipeline.
Definition:
textureStage.h:38
Generated on Mon Feb 1 2016 13:44:28 for Panda3D by
1.8.5