From: <baz...@us...> - 2008-02-11 08:53:40
|
Revision: 7852 http://armagetronad.svn.sourceforge.net/armagetronad/?rev=7852&view=rev Author: bazaarmagetron Date: 2008-02-11 00:53:45 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Manuel Moos: Performance improvement: the cycle now triggers rendering of its walls, the renderer does not have to traverse all walls (and render them multiple times). Modified Paths: -------------- armagetronad/branches/0.2.8/armagetronad/src/engine/eAdvWall.h armagetronad/branches/0.2.8/armagetronad/src/engine/eDisplay.cpp armagetronad/branches/0.2.8/armagetronad/src/tools/tLinkedList.h armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.cpp armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.h armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.cpp armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.h Property Changed: ---------------- armagetronad/branches/0.2.8/armagetronad/ Property changes on: armagetronad/branches/0.2.8/armagetronad ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2008-02-10 22:22:53.944999933 +0100 committer: Manuel Moos <z-...@us...> properties: branch-nick: armagetronad + timestamp: 2008-02-11 09:48:00.394000053 +0100 committer: Manuel Moos <z-...@us...> properties: branch-nick: armagetronad Name: bzr:revision-id:v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs - 538 z-...@us...-20080207163247-91eo4mrbiind6xrz 540 z-...@us...-20080208122252-nvhak6io6j0ui3aa 541 z-...@us...-20080208123045-76r9p0l7iwpbq1hy 542 z-...@us...-20080208124439-10s870zpb61b8buo 543 z-...@us...-20080208133845-a22a5j0z6vjgfaby 544 z-...@us...-20080208134134-bxi2z09linxnzl63 545 z-...@us...-20080208165812-xabnqfq34666e2z5 546 z-...@us...-20080208170201-jmubp7bm7lrpmw4z 551 z-...@us...-20080209115751-1w0yo2lwtv1xxmsc 552 z-...@us...-20080209121700-8mf9ure4bfaxtqfp 553 z-...@us...-20080209130301-0kw4jxjm7cvmbptp 561 z-...@us...-20080210002729-ee7t2nfh542nxksj 563 wrt...@us...-20080210153610-ucwvl013f1yil7og 564 z-...@us...-20080210212253-bxpkh4mtyisctr39 + 538 z-...@us...-20080207163247-91eo4mrbiind6xrz 540 z-...@us...-20080208122252-nvhak6io6j0ui3aa 541 z-...@us...-20080208123045-76r9p0l7iwpbq1hy 542 z-...@us...-20080208124439-10s870zpb61b8buo 543 z-...@us...-20080208133845-a22a5j0z6vjgfaby 544 z-...@us...-20080208134134-bxi2z09linxnzl63 545 z-...@us...-20080208165812-xabnqfq34666e2z5 546 z-...@us...-20080208170201-jmubp7bm7lrpmw4z 551 z-...@us...-20080209115751-1w0yo2lwtv1xxmsc 552 z-...@us...-20080209121700-8mf9ure4bfaxtqfp 553 z-...@us...-20080209130301-0kw4jxjm7cvmbptp 561 z-...@us...-20080210002729-ee7t2nfh542nxksj 563 wrt...@us...-20080210153610-ucwvl013f1yil7og 564 z-...@us...-20080210212253-bxpkh4mtyisctr39 565 z-...@us...-20080211084800-j2c13scyxqc31m8x Modified: armagetronad/branches/0.2.8/armagetronad/src/engine/eAdvWall.h =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/engine/eAdvWall.h 2008-02-11 00:21:35 UTC (rev 7851) +++ armagetronad/branches/0.2.8/armagetronad/src/engine/eAdvWall.h 2008-02-11 08:53:45 UTC (rev 7852) @@ -57,7 +57,7 @@ } #endif -virtual REAL Height() const{return height;} + virtual REAL Height() const{return height;} virtual REAL SeeHeight() const{return height*40;} Modified: armagetronad/branches/0.2.8/armagetronad/src/engine/eDisplay.cpp =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/engine/eDisplay.cpp 2008-02-11 00:21:35 UTC (rev 7851) +++ armagetronad/branches/0.2.8/armagetronad/src/engine/eDisplay.cpp 2008-02-11 08:53:45 UTC (rev 7852) @@ -506,8 +506,8 @@ glEnable(GL_DEPTH_TEST); if (eWalls){ - glDisable(GL_CULL_FACE); - draw_eWall(this,viewer,0,zNear,cameras(viewer)); + // glDisable(GL_CULL_FACE); + // draw_eWall(this,viewer,0,zNear,cameras(viewer)); /* #ifdef DEBUG Modified: armagetronad/branches/0.2.8/armagetronad/src/tools/tLinkedList.h =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/tools/tLinkedList.h 2008-02-11 00:21:35 UTC (rev 7851) +++ armagetronad/branches/0.2.8/armagetronad/src/tools/tLinkedList.h 2008-02-11 08:53:45 UTC (rev 7852) @@ -28,6 +28,8 @@ #ifndef ArmageTron_tLinkedList_H #define ArmageTron_tLinkedList_H +#include "tError.h" + #include <stdlib.h> class tListItemBase{ @@ -63,7 +65,11 @@ template <class T> class tListItem:public tListItemBase{ public: - tListItem():tListItemBase(){}; + tListItem():tListItemBase() + { + // this class only works under this condition: + tASSERT( static_cast< tListItemBase * >( ( T * )(NULL) ) == NULL ); + }; tListItem(T *&a):tListItemBase(reinterpret_cast<tListItemBase*&>(a)){}; T *Next(){return reinterpret_cast<T*>(next);} Modified: armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.cpp =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.cpp 2008-02-11 00:21:35 UTC (rev 7851) +++ armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.cpp 2008-02-11 08:53:45 UTC (rev 7852) @@ -2264,6 +2264,7 @@ turning(NULL), skew(0),skewDot(0), rotationFrontWheel(1,0),rotationRearWheel(1,0),heightFrontWheel(0),heightRearWheel(0), + wallList_(NULL), currentWall(NULL), lastWall(NULL) { @@ -2454,6 +2455,12 @@ } bool gCycle::Timestep(REAL currentTime){ + // keep cycle in list for rendering as long as walls are active + if ( !Alive() && wallList_ ) + { + return false; + } + // clear out dangerous info when we're done gMaxSpaceAheadHitInfoClearer hitInfoClearer( maxSpaceHit_ ); @@ -2628,6 +2635,12 @@ currentWall->Update(predictTime, PredictPosition() ); } + // keep cycle in list for rendering as long as walls are active + if ( wallList_ ) + { + return false; + } + return ret; } @@ -3843,7 +3856,39 @@ } +static REAL mp_eWall_stretch=4; +static tSettingItem<REAL> mpws +("MOVIEPACK_WALL_STRETCH",mp_eWall_stretch); + +static rFileTexture dir_eWall(rTextureGroups::TEX_WALL,"textures/dir_wall.png",1,0,1); +static rFileTexture dir_eWall_moviepack(rTextureGroups::TEX_WALL,"moviepack/dir_wall.png",1,0,1); + +static void dir_eWall_select() +{ + if (sg_MoviePack()){ + TexMatrix(); + IdentityMatrix(); + ScaleMatrix(1/mp_eWall_stretch,1,1); + dir_eWall_moviepack.Select(); + } + else + { + dir_eWall.Select(); + } +} + void gCycle::Render(const eCamera *cam){ + dir_eWall_select(); + + // render walls + gNetPlayerWall * run = wallList_; + while( run ) + { + run->Render( cam ); + run = run->Next(); + } + + // are we blinking from invulnerability? bool blinking = false; if ( lastTime > spawnTime_ && !Vulnerable() ) { @@ -4516,6 +4561,7 @@ spark(NULL), skew(0),skewDot(0), rotationFrontWheel(1,0),rotationRearWheel(1,0),heightFrontWheel(0),heightRearWheel(0), + wallList_(NULL), currentWall(NULL), lastWall(NULL) { Modified: armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.h =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.h 2008-02-11 00:21:35 UTC (rev 7851) +++ armagetronad/branches/0.2.8/armagetronad/src/tron/gCycle.h 2008-02-11 08:53:45 UTC (rev 7852) @@ -170,6 +170,7 @@ private: void TransferPositionCorrectionToDistanceCorrection(); + gNetPlayerWall * wallList_; //!< linked list of all walls tCHECKED_PTR(gNetPlayerWall) currentWall; //!< the wall that currenly is attached to the cycle tCHECKED_PTR(gNetPlayerWall) lastWall; //!< the last wall that was attached to this cycle tCHECKED_PTR(gNetPlayerWall) lastNetWall; //!< the last wall received over the network Modified: armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.cpp =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.cpp 2008-02-11 00:21:35 UTC (rev 7851) +++ armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.cpp 2008-02-11 08:53:45 UTC (rev 7852) @@ -105,10 +105,6 @@ static nSettingItem<tString> lalala_mp_dir_eWall("TEXTURE_MP_DIR_WALL", lala_mp_dir_eWall); rFileTexture dir_eWall_moviepack(rTextureGroups::TEX_WALL, lala_mp_dir_eWall, 1,0); */ - -static rFileTexture dir_eWall(rTextureGroups::TEX_WALL,"textures/dir_wall.png",1,0,1); -static rFileTexture dir_eWall_moviepack(rTextureGroups::TEX_WALL,"moviepack/dir_wall.png",1,0,1); - #endif static REAL sg_RimStretchX=100; @@ -128,25 +124,6 @@ static tSettingItem<REAL> sg_MPRimStretchYConf ("MOVIEPACK_RIM_WALL_STRETCH_Y",sg_MPRimStretchY); -static REAL mp_eWall_stretch=4; -static tSettingItem<REAL> mpws -("MOVIEPACK_WALL_STRETCH",mp_eWall_stretch); - -#ifndef DEDICATED -static void dir_eWall_select(){ - if (sg_MoviePack()){ - TexMatrix(); - IdentityMatrix(); - ScaleMatrix(1/mp_eWall_stretch,1,1); - dir_eWall_moviepack.Select(); - } - else - dir_eWall.Select(); -} - - -#endif - /* ********************************************** RimWall ********************************************** */ @@ -885,8 +862,6 @@ glCallList(displayList_); else { - dir_eWall_select(); - REAL r,g,b; if (cycle_){ r=cycle_->trailColor_.r; @@ -1059,12 +1034,12 @@ glVertex3f(p2.x,p2.y,h*hfrac); RenderEnd(); sr_DepthOffset(false); + if ( rTextureGroups::TextureMode[rTextureGroups::TEX_WALL] != 0 ) + glEnable(GL_TEXTURE_2D); } //glColor4f(r,g,b,a); - dir_eWall_select(); - glColor3f(r,g,b); #ifdef XDEBUG @@ -1166,15 +1141,12 @@ } RenderEnd(); sr_DepthOffset(false); + if ( rTextureGroups::TextureMode[rTextureGroups::TEX_WALL] != 0 ) + glEnable(GL_TEXTURE_2D); } - dir_eWall_select(); - - BeginQuadStrip(); - - //REAL H=h*hfrac; //ppos=ePlayer->pos-ePlayer->dir*gCYCLE__LEN; @@ -1484,6 +1456,14 @@ void gNetPlayerWall::MyInitAfterCreation() { +#ifndef DEDICATED + // put yourself into rendering list + if ( cycle_ ) + { + Insert( cycle_->wallList_ ); + } +#endif + //w= #ifdef DEBUG if (!finite(end.x) || !finite(end.y)) Modified: armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.h =================================================================== --- armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.h 2008-02-11 00:21:35 UTC (rev 7851) +++ armagetronad/branches/0.2.8/armagetronad/src/tron/gWall.h 2008-02-11 08:53:45 UTC (rev 7852) @@ -144,7 +144,7 @@ // the sn_netObjects that represents eWalls across the network. -class gNetPlayerWall: public nNetObject{ +class gNetPlayerWall: public tListItem< gNetPlayerWall >, public nNetObject{ friend class gCycle; int id,griddedid; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |