瀏覽代碼

move default_fov to a configrc variable

David Rose 22 年之前
父節點
當前提交
d684df5958
共有 4 個文件被更改,包括 10 次插入7 次删除
  1. 3 0
      panda/src/gobj/config_gobj.cxx
  2. 4 0
      panda/src/gobj/config_gobj.h
  3. 3 5
      panda/src/gobj/lens.cxx
  4. 0 2
      panda/src/gobj/lens.h

+ 3 - 0
panda/src/gobj/config_gobj.cxx

@@ -123,6 +123,9 @@ const float lod_stress_factor = config_gobj.GetFloat("lod-stress-factor", 1.0f);
 const float default_near = config_gobj.GetFloat("default-near", 1.0f);
 const float default_far = config_gobj.GetFloat("default-far", 1000.0f);
 
+// The default camera FOV.
+const float default_fov = config_gobj.GetFloat("default-fov", 40.0f);
+
 static BamTextureMode
 parse_texture_mode(const string &mode) {
   if (cmp_nocase(mode, "unchanged") == 0) {

+ 4 - 0
panda/src/gobj/config_gobj.h

@@ -49,6 +49,10 @@ extern EXPCL_PANDA const int select_LOD_number;
 extern EXPCL_PANDA const int minimum_LOD_number;
 extern EXPCL_PANDA const bool debug_LOD_mode;
 
+extern const float default_near;
+extern const float default_far;
+extern const float default_fov;
+
 #endif
 
 

+ 3 - 5
panda/src/gobj/lens.cxx

@@ -28,8 +28,6 @@
 
 TypeHandle Lens::_type_handle;
 
-const float Lens::_default_fov = 40.0f;
-
 ////////////////////////////////////////////////////////////////////
 //     Function: Lens::Constructor
 //       Access: Public
@@ -99,7 +97,7 @@ clear() {
   _film_size.set(1.0f, 1.0f);
   _film_offset.set(0.0f, 0.0f);
   _focal_length = 1.0f;
-  _fov.set(_default_fov, _default_fov);
+  _fov.set(default_fov, default_fov);
   _aspect_ratio = 1.0f;
   _near_distance = default_near;
   _far_distance = default_far;
@@ -1228,7 +1226,7 @@ compute_fov() {
     if ((_user_flags & UF_focal_length) != 0) {
       _fov[0] = film_to_fov(film_size[0], _focal_length, true);
     } else {
-      _fov[0] = _default_fov;
+      _fov[0] = default_fov;
     }
   }
 
@@ -1431,7 +1429,7 @@ fov_to_focal_length(float, float, bool) const {
 ////////////////////////////////////////////////////////////////////
 float Lens::
 film_to_fov(float, float, bool) const {
-  return _default_fov;
+  return default_fov;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 0 - 2
panda/src/gobj/lens.h

@@ -242,8 +242,6 @@ protected:
 
   PTA_Vertexf _geom_coords;
 
-  static const float _default_fov;
-
 public:
   virtual void write_datagram(BamWriter *manager, Datagram &dg);