00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "showBase.h"
00020
00021 #include "throw_event.h"
00022 #include "graphicsWindow.h"
00023 #include "chancfg.h"
00024 #include "renderBuffer.h"
00025 #include "get_config_path.h"
00026 #include "camera.h"
00027 #include "graphicsPipeSelection.h"
00028
00029
00030 ConfigureDef(config_showbase);
00031 ConfigureFn(config_showbase) {
00032 }
00033
00034 DSearchPath &
00035 get_particle_path() {
00036 static DSearchPath *particle_path = NULL;
00037 return get_config_path("particle-path", particle_path);
00038 }
00039
00040
00041
00042 void
00043 throw_new_frame() {
00044 throw_event("NewFrame");
00045 }
00046
00047
00048 void
00049 take_snapshot(GraphicsWindow *win, const string &name) {
00050 GraphicsStateGuardian* gsg = win->get_gsg();
00051 const RenderBuffer& rb = gsg->get_render_buffer(RenderBuffer::T_front);
00052
00053 CPT(DisplayRegion) dr = win->get_display_region(0);
00054 nassertv(dr != (DisplayRegion *)NULL);
00055
00056 int width = dr->get_pixel_width();
00057 int height = dr->get_pixel_height();
00058
00059 PixelBuffer p(width, height, 3, 1, PixelBuffer::T_unsigned_byte,
00060 PixelBuffer::F_rgb);
00061
00062 p.copy(gsg, dr, rb);
00063 p.write(name);
00064 }
00065
00066
00067
00068 ConfigShowbase &
00069 get_config_showbase() {
00070 return config_showbase;
00071 }
00072
00073
00074 static int num_fullscreen_testsizes = 0;
00075 #define MAX_FULLSCREEN_TESTS 10
00076 static int fullscreen_testsizes[MAX_FULLSCREEN_TESTS * 2];
00077
00078 void
00079 add_fullscreen_testsize(int xsize, int ysize) {
00080 if ((xsize == 0) && (ysize == 0)) {
00081 num_fullscreen_testsizes = 0;
00082 return;
00083 }
00084
00085
00086 if (num_fullscreen_testsizes < MAX_FULLSCREEN_TESTS) {
00087 fullscreen_testsizes[num_fullscreen_testsizes * 2] = xsize;
00088 fullscreen_testsizes[num_fullscreen_testsizes * 2 + 1] = ysize;
00089 num_fullscreen_testsizes++;
00090 }
00091 }
00092
00093 void
00094 runtest_fullscreen_sizes(GraphicsWindow *win) {
00095 win->verify_window_sizes(num_fullscreen_testsizes, fullscreen_testsizes);
00096 }
00097
00098 bool
00099 query_fullscreen_testresult(int xsize, int ysize) {
00100
00101 int i;
00102 for (i=0; i < num_fullscreen_testsizes; i++) {
00103 if((fullscreen_testsizes[i * 2] == xsize) &&
00104 (fullscreen_testsizes[i * 2 + 1] == ysize))
00105 return true;
00106 }
00107 return false;
00108 }
00109