mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
slightly better viewport handling
This commit is contained in:
parent
986bf172c5
commit
799f0fcf19
@ -36,7 +36,7 @@ DisplayRegion(GraphicsOutput *window) :
|
||||
_window(window)
|
||||
{
|
||||
_draw_buffer_type = window->get_draw_buffer_type();
|
||||
compute_pixels();
|
||||
compute_pixels_all_stages();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -50,6 +50,7 @@ DisplayRegion(GraphicsOutput *window, float l, float r, float b, float t) :
|
||||
{
|
||||
_draw_buffer_type = window->get_draw_buffer_type();
|
||||
set_dimensions(l, r, b, t);
|
||||
compute_pixels_all_stages();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -334,6 +335,28 @@ compute_pixels() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::compute_pixels_all_stages
|
||||
// Access: Published
|
||||
// Description: Computes the pixel locations of the DisplayRegion
|
||||
// within its window. The DisplayRegion will request
|
||||
// the size from the window.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplayRegion::
|
||||
compute_pixels_all_stages() {
|
||||
int pipeline_stage = Thread::get_current_pipeline_stage();
|
||||
nassertv(pipeline_stage == 0);
|
||||
|
||||
if (_window != (GraphicsOutput *)NULL) {
|
||||
OPEN_ITERATE_ALL_STAGES(_cycler) {
|
||||
CDStageWriter cdata(_cycler, pipeline_stage);
|
||||
do_compute_pixels(_window->get_x_size(), _window->get_y_size(),
|
||||
cdata);
|
||||
}
|
||||
CLOSE_ITERATE_ALL_STAGES(_cycler);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::compute_pixels
|
||||
// Access: Published
|
||||
@ -349,6 +372,24 @@ compute_pixels(int x_size, int y_size) {
|
||||
do_compute_pixels(x_size, y_size, cdata);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::compute_pixels_all_stages
|
||||
// Access: Published
|
||||
// Description: Performs a compute_pixels() operation for all stages
|
||||
// of the pipeline. This is appropriate, for instance,
|
||||
// when a window changes sizes, since this is a global
|
||||
// operation; and you want the new window size to be
|
||||
// immediately available even to the downstream stages.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DisplayRegion::
|
||||
compute_pixels_all_stages(int x_size, int y_size) {
|
||||
OPEN_ITERATE_ALL_STAGES(_cycler) {
|
||||
CDStageWriter cdata(_cycler, pipeline_stage);
|
||||
do_compute_pixels(x_size, y_size, cdata);
|
||||
}
|
||||
CLOSE_ITERATE_ALL_STAGES(_cycler);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DisplayRegion::get_pixels
|
||||
// Access: Published
|
||||
@ -640,6 +681,8 @@ do_compute_pixels(int x_size, int y_size, CData *cdata) {
|
||||
DisplayRegion::CData::
|
||||
CData() :
|
||||
_l(0.), _r(1.), _b(0.), _t(1.),
|
||||
_pl(0), _pr(0), _pb(0), _pt(0),
|
||||
_pbi(0), _pti(0),
|
||||
_camera_node((Camera *)NULL),
|
||||
_active(true),
|
||||
_sort(0),
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "cycleData.h"
|
||||
#include "cycleDataReader.h"
|
||||
#include "cycleDataWriter.h"
|
||||
#include "cycleDataStageWriter.h"
|
||||
#include "pipelineCycler.h"
|
||||
#include "config_display.h"
|
||||
|
||||
@ -91,7 +92,9 @@ PUBLISHED:
|
||||
INLINE int get_cube_map_index() const;
|
||||
|
||||
void compute_pixels();
|
||||
void compute_pixels_all_stages();
|
||||
void compute_pixels(int x_size, int y_size);
|
||||
void compute_pixels_all_stages(int x_size, int y_size);
|
||||
void get_pixels(int &pl, int &pr, int &pb, int &pt) const;
|
||||
void get_region_pixels(int &xo, int &yo, int &w, int &h) const;
|
||||
void get_region_pixels_i(int &xo, int &yo, int &w, int &h) const;
|
||||
@ -158,6 +161,7 @@ private:
|
||||
PipelineCycler<CData> _cycler;
|
||||
typedef CycleDataReader<CData> CDReader;
|
||||
typedef CycleDataWriter<CData> CDWriter;
|
||||
typedef CycleDataWriter<CData> CDStageWriter;
|
||||
|
||||
// This is a special cycler created to hold the results from the
|
||||
// cull traversal, for (a) the draw traversal, and (b) the next
|
||||
|
@ -565,7 +565,7 @@ set_size_and_recalc(int x, int y) {
|
||||
for (dri = _total_display_regions.begin();
|
||||
dri != _total_display_regions.end();
|
||||
++dri) {
|
||||
(*dri)->compute_pixels(x,y);
|
||||
(*dri)->compute_pixels_all_stages(x, y);
|
||||
}
|
||||
|
||||
if (_texture_card != 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user