mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
robustify config for framebuffer etc.
This commit is contained in:
parent
566ee4e986
commit
03408cd09d
@ -119,6 +119,14 @@ ConfigVariableBool window_inverted
|
|||||||
"they will render upside-down and backwards. Normally this is useful only "
|
"they will render upside-down and backwards. Normally this is useful only "
|
||||||
"for debugging."));
|
"for debugging."));
|
||||||
|
|
||||||
|
ConfigVariableBool depth_offset_decals
|
||||||
|
("depth-offset-decals", false,
|
||||||
|
PRC_DESC("Set this true to allow decals to be implemented via the advanced "
|
||||||
|
"depth offset feature, if supported, instead of via the traditional "
|
||||||
|
"(and slower) two-pass approach. This is false by default "
|
||||||
|
"because it appears that many graphics drivers have issues with "
|
||||||
|
"their depth offset implementation."));
|
||||||
|
|
||||||
ConfigVariableInt win_size
|
ConfigVariableInt win_size
|
||||||
("win-size", "640 480",
|
("win-size", "640 480",
|
||||||
PRC_DESC("This is the default size at which to open a new window. This "
|
PRC_DESC("This is the default size at which to open a new window. This "
|
||||||
@ -162,6 +170,31 @@ ConfigVariableEnum<WindowProperties::ZOrder> z_order
|
|||||||
ConfigVariableString window_title
|
ConfigVariableString window_title
|
||||||
("window-title", "Panda");
|
("window-title", "Panda");
|
||||||
|
|
||||||
|
ConfigVariableString framebuffer_mode
|
||||||
|
("framebuffer-mode", "rgba double-buffer depth multisample hardware",
|
||||||
|
PRC_DESC("A space-separated list of keywords that describe the default "
|
||||||
|
"framebuffer properties requested for a window."));
|
||||||
|
ConfigVariableInt depth_bits
|
||||||
|
("depth-bits", 1,
|
||||||
|
PRC_DESC("The minimum number of depth bits requested if the depth keyword "
|
||||||
|
"is present in framebuffer-mode."));
|
||||||
|
ConfigVariableInt color_bits
|
||||||
|
("color-bits", 1,
|
||||||
|
PRC_DESC("The minimum number of color bits requested in the default "
|
||||||
|
"framebuffer properties (sum of all three color channels)."));
|
||||||
|
ConfigVariableInt alpha_bits
|
||||||
|
("alpha-bits", 1,
|
||||||
|
PRC_DESC("The minimum number of alpha bits requested if the alpha or rgba "
|
||||||
|
"keyword is present in framebuffer-mode."));
|
||||||
|
ConfigVariableInt stencil_bits
|
||||||
|
("stencil-bits", 1,
|
||||||
|
PRC_DESC("The minimum number of stencil bits requested if the stencil keyword "
|
||||||
|
"is present in framebuffer-mode."));
|
||||||
|
ConfigVariableInt multisample_bits
|
||||||
|
("multisample-bits", 1,
|
||||||
|
PRC_DESC("The minimum number of multisample bits requested if the multisample keyword "
|
||||||
|
"is present in framebuffer-mode."));
|
||||||
|
|
||||||
ConfigVariableDouble background_color
|
ConfigVariableDouble background_color
|
||||||
("background-color", "0.41 0.41 0.41",
|
("background-color", "0.41 0.41 0.41",
|
||||||
PRC_DESC("Specifies the rgb(a) value of the default background color for a "
|
PRC_DESC("Specifies the rgb(a) value of the default background color for a "
|
||||||
|
@ -53,6 +53,7 @@ extern ConfigVariableBool prefer_single_buffer;
|
|||||||
|
|
||||||
extern ConfigVariableBool copy_texture_inverted;
|
extern ConfigVariableBool copy_texture_inverted;
|
||||||
extern ConfigVariableBool window_inverted;
|
extern ConfigVariableBool window_inverted;
|
||||||
|
extern ConfigVariableBool depth_offset_decals;
|
||||||
|
|
||||||
extern ConfigVariableInt win_size;
|
extern ConfigVariableInt win_size;
|
||||||
extern ConfigVariableInt win_origin;
|
extern ConfigVariableInt win_origin;
|
||||||
@ -68,6 +69,13 @@ extern ConfigVariableFilename cursor_filename;
|
|||||||
extern ConfigVariableEnum<WindowProperties::ZOrder> z_order;
|
extern ConfigVariableEnum<WindowProperties::ZOrder> z_order;
|
||||||
extern ConfigVariableString window_title;
|
extern ConfigVariableString window_title;
|
||||||
|
|
||||||
|
extern ConfigVariableString framebuffer_mode;
|
||||||
|
extern ConfigVariableInt depth_bits;
|
||||||
|
extern ConfigVariableInt color_bits;
|
||||||
|
extern ConfigVariableInt alpha_bits;
|
||||||
|
extern ConfigVariableInt stencil_bits;
|
||||||
|
extern ConfigVariableInt multisample_bits;
|
||||||
|
|
||||||
extern ConfigVariableDouble background_color;
|
extern ConfigVariableDouble background_color;
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ DisplayRegion(GraphicsOutput *window) :
|
|||||||
_active(true),
|
_active(true),
|
||||||
_sort(0)
|
_sort(0)
|
||||||
{
|
{
|
||||||
|
_draw_buffer_type = window->get_draw_buffer_type();
|
||||||
compute_pixels();
|
compute_pixels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ DisplayRegion(GraphicsOutput *window, const float l,
|
|||||||
_active(true),
|
_active(true),
|
||||||
_sort(0)
|
_sort(0)
|
||||||
{
|
{
|
||||||
|
_draw_buffer_type = window->get_draw_buffer_type();
|
||||||
compute_pixels();
|
compute_pixels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ has_depth_bits() const {
|
|||||||
INLINE void FrameBufferProperties::
|
INLINE void FrameBufferProperties::
|
||||||
clear_depth_bits() {
|
clear_depth_bits() {
|
||||||
_specified &= ~S_depth_bits;
|
_specified &= ~S_depth_bits;
|
||||||
_depth_bits = 0;
|
_depth_bits = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -212,7 +212,145 @@ has_color_bits() const {
|
|||||||
INLINE void FrameBufferProperties::
|
INLINE void FrameBufferProperties::
|
||||||
clear_color_bits() {
|
clear_color_bits() {
|
||||||
_specified &= ~S_color_bits;
|
_specified &= ~S_color_bits;
|
||||||
_color_bits = 0;
|
_color_bits = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::set_alpha_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Specifies the minimum number of bits that are
|
||||||
|
// required of the alpha buffer.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void FrameBufferProperties::
|
||||||
|
set_alpha_bits(int alpha_bits) {
|
||||||
|
_alpha_bits = alpha_bits;
|
||||||
|
_specified |= S_alpha_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::get_alpha_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns the number of bits specified for the alpha
|
||||||
|
// buffer.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE int FrameBufferProperties::
|
||||||
|
get_alpha_bits() const {
|
||||||
|
return _alpha_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::has_alpha_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the number of bits for the alpha
|
||||||
|
// buffer has been specified, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool FrameBufferProperties::
|
||||||
|
has_alpha_bits() const {
|
||||||
|
return ((_specified & S_alpha_bits) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::clear_alpha_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Removes the alpha_bits specification from the
|
||||||
|
// properties.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void FrameBufferProperties::
|
||||||
|
clear_alpha_bits() {
|
||||||
|
_specified &= ~S_alpha_bits;
|
||||||
|
_alpha_bits = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::set_stencil_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Specifies the minimum number of bits that are
|
||||||
|
// required for the stencil buffer.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void FrameBufferProperties::
|
||||||
|
set_stencil_bits(int stencil_bits) {
|
||||||
|
_stencil_bits = stencil_bits;
|
||||||
|
_specified |= S_stencil_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::get_stencil_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns the number of bits specified for the stencil
|
||||||
|
// buffer.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE int FrameBufferProperties::
|
||||||
|
get_stencil_bits() const {
|
||||||
|
return _stencil_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::has_stencil_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the number of bits for the stencil
|
||||||
|
// buffer has been specified, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool FrameBufferProperties::
|
||||||
|
has_stencil_bits() const {
|
||||||
|
return ((_specified & S_stencil_bits) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::clear_stencil_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Removes the stencil_bits specification from the
|
||||||
|
// properties.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void FrameBufferProperties::
|
||||||
|
clear_stencil_bits() {
|
||||||
|
_specified &= ~S_stencil_bits;
|
||||||
|
_stencil_bits = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::set_multisample_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Specifies the minimum number of bits that are
|
||||||
|
// required for the multisample buffer.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void FrameBufferProperties::
|
||||||
|
set_multisample_bits(int multisample_bits) {
|
||||||
|
_multisample_bits = multisample_bits;
|
||||||
|
_specified |= S_multisample_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::get_multisample_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns the number of bits specified for the multisample
|
||||||
|
// buffer.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE int FrameBufferProperties::
|
||||||
|
get_multisample_bits() const {
|
||||||
|
return _multisample_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::has_multisample_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the number of bits for the multisample
|
||||||
|
// buffer has been specified, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool FrameBufferProperties::
|
||||||
|
has_multisample_bits() const {
|
||||||
|
return ((_specified & S_multisample_bits) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::clear_multisample_bits
|
||||||
|
// Access: Published
|
||||||
|
// Description: Removes the multisample_bits specification from the
|
||||||
|
// properties.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void FrameBufferProperties::
|
||||||
|
clear_multisample_bits() {
|
||||||
|
_specified &= ~S_multisample_bits;
|
||||||
|
_multisample_bits = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE ostream &
|
INLINE ostream &
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "frameBufferProperties.h"
|
#include "frameBufferProperties.h"
|
||||||
|
#include "string_utils.h"
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -41,6 +42,85 @@ operator = (const FrameBufferProperties ©) {
|
|||||||
_frame_buffer_mode = copy._frame_buffer_mode;
|
_frame_buffer_mode = copy._frame_buffer_mode;
|
||||||
_depth_bits = copy._depth_bits;
|
_depth_bits = copy._depth_bits;
|
||||||
_color_bits = copy._color_bits;
|
_color_bits = copy._color_bits;
|
||||||
|
_alpha_bits = copy._alpha_bits;
|
||||||
|
_stencil_bits = copy._stencil_bits;
|
||||||
|
_multisample_bits = copy._multisample_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FrameBufferProperties::get_default
|
||||||
|
// Access: Published, Static
|
||||||
|
// Description: Returns a FrameBufferProperties structure with all of
|
||||||
|
// the default values filled in according to the user's
|
||||||
|
// config file.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
FrameBufferProperties FrameBufferProperties::
|
||||||
|
get_default() {
|
||||||
|
FrameBufferProperties props;
|
||||||
|
|
||||||
|
int mode = 0;
|
||||||
|
int num_words = framebuffer_mode.get_num_words();
|
||||||
|
for (int i = 0; i < num_words; i++) {
|
||||||
|
string word = framebuffer_mode.get_word(i);
|
||||||
|
if (cmp_nocase_uh(word, "rgb") == 0) {
|
||||||
|
mode |= FM_rgb;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "index") == 0) {
|
||||||
|
mode |= FM_index;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "single") == 0 ||
|
||||||
|
cmp_nocase_uh(word, "single-buffer") == 0) {
|
||||||
|
mode |= FM_single_buffer;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "double") == 0 ||
|
||||||
|
cmp_nocase_uh(word, "double-buffer") == 0) {
|
||||||
|
mode |= FM_double_buffer;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "triple") == 0 ||
|
||||||
|
cmp_nocase_uh(word, "triple-buffer") == 0) {
|
||||||
|
mode |= FM_triple_buffer;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "accum") == 0) {
|
||||||
|
mode |= FM_accum;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "alpha") == 0) {
|
||||||
|
mode |= FM_alpha;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "rgba") == 0) {
|
||||||
|
mode |= FM_rgba;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "depth") == 0) {
|
||||||
|
mode |= FM_depth;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "stencil") == 0) {
|
||||||
|
mode |= FM_stencil;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "multisample") == 0) {
|
||||||
|
mode |= FM_multisample;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "stereo") == 0) {
|
||||||
|
mode |= FM_stereo;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "software") == 0) {
|
||||||
|
mode |= FM_software;
|
||||||
|
|
||||||
|
} else if (cmp_nocase_uh(word, "hardware") == 0) {
|
||||||
|
mode |= FM_hardware;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
display_cat.warning()
|
||||||
|
<< "Unknown framebuffer keyword: " << word << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
props.set_frame_buffer_mode(mode);
|
||||||
|
props.set_depth_bits(depth_bits);
|
||||||
|
props.set_color_bits(color_bits);
|
||||||
|
props.set_alpha_bits(alpha_bits);
|
||||||
|
props.set_stencil_bits(stencil_bits);
|
||||||
|
props.set_multisample_bits(multisample_bits);
|
||||||
|
|
||||||
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -54,7 +134,10 @@ operator == (const FrameBufferProperties &other) const {
|
|||||||
_flags == other._flags &&
|
_flags == other._flags &&
|
||||||
_frame_buffer_mode == other._frame_buffer_mode &&
|
_frame_buffer_mode == other._frame_buffer_mode &&
|
||||||
_depth_bits == other._depth_bits &&
|
_depth_bits == other._depth_bits &&
|
||||||
_color_bits == other._color_bits);
|
_color_bits == other._color_bits &&
|
||||||
|
_alpha_bits == other._alpha_bits &&
|
||||||
|
_stencil_bits == other._stencil_bits &&
|
||||||
|
_multisample_bits == other._multisample_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -69,8 +152,11 @@ clear() {
|
|||||||
_specified = 0;
|
_specified = 0;
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
_frame_buffer_mode = 0;
|
_frame_buffer_mode = 0;
|
||||||
_depth_bits = 0;
|
_depth_bits = 1;
|
||||||
_color_bits = 0;
|
_color_bits = 1;
|
||||||
|
_alpha_bits = 1;
|
||||||
|
_stencil_bits = 1;
|
||||||
|
_multisample_bits = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -91,6 +177,15 @@ add_properties(const FrameBufferProperties &other) {
|
|||||||
if (other.has_color_bits()) {
|
if (other.has_color_bits()) {
|
||||||
set_color_bits(other.get_color_bits());
|
set_color_bits(other.get_color_bits());
|
||||||
}
|
}
|
||||||
|
if (other.has_alpha_bits()) {
|
||||||
|
set_alpha_bits(other.get_alpha_bits());
|
||||||
|
}
|
||||||
|
if (other.has_stencil_bits()) {
|
||||||
|
set_stencil_bits(other.get_stencil_bits());
|
||||||
|
}
|
||||||
|
if (other.has_multisample_bits()) {
|
||||||
|
set_multisample_bits(other.get_multisample_bits());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -137,8 +232,11 @@ output(ostream &out) const {
|
|||||||
if ((frameBuffer_mode & FM_stereo) != 0) {
|
if ((frameBuffer_mode & FM_stereo) != 0) {
|
||||||
out << "|FM_stereo";
|
out << "|FM_stereo";
|
||||||
}
|
}
|
||||||
if ((frameBuffer_mode & FM_luminance) != 0) {
|
if ((frameBuffer_mode & FM_software) != 0) {
|
||||||
out << "|FM_luminance";
|
out << "|FM_software";
|
||||||
|
}
|
||||||
|
if ((frameBuffer_mode & FM_hardware) != 0) {
|
||||||
|
out << "|FM_hardware";
|
||||||
}
|
}
|
||||||
out << " ";
|
out << " ";
|
||||||
}
|
}
|
||||||
@ -148,4 +246,13 @@ output(ostream &out) const {
|
|||||||
if (has_color_bits()) {
|
if (has_color_bits()) {
|
||||||
out << "color_bits=" << get_color_bits() << " ";
|
out << "color_bits=" << get_color_bits() << " ";
|
||||||
}
|
}
|
||||||
|
if (has_alpha_bits()) {
|
||||||
|
out << "alpha_bits=" << get_alpha_bits() << " ";
|
||||||
|
}
|
||||||
|
if (has_stencil_bits()) {
|
||||||
|
out << "stencil_bits=" << get_stencil_bits() << " ";
|
||||||
|
}
|
||||||
|
if (has_multisample_bits()) {
|
||||||
|
out << "multisample_bits=" << get_multisample_bits() << " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,24 +34,27 @@ PUBLISHED:
|
|||||||
void operator = (const FrameBufferProperties ©);
|
void operator = (const FrameBufferProperties ©);
|
||||||
INLINE ~FrameBufferProperties();
|
INLINE ~FrameBufferProperties();
|
||||||
|
|
||||||
|
static FrameBufferProperties get_default();
|
||||||
|
|
||||||
bool operator == (const FrameBufferProperties &other) const;
|
bool operator == (const FrameBufferProperties &other) const;
|
||||||
INLINE bool operator != (const FrameBufferProperties &other) const;
|
INLINE bool operator != (const FrameBufferProperties &other) const;
|
||||||
|
|
||||||
enum FrameBufferMode {
|
enum FrameBufferMode {
|
||||||
FM_rgb = 0x0000,
|
FM_rgb = 0x0000,
|
||||||
FM_index = 0x0001,
|
FM_index = 0x0001,
|
||||||
FM_single_buffer = 0x0000,
|
FM_single_buffer = 0x0000,
|
||||||
FM_double_buffer = 0x0002,
|
FM_double_buffer = 0x0002,
|
||||||
FM_triple_buffer = 0x0004,
|
FM_triple_buffer = 0x0004,
|
||||||
FM_buffer = 0x0006, // == (FM_single_buffer | FM_double_buffer | FM_triple_buffer)
|
FM_buffer = 0x0006, // == (FM_single_buffer | FM_double_buffer | FM_triple_buffer)
|
||||||
FM_accum = 0x0008,
|
FM_accum = 0x0008,
|
||||||
FM_alpha = 0x0010,
|
FM_alpha = 0x0010,
|
||||||
FM_rgba = 0x0010, // == (FM_rgb | FM_alpha)
|
FM_rgba = 0x0010, // == (FM_rgb | FM_alpha)
|
||||||
FM_depth = 0x0020,
|
FM_depth = 0x0020,
|
||||||
FM_stencil = 0x0040,
|
FM_stencil = 0x0040,
|
||||||
FM_multisample = 0x0080,
|
FM_multisample = 0x0080,
|
||||||
FM_stereo = 0x0100,
|
FM_stereo = 0x0100,
|
||||||
FM_luminance = 0x0200,
|
FM_software = 0x0200,
|
||||||
|
FM_hardware = 0x0400,
|
||||||
};
|
};
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
@ -74,6 +77,21 @@ PUBLISHED:
|
|||||||
INLINE bool has_color_bits() const;
|
INLINE bool has_color_bits() const;
|
||||||
INLINE void clear_color_bits();
|
INLINE void clear_color_bits();
|
||||||
|
|
||||||
|
INLINE void set_alpha_bits(int alpha_bits);
|
||||||
|
INLINE int get_alpha_bits() const;
|
||||||
|
INLINE bool has_alpha_bits() const;
|
||||||
|
INLINE void clear_alpha_bits();
|
||||||
|
|
||||||
|
INLINE void set_stencil_bits(int stencil_bits);
|
||||||
|
INLINE int get_stencil_bits() const;
|
||||||
|
INLINE bool has_stencil_bits() const;
|
||||||
|
INLINE void clear_stencil_bits();
|
||||||
|
|
||||||
|
INLINE void set_multisample_bits(int multisample_bits);
|
||||||
|
INLINE int get_multisample_bits() const;
|
||||||
|
INLINE bool has_multisample_bits() const;
|
||||||
|
INLINE void clear_multisample_bits();
|
||||||
|
|
||||||
void add_properties(const FrameBufferProperties &other);
|
void add_properties(const FrameBufferProperties &other);
|
||||||
|
|
||||||
void output(ostream &out) const;
|
void output(ostream &out) const;
|
||||||
@ -83,24 +101,22 @@ private:
|
|||||||
// structure have been filled in by the user, and which remain
|
// structure have been filled in by the user, and which remain
|
||||||
// unspecified.
|
// unspecified.
|
||||||
enum Specified {
|
enum Specified {
|
||||||
S_frame_buffer_mode = 0x0200,
|
S_frame_buffer_mode = 0x0001,
|
||||||
S_depth_bits = 0x0400,
|
S_depth_bits = 0x0002,
|
||||||
S_color_bits = 0x0800,
|
S_color_bits = 0x0004,
|
||||||
|
S_alpha_bits = 0x0008,
|
||||||
|
S_stencil_bits = 0x0010,
|
||||||
|
S_multisample_bits = 0x0020,
|
||||||
};
|
};
|
||||||
|
|
||||||
// This bitmask represents the true/false settings for various
|
|
||||||
// boolean flags (assuming the corresponding S_* bit has been set,
|
|
||||||
// above).
|
|
||||||
/*
|
|
||||||
enum Flags {
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
int _specified;
|
int _specified;
|
||||||
int _flags;
|
int _flags;
|
||||||
int _frame_buffer_mode;
|
int _frame_buffer_mode;
|
||||||
int _depth_bits;
|
int _depth_bits;
|
||||||
int _color_bits;
|
int _color_bits;
|
||||||
|
int _alpha_bits;
|
||||||
|
int _stencil_bits;
|
||||||
|
int _multisample_bits;
|
||||||
};
|
};
|
||||||
|
|
||||||
INLINE ostream &operator << (ostream &out, const FrameBufferProperties &properties);
|
INLINE ostream &operator << (ostream &out, const FrameBufferProperties &properties);
|
||||||
|
@ -73,13 +73,7 @@ GraphicsEngine(Pipeline *pipeline) :
|
|||||||
_windows_sorted = true;
|
_windows_sorted = true;
|
||||||
|
|
||||||
// Default frame buffer properties.
|
// Default frame buffer properties.
|
||||||
_frame_buffer_properties.set_depth_bits(1);
|
_frame_buffer_properties = FrameBufferProperties::get_default();
|
||||||
_frame_buffer_properties.set_color_bits(1);
|
|
||||||
_frame_buffer_properties.set_frame_buffer_mode
|
|
||||||
(FrameBufferProperties::FM_rgba |
|
|
||||||
FrameBufferProperties::FM_double_buffer |
|
|
||||||
FrameBufferProperties::FM_multisample |
|
|
||||||
FrameBufferProperties::FM_depth);
|
|
||||||
|
|
||||||
set_threading_model(GraphicsThreadingModel(threading_model));
|
set_threading_model(GraphicsThreadingModel(threading_model));
|
||||||
if (!_threading_model.is_default()) {
|
if (!_threading_model.is_default()) {
|
||||||
@ -1084,7 +1078,7 @@ do_cull(CullHandler *cull_handler, SceneSetup *scene_setup,
|
|||||||
|
|
||||||
CullTraverser trav;
|
CullTraverser trav;
|
||||||
trav.set_cull_handler(cull_handler);
|
trav.set_cull_handler(cull_handler);
|
||||||
trav.set_depth_offset_decals(gsg->depth_offset_decals());
|
trav.set_depth_offset_decals(depth_offset_decals && gsg->depth_offset_decals());
|
||||||
trav.set_scene(scene_setup);
|
trav.set_scene(scene_setup);
|
||||||
|
|
||||||
if (view_frustum_cull) {
|
if (view_frustum_cull) {
|
||||||
|
@ -486,7 +486,7 @@ wants_colors() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool GraphicsStateGuardian::
|
bool GraphicsStateGuardian::
|
||||||
depth_offset_decals() {
|
depth_offset_decals() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -59,11 +59,6 @@ ConfigVariableBool dx_no_vertex_fog
|
|||||||
ConfigVariableBool dx_auto_normalize_lighting
|
ConfigVariableBool dx_auto_normalize_lighting
|
||||||
("auto-normalize-lighting", true);
|
("auto-normalize-lighting", true);
|
||||||
|
|
||||||
ConfigVariableBool dx_allow_software_renderer
|
|
||||||
("dx-allow-software-renderer", false);
|
|
||||||
ConfigVariableBool dx_force_software_renderer
|
|
||||||
("dx-force-software-renderer", false);
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// debugging flag
|
// debugging flag
|
||||||
// values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
|
// values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
|
||||||
@ -96,12 +91,6 @@ ConfigVariableBool dx_do_vidmemsize_check
|
|||||||
ConfigVariableBool dx_preserve_fpu_state
|
ConfigVariableBool dx_preserve_fpu_state
|
||||||
("dx-preserve-fpu-state", true);
|
("dx-preserve-fpu-state", true);
|
||||||
|
|
||||||
// Configure this true to try to implement decals using a
|
|
||||||
// DepthOffsetAttrib, false to do them with the more reliable 3-pass
|
|
||||||
// rendering method instead.
|
|
||||||
ConfigVariableBool dx_depth_offset_decals
|
|
||||||
("depth-offset-decals", false);
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
ConfigVariableDouble dx_global_miplevel_bias
|
ConfigVariableDouble dx_global_miplevel_bias
|
||||||
("dx-global-miplevel-bias", 0.0);
|
("dx-global-miplevel-bias", 0.0);
|
||||||
|
@ -34,8 +34,6 @@ extern ConfigVariableBool dx_no_vertex_fog;
|
|||||||
extern ConfigVariableBool dx_full_screen_antialiasing;
|
extern ConfigVariableBool dx_full_screen_antialiasing;
|
||||||
extern ConfigVariableBool dx_auto_normalize_lighting;
|
extern ConfigVariableBool dx_auto_normalize_lighting;
|
||||||
extern ConfigVariableBool dx_use_rangebased_fog;
|
extern ConfigVariableBool dx_use_rangebased_fog;
|
||||||
extern ConfigVariableBool dx_allow_software_renderer;
|
|
||||||
extern ConfigVariableBool dx_force_software_renderer;
|
|
||||||
extern ConfigVariableBool link_tristrips;
|
extern ConfigVariableBool link_tristrips;
|
||||||
|
|
||||||
// debug flags we might want to use in full optimized build
|
// debug flags we might want to use in full optimized build
|
||||||
@ -47,8 +45,6 @@ extern ConfigVariableBool dx_force_16bpp_zbuffer;
|
|||||||
extern ConfigVariableBool dx_do_vidmemsize_check;
|
extern ConfigVariableBool dx_do_vidmemsize_check;
|
||||||
extern ConfigVariableBool dx_preserve_fpu_state;
|
extern ConfigVariableBool dx_preserve_fpu_state;
|
||||||
|
|
||||||
extern ConfigVariableBool dx_depth_offset_decals;
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
extern ConfigVariableInt dx_force_backface_culling;
|
extern ConfigVariableInt dx_force_backface_culling;
|
||||||
#endif
|
#endif
|
||||||
|
@ -4267,20 +4267,6 @@ wants_texcoords() const {
|
|||||||
return _texturing_enabled;
|
return _texturing_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian7::depth_offset_decals
|
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description: Returns true if this GSG can implement decals using a
|
|
||||||
// DepthOffsetAttrib, or false if that is unreliable
|
|
||||||
// and the three-step rendering process should be used
|
|
||||||
// instead.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DXGraphicsStateGuardian7::
|
|
||||||
depth_offset_decals() {
|
|
||||||
return dx_depth_offset_decals;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian7::compute_distance_to
|
// Function: DXGraphicsStateGuardian7::compute_distance_to
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -131,8 +131,6 @@ public:
|
|||||||
|
|
||||||
virtual bool wants_texcoords(void) const;
|
virtual bool wants_texcoords(void) const;
|
||||||
|
|
||||||
virtual bool depth_offset_decals();
|
|
||||||
|
|
||||||
INLINE float compute_distance_to(const LPoint3f &point) const;
|
INLINE float compute_distance_to(const LPoint3f &point) const;
|
||||||
virtual void set_color_clear_value(const Colorf& value);
|
virtual void set_color_clear_value(const Colorf& value);
|
||||||
|
|
||||||
|
@ -1013,8 +1013,22 @@ choose_device(int devnum, DXDeviceInfo *pDevinfo) {
|
|||||||
wdxGraphicsPipe7 *dxpipe;
|
wdxGraphicsPipe7 *dxpipe;
|
||||||
DCAST_INTO_R(dxpipe, _pipe, false);
|
DCAST_INTO_R(dxpipe, _pipe, false);
|
||||||
|
|
||||||
DWORD dwRenderWidth = get_properties().get_x_size();
|
WindowProperties properties = get_properties();
|
||||||
DWORD dwRenderHeight = get_properties().get_y_size();
|
FrameBufferProperties fbprops = _dxgsg->get_properties();
|
||||||
|
|
||||||
|
int mode = fbprops.get_frame_buffer_mode();
|
||||||
|
bool hardware = ((mode & FrameBufferProperties::FM_hardware) != 0);
|
||||||
|
bool software = ((mode & FrameBufferProperties::FM_software) != 0);
|
||||||
|
|
||||||
|
// If the user specified neither hardware nor software frame buffer,
|
||||||
|
// he gets either one.
|
||||||
|
if (!hardware && !software) {
|
||||||
|
hardware = true;
|
||||||
|
software = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD dwRenderWidth = properties.get_x_size();
|
||||||
|
DWORD dwRenderHeight = properties.get_y_size();
|
||||||
LPDIRECTDRAW7 pDD=NULL;
|
LPDIRECTDRAW7 pDD=NULL;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
@ -1111,22 +1125,18 @@ choose_device(int devnum, DXDeviceInfo *pDevinfo) {
|
|||||||
WORD DeviceIdx;
|
WORD DeviceIdx;
|
||||||
|
|
||||||
// select TNL if present
|
// select TNL if present
|
||||||
if (d3ddevs[TNLHALIDX].dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) {
|
if (hardware && (d3ddevs[TNLHALIDX].dwDevCaps & D3DDEVCAPS_HWRASTERIZATION)) {
|
||||||
DeviceIdx = TNLHALIDX;
|
DeviceIdx = TNLHALIDX;
|
||||||
} else if (d3ddevs[REGHALIDX].dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) {
|
} else if (hardware && (d3ddevs[REGHALIDX].dwDevCaps & D3DDEVCAPS_HWRASTERIZATION)) {
|
||||||
DeviceIdx = REGHALIDX;
|
DeviceIdx = REGHALIDX;
|
||||||
} else if (dx_allow_software_renderer || dx_force_software_renderer) {
|
} else if (software) {
|
||||||
DeviceIdx = SWRASTIDX;
|
DeviceIdx = SWRASTIDX;
|
||||||
} else {
|
} else {
|
||||||
wdxdisplay7_cat.error()
|
wdxdisplay7_cat.error()
|
||||||
<< "No 3D HW present on device #" << devnum << ", skipping it... ("
|
<< "No 3D graphics present on device #" << devnum << ", skipping it... ("
|
||||||
<< _wcontext.DXDeviceID.szDescription<<")\n";
|
<< _wcontext.DXDeviceID.szDescription<<")\n";
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dx_force_software_renderer) {
|
|
||||||
DeviceIdx = SWRASTIDX;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&_wcontext.D3DDevDesc, &d3ddevs[DeviceIdx],
|
memcpy(&_wcontext.D3DDevDesc, &d3ddevs[DeviceIdx],
|
||||||
sizeof(D3DDEVICEDESC7));
|
sizeof(D3DDEVICEDESC7));
|
||||||
|
@ -37,11 +37,6 @@ NotifyCategoryDef(wdxdisplay8, "windisplay");
|
|||||||
ConfigVariableBool dx_show_transforms
|
ConfigVariableBool dx_show_transforms
|
||||||
("dx-show-transforms", false);
|
("dx-show-transforms", false);
|
||||||
|
|
||||||
// Configure this to TRUE if you want DirectX to control the entire screen,
|
|
||||||
// If false, it will just blit into a window.
|
|
||||||
ConfigVariableBool dx_full_screen
|
|
||||||
("dx-full-screen", false);
|
|
||||||
|
|
||||||
// Configure this true to force the rendering to sync to the video
|
// Configure this true to force the rendering to sync to the video
|
||||||
// refresh, or false to let your frame rate go as high as it can,
|
// refresh, or false to let your frame rate go as high as it can,
|
||||||
// irrespective of the video refresh.
|
// irrespective of the video refresh.
|
||||||
@ -52,12 +47,6 @@ ConfigVariableBool dx_sync_video
|
|||||||
ConfigVariableInt dx_multisample_antialiasing_level
|
ConfigVariableInt dx_multisample_antialiasing_level
|
||||||
("dx-multisample-antialiasing-level", 0);
|
("dx-multisample-antialiasing-level", 0);
|
||||||
|
|
||||||
// Configure this true to perform a cull traversal over the geometry
|
|
||||||
// by default, false otherwise. The cull traversal provides support
|
|
||||||
// for state-sorting, z-sorting, and binning.
|
|
||||||
ConfigVariableBool dx_cull_traversal
|
|
||||||
("dx-cull-traversal", true);
|
|
||||||
|
|
||||||
// if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
|
// if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
|
||||||
ConfigVariableBool dx_no_vertex_fog
|
ConfigVariableBool dx_no_vertex_fog
|
||||||
("dx-no-vertex-fog", false);
|
("dx-no-vertex-fog", false);
|
||||||
|
@ -29,9 +29,7 @@
|
|||||||
NotifyCategoryDecl(dxgsg8, EXPCL_PANDADX, EXPTP_PANDADX);
|
NotifyCategoryDecl(dxgsg8, EXPCL_PANDADX, EXPTP_PANDADX);
|
||||||
NotifyCategoryDecl(wdxdisplay8, EXPCL_PANDADX, EXPTP_PANDADX);
|
NotifyCategoryDecl(wdxdisplay8, EXPCL_PANDADX, EXPTP_PANDADX);
|
||||||
|
|
||||||
extern ConfigVariableBool dx_full_screen;
|
|
||||||
extern ConfigVariableBool dx_sync_video;
|
extern ConfigVariableBool dx_sync_video;
|
||||||
extern ConfigVariableBool dx_cull_traversal;
|
|
||||||
extern ConfigVariableBool dx_no_vertex_fog;
|
extern ConfigVariableBool dx_no_vertex_fog;
|
||||||
extern ConfigVariableBool dx_show_cursor_watermark;
|
extern ConfigVariableBool dx_show_cursor_watermark;
|
||||||
extern ConfigVariableBool dx_full_screen_antialiasing;
|
extern ConfigVariableBool dx_full_screen_antialiasing;
|
||||||
|
@ -74,10 +74,6 @@
|
|||||||
// for sprites, 1000 prims, 6 verts/prim, 24 bytes/vert
|
// for sprites, 1000 prims, 6 verts/prim, 24 bytes/vert
|
||||||
const int VERT_BUFFER_SIZE = (32*6*1024L);
|
const int VERT_BUFFER_SIZE = (32*6*1024L);
|
||||||
|
|
||||||
// if defined, pandadx only handles 1 panda display region
|
|
||||||
// note multiple region code doesnt work now (see prepare_display_region,set_clipper)
|
|
||||||
#define NO_MULTIPLE_DISPLAY_REGIONS
|
|
||||||
|
|
||||||
TypeHandle DXGraphicsStateGuardian8::_type_handle;
|
TypeHandle DXGraphicsStateGuardian8::_type_handle;
|
||||||
|
|
||||||
// bit masks used for drawing primitives
|
// bit masks used for drawing primitives
|
||||||
@ -576,34 +572,6 @@ dx_init(void) {
|
|||||||
void DXGraphicsStateGuardian8::
|
void DXGraphicsStateGuardian8::
|
||||||
support_overlay_window(bool flag) {
|
support_overlay_window(bool flag) {
|
||||||
// How is this supposed to be done in DX8?
|
// How is this supposed to be done in DX8?
|
||||||
//_bDXisReady = !flag;
|
|
||||||
//dxgsg8_cat.debug() << "Set DxReady to " << _bDXisReady << "\n";
|
|
||||||
/*
|
|
||||||
if (_overlay_windows_supported && !flag) {
|
|
||||||
// Disable support for overlay windows.
|
|
||||||
_overlay_windows_supported = false;
|
|
||||||
|
|
||||||
if (dx_full_screen) {
|
|
||||||
_pScrn->pddsPrimary->SetClipper(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (!_overlay_windows_supported && flag) {
|
|
||||||
// Enable support for overlay windows.
|
|
||||||
_overlay_windows_supported = true;
|
|
||||||
|
|
||||||
if (dx_full_screen) {
|
|
||||||
// Create a Clipper object to blt the whole screen.
|
|
||||||
LPDIRECTDRAWCLIPPER Clipper;
|
|
||||||
|
|
||||||
if (_pScrn->pDD->CreateClipper(0, &Clipper, NULL) == DD_OK) {
|
|
||||||
Clipper->SetHWnd(0, _pScrn->hWnd);
|
|
||||||
_pScrn->pddsPrimary->SetClipper(Clipper);
|
|
||||||
}
|
|
||||||
_pScrn->pDD->FlipToGDISurface();
|
|
||||||
Clipper->Release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -755,54 +723,6 @@ prepare_lens() {
|
|||||||
return SUCCEEDED(hr);
|
return SUCCEEDED(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_MULTIPLE_DISPLAY_REGIONS
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: set_clipper
|
|
||||||
// Access:
|
|
||||||
// Description: Useless in DX at the present time
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DXGraphicsStateGuardian8::set_clipper(RECT cliprect) {
|
|
||||||
|
|
||||||
LPDIRECTDRAWCLIPPER Clipper;
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
// For windowed mode, the clip region is associated with the window,
|
|
||||||
// and DirectX does not allow you to create clip regions.
|
|
||||||
if (dx_full_screen) return;
|
|
||||||
|
|
||||||
/* The cliprect we receive is normalized so that (0,0) means the upper left of
|
|
||||||
the client portion of the window.
|
|
||||||
At least, I think that's true, and the following code assumes that.
|
|
||||||
So we must adjust the clip region by offsetting it to the origin of the
|
|
||||||
view rectangle.
|
|
||||||
*/
|
|
||||||
clip_rect = cliprect; // store the normalized clip rect
|
|
||||||
cliprect.left += _view_rect.left;
|
|
||||||
cliprect.right += _view_rect.left;
|
|
||||||
cliprect.top += _view_rect.top;
|
|
||||||
cliprect.bottom += _view_rect.top;
|
|
||||||
RGNDATA *rgn_data = (RGNDATA *)malloc(sizeof(RGNDATAHEADER) + sizeof(RECT));
|
|
||||||
HRGN hrgn = CreateRectRgn(cliprect.left, cliprect.top, cliprect.right, cliprect.bottom);
|
|
||||||
GetRegionData(hrgn, sizeof(RGNDATAHEADER) + sizeof(RECT), rgn_data);
|
|
||||||
|
|
||||||
if (_pD3DDevicesPrimary->GetClipper(&Clipper) != DD_OK) {
|
|
||||||
result = _pD3DDevice->CreateClipper(0, &Clipper, NULL);
|
|
||||||
result = Clipper->SetClipList(rgn_data, 0);
|
|
||||||
result = _pD3DDevicesPrimary->SetClipper(Clipper);
|
|
||||||
} else {
|
|
||||||
result = Clipper->SetClipList(rgn_data, 0 );
|
|
||||||
if (result == DDERR_CLIPPERISUSINGHWND) {
|
|
||||||
result = _pD3DDevicesPrimary->SetClipper(NULL);
|
|
||||||
result = _pD3DDevice->CreateClipper(0, &Clipper, NULL);
|
|
||||||
result = Clipper->SetClipList(rgn_data, 0 ) ;
|
|
||||||
result = _pD3DDevicesPrimary->SetClipper(Clipper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(rgn_data);
|
|
||||||
DeleteObject(hrgn);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian8::get_blend_func
|
// Function: DXGraphicsStateGuardian8::get_blend_func
|
||||||
// Access: Protected, Static
|
// Access: Protected, Static
|
||||||
@ -3774,20 +3694,6 @@ end_frame() {
|
|||||||
GraphicsStateGuardian::end_frame();
|
GraphicsStateGuardian::end_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian8::depth_offset_decals
|
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description: Returns true if this GSG can implement decals using a
|
|
||||||
// DepthOffsetAttrib, or false if that is unreliable
|
|
||||||
// and the three-step rendering process should be used
|
|
||||||
// instead.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DXGraphicsStateGuardian8::
|
|
||||||
depth_offset_decals() {
|
|
||||||
// False for now.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian8::set_draw_buffer
|
// Function: DXGraphicsStateGuardian8::set_draw_buffer
|
||||||
// Access: Protected
|
// Access: Protected
|
||||||
@ -4391,13 +4297,11 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *pPresParams, DXScreenData **pScrn) {
|
|||||||
|
|
||||||
ReleaseAllDeviceObjects();
|
ReleaseAllDeviceObjects();
|
||||||
|
|
||||||
if(!dx_full_screen) {
|
// for windowed mode make sure our format matches the desktop fmt,
|
||||||
// for windowed make sure out format matches the desktop fmt, in case the
|
// in case the desktop mode has been changed
|
||||||
// desktop mode has been changed
|
_pScrn->pD3D8->GetAdapterDisplayMode(_pScrn->CardIDNum, &_pScrn->DisplayMode);
|
||||||
|
pPresParams->BackBufferFormat = _pScrn->DisplayMode.Format;
|
||||||
|
|
||||||
_pScrn->pD3D8->GetAdapterDisplayMode(_pScrn->CardIDNum, &_pScrn->DisplayMode);
|
|
||||||
pPresParams->BackBufferFormat = _pScrn->DisplayMode.Format;
|
|
||||||
}
|
|
||||||
// here we have to look at the _PresReset frame buffer dimension
|
// here we have to look at the _PresReset frame buffer dimension
|
||||||
// if current window's dimension is bigger than _PresReset
|
// if current window's dimension is bigger than _PresReset
|
||||||
// we have to reset the device before creating new swapchain.
|
// we have to reset the device before creating new swapchain.
|
||||||
@ -4510,145 +4414,6 @@ CheckCooperativeLevel(bool bDoReactivateWindow) {
|
|||||||
return SUCCEEDED(hr);
|
return SUCCEEDED(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: adjust_view_rect
|
|
||||||
// Access:
|
|
||||||
// Description: we receive the new x and y position of the client
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DXGraphicsStateGuardian8::adjust_view_rect(int x, int y) {
|
|
||||||
if (_pScrn->view_rect.left != x || _pScrn->view_rect.top != y) {
|
|
||||||
|
|
||||||
_pScrn->view_rect.right = x + RECT_XSIZE(_pScrn->view_rect);
|
|
||||||
_pScrn->view_rect.left = x;
|
|
||||||
_pScrn->view_rect.bottom = y + RECT_YSIZE(_pScrn->view_rect);
|
|
||||||
_pScrn->view_rect.top = y;
|
|
||||||
|
|
||||||
// set_clipper(clip_rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: GLGraphicsStateGuardian::save_mipmap_images
|
|
||||||
// Access: Protected
|
|
||||||
// Description: Saves out each mipmap level of the indicated texture
|
|
||||||
// (which must also be the currently active texture in
|
|
||||||
// the GL state) as a separate image file to disk.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DXGraphicsStateGuardian8::read_mipmap_images(Texture *tex) {
|
|
||||||
Filename filename = tex->get_name();
|
|
||||||
string name;
|
|
||||||
if (filename.empty()) {
|
|
||||||
static index = 0;
|
|
||||||
name = "texture" + format_string(index);
|
|
||||||
index++;
|
|
||||||
} else {
|
|
||||||
name = filename.get_basename_wo_extension();
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelBuffer *pb = tex->get_ram_image();
|
|
||||||
nassertv(pb != (PixelBuffer *)NULL);
|
|
||||||
|
|
||||||
GLenum external_format = get_external_image_format(pb->get_format());
|
|
||||||
GLenum type = get_image_type(pb->get_image_type());
|
|
||||||
|
|
||||||
int xsize = pb->get_xsize();
|
|
||||||
int ysize = pb->get_ysize();
|
|
||||||
|
|
||||||
// Specify byte-alignment for the pixels on output.
|
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
|
||||||
|
|
||||||
int mipmap_level = 0;
|
|
||||||
do {
|
|
||||||
xsize = max(xsize, 1);
|
|
||||||
ysize = max(ysize, 1);
|
|
||||||
|
|
||||||
PT(PixelBuffer) mpb =
|
|
||||||
new PixelBuffer(xsize, ysize, pb->get_num_components(),
|
|
||||||
pb->get_component_width(), pb->get_image_type(),
|
|
||||||
pb->get_format());
|
|
||||||
glGetTexImage(GL_TEXTURE_2D, mipmap_level, external_format,
|
|
||||||
type, mpb->_image);
|
|
||||||
Filename mipmap_filename = name + "_" + format_string(mipmap_level) + ".pnm";
|
|
||||||
nout << "Writing mipmap level " << mipmap_level
|
|
||||||
<< " (" << xsize << " by " << ysize << ") "
|
|
||||||
<< mipmap_filename << "\n";
|
|
||||||
mpb->write(mipmap_filename);
|
|
||||||
|
|
||||||
xsize >>= 1;
|
|
||||||
ysize >>= 1;
|
|
||||||
mipmap_level++;
|
|
||||||
} while (xsize > 0 && ysize > 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Name: SetViewMatrix()
|
|
||||||
// Desc: Given an eye point, a lookat point, and an up vector, this
|
|
||||||
// function builds a 4x4 view matrix.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
HRESULT SetViewMatrix( D3DMATRIX& mat, D3DXVECTOR3& vFrom, D3DXVECTOR3& vAt,
|
|
||||||
D3DXVECTOR3& vWorldUp ) {
|
|
||||||
// Get the z basis vector, which points straight ahead. This is the
|
|
||||||
// difference from the eyepoint to the lookat point.
|
|
||||||
D3DXVECTOR3 vView = vAt - vFrom;
|
|
||||||
|
|
||||||
float fLength = Magnitude( vView );
|
|
||||||
if (fLength < 1e-6f)
|
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
// Normalize the z basis vector
|
|
||||||
vView /= fLength;
|
|
||||||
|
|
||||||
// Get the dot product, and calculate the projection of the z basis
|
|
||||||
// vector onto the up vector. The projection is the y basis vector.
|
|
||||||
float fDotProduct = DotProduct( vWorldUp, vView );
|
|
||||||
|
|
||||||
D3DXVECTOR3 vUp = vWorldUp - fDotProduct * vView;
|
|
||||||
|
|
||||||
// If this vector has near-zero length because the input specified a
|
|
||||||
// bogus up vector, let's try a default up vector
|
|
||||||
if (1e-6f > ( fLength = Magnitude( vUp ) )) {
|
|
||||||
vUp = D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) - vView.y * vView;
|
|
||||||
|
|
||||||
// If we still have near-zero length, resort to a different axis.
|
|
||||||
if (1e-6f > ( fLength = Magnitude( vUp ) )) {
|
|
||||||
vUp = D3DXVECTOR3( 0.0f, 0.0f, 1.0f ) - vView.z * vView;
|
|
||||||
|
|
||||||
if (1e-6f > ( fLength = Magnitude( vUp ) ))
|
|
||||||
return E_INVALIDARG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize the y basis vector
|
|
||||||
vUp /= fLength;
|
|
||||||
|
|
||||||
// The x basis vector is found simply with the cross product of the y
|
|
||||||
// and z basis vectors
|
|
||||||
D3DXVECTOR3 vRight = CrossProduct( vUp, vView );
|
|
||||||
|
|
||||||
// Start building the matrix. The first three rows contains the basis
|
|
||||||
// vectors used to rotate the view to point at the lookat point
|
|
||||||
mat._11 = vRight.x; mat._12 = vUp.x; mat._13 = vView.x; mat._14 = 0.0f;
|
|
||||||
mat._21 = vRight.y; mat._22 = vUp.y; mat._23 = vView.y; mat._24 = 0.0f;
|
|
||||||
mat._31 = vRight.z; mat._32 = vUp.z; mat._33 = vView.z; mat._34 = 0.0f;
|
|
||||||
|
|
||||||
// Do the translation values (rotations are still about the eyepoint)
|
|
||||||
mat._41 = - DotProduct( vFrom, vRight );
|
|
||||||
mat._42 = - DotProduct( vFrom, vUp );
|
|
||||||
mat._43 = - DotProduct( vFrom, vView );
|
|
||||||
mat._44 = 1.0f;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HRESULT CreateDX8Cursor(LPDIRECT3DDEVICE8 pd3dDevice, HCURSOR hCursor,BOOL bAddWatermark) {
|
HRESULT CreateDX8Cursor(LPDIRECT3DDEVICE8 pd3dDevice, HCURSOR hCursor,BOOL bAddWatermark) {
|
||||||
// copied directly from dxsdk SetDeviceCursor
|
// copied directly from dxsdk SetDeviceCursor
|
||||||
HRESULT hr = E_FAIL;
|
HRESULT hr = E_FAIL;
|
||||||
|
@ -135,8 +135,6 @@ public:
|
|||||||
|
|
||||||
virtual bool wants_texcoords(void) const;
|
virtual bool wants_texcoords(void) const;
|
||||||
|
|
||||||
virtual bool depth_offset_decals();
|
|
||||||
|
|
||||||
INLINE float compute_distance_to(const LPoint3f &point) const;
|
INLINE float compute_distance_to(const LPoint3f &point) const;
|
||||||
virtual void set_color_clear_value(const Colorf& value);
|
virtual void set_color_clear_value(const Colorf& value);
|
||||||
|
|
||||||
|
@ -37,11 +37,6 @@ NotifyCategoryDef(wdxdisplay9, "windisplay");
|
|||||||
ConfigVariableBool dx_show_transforms
|
ConfigVariableBool dx_show_transforms
|
||||||
("dx-show-transforms", false);
|
("dx-show-transforms", false);
|
||||||
|
|
||||||
// Configure this to TRUE if you want DirectX to control the entire screen,
|
|
||||||
// If false, it will just blit into a window.
|
|
||||||
ConfigVariableBool dx_full_screen
|
|
||||||
("dx-full-screen", false);
|
|
||||||
|
|
||||||
// Configure this true to force the rendering to sync to the video
|
// Configure this true to force the rendering to sync to the video
|
||||||
// refresh, or false to let your frame rate go as high as it can,
|
// refresh, or false to let your frame rate go as high as it can,
|
||||||
// irrespective of the video refresh.
|
// irrespective of the video refresh.
|
||||||
@ -52,12 +47,6 @@ ConfigVariableBool dx_sync_video
|
|||||||
ConfigVariableInt dx_multisample_antialiasing_level
|
ConfigVariableInt dx_multisample_antialiasing_level
|
||||||
("dx-multisample-antialiasing-level", 0);
|
("dx-multisample-antialiasing-level", 0);
|
||||||
|
|
||||||
// Configure this true to perform a cull traversal over the geometry
|
|
||||||
// by default, false otherwise. The cull traversal provides support
|
|
||||||
// for state-sorting, z-sorting, and binning.
|
|
||||||
ConfigVariableBool dx_cull_traversal
|
|
||||||
("dx-cull-traversal", true);
|
|
||||||
|
|
||||||
// if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
|
// if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
|
||||||
ConfigVariableBool dx_no_vertex_fog
|
ConfigVariableBool dx_no_vertex_fog
|
||||||
("dx-no-vertex-fog", false);
|
("dx-no-vertex-fog", false);
|
||||||
|
@ -29,9 +29,7 @@
|
|||||||
NotifyCategoryDecl(dxgsg9, EXPCL_PANDADX, EXPTP_PANDADX);
|
NotifyCategoryDecl(dxgsg9, EXPCL_PANDADX, EXPTP_PANDADX);
|
||||||
NotifyCategoryDecl(wdxdisplay9, EXPCL_PANDADX, EXPTP_PANDADX);
|
NotifyCategoryDecl(wdxdisplay9, EXPCL_PANDADX, EXPTP_PANDADX);
|
||||||
|
|
||||||
extern ConfigVariableBool dx_full_screen;
|
|
||||||
extern ConfigVariableBool dx_sync_video;
|
extern ConfigVariableBool dx_sync_video;
|
||||||
extern ConfigVariableBool dx_cull_traversal;
|
|
||||||
extern ConfigVariableBool dx_no_vertex_fog;
|
extern ConfigVariableBool dx_no_vertex_fog;
|
||||||
extern ConfigVariableBool dx_show_cursor_watermark;
|
extern ConfigVariableBool dx_show_cursor_watermark;
|
||||||
extern ConfigVariableBool dx_full_screen_antialiasing;
|
extern ConfigVariableBool dx_full_screen_antialiasing;
|
||||||
|
@ -73,10 +73,6 @@
|
|||||||
// for sprites, 1000 prims, 6 verts/prim, 24 bytes/vert
|
// for sprites, 1000 prims, 6 verts/prim, 24 bytes/vert
|
||||||
const int VERT_BUFFER_SIZE = (32*6*1024L);
|
const int VERT_BUFFER_SIZE = (32*6*1024L);
|
||||||
|
|
||||||
// if defined, pandadx only handles 1 panda display region
|
|
||||||
// note multiple region code doesnt work now (see prepare_display_region,set_clipper)
|
|
||||||
#define NO_MULTIPLE_DISPLAY_REGIONS
|
|
||||||
|
|
||||||
TypeHandle DXGraphicsStateGuardian9::_type_handle;
|
TypeHandle DXGraphicsStateGuardian9::_type_handle;
|
||||||
|
|
||||||
// bit masks used for drawing primitives
|
// bit masks used for drawing primitives
|
||||||
@ -574,33 +570,6 @@ dx_init(void) {
|
|||||||
void DXGraphicsStateGuardian9::
|
void DXGraphicsStateGuardian9::
|
||||||
support_overlay_window(bool flag) {
|
support_overlay_window(bool flag) {
|
||||||
// How is this supposed to be done in DX9?
|
// How is this supposed to be done in DX9?
|
||||||
|
|
||||||
/*
|
|
||||||
if (_overlay_windows_supported && !flag) {
|
|
||||||
// Disable support for overlay windows.
|
|
||||||
_overlay_windows_supported = false;
|
|
||||||
|
|
||||||
if (dx_full_screen) {
|
|
||||||
_pD3DDevicesPrimary->SetClipper(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (!_overlay_windows_supported && flag) {
|
|
||||||
// Enable support for overlay windows.
|
|
||||||
_overlay_windows_supported = true;
|
|
||||||
|
|
||||||
if (dx_full_screen) {
|
|
||||||
// Create a Clipper object to blt the whole screen.
|
|
||||||
LPDIRECTDRAWCLIPPER Clipper;
|
|
||||||
|
|
||||||
if (_pScrn->pDD->CreateClipper(0, &Clipper, NULL) == DD_OK) {
|
|
||||||
Clipper->SetHWnd(0, _pScrn->hWnd);
|
|
||||||
_pScrn->pddsPrimary->SetClipper(Clipper);
|
|
||||||
}
|
|
||||||
_pScrn->pDD->FlipToGDISurface();
|
|
||||||
Clipper->Release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -732,54 +701,6 @@ prepare_lens() {
|
|||||||
return SUCCEEDED(hr);
|
return SUCCEEDED(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_MULTIPLE_DISPLAY_REGIONS
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: set_clipper
|
|
||||||
// Access:
|
|
||||||
// Description: Useless in DX at the present time
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DXGraphicsStateGuardian9::set_clipper(RECT cliprect) {
|
|
||||||
|
|
||||||
LPDIRECTDRAWCLIPPER Clipper;
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
// For windowed mode, the clip region is associated with the window,
|
|
||||||
// and DirectX does not allow you to create clip regions.
|
|
||||||
if (dx_full_screen) return;
|
|
||||||
|
|
||||||
/* The cliprect we receive is normalized so that (0,0) means the upper left of
|
|
||||||
the client portion of the window.
|
|
||||||
At least, I think that's true, and the following code assumes that.
|
|
||||||
So we must adjust the clip region by offsetting it to the origin of the
|
|
||||||
view rectangle.
|
|
||||||
*/
|
|
||||||
clip_rect = cliprect; // store the normalized clip rect
|
|
||||||
cliprect.left += _view_rect.left;
|
|
||||||
cliprect.right += _view_rect.left;
|
|
||||||
cliprect.top += _view_rect.top;
|
|
||||||
cliprect.bottom += _view_rect.top;
|
|
||||||
RGNDATA *rgn_data = (RGNDATA *)malloc(sizeof(RGNDATAHEADER) + sizeof(RECT));
|
|
||||||
HRGN hrgn = CreateRectRgn(cliprect.left, cliprect.top, cliprect.right, cliprect.bottom);
|
|
||||||
GetRegionData(hrgn, sizeof(RGNDATAHEADER) + sizeof(RECT), rgn_data);
|
|
||||||
|
|
||||||
if (_pD3DDevicesPrimary->GetClipper(&Clipper) != DD_OK) {
|
|
||||||
result = _pD3DDevice->CreateClipper(0, &Clipper, NULL);
|
|
||||||
result = Clipper->SetClipList(rgn_data, 0);
|
|
||||||
result = _pD3DDevicesPrimary->SetClipper(Clipper);
|
|
||||||
} else {
|
|
||||||
result = Clipper->SetClipList(rgn_data, 0 );
|
|
||||||
if (result == DDERR_CLIPPERISUSINGHWND) {
|
|
||||||
result = _pD3DDevicesPrimary->SetClipper(NULL);
|
|
||||||
result = _pD3DDevice->CreateClipper(0, &Clipper, NULL);
|
|
||||||
result = Clipper->SetClipList(rgn_data, 0 ) ;
|
|
||||||
result = _pD3DDevicesPrimary->SetClipper(Clipper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(rgn_data);
|
|
||||||
DeleteObject(hrgn);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::get_blend_func
|
// Function: DXGraphicsStateGuardian9::get_blend_func
|
||||||
// Access: Protected, Static
|
// Access: Protected, Static
|
||||||
@ -3761,20 +3682,6 @@ end_frame() {
|
|||||||
GraphicsStateGuardian::end_frame();
|
GraphicsStateGuardian::end_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DXGraphicsStateGuardian9::depth_offset_decals
|
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description: Returns true if this GSG can implement decals using a
|
|
||||||
// DepthOffsetAttrib, or false if that is unreliable
|
|
||||||
// and the three-step rendering process should be used
|
|
||||||
// instead.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DXGraphicsStateGuardian9::
|
|
||||||
depth_offset_decals() {
|
|
||||||
// False for now.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DXGraphicsStateGuardian9::set_draw_buffer
|
// Function: DXGraphicsStateGuardian9::set_draw_buffer
|
||||||
// Access: Protected
|
// Access: Protected
|
||||||
@ -4380,13 +4287,12 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *pPresParams, DXScreenData **pScrn) {
|
|||||||
|
|
||||||
ReleaseAllDeviceObjects();
|
ReleaseAllDeviceObjects();
|
||||||
|
|
||||||
if(!dx_full_screen) {
|
// for windowed mode make sure our format matches the desktop fmt,
|
||||||
// for windowed make sure out format matches the desktop fmt, in case the
|
// in case the desktop mode has been changed
|
||||||
// desktop mode has been changed
|
|
||||||
|
_pScrn->pD3D9->GetAdapterDisplayMode(_pScrn->CardIDNum, &_pScrn->DisplayMode);
|
||||||
|
pPresParams->BackBufferFormat = _pScrn->DisplayMode.Format;
|
||||||
|
|
||||||
_pScrn->pD3D9->GetAdapterDisplayMode(_pScrn->CardIDNum, &_pScrn->DisplayMode);
|
|
||||||
pPresParams->BackBufferFormat = _pScrn->DisplayMode.Format;
|
|
||||||
}
|
|
||||||
// here we have to look at the _PresReset frame buffer dimension
|
// here we have to look at the _PresReset frame buffer dimension
|
||||||
// if current window's dimension is bigger than _PresReset
|
// if current window's dimension is bigger than _PresReset
|
||||||
// we have to reset the device before creating new swapchain.
|
// we have to reset the device before creating new swapchain.
|
||||||
@ -4499,146 +4405,6 @@ CheckCooperativeLevel(bool bDoReactivateWindow) {
|
|||||||
return SUCCEEDED(hr);
|
return SUCCEEDED(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: adjust_view_rect
|
|
||||||
// Access:
|
|
||||||
// Description: we receive the new x and y position of the client
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DXGraphicsStateGuardian9::adjust_view_rect(int x, int y) {
|
|
||||||
if (_pScrn->view_rect.left != x || _pScrn->view_rect.top != y) {
|
|
||||||
|
|
||||||
_pScrn->view_rect.right = x + RECT_XSIZE(_pScrn->view_rect);
|
|
||||||
_pScrn->view_rect.left = x;
|
|
||||||
_pScrn->view_rect.bottom = y + RECT_YSIZE(_pScrn->view_rect);
|
|
||||||
_pScrn->view_rect.top = y;
|
|
||||||
|
|
||||||
// set_clipper(clip_rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: GLGraphicsStateGuardian::save_mipmap_images
|
|
||||||
// Access: Protected
|
|
||||||
// Description: Saves out each mipmap level of the indicated texture
|
|
||||||
// (which must also be the currently active texture in
|
|
||||||
// the GL state) as a separate image file to disk.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DXGraphicsStateGuardian9::read_mipmap_images(Texture *tex) {
|
|
||||||
Filename filename = tex->get_name();
|
|
||||||
string name;
|
|
||||||
if (filename.empty()) {
|
|
||||||
static index = 0;
|
|
||||||
name = "texture" + format_string(index);
|
|
||||||
index++;
|
|
||||||
} else {
|
|
||||||
name = filename.get_basename_wo_extension();
|
|
||||||
}
|
|
||||||
|
|
||||||
PixelBuffer *pb = tex->get_ram_image();
|
|
||||||
nassertv(pb != (PixelBuffer *)NULL);
|
|
||||||
|
|
||||||
GLenum external_format = get_external_image_format(pb->get_format());
|
|
||||||
GLenum type = get_image_type(pb->get_image_type());
|
|
||||||
|
|
||||||
int xsize = pb->get_xsize();
|
|
||||||
int ysize = pb->get_ysize();
|
|
||||||
|
|
||||||
// Specify byte-alignment for the pixels on output.
|
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
|
||||||
|
|
||||||
int mipmap_level = 0;
|
|
||||||
do {
|
|
||||||
xsize = max(xsize, 1);
|
|
||||||
ysize = max(ysize, 1);
|
|
||||||
|
|
||||||
PT(PixelBuffer) mpb =
|
|
||||||
new PixelBuffer(xsize, ysize, pb->get_num_components(),
|
|
||||||
pb->get_component_width(), pb->get_image_type(),
|
|
||||||
pb->get_format());
|
|
||||||
glGetTexImage(GL_TEXTURE_2D, mipmap_level, external_format,
|
|
||||||
type, mpb->_image);
|
|
||||||
Filename mipmap_filename = name + "_" + format_string(mipmap_level) + ".pnm";
|
|
||||||
nout << "Writing mipmap level " << mipmap_level
|
|
||||||
<< " (" << xsize << " by " << ysize << ") "
|
|
||||||
<< mipmap_filename << "\n";
|
|
||||||
mpb->write(mipmap_filename);
|
|
||||||
|
|
||||||
xsize >>= 1;
|
|
||||||
ysize >>= 1;
|
|
||||||
mipmap_level++;
|
|
||||||
} while (xsize > 0 && ysize > 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Name: SetViewMatrix()
|
|
||||||
// Desc: Given an eye point, a lookat point, and an up vector, this
|
|
||||||
// function builds a 4x4 view matrix.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
HRESULT SetViewMatrix( D3DMATRIX& mat, D3DXVECTOR3& vFrom, D3DXVECTOR3& vAt,
|
|
||||||
D3DXVECTOR3& vWorldUp ) {
|
|
||||||
// Get the z basis vector, which points straight ahead. This is the
|
|
||||||
// difference from the eyepoint to the lookat point.
|
|
||||||
D3DXVECTOR3 vView = vAt - vFrom;
|
|
||||||
|
|
||||||
float fLength = Magnitude( vView );
|
|
||||||
if (fLength < 1e-6f)
|
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
// Normalize the z basis vector
|
|
||||||
vView /= fLength;
|
|
||||||
|
|
||||||
// Get the dot product, and calculate the projection of the z basis
|
|
||||||
// vector onto the up vector. The projection is the y basis vector.
|
|
||||||
float fDotProduct = DotProduct( vWorldUp, vView );
|
|
||||||
|
|
||||||
D3DXVECTOR3 vUp = vWorldUp - fDotProduct * vView;
|
|
||||||
|
|
||||||
// If this vector has near-zero length because the input specified a
|
|
||||||
// bogus up vector, let's try a default up vector
|
|
||||||
if (1e-6f > ( fLength = Magnitude( vUp ) )) {
|
|
||||||
vUp = D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) - vView.y * vView;
|
|
||||||
|
|
||||||
// If we still have near-zero length, resort to a different axis.
|
|
||||||
if (1e-6f > ( fLength = Magnitude( vUp ) )) {
|
|
||||||
vUp = D3DXVECTOR3( 0.0f, 0.0f, 1.0f ) - vView.z * vView;
|
|
||||||
|
|
||||||
if (1e-6f > ( fLength = Magnitude( vUp ) ))
|
|
||||||
return E_INVALIDARG;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize the y basis vector
|
|
||||||
vUp /= fLength;
|
|
||||||
|
|
||||||
// The x basis vector is found simply with the cross product of the y
|
|
||||||
// and z basis vectors
|
|
||||||
D3DXVECTOR3 vRight = CrossProduct( vUp, vView );
|
|
||||||
|
|
||||||
// Start building the matrix. The first three rows contains the basis
|
|
||||||
// vectors used to rotate the view to point at the lookat point
|
|
||||||
mat._11 = vRight.x; mat._12 = vUp.x; mat._13 = vView.x; mat._14 = 0.0f;
|
|
||||||
mat._21 = vRight.y; mat._22 = vUp.y; mat._23 = vView.y; mat._24 = 0.0f;
|
|
||||||
mat._31 = vRight.z; mat._32 = vUp.z; mat._33 = vView.z; mat._34 = 0.0f;
|
|
||||||
|
|
||||||
// Do the translation values (rotations are still about the eyepoint)
|
|
||||||
mat._41 = - DotProduct( vFrom, vRight );
|
|
||||||
mat._42 = - DotProduct( vFrom, vUp );
|
|
||||||
mat._43 = - DotProduct( vFrom, vView );
|
|
||||||
mat._44 = 1.0f;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT CreateDX9Cursor(LPDIRECT3DDEVICE9 pd3dDevice, HCURSOR hCursor,BOOL bAddWatermark) {
|
HRESULT CreateDX9Cursor(LPDIRECT3DDEVICE9 pd3dDevice, HCURSOR hCursor,BOOL bAddWatermark) {
|
||||||
// copied directly from dxsdk SetDeviceCursor
|
// copied directly from dxsdk SetDeviceCursor
|
||||||
HRESULT hr = E_FAIL;
|
HRESULT hr = E_FAIL;
|
||||||
|
@ -136,8 +136,6 @@ public:
|
|||||||
|
|
||||||
virtual bool wants_texcoords(void) const;
|
virtual bool wants_texcoords(void) const;
|
||||||
|
|
||||||
virtual bool depth_offset_decals();
|
|
||||||
|
|
||||||
INLINE float compute_distance_to(const LPoint3f &point) const;
|
INLINE float compute_distance_to(const LPoint3f &point) const;
|
||||||
virtual void set_color_clear_value(const Colorf& value);
|
virtual void set_color_clear_value(const Colorf& value);
|
||||||
|
|
||||||
|
@ -414,19 +414,14 @@ reset() {
|
|||||||
|
|
||||||
report_my_gl_errors();
|
report_my_gl_errors();
|
||||||
|
|
||||||
_buffer_mask = 0;
|
// All GL implementations have the following buffers.
|
||||||
|
|
||||||
// All GL implementations have the following buffers. (?)
|
|
||||||
_buffer_mask = (RenderBuffer::T_color |
|
_buffer_mask = (RenderBuffer::T_color |
|
||||||
RenderBuffer::T_depth |
|
RenderBuffer::T_depth |
|
||||||
RenderBuffer::T_stencil |
|
RenderBuffer::T_stencil |
|
||||||
RenderBuffer::T_accum);
|
RenderBuffer::T_accum);
|
||||||
|
|
||||||
// Check to see if we have double-buffering.
|
// If we don't have double-buffering, don't attempt to write to the
|
||||||
|
// back buffer.
|
||||||
// This isn't completely right. Instead of just clearing this bit
|
|
||||||
// and disallowing writes to T_back, we need to set T_front on
|
|
||||||
// operations that might have had T_back set otherwise.
|
|
||||||
GLboolean has_back;
|
GLboolean has_back;
|
||||||
GLP(GetBooleanv)(GL_DOUBLEBUFFER, &has_back);
|
GLP(GetBooleanv)(GL_DOUBLEBUFFER, &has_back);
|
||||||
if (!has_back) {
|
if (!has_back) {
|
||||||
@ -2831,19 +2826,6 @@ wants_texcoords() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: CLP(GraphicsStateGuardian)::depth_offset_decals
|
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description: Returns true if this GSG can implement decals using a
|
|
||||||
// DepthOffsetAttrib, or false if that is unreliable
|
|
||||||
// and the three-step rendering process should be used
|
|
||||||
// instead.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool CLP(GraphicsStateGuardian)::
|
|
||||||
depth_offset_decals() {
|
|
||||||
return CLP(depth_offset_decals);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CLP(GraphicsStateGuardian)::compute_distance_to
|
// Function: CLP(GraphicsStateGuardian)::compute_distance_to
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -132,8 +132,6 @@ public:
|
|||||||
|
|
||||||
virtual bool wants_texcoords(void) const;
|
virtual bool wants_texcoords(void) const;
|
||||||
|
|
||||||
virtual bool depth_offset_decals();
|
|
||||||
|
|
||||||
virtual float compute_distance_to(const LPoint3f &point) const;
|
virtual float compute_distance_to(const LPoint3f &point) const;
|
||||||
|
|
||||||
void print_gfx_visual();
|
void print_gfx_visual();
|
||||||
|
@ -52,11 +52,6 @@ bool CLP(save_mipmaps) = CONFIGOBJ.GetBool("gl-save-mipmaps", false);
|
|||||||
// variable.
|
// variable.
|
||||||
bool CLP(auto_normalize_lighting) = CONFIGOBJ.GetBool("auto-normalize-lighting", true);
|
bool CLP(auto_normalize_lighting) = CONFIGOBJ.GetBool("auto-normalize-lighting", true);
|
||||||
|
|
||||||
// Configure this true to try to implement decals using a
|
|
||||||
// DepthOffsetAttrib, false to do them with the more reliable 3-pass
|
|
||||||
// rendering method instead.
|
|
||||||
bool CLP(depth_offset_decals) = CONFIGOBJ.GetBool("depth-offset-decals", false);
|
|
||||||
|
|
||||||
// Configure this false if your GL's implementation of GLP(ColorMask)()
|
// Configure this false if your GL's implementation of GLP(ColorMask)()
|
||||||
// is broken (some are). This will force the use of a (presumably)
|
// is broken (some are). This will force the use of a (presumably)
|
||||||
// more expensive blending operation instead.
|
// more expensive blending operation instead.
|
||||||
|
@ -28,7 +28,6 @@ extern bool CLP(force_mipmaps);
|
|||||||
extern bool CLP(show_mipmaps);
|
extern bool CLP(show_mipmaps);
|
||||||
extern bool CLP(save_mipmaps);
|
extern bool CLP(save_mipmaps);
|
||||||
extern bool CLP(auto_normalize_lighting);
|
extern bool CLP(auto_normalize_lighting);
|
||||||
extern bool CLP(depth_offset_decals);
|
|
||||||
extern bool CLP(color_mask);
|
extern bool CLP(color_mask);
|
||||||
|
|
||||||
extern EXPCL_GL void CLP(init_classes)();
|
extern EXPCL_GL void CLP(init_classes)();
|
||||||
|
@ -100,15 +100,10 @@ make_gsg(const FrameBufferProperties &properties,
|
|||||||
DCAST_INTO_R(share_gsg, share_with, NULL);
|
DCAST_INTO_R(share_gsg, share_with, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make a copy of the supplied properties so we can possibly modify
|
|
||||||
// them to suit our available properties.
|
|
||||||
FrameBufferProperties new_properties = properties;
|
|
||||||
|
|
||||||
// We need a DC to examine the available pixel formats. We'll use
|
// We need a DC to examine the available pixel formats. We'll use
|
||||||
// the screen DC.
|
// the screen DC.
|
||||||
HDC hdc = GetDC(NULL);
|
HDC hdc = GetDC(NULL);
|
||||||
int pfnum = choose_pfnum(new_properties, hdc);
|
int pfnum = choose_pfnum(properties, hdc);
|
||||||
ReleaseDC(NULL, hdc);
|
|
||||||
|
|
||||||
if (gl_force_pixfmt != 0) {
|
if (gl_force_pixfmt != 0) {
|
||||||
wgldisplay_cat.info()
|
wgldisplay_cat.info()
|
||||||
@ -117,13 +112,18 @@ make_gsg(const FrameBufferProperties &properties,
|
|||||||
pfnum = gl_force_pixfmt;
|
pfnum = gl_force_pixfmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FrameBufferProperties new_properties;
|
||||||
|
get_properties(new_properties, hdc, pfnum);
|
||||||
|
ReleaseDC(NULL, hdc);
|
||||||
|
|
||||||
if (wgldisplay_cat.is_debug()) {
|
if (wgldisplay_cat.is_debug()) {
|
||||||
wgldisplay_cat.debug()
|
wgldisplay_cat.debug()
|
||||||
<< "config() - picking pixfmt #" << pfnum <<endl;
|
<< "Picking pixfmt #" << pfnum << " = "
|
||||||
|
<< new_properties << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
PT(wglGraphicsStateGuardian) gsg =
|
PT(wglGraphicsStateGuardian) gsg =
|
||||||
new wglGraphicsStateGuardian(properties, share_gsg, pfnum);
|
new wglGraphicsStateGuardian(new_properties, share_gsg, pfnum);
|
||||||
|
|
||||||
// Ideally, we should be able to detect whether the share_gsg will
|
// Ideally, we should be able to detect whether the share_gsg will
|
||||||
// be successful, and return NULL if it won't work. But we can't do
|
// be successful, and return NULL if it won't work. But we can't do
|
||||||
@ -167,22 +167,24 @@ make_buffer(GraphicsStateGuardian *gsg, const string &name,
|
|||||||
// the actual visual chosen.
|
// the actual visual chosen.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int wglGraphicsPipe::
|
int wglGraphicsPipe::
|
||||||
choose_pfnum(FrameBufferProperties &properties, HDC hdc) {
|
choose_pfnum(const FrameBufferProperties &properties, HDC hdc) {
|
||||||
int pfnum;
|
int pfnum;
|
||||||
|
|
||||||
if (force_software_renderer) {
|
int mode = properties.get_frame_buffer_mode();
|
||||||
pfnum = find_pixfmtnum(properties, hdc, false);
|
bool hardware = ((mode & FrameBufferProperties::FM_hardware) != 0);
|
||||||
|
bool software = ((mode & FrameBufferProperties::FM_software) != 0);
|
||||||
if (pfnum == 0) {
|
|
||||||
wgldisplay_cat.error()
|
|
||||||
<< "Couldn't find compatible software-renderer OpenGL pixfmt, check your window properties!\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
// If the user specified neither hardware nor software frame buffer,
|
||||||
|
// he gets either one.
|
||||||
|
if (!hardware && !software) {
|
||||||
|
hardware = true;
|
||||||
|
software = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hardware) {
|
||||||
pfnum = find_pixfmtnum(properties, hdc, true);
|
pfnum = find_pixfmtnum(properties, hdc, true);
|
||||||
if (pfnum == 0) {
|
if (pfnum == 0) {
|
||||||
if (allow_software_renderer) {
|
if (software) {
|
||||||
pfnum = find_pixfmtnum(properties, hdc, false);
|
pfnum = find_pixfmtnum(properties, hdc, false);
|
||||||
if (pfnum == 0) {
|
if (pfnum == 0) {
|
||||||
wgldisplay_cat.error()
|
wgldisplay_cat.error()
|
||||||
@ -204,6 +206,15 @@ choose_pfnum(FrameBufferProperties &properties, HDC hdc) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
pfnum = find_pixfmtnum(properties, hdc, false);
|
||||||
|
|
||||||
|
if (pfnum == 0) {
|
||||||
|
wgldisplay_cat.error()
|
||||||
|
<< "Couldn't find compatible software-renderer OpenGL pixfmt, check your window properties!\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pfnum;
|
return pfnum;
|
||||||
@ -218,11 +229,13 @@ choose_pfnum(FrameBufferProperties &properties, HDC hdc) {
|
|||||||
// not be found.
|
// not be found.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int wglGraphicsPipe::
|
int wglGraphicsPipe::
|
||||||
find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
find_pixfmtnum(const FrameBufferProperties &properties, HDC hdc,
|
||||||
bool bLookforHW) {
|
bool bLookforHW) {
|
||||||
int frame_buffer_mode = properties.get_frame_buffer_mode();
|
int frame_buffer_mode = properties.get_frame_buffer_mode();
|
||||||
bool want_depth_bits = properties.has_depth_bits();
|
int depth_bits = properties.get_depth_bits();
|
||||||
bool want_color_bits = properties.has_color_bits();
|
int color_bits = properties.get_color_bits();
|
||||||
|
int alpha_bits = properties.get_alpha_bits();
|
||||||
|
int stencil_bits = properties.get_stencil_bits();
|
||||||
OGLDriverType drvtype;
|
OGLDriverType drvtype;
|
||||||
|
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
@ -313,19 +326,19 @@ find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((frame_buffer_mode & FrameBufferProperties::FM_alpha) != 0 &&
|
if ((frame_buffer_mode & FrameBufferProperties::FM_alpha) != 0 &&
|
||||||
(pfd.cAlphaBits==0)) {
|
(pfd.cAlphaBits < alpha_bits)) {
|
||||||
wgldisplay_cat.debug()
|
wgldisplay_cat.debug()
|
||||||
<< " rejecting.\n";
|
<< " rejecting.\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((frame_buffer_mode & FrameBufferProperties::FM_depth) != 0 &&
|
if ((frame_buffer_mode & FrameBufferProperties::FM_depth) != 0 &&
|
||||||
(pfd.cDepthBits==0)) {
|
(pfd.cDepthBits < depth_bits)) {
|
||||||
wgldisplay_cat.debug()
|
wgldisplay_cat.debug()
|
||||||
<< " rejecting.\n";
|
<< " rejecting.\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((frame_buffer_mode & FrameBufferProperties::FM_stencil) != 0 &&
|
if ((frame_buffer_mode & FrameBufferProperties::FM_stencil) != 0 &&
|
||||||
(pfd.cStencilBits==0)) {
|
(pfd.cStencilBits < stencil_bits)) {
|
||||||
wgldisplay_cat.debug()
|
wgldisplay_cat.debug()
|
||||||
<< " rejecting.\n";
|
<< " rejecting.\n";
|
||||||
continue;
|
continue;
|
||||||
@ -338,18 +351,9 @@ find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we ignore the specified want_color_bits for windowed mode
|
if (pfd.cColorBits < color_bits) {
|
||||||
// instead we use the current screen depth
|
|
||||||
|
|
||||||
// drose: Does this help anything? Checking the current screen
|
|
||||||
// depth doesn't make sense if we are rendering offscreen or if we
|
|
||||||
// are planning to open a fullscreen window, and it seems like it
|
|
||||||
// shouldn't be necessary anyway.
|
|
||||||
if ((pfd.cColorBits!=cur_bpp) &&
|
|
||||||
(!((cur_bpp==16) && (pfd.cColorBits==15))) &&
|
|
||||||
(!((cur_bpp==32) && (pfd.cColorBits==24)))) {
|
|
||||||
wgldisplay_cat.debug()
|
wgldisplay_cat.debug()
|
||||||
<< " rejecting because it doesn't match the screen depth.\n";
|
<< " rejecting.\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,6 +397,57 @@ find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
|||||||
return found_pfnum;
|
return found_pfnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: wglGraphicsPipe::get_properties
|
||||||
|
// Access: Private, Static
|
||||||
|
// Description: Gets the FrameBufferProperties to match the
|
||||||
|
// indicated pixel format descriptor.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void wglGraphicsPipe::
|
||||||
|
get_properties(FrameBufferProperties &properties, HDC hdc,
|
||||||
|
int pfnum) {
|
||||||
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
ZeroMemory(&pfd,sizeof(PIXELFORMATDESCRIPTOR));
|
||||||
|
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||||
|
pfd.nVersion = 1;
|
||||||
|
|
||||||
|
DescribePixelFormat(hdc, pfnum, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||||
|
|
||||||
|
properties.clear();
|
||||||
|
|
||||||
|
int mode = 0;
|
||||||
|
if (pfd.dwFlags & PFD_DOUBLEBUFFER) {
|
||||||
|
mode |= FrameBufferProperties::FM_double_buffer;
|
||||||
|
}
|
||||||
|
if (pfd.dwFlags & PFD_STEREO) {
|
||||||
|
mode |= FrameBufferProperties::FM_stereo;
|
||||||
|
}
|
||||||
|
if (pfd.dwFlags & PFD_GENERIC_FORMAT) {
|
||||||
|
mode |= FrameBufferProperties::FM_software;
|
||||||
|
} else {
|
||||||
|
mode |= FrameBufferProperties::FM_hardware;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pfd.cColorBits != 0) {
|
||||||
|
mode |= FrameBufferProperties::FM_rgb;
|
||||||
|
properties.set_color_bits(pfd.cColorBits);
|
||||||
|
}
|
||||||
|
if (pfd.cAlphaBits != 0) {
|
||||||
|
mode |= FrameBufferProperties::FM_alpha;
|
||||||
|
properties.set_alpha_bits(pfd.cAlphaBits);
|
||||||
|
}
|
||||||
|
if (pfd.cDepthBits != 0) {
|
||||||
|
mode |= FrameBufferProperties::FM_depth;
|
||||||
|
properties.set_depth_bits(pfd.cDepthBits);
|
||||||
|
}
|
||||||
|
if (pfd.cStencilBits != 0) {
|
||||||
|
mode |= FrameBufferProperties::FM_stencil;
|
||||||
|
properties.set_stencil_bits(pfd.cStencilBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
properties.set_frame_buffer_mode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: wglGraphicsPipe::format_pfd_flags
|
// Function: wglGraphicsPipe::format_pfd_flags
|
||||||
// Access: Private, Static
|
// Access: Private, Static
|
||||||
|
@ -45,9 +45,11 @@ protected:
|
|||||||
const string &name,
|
const string &name,
|
||||||
int x_size, int y_size, bool want_texture);
|
int x_size, int y_size, bool want_texture);
|
||||||
private:
|
private:
|
||||||
static int choose_pfnum(FrameBufferProperties &properties, HDC hdc);
|
static int choose_pfnum(const FrameBufferProperties &properties, HDC hdc);
|
||||||
static int find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
static int find_pixfmtnum(const FrameBufferProperties &properties, HDC hdc,
|
||||||
bool bLookforHW);
|
bool bLookforHW);
|
||||||
|
static void get_properties(FrameBufferProperties &properties, HDC hdc,
|
||||||
|
int pfnum);
|
||||||
static string format_pfd_flags(DWORD pfd_flags);
|
static string format_pfd_flags(DWORD pfd_flags);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -72,11 +72,6 @@ ConfigVariableBool swapbuffer_framelock
|
|||||||
("swapbuffer-framelock", false,
|
("swapbuffer-framelock", false,
|
||||||
PRC_DESC("Set this true to enable HW swapbuffer frame-lock on 3dlabs cards"));
|
PRC_DESC("Set this true to enable HW swapbuffer frame-lock on 3dlabs cards"));
|
||||||
|
|
||||||
ConfigVariableBool force_software_renderer
|
|
||||||
("force-software-renderer", false);
|
|
||||||
ConfigVariableBool allow_software_renderer
|
|
||||||
("allow-software-renderer", false);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: init_libwindisplay
|
// Function: init_libwindisplay
|
||||||
// Description: Initializes the library. This must be called at
|
// Description: Initializes the library. This must be called at
|
||||||
|
@ -35,8 +35,6 @@ extern ConfigVariableBool ime_hide;
|
|||||||
|
|
||||||
extern EXPCL_PANDAWIN ConfigVariableBool sync_video;
|
extern EXPCL_PANDAWIN ConfigVariableBool sync_video;
|
||||||
extern EXPCL_PANDAWIN ConfigVariableBool swapbuffer_framelock;
|
extern EXPCL_PANDAWIN ConfigVariableBool swapbuffer_framelock;
|
||||||
extern EXPCL_PANDAWIN ConfigVariableBool force_software_renderer;
|
|
||||||
extern EXPCL_PANDAWIN ConfigVariableBool allow_software_renderer;
|
|
||||||
|
|
||||||
extern EXPCL_PANDAWIN void init_libwindisplay();
|
extern EXPCL_PANDAWIN void init_libwindisplay();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user