Просмотр исходного кода

read color_bits, etc. from config file

David Rose 19 лет назад
Родитель
Сommit
c7a4859e3c

+ 5 - 1
panda/src/display/config_display.cxx

@@ -258,8 +258,12 @@ ConfigVariableBool framebuffer_depth
           "properties, which requests a depth buffer."));
 ConfigVariableBool framebuffer_alpha
 ("framebuffer-alpha", true,
- PRC_DESC("True if FM_depth should be added to the default framebuffer "
+ PRC_DESC("True if FM_alpha should be added to the default framebuffer "
           "properties, which requests an alpha channel if possible."));
+ConfigVariableBool framebuffer_stencil
+("framebuffer-stencil", false,
+ PRC_DESC("True if FM_stencil should be added to the default framebuffer "
+          "properties, which requests an stencil buffer if possible."));
 ConfigVariableBool framebuffer_stereo
 ("framebuffer-stereo", false,
  PRC_DESC("True if FM_stereo should be added to the default framebuffer "

+ 1 - 0
panda/src/display/config_display.h

@@ -78,6 +78,7 @@ extern EXPCL_PANDA ConfigVariableBool framebuffer_software;
 extern EXPCL_PANDA ConfigVariableBool framebuffer_multisample;
 extern EXPCL_PANDA ConfigVariableBool framebuffer_depth;
 extern EXPCL_PANDA ConfigVariableBool framebuffer_alpha;
+extern EXPCL_PANDA ConfigVariableBool framebuffer_stencil;
 extern EXPCL_PANDA ConfigVariableBool framebuffer_stereo;
 extern EXPCL_PANDA ConfigVariableInt depth_bits;
 extern EXPCL_PANDA ConfigVariableInt color_bits;

+ 12 - 7
panda/src/display/frameBufferProperties.cxx

@@ -84,6 +84,7 @@ get_default() {
     string word = framebuffer_mode.get_word(i);
     if (cmp_nocase_uh(word, "rgb") == 0) {
       default_props._property[FBP_indexed_color] = 0;
+      default_props._property[FBP_color_bits] = color_bits;
       default_props._property[FBP_rgb_color] = 1;
 
     } else if (cmp_nocase_uh(word, "index") == 0) {
@@ -108,21 +109,22 @@ get_default() {
     } else if (cmp_nocase_uh(word, "alpha") == 0) {
       default_props._property[FBP_indexed_color] = 0;
       default_props._property[FBP_rgb_color] = 1;
-      default_props._property[FBP_alpha_bits] = 1;
+      default_props._property[FBP_alpha_bits] = alpha_bits;
       
     } else if (cmp_nocase_uh(word, "rgba") == 0) {
       default_props._property[FBP_indexed_color] = 0;
       default_props._property[FBP_rgb_color] = 1;
-      default_props._property[FBP_alpha_bits] = 1;
+      default_props._property[FBP_color_bits] = color_bits;
+      default_props._property[FBP_alpha_bits] = alpha_bits;
       
     } else if (cmp_nocase_uh(word, "depth") == 0) {
-      default_props._property[FBP_depth_bits] = 1;
+      default_props._property[FBP_depth_bits] = depth_bits;
 
     } else if (cmp_nocase_uh(word, "stencil") == 0) {
-      default_props._property[FBP_stencil_bits] = 1;
+      default_props._property[FBP_stencil_bits] = stencil_bits;
 
     } else if (cmp_nocase_uh(word, "multisample") == 0) {
-      default_props._property[FBP_multisamples] = 1;
+      default_props._property[FBP_multisamples] = multisamples;
 
     } else if (cmp_nocase_uh(word, "stereo") == 0) {
       default_props._property[FBP_stereo] = 1;
@@ -149,10 +151,13 @@ get_default() {
     default_props.set_multisamples(1);
   }
   if (framebuffer_depth) {
-    default_props.set_depth_bits(1);
+    default_props.set_depth_bits(depth_bits);
   }
   if (framebuffer_alpha) {
-    default_props.set_alpha_bits(1);
+    default_props.set_alpha_bits(alpha_bits);
+  }
+  if (framebuffer_stencil) {
+    default_props.set_stencil_bits(stencil_bits);
   }
   if (framebuffer_stereo) {
     default_props.set_stereo(1);