Browse Source

Add -L (lighting) and -P <pipe> options to pview

Ed Swartz 10 years ago
parent
commit
6ceaf63c7d
2 changed files with 41 additions and 3 deletions
  1. 10 1
      doc/man/pview.1
  2. 31 2
      panda/src/testbed/pview.cxx

+ 10 - 1
doc/man/pview.1

@@ -1,4 +1,4 @@
-.TH PVIEW 1 "27 December 2014" "" Panda3D
+.TH PVIEW 1 "1 May 2015" "" Panda3D
 .SH NAME
 .SH NAME
 pview \- quickly view a Panda model and/or animation
 pview \- quickly view a Panda model and/or animation
 .SH SYNOPSIS
 .SH SYNOPSIS
@@ -43,6 +43,15 @@ exit.
 Delete the model files after loading them (presumably this option
 Delete the model files after loading them (presumably this option
 will only be used when loading a temporary model file).
 will only be used when loading a temporary model file).
 .TP
 .TP
+.B \-L
+Enable lighting in the scene.  This can also be achieved with 
+the 'l' hotkey at runtime.
+.TP
+.BI "\-P " pipename
+Select the given graphics pipe for the window, rather than using
+the platform default.  The allowed values for <pipe> are those 
+from the Config.prc variables 'load-display' and 'aux-display'.
+.TP
 .B \-V
 .B \-V
 Report the current version of Panda, and exit.
 Report the current version of Panda, and exit.
 .TP
 .TP

+ 31 - 2
panda/src/testbed/pview.cxx

@@ -26,6 +26,7 @@
 #include "virtualFileSystem.h"
 #include "virtualFileSystem.h"
 #include "panda_getopt.h"
 #include "panda_getopt.h"
 #include "preprocess_argv.h"
 #include "preprocess_argv.h"
+#include "graphicsPipeSelection.h"
 
 
 // By including checkPandaVersion.h, we guarantee that runtime
 // By including checkPandaVersion.h, we guarantee that runtime
 // attempts to run pview will fail if it inadvertently links with the
 // attempts to run pview will fail if it inadvertently links with the
@@ -209,6 +210,15 @@ help() {
     "      Delete the model files after loading them (presumably this option\n"
     "      Delete the model files after loading them (presumably this option\n"
     "      will only be used when loading a temporary model file).\n\n"
     "      will only be used when loading a temporary model file).\n\n"
 
 
+    "  -L\n"
+    "      Enable lighting in the scene.  This can also be achieved with\n"
+    "      the 'l' hotkey at runtime.\n\n"
+
+    "  -P <pipe>\n"
+    "      Select the given graphics pipe for the window, rather than using\n"
+    "      the platform default.  The allowed values for <pipe> are those\n"
+    "      from the Config.prc variables 'load-display' and 'aux-display'.\n\n"
+
     "  -V\n"
     "  -V\n"
     "      Report the current version of Panda, and exit.\n\n"
     "      Report the current version of Panda, and exit.\n\n"
     
     
@@ -241,10 +251,12 @@ main(int argc, char **argv) {
                               PartGroup::HMF_ok_anim_extra;
                               PartGroup::HMF_ok_anim_extra;
   Filename screenshotfn;
   Filename screenshotfn;
   bool delete_models = false;
   bool delete_models = false;
+  bool apply_lighting = false;
+  PointerTo<GraphicsPipe> pipe = NULL;
 
 
   extern char *optarg;
   extern char *optarg;
   extern int optind;
   extern int optind;
-  static const char *optflags = "acls:DVhi";
+  static const char *optflags = "acls:DVhiLP:";
   int flag = getopt(argc, argv, optflags);
   int flag = getopt(argc, argv, optflags);
 
 
   while (flag != EOF) {
   while (flag != EOF) {
@@ -275,6 +287,19 @@ main(int argc, char **argv) {
       delete_models = true;
       delete_models = true;
       break;
       break;
 
 
+    case 'L':
+      apply_lighting = true;
+      break;
+
+    case 'P': {
+      pipe = GraphicsPipeSelection::get_global_ptr()->make_module_pipe(optarg);
+      if (!pipe) {
+        cerr << "No such pipe '" << optarg << "' available." << endl;
+        return 1;
+      }
+      break;
+    }
+
     case 'V':
     case 'V':
       report_version();
       report_version();
       return 1;
       return 1;
@@ -296,7 +321,7 @@ main(int argc, char **argv) {
   argc -= (optind - 1);
   argc -= (optind - 1);
   argv += (optind - 1);
   argv += (optind - 1);
 
 
-  WindowFramework *window = framework.open_window();
+  WindowFramework *window = framework.open_window(pipe, NULL);
   if (window != (WindowFramework *)NULL) {
   if (window != (WindowFramework *)NULL) {
     // We've successfully opened a window.
     // We've successfully opened a window.
 
 
@@ -348,6 +373,10 @@ main(int argc, char **argv) {
     
     
     loading_np.remove_node();
     loading_np.remove_node();
 
 
+    if (apply_lighting) {
+      window->set_lighting(true);
+    }
+
     if (auto_center) {
     if (auto_center) {
       window->center_trackball(framework.get_models());
       window->center_trackball(framework.get_models());
     }
     }