From: <axl...@us...> - 2009-06-14 02:12:55
|
Revision: 318 http://hgengine.svn.sourceforge.net/hgengine/?rev=318&view=rev Author: axlecrusher Date: 2009-06-14 01:54:48 +0000 (Sun, 14 Jun 2009) Log Message: ----------- Rendering scene to FBO then to a fullscreen quad Modified Paths: -------------- Mercury2/adv_set.c Mercury2/scenegraph.xml Added Paths: ----------- Mercury2/src/FullscreenQuad.cpp Mercury2/src/FullscreenQuad.h Modified: Mercury2/adv_set.c =================================================================== --- Mercury2/adv_set.c 2009-06-13 21:56:35 UTC (rev 317) +++ Mercury2/adv_set.c 2009-06-14 01:54:48 UTC (rev 318) @@ -12,7 +12,7 @@ src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \ src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \ src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \ - src/GLHelpers.cpp" + src/GLHelpers.cpp src/FullscreenQuad.cpp" SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \ src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp" Modified: Mercury2/scenegraph.xml =================================================================== --- Mercury2/scenegraph.xml 2009-06-13 21:56:35 UTC (rev 317) +++ Mercury2/scenegraph.xml 2009-06-14 01:54:48 UTC (rev 318) @@ -6,18 +6,17 @@ <node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0"> <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100"/> </node> - <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5"> - <node type="renderablenode"> - <asset type="texture" file="map.png"/> - <asset type="hgmdlmodel" file="map.hgmdl" /> - </node> - <node type="renderablenode"> - <asset type="texture" file="screenFBO" dynamic="true"/> - <asset type="quad"/> - </node> + <node type="renderablenode"> + <asset type="texture" file="screenFBO" dynamic="true"/> + <asset type="fullscreenquad"/> </node> - <node type="mercuryfbo" width="512" height="512" depth="false" tnum="1" name="screenFBO"> -<!-- <asset type="renderbuffer" buffertype="texture" /> --> + <node type="mercuryfbo" width="640" height="480" depth="false" tnum="1" name="screenFBO"> + <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5"> + <node type="renderablenode"> + <asset type="texture" file="map.png"/> + <asset type="hgmdlmodel" file="map.hgmdl" /> + </node> + </node> <node type="renderablenode" name="lampForest"> <asset type="texture" file="lamp.png"/> <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" > Added: Mercury2/src/FullscreenQuad.cpp =================================================================== --- Mercury2/src/FullscreenQuad.cpp (rev 0) +++ Mercury2/src/FullscreenQuad.cpp 2009-06-14 01:54:48 UTC (rev 318) @@ -0,0 +1,71 @@ +#include <GLHeaders.h> +#include <FullscreenQuad.h> + +REGISTER_ASSET_TYPE(FullscreenQuad); + +FullscreenQuad::FullscreenQuad() +{ + m_matrix = MercuryMatrix::Identity(); + m_matrix.Scale(2,2,1); + m_matrix.Transpose(); +} + +void FullscreenQuad::Render(const MercuryNode* node) +{ + //reverse texture mapping for + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + glLoadIdentity(); + glRotatef(180,1,0,0); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadMatrixf( m_matrix.Ptr() ); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + Quad::Render( node ); + + glPopMatrix(); + glMatrixMode(GL_TEXTURE); glPopMatrix(); + glMatrixMode(GL_MODELVIEW); glPopMatrix(); +} + +FullscreenQuad* FullscreenQuad::Generate() +{ + return new FullscreenQuad(); +} + +/**************************************************************************** + * Copyright (C) 2009 by Joshua Allen * + * * + * * + * All rights reserved. * + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * Redistributions of source code must retain the above copyright * + * notice, this list of conditions and the following disclaimer. * + * * Redistributions in binary form must reproduce the above * + * copyright notice, this list of conditions and the following * + * disclaimer in the documentation and/or other materials provided * + * with the distribution. * + * * Neither the name of the Mercury Engine nor the names of its * + * contributors may be used to endorse or promote products derived * + * from this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + ***************************************************************************/ Added: Mercury2/src/FullscreenQuad.h =================================================================== --- Mercury2/src/FullscreenQuad.h (rev 0) +++ Mercury2/src/FullscreenQuad.h 2009-06-14 01:54:48 UTC (rev 318) @@ -0,0 +1,46 @@ +#include <Quad.h> + +class FullscreenQuad : public Quad +{ + public: + FullscreenQuad(); +// virtual ~FullscreenQuad(); + + virtual void Render(const MercuryNode* node); + + static FullscreenQuad* Generate(); + private: + MercuryMatrix m_matrix; +}; + +/**************************************************************************** + * Copyright (C) 2009 by Joshua Allen * + * * + * * + * All rights reserved. * + * * + * Redistribution and use in source and binary forms, with or without * + * modification, are permitted provided that the following conditions * + * are met: * + * * Redistributions of source code must retain the above copyright * + * notice, this list of conditions and the following disclaimer. * + * * Redistributions in binary form must reproduce the above * + * copyright notice, this list of conditions and the following * + * disclaimer in the documentation and/or other materials provided * + * with the distribution. * + * * Neither the name of the Mercury Engine nor the names of its * + * contributors may be used to endorse or promote products derived * + * from this software without specific prior written permission. * + * * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + ***************************************************************************/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |