Panda3D
panda
src
gobj
textureReloadRequest.cxx
Go to the documentation of this file.
1
/**
2
* PANDA 3D SOFTWARE
3
* Copyright (c) Carnegie Mellon University. All rights reserved.
4
*
5
* All use of this software is subject to the terms of the revised BSD
6
* license. You should have received a copy of this license along
7
* with this source code in a file named "LICENSE."
8
*
9
* @file textureReloadRequest.cxx
10
* @author drose
11
* @date 2008-08-12
12
*/
13
14
#include "
textureReloadRequest.h
"
15
#include "
textureContext.h
"
16
17
TypeHandle
TextureReloadRequest::_type_handle;
18
19
/**
20
* Performs the task: that is, loads the one model.
21
*/
22
AsyncTask::DoneStatus TextureReloadRequest::
23
do_task() {
24
// Don't reload the texture if it doesn't need it.
25
if
(_texture->was_image_modified(_pgo)) {
26
double
delay = async_load_delay;
27
if
(delay != 0.0) {
28
Thread::sleep
(delay);
29
}
30
31
if
(_texture->was_image_modified(_pgo)) {
32
if
(_allow_compressed) {
33
_texture->get_ram_image();
34
}
else
{
35
_texture->get_uncompressed_ram_image();
36
}
37
38
// Now that we've loaded the texture, we should ensure it actually gets
39
// prepared--even if it's no longer visible in the frame--or it may
40
// become a kind of a leak (if the texture is never rendered again on
41
// this GSG, we'll just end up carrying the texture memory in RAM
42
// forever, instead of dumping it as soon as it gets prepared).
43
_pgo->enqueue_texture(_texture);
44
}
45
}
46
47
// Don't continue the task; we're done.
48
return
DS_done;
49
}
Thread::sleep
static void sleep(double seconds)
Suspends the current thread for at least the indicated amount of time.
Definition:
thread.I:192
textureContext.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition:
typeHandle.h:81
textureReloadRequest.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Wed Jan 23 2019 21:40:04 for Panda3D by
1.8.15