mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
add DisplayRegion::set_incomplete_render()
This commit is contained in:
parent
154fa4b198
commit
df3fe996b9
@ -1090,10 +1090,10 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# region (see the comment in setupRender2d, above).
|
||||
dr.setClearDepthActive(1)
|
||||
|
||||
# Make any texture reloads on the gui come up first, before
|
||||
# textures on the rest of the scene, and before the default
|
||||
# asynchronous animation load priority (100).
|
||||
dr.setTextureReloadPriority(200)
|
||||
# Make any texture reloads on the gui come up immediately.
|
||||
# Temporary hasattr for old Pandas.
|
||||
if hasattr(dr, 'setIncompleteRender'):
|
||||
dr.setIncompleteRender(False)
|
||||
|
||||
left, right, bottom, top = coords
|
||||
|
||||
@ -1136,7 +1136,8 @@ class ShowBase(DirectObject.DirectObject):
|
||||
# Unlike render2d, we don't clear the depth buffer for
|
||||
# render2dp. Caveat emptor.
|
||||
|
||||
dr.setTextureReloadPriority(250)
|
||||
if hasattr(dr, 'setIncompleteRender'):
|
||||
dr.setIncompleteRender(False)
|
||||
|
||||
left, right, bottom, top = coords
|
||||
|
||||
|
@ -186,6 +186,40 @@ get_clear_depth_between_eyes() const {
|
||||
return _clear_depth_between_eyes;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::set_incomplete_render
|
||||
// Access: Public
|
||||
// Description: Sets the incomplete_render flag. When this is
|
||||
// true, the frame will be rendered even if some of the
|
||||
// geometry or textures in the scene are not available
|
||||
// (e.g. they have been temporarily paged out). When
|
||||
// this is false, the frame will be held up while this
|
||||
// data is reloaded.
|
||||
//
|
||||
// This flag may also be set on the
|
||||
// GraphicsStateGuardian. It will be considered true
|
||||
// for a given DisplayRegion only if it is true on both
|
||||
// the GSG and on the DisplayRegion.
|
||||
//
|
||||
// See GraphicsStateGuardian::set_incomplete_render()
|
||||
// for more detail.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void DisplayRegion::
|
||||
set_incomplete_render(bool incomplete_render) {
|
||||
_incomplete_render = incomplete_render;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::get_incomplete_render
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns the incomplete_render flag. See
|
||||
// set_incomplete_render().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool DisplayRegion::
|
||||
get_incomplete_render() const {
|
||||
return _incomplete_render;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::set_texture_reload_priority
|
||||
// Access: Published
|
||||
|
@ -32,6 +32,7 @@ DisplayRegion::
|
||||
DisplayRegion(GraphicsOutput *window) :
|
||||
_window(window),
|
||||
_clear_depth_between_eyes(true),
|
||||
_incomplete_render(true),
|
||||
_texture_reload_priority(0),
|
||||
_cull_region_pcollector("Cull:Invalid"),
|
||||
_draw_region_pcollector("Draw:Invalid")
|
||||
@ -50,6 +51,7 @@ DisplayRegion::
|
||||
DisplayRegion(GraphicsOutput *window, float l, float r, float b, float t) :
|
||||
_window(window),
|
||||
_clear_depth_between_eyes(true),
|
||||
_incomplete_render(true),
|
||||
_texture_reload_priority(0),
|
||||
_cull_region_pcollector("Cull:Invalid"),
|
||||
_draw_region_pcollector("Draw:Invalid")
|
||||
|
@ -95,6 +95,9 @@ PUBLISHED:
|
||||
INLINE void set_clear_depth_between_eyes(bool clear_depth_between_eyes);
|
||||
INLINE bool get_clear_depth_between_eyes() const;
|
||||
|
||||
INLINE void set_incomplete_render(bool incomplete_render);
|
||||
INLINE bool get_incomplete_render() const;
|
||||
|
||||
INLINE void set_texture_reload_priority(int texture_reload_priority);
|
||||
INLINE int get_texture_reload_priority() const;
|
||||
|
||||
@ -149,6 +152,7 @@ private:
|
||||
GraphicsOutput *_window;
|
||||
bool _clear_depth_between_eyes;
|
||||
|
||||
bool _incomplete_render;
|
||||
int _texture_reload_priority;
|
||||
|
||||
// Ditto for the cull traverser.
|
||||
|
@ -137,6 +137,11 @@ needs_reset() const {
|
||||
// screens, to guarantee that all of your assets are
|
||||
// available by the time you take the loading screen
|
||||
// down.
|
||||
//
|
||||
// This flag may also be set individually on each
|
||||
// DisplayRegion. It will be considered true for a
|
||||
// given DisplayRegion only if it is true on both the
|
||||
// GSG and on the DisplayRegion.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GraphicsStateGuardian::
|
||||
set_incomplete_render(bool incomplete_render) {
|
||||
|
@ -1075,6 +1075,7 @@ prepare_display_region(DisplayRegionPipelineReader *dr,
|
||||
Lens::StereoChannel stereo_channel) {
|
||||
_current_display_region = dr->get_object();
|
||||
_current_stereo_channel = stereo_channel;
|
||||
_effective_incomplete_render = _incomplete_render && _current_display_region->get_incomplete_render();
|
||||
|
||||
_stereo_buffer_mask = ~0;
|
||||
|
||||
|
@ -387,6 +387,7 @@ protected:
|
||||
bool _closing_gsg;
|
||||
bool _active;
|
||||
bool _incomplete_render;
|
||||
bool _effective_incomplete_render;
|
||||
PT(Loader) _loader;
|
||||
|
||||
PT(PreparedGraphicsObjects) _prepared_objects;
|
||||
|
@ -300,7 +300,7 @@ upload_texture(DXTextureContext8 *dtc, bool force) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_incomplete_render && !force) {
|
||||
if (_effective_incomplete_render && !force) {
|
||||
bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image();
|
||||
if (!has_image && tex->might_have_ram_image() &&
|
||||
tex->has_simple_ram_image() &&
|
||||
|
@ -359,7 +359,7 @@ upload_texture(DXTextureContext9 *dtc, bool force) {
|
||||
dtc->update_data_size_bytes(0);
|
||||
dtc->mark_unloaded();
|
||||
|
||||
if (_incomplete_render && !force) {
|
||||
if (_effective_incomplete_render && !force) {
|
||||
bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image();
|
||||
if (!has_image && tex->might_have_ram_image() &&
|
||||
tex->has_simple_ram_image() &&
|
||||
|
@ -6983,7 +6983,7 @@ bool CLP(GraphicsStateGuardian)::
|
||||
upload_texture(CLP(TextureContext) *gtc, bool force) {
|
||||
Texture *tex = gtc->get_texture();
|
||||
|
||||
if (_incomplete_render && !force) {
|
||||
if (_effective_incomplete_render && !force) {
|
||||
bool has_image = _supports_compressed_texture ? tex->has_ram_image() : tex->has_uncompressed_ram_image();
|
||||
if (!has_image && tex->might_have_ram_image() &&
|
||||
tex->has_simple_ram_image() &&
|
||||
|
@ -2428,7 +2428,7 @@ bool TinyGraphicsStateGuardian::
|
||||
upload_texture(TinyTextureContext *gtc, bool force) {
|
||||
Texture *tex = gtc->get_texture();
|
||||
|
||||
if (_incomplete_render && !force) {
|
||||
if (_effective_incomplete_render && !force) {
|
||||
if (!tex->has_ram_image() && tex->might_have_ram_image() &&
|
||||
tex->has_simple_ram_image() &&
|
||||
!_loader.is_null()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user