From 7108474f4407f64ed0754dc95fb01eba274e6750 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Tue, 11 Apr 2006 18:01:16 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/directscripts/gendocs.py | 3 ++ direct/src/directscripts/packpanda.py | 49 ++++++++++--------- direct/src/showbase/ShowBase.py | 7 ++- panda/src/display/graphicsBuffer.cxx | 4 ++ panda/src/display/graphicsOutput.cxx | 3 -- panda/src/display/graphicsPipe.h | 1 + panda/src/dxgsg8/wdxGraphicsPipe8.cxx | 2 + panda/src/dxgsg9/wdxGraphicsPipe9.cxx | 2 + panda/src/glstuff/glGraphicsBuffer_src.cxx | 35 +++++++++++-- panda/src/glstuff/glGraphicsBuffer_src.h | 16 +++++- panda/src/glxdisplay/glxGraphicsPipe.cxx | 2 + .../glxdisplay/glxGraphicsStateGuardian.cxx | 10 +++- panda/src/mesadisplay/osMesaGraphicsPipe.cxx | 1 + panda/src/wgldisplay/wglGraphicsPipe.cxx | 2 + 14 files changed, 104 insertions(+), 33 deletions(-) diff --git a/direct/src/directscripts/gendocs.py b/direct/src/directscripts/gendocs.py index de34561d17..8bcc091b2f 100644 --- a/direct/src/directscripts/gendocs.py +++ b/direct/src/directscripts/gendocs.py @@ -96,6 +96,9 @@ def textToHTML(comment, sep, delsection=None): line = line.lstrip(" ").lstrip(sep).lstrip(" ").rstrip("\r").rstrip(" ") if (line == ""): sections.append("") + elif (line[0]=="*") or (line[0]=="-"): + sections.append(line) + sections.append("") elif (SECHEADER.match(line)): sections.append(line) else: diff --git a/direct/src/directscripts/packpanda.py b/direct/src/directscripts/packpanda.py index f72d5e86d8..382ead75dd 100755 --- a/direct/src/directscripts/packpanda.py +++ b/direct/src/directscripts/packpanda.py @@ -15,7 +15,8 @@ import sys, os, getopt, string, shutil, py_compile OPTIONLIST = [ -("game", 1, "Name of directory containing game"), +("dir", 1, "Name of directory containing game"), +("name", 1, "Human-readable name of the game"), ("version", 1, "Version number to add to game name"), ("rmdir", 2, "Delete all directories with given name"), ("rmext", 2, "Delete all files with given extension"), @@ -69,7 +70,7 @@ OPTIONS = ParseOptions(sys.argv[1:]) PANDA=None for dir in sys.path: - if (dir != "") and os.path.exists(os.path.join(dir,"direct")) and os.path.exists(os.path.join(dir,"pandac")) and os.path.exists(os.path.join(dir,"python")) and os.path.exists(os.path.join(dir,"nsis")): + if (dir != "") and os.path.exists(os.path.join(dir,"direct")) and os.path.exists(os.path.join(dir,"pandac")) and os.path.exists(os.path.join(dir,"python")): PANDA=os.path.abspath(dir) if (PANDA is None): sys.exit("Cannot locate the panda root directory in the python path (cannot locate directory containing direct and pandac).") @@ -84,31 +85,33 @@ else: ############################################################################## # -# Identify the main parts of the game: GAME, NAME, MAIN, ICON, BITMAP, etc +# Identify the main parts of the game: DIR, NAME, MAIN, ICON, BITMAP, etc # ############################################################################## VER=OPTIONS["version"] -GAME=OPTIONS["game"] -if (GAME==""): - print "You must specify the --game option." +DIR=OPTIONS["dir"] +if (DIR==""): + print "You must specify the --dir option." ParseFailure() -GAME=os.path.abspath(GAME) -NAME=os.path.basename(GAME) -SMDIRECTORY=os.path.basename(GAME) +DIR=os.path.abspath(DIR) +NAME=os.path.basename(DIR) +if (OPTIONS["name"] != ""): + NAME=OPTIONS["name"] +SMDIRECTORY=NAME if (VER!=""): SMDIRECTORY=SMDIRECTORY+" "+VER -ICON=os.path.join(GAME, NAME+".ico") -BITMAP=os.path.join(GAME, NAME+".bmp") -LICENSE=os.path.join(GAME,"LICENSE.TXT") -OUTFILE=os.path.basename(GAME) +ICON=os.path.join(DIR, "icon.ico") +BITMAP=os.path.join(DIR, "installer.bmp") +LICENSE=os.path.join(DIR, "license.txt") +OUTFILE=os.path.basename(DIR) if (VER!=""): OUTFILE=OUTFILE+"-"+VER OUTFILE=os.path.abspath(OUTFILE+".exe") -INSTALLDIR='C:\\'+os.path.basename(GAME) +INSTALLDIR='C:\\'+os.path.basename(DIR) if (VER!=""): INSTALLDIR=INSTALLDIR+"-"+VER COMPRESS="lzma" if (OPTIONS["fast"]): COMPRESS="zlib" -if (OPTIONS["pyc"]): MAIN=NAME+".pyc" -else: MAIN=NAME+".py" +if (OPTIONS["pyc"]): MAIN="main.pyc" +else: MAIN="main.py" def PrintFileStatus(label, file): if (os.path.exists(file)): @@ -116,21 +119,21 @@ def PrintFileStatus(label, file): else: print "%-15s: %s (MISSING)"%(label, file) -PrintFileStatus("Game", GAME) +PrintFileStatus("Dir", DIR) print "%-15s: %s"%("Name", NAME) print "%-15s: %s"%("Start Menu", SMDIRECTORY) -PrintFileStatus("Main", os.path.join(GAME, MAIN)) +PrintFileStatus("Main", os.path.join(DIR, MAIN)) PrintFileStatus("Icon", ICON) PrintFileStatus("Bitmap", BITMAP) PrintFileStatus("License", LICENSE) print "%-15s: %s"%("Output", OUTFILE) print "%-15s: %s"%("Install Dir", INSTALLDIR) -if (os.path.isdir(GAME)==0): - sys.exit("Difficulty reading "+GAME+". Cannot continue.") +if (os.path.isdir(DIR)==0): + sys.exit("Difficulty reading "+DIR+". Cannot continue.") -if (os.path.isfile(os.path.join(GAME, NAME+".py"))==0): - sys.exit("Difficulty reading "+NAME+".py. Cannot continue.") +if (os.path.isfile(os.path.join(DIR, "main.py"))==0): + sys.exit("Difficulty reading main.py. Cannot continue.") if (os.path.isfile(LICENSE)==0): LICENSE=os.path.join(PANDA,"LICENSE") @@ -150,7 +153,7 @@ print "Copying the game to "+TMPDIR+"..." if (os.path.exists(TMPDIR)): try: shutil.rmtree(TMPDIR) except: sys.exit("Cannot delete "+TMPDIR) -try: shutil.copytree(GAME, TMPDIR) +try: shutil.copytree(DIR, TMPDIR) except: sys.exit("Cannot copy game to "+TMPDIR) ############################################################################## diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index b59060b982..93725c8fd2 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -804,7 +804,7 @@ class ShowBase(DirectObject.DirectObject): def makeCamera(self, win, sort = 0, scene = None, displayRegion = (0, 1, 0, 1), stereo = None, aspectRatio = None, clearDepth = 0, clearColor = None, - lens = None, camName = 'cam'): + lens = None, camName = 'cam', mask = None): """ Makes a new 3-d camera associated with the indicated window, and creates a display region in the indicated subrectangle. @@ -828,6 +828,11 @@ class ShowBase(DirectObject.DirectObject): if scene != None: camNode.setScene(scene) + if mask != None: + if (isinstance(mask, int)): + mask = BitMask32(mask) + camNode.setCameraMask(mask) + # self.camera is the parent node of all cameras: a node that # we can move around to move all cameras as a group. if self.camera == None: diff --git a/panda/src/display/graphicsBuffer.cxx b/panda/src/display/graphicsBuffer.cxx index 7b4b318699..381f6b4bc0 100644 --- a/panda/src/display/graphicsBuffer.cxx +++ b/panda/src/display/graphicsBuffer.cxx @@ -36,6 +36,8 @@ GraphicsBuffer(GraphicsPipe *pipe, GraphicsOutput *host) : GraphicsOutput(pipe, name, properties, x_size, y_size, flags, gsg, host) { + nassertv(gsg != (GraphicsStateGuardian *)NULL); + #ifdef DO_MEMORY_USAGE MemoryUsage::update_type(this, this); #endif @@ -47,6 +49,8 @@ GraphicsBuffer(GraphicsPipe *pipe, _default_display_region->compute_pixels(_x_size, _y_size); _open_request = OR_none; + + set_inverted(gsg->get_copy_texture_inverted()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsOutput.cxx b/panda/src/display/graphicsOutput.cxx index a7433d7e1f..a39f39d244 100644 --- a/panda/src/display/graphicsOutput.cxx +++ b/panda/src/display/graphicsOutput.cxx @@ -325,9 +325,6 @@ add_render_texture(Texture *tex, RenderTextureMode mode, result._plane = plane; result._rtm_mode = mode; _textures.push_back(result); - - nassertv(_gsg != (GraphicsStateGuardian *)NULL); - set_inverted(_gsg->get_copy_texture_inverted()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsPipe.h b/panda/src/display/graphicsPipe.h index d574f7c90e..0abbeb54c0 100644 --- a/panda/src/display/graphicsPipe.h +++ b/panda/src/display/graphicsPipe.h @@ -88,6 +88,7 @@ PUBLISHED: BF_can_bind_color = 0x0040, // Need capability: bind the color bitplane to a tex. BF_can_bind_every = 0x0080, // Need capability: bind all bitplanes to a tex. BF_size_track_host = 0x0100, // Buffer should track the host size. + BF_rtt_cumulative = 0x0200, // Buffer supports cumulative render-to-texture. }; INLINE bool is_valid() const; diff --git a/panda/src/dxgsg8/wdxGraphicsPipe8.cxx b/panda/src/dxgsg8/wdxGraphicsPipe8.cxx index 8973f9f96b..edd964cd5c 100644 --- a/panda/src/dxgsg8/wdxGraphicsPipe8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsPipe8.cxx @@ -108,6 +108,7 @@ make_output(const string &name, if (((flags&BF_require_parasite)!=0)|| ((flags&BF_refuse_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_color)!=0)|| ((flags&BF_can_bind_every)!=0)|| (properties != gsg->get_default_properties())) { @@ -124,6 +125,7 @@ make_output(const string &name, ((flags&BF_require_parasite)!=0)|| ((flags&BF_require_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_every)!=0)|| (properties != gsg->get_default_properties())) { return NULL; diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx index de9d1486a3..6e6071ad33 100755 --- a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx @@ -107,6 +107,7 @@ make_output(const string &name, if (((flags&BF_require_parasite)!=0)|| ((flags&BF_refuse_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_color)!=0)|| ((flags&BF_can_bind_every)!=0)|| (prop != gsg->get_default_properties())) { @@ -123,6 +124,7 @@ make_output(const string &name, ((flags&BF_require_parasite)!=0)|| ((flags&BF_require_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_every)!=0)|| (prop != gsg->get_default_properties())) { return NULL; diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index f81c3efa5d..1b58e50ded 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -40,6 +40,7 @@ CLP(GraphicsBuffer)(GraphicsPipe *pipe, _fbo = 0; _rb_size_x = 0; _rb_size_y = 0; + _cube_face_active = 0; for (int i=0; ireport_my_gl_errors(); } @@ -285,9 +287,11 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GL_TEXTURE_2D, gtc->_index, 0); } else { glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachpoint, - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, gtc->_index, 0); + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, + gtc->_index, 0); } _tex[slot] = tex; + _attach_point[slot] = attachpoint; // If there was a renderbuffer bound to this slot, delete it. if (_rb[slot] != 0) { @@ -320,6 +324,7 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, // Toss any texture that was connected to the slot. _tex[slot] = 0; + _attach_point[slot] = attachpoint; } } @@ -401,7 +406,27 @@ end_frame(FrameMode mode) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsBuffer):: select_cube_map(int cube_map_index) { - GLCAT.error() << "select_cube_map not implemented yet.\n"; + if (cube_map_index == _cube_face_active) { + return; + } + _cube_face_active = cube_map_index; + + CLP(GraphicsStateGuardian) *glgsg; + DCAST_INTO_V(glgsg, _gsg); + + for (int i=0; iget_texture_type() != Texture::TT_cube_map)) { + continue; + } + TextureContext *tc = tex->prepare_now(glgsg->get_prepared_objects(), glgsg); + nassertv(tc != (TextureContext *)NULL); + CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc); + glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, _attach_point[i], + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + cube_map_index, + gtc->_index, 0); + } } //////////////////////////////////////////////////////////////////// @@ -435,6 +460,11 @@ open_buffer() { void CLP(GraphicsBuffer):: close_buffer() { + _active = false; + if (_gsg == 0) { + return; + } + // Get the glgsg. CLP(GraphicsStateGuardian) *glgsg; DCAST_INTO_V(glgsg, _gsg); @@ -458,6 +488,5 @@ close_buffer() { // Release the Gsg _gsg.clear(); - _active = false; } diff --git a/panda/src/glstuff/glGraphicsBuffer_src.h b/panda/src/glstuff/glGraphicsBuffer_src.h index 104c907dbe..48aec27ac0 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.h +++ b/panda/src/glstuff/glGraphicsBuffer_src.h @@ -26,15 +26,27 @@ // The glGraphicsBuffer is based on the OpenGL // EXT_framebuffer_object and ARB_draw_buffers extensions. // This design has significant advantages over the -// older wglGraphicsBuffer and glxGraphicsBuffer. +// older wglGraphicsBuffer and glxGraphicsBuffer: // // * Can export depth and stencil. // * Supports auxiliary bitplanes. // * Supports non-power-of-two padding. // * Supports tracking of host window size. +// * Supports cumulative render-to-texture. // * Faster than pbuffers. // * Can render onto a texture without clearing it first. // +// Some of these deserve a little explanation. +// Auxiliary bitplanes are additional bitplanes above +// and beyond the normal depth,stencil,color. One can +// use them to render out multiple textures in a single +// pass. Cumulative render-to-texture means that if +// don't clear the buffer, then the contents of the +// buffer will be equal to the texture's previous +// contents. This alo means you can meaningfully +// share a bitplane between two buffers by binding +// the same texture to both buffers. +// // If either of the necessary OpenGL extensions is not // available, then the glGraphicsBuffer will not be // available (although it may still be possible to @@ -72,8 +84,10 @@ private: GLuint _fbo; int _rb_size_x; int _rb_size_y; + int _cube_face_active; PT(Texture) _tex[RTP_COUNT]; GLuint _rb[RTP_COUNT]; + GLenum _attach_point[RTP_COUNT]; public: static TypeHandle get_class_type() { diff --git a/panda/src/glxdisplay/glxGraphicsPipe.cxx b/panda/src/glxdisplay/glxGraphicsPipe.cxx index 40a4686e6c..b96d55c09c 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.cxx +++ b/panda/src/glxdisplay/glxGraphicsPipe.cxx @@ -300,6 +300,7 @@ make_output(const string &name, if (((flags&BF_require_parasite)!=0)|| ((flags&BF_refuse_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_color)!=0)|| ((flags&BF_can_bind_every)!=0)) { return NULL; @@ -333,6 +334,7 @@ make_output(const string &name, ((flags&BF_require_parasite)!=0)|| ((flags&BF_require_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_every)!=0)) { return NULL; } diff --git a/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx b/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx index d9efa71aa3..2133707872 100644 --- a/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx +++ b/panda/src/glxdisplay/glxGraphicsStateGuardian.cxx @@ -132,9 +132,15 @@ reset() { // It's Mesa, therefore probably a software context. if (!software) { glxdisplay_cat.error() - << "Using GL renderer " << _gl_renderer << "; it is probably a software renderer.\n"; + << "The application requested harware acceleration, but your OpenGL\n"; glxdisplay_cat.error() - << "To allow use of this display add FM_software to your frame buffer mode.\n"; + << "driver, " << _gl_renderer << ", only supports software rendering.\n"; + glxdisplay_cat.error() + << "You need to install a hardware-accelerated OpenGL driver, or,\n"; + glxdisplay_cat.error() + << "if you actually *want* to use a software renderer, then\n"; + glxdisplay_cat.error() + << "change the word 'hardware' to 'software' in the Config.prc file.\n"; _is_valid = false; } frame_buffer_mode = (frame_buffer_mode | FrameBufferProperties::FM_software) & ~FrameBufferProperties::FM_hardware; diff --git a/panda/src/mesadisplay/osMesaGraphicsPipe.cxx b/panda/src/mesadisplay/osMesaGraphicsPipe.cxx index 2e1936c43d..29542615a4 100644 --- a/panda/src/mesadisplay/osMesaGraphicsPipe.cxx +++ b/panda/src/mesadisplay/osMesaGraphicsPipe.cxx @@ -144,6 +144,7 @@ make_output(const string &name, ((flags&BF_require_window)!=0)|| ((flags&BF_size_track_host)!=0)|| ((flags&BF_can_bind_every)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| (properties != gsg->get_default_properties())) { return NULL; } diff --git a/panda/src/wgldisplay/wglGraphicsPipe.cxx b/panda/src/wgldisplay/wglGraphicsPipe.cxx index a290682ad8..c68f2b7884 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.cxx +++ b/panda/src/wgldisplay/wglGraphicsPipe.cxx @@ -128,6 +128,7 @@ make_output(const string &name, if (((flags&BF_require_parasite)!=0)|| ((flags&BF_refuse_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_color)!=0)|| ((flags&BF_can_bind_every)!=0)) { return NULL; @@ -169,6 +170,7 @@ make_output(const string &name, ((flags&BF_require_parasite)!=0)|| ((flags&BF_require_window)!=0)|| ((flags&BF_size_track_host)!=0)|| + ((flags&BF_rtt_cumulative)!=0)|| ((flags&BF_can_bind_every)!=0)) { return NULL; }