From 46f140710a7c80e508ab98735078b848bde6732e Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Tue, 20 Nov 2012 08:18:14 +1100 Subject: [PATCH 1/3] Prevented looking up incorrect object handles. Previously, dAtoi would be called on arbitrary strings delimited only by the / character. Now, Sim::findObject actually checks that object handles (strings starting with a digit) actually only contain digits or slashes. --- Engine/source/console/simManager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index 0f00d1e33..2347219aa 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -367,6 +367,8 @@ SimObject* findObject(const char* name) return NULL; return obj->findObject(temp); } + else if (c < '0' || c > '9') + return NULL; } } S32 len; From b661abaf838b6b1e3b2f635a23ffffec7711c80b Mon Sep 17 00:00:00 2001 From: Andrew Mac Date: Mon, 23 Jun 2014 14:58:06 -0300 Subject: [PATCH 2/3] Fix for unexpected behavior described in issue #704 --- Engine/source/console/compiledEval.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 37f621997..da1aa9f20 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -1572,6 +1572,7 @@ breakContinue: Con::warnf(ConsoleLogEntry::General,"%s: Unable to find object: '%s' attempting to call function '%s'", getFileLine(ip-4), callArgv[1], fnName); STR.popFrame(); + STR.setStringValue(""); break; } From 901ceb943d735915113c468bd67d050c25a41c7d Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 9 Jul 2014 15:46:15 -0500 Subject: [PATCH 3/3] deprecated functionality. T3D handles this in the reflector class. --- Engine/source/gfx/sim/cubemapData.cpp | 163 +++----------------------- Engine/source/gfx/sim/cubemapData.h | 13 +- 2 files changed, 16 insertions(+), 160 deletions(-) diff --git a/Engine/source/gfx/sim/cubemapData.cpp b/Engine/source/gfx/sim/cubemapData.cpp index aa06144af..2d0100c77 100644 --- a/Engine/source/gfx/sim/cubemapData.cpp +++ b/Engine/source/gfx/sim/cubemapData.cpp @@ -39,14 +39,6 @@ IMPLEMENT_CONOBJECT( CubemapData ); CubemapData::CubemapData() { mCubemap = NULL; - mDynamic = false; - mDynamicSize = 512; - mDynamicNearDist = 0.1f; - mDynamicFarDist = 100.0f; - mDynamicObjectTypeMask = 0; -#ifdef INIT_HACK - mInit = false; -#endif } CubemapData::~CubemapData() @@ -84,22 +76,6 @@ void CubemapData::initPersistFields() " - cubeFace[3] is +Z\n" " - cubeFace[4] is -Y\n" " - cubeFace[5] is +Y\n" ); - - addField("dynamic", TypeBool, Offset(mDynamic, CubemapData), - "Set to true if this is a dynamic cubemap. The default is false." ); - - addField("dynamicSize", TypeS32, Offset(mDynamicSize, CubemapData), - "The size of each dynamic cubemap face in pixels." ); - - addField("dynamicNearDist", TypeF32, Offset(mDynamicNearDist, CubemapData), - "The near clip distance used when rendering to the dynamic cubemap." ); - - addField("dynamicFarDist", TypeF32, Offset(mDynamicFarDist, CubemapData), - "The far clip distance used when rendering to the dynamic cubemap." ); - - addField("dynamicObjectTypeMask", TypeS32, Offset(mDynamicObjectTypeMask, CubemapData), - "The typemask used to filter the objects rendered to the dynamic cubemap." ); - Parent::initPersistFields(); } @@ -118,136 +94,27 @@ void CubemapData::createMap() { if( !mCubemap ) { - if( mDynamic ) - { - mCubemap = GFX->createCubemap(); - mCubemap->initDynamic( mDynamicSize ); - mDepthBuff = GFXTexHandle( mDynamicSize, mDynamicSize, GFXFormatD24S8, - &GFXDefaultZTargetProfile, avar("%s() - mDepthBuff (line %d)", __FUNCTION__, __LINE__)); - mRenderTarget = GFX->allocRenderToTextureTarget(); - } - else - { - bool initSuccess = true; - - for( U32 i=0; i<6; i++ ) - { - if( !mCubeFaceFile[i].isEmpty() ) - { + bool initSuccess = true; + + for( U32 i=0; i<6; i++ ) + { + if( !mCubeFaceFile[i].isEmpty() ) + { if(!mCubeFace[i].set(mCubeFaceFile[i], &GFXDefaultStaticDiffuseProfile, avar("%s() - mCubeFace[%d] (line %d)", __FUNCTION__, i, __LINE__) )) { - Con::errorf("CubemapData::createMap - Failed to load texture '%s'", mCubeFaceFile[i].c_str()); - initSuccess = false; + Con::errorf("CubemapData::createMap - Failed to load texture '%s'", mCubeFaceFile[i].c_str()); + initSuccess = false; } - } - } - - if( initSuccess ) - { - mCubemap = GFX->createCubemap(); - mCubemap->initStatic( mCubeFace ); - } - } + } + } + if( initSuccess ) + { + mCubemap = GFX->createCubemap(); + mCubemap->initStatic( mCubeFace ); + } } } -void CubemapData::updateDynamic(SceneManager* sm, const Point3F& pos) -{ - AssertFatal(mDynamic, "This is not a dynamic cubemap!"); - - GFXDEBUGEVENT_SCOPE( CubemapData_updateDynamic, ColorI::WHITE ); - -#ifdef INIT_HACK - if( mInit ) return; - mInit = true; -#endif - - GFX->pushActiveRenderTarget(); - mRenderTarget->attachTexture(GFXTextureTarget::DepthStencil, mDepthBuff ); - - // store current matrices - GFXTransformSaver saver; - F32 oldVisibleDist = sm->getVisibleDistance(); - - // set projection to 90 degrees vertical and horizontal - { - F32 left, right, top, bottom; - MathUtils::makeFrustum( &left, &right, &top, &bottom, M_HALFPI_F, 1.0f, mDynamicNearDist ); - GFX->setFrustum( left, right, bottom, top, mDynamicNearDist, mDynamicFarDist ); - } - sm->setVisibleDistance(mDynamicFarDist); - - // We don't use a special clipping projection, but still need to initialize - // this for objects like SkyBox which will use it during a reflect pass. - gClientSceneGraph->setNonClipProjection( (MatrixF&) GFX->getProjectionMatrix() ); - - // Loop through the six faces of the cube map. - for(U32 i=0; i<6; i++) - { - // Standard view that will be overridden below. - VectorF vLookatPt(0.0f, 0.0f, 0.0f), vUpVec(0.0f, 0.0f, 0.0f), vRight(0.0f, 0.0f, 0.0f); - - switch( i ) - { - case 0 : // D3DCUBEMAP_FACE_POSITIVE_X: - vLookatPt = VectorF( 1.0f, 0.0f, 0.0f ); - vUpVec = VectorF( 0.0f, 1.0f, 0.0f ); - break; - case 1 : // D3DCUBEMAP_FACE_NEGATIVE_X: - vLookatPt = VectorF( -1.0f, 0.0f, 0.0f ); - vUpVec = VectorF( 0.0f, 1.0f, 0.0f ); - break; - case 2 : // D3DCUBEMAP_FACE_POSITIVE_Y: - vLookatPt = VectorF( 0.0f, 1.0f, 0.0f ); - vUpVec = VectorF( 0.0f, 0.0f,-1.0f ); - break; - case 3 : // D3DCUBEMAP_FACE_NEGATIVE_Y: - vLookatPt = VectorF( 0.0f, -1.0f, 0.0f ); - vUpVec = VectorF( 0.0f, 0.0f, 1.0f ); - break; - case 4 : // D3DCUBEMAP_FACE_POSITIVE_Z: - vLookatPt = VectorF( 0.0f, 0.0f, 1.0f ); - vUpVec = VectorF( 0.0f, 1.0f, 0.0f ); - break; - case 5: // D3DCUBEMAP_FACE_NEGATIVE_Z: - vLookatPt = VectorF( 0.0f, 0.0f, -1.0f ); - vUpVec = VectorF( 0.0f, 1.0f, 0.0f ); - break; - } - - // create camera matrix - VectorF cross = mCross( vUpVec, vLookatPt ); - cross.normalizeSafe(); - - MatrixF matView(true); - matView.setColumn( 0, cross ); - matView.setColumn( 1, vLookatPt ); - matView.setColumn( 2, vUpVec ); - matView.setPosition( pos ); - matView.inverse(); - - GFX->pushWorldMatrix(); - GFX->setWorldMatrix(matView); - - mRenderTarget->attachTexture( GFXTextureTarget::Color0, mCubemap, i ); - GFX->setActiveRenderTarget( mRenderTarget ); - GFX->clear( GFXClearStencil | GFXClearTarget | GFXClearZBuffer, ColorI( 64, 64, 64 ), 1.f, 0 ); - - // render scene - sm->renderScene( SPT_Reflect, mDynamicObjectTypeMask ); - - // Resolve render target for each face - mRenderTarget->resolve(); - GFX->popWorldMatrix(); - } - - // restore render surface and depth buffer - GFX->popActiveRenderTarget(); - - mRenderTarget->attachTexture(GFXTextureTarget::Color0, NULL); - sm->setVisibleDistance(oldVisibleDist); -} - void CubemapData::updateFaces() { bool initSuccess = true; diff --git a/Engine/source/gfx/sim/cubemapData.h b/Engine/source/gfx/sim/cubemapData.h index 76604a886..cd0560ac0 100644 --- a/Engine/source/gfx/sim/cubemapData.h +++ b/Engine/source/gfx/sim/cubemapData.h @@ -60,16 +60,8 @@ public: // Force creation of cubemap void createMap(); - // Update a dynamic cubemap @ pos - void updateDynamic(SceneManager* sm, const Point3F& pos); + // Update a static cubemap @ pos void updateFaces(); - - // Dynamic cube map support - bool mDynamic; - U32 mDynamicSize; - F32 mDynamicNearDist; - F32 mDynamicFarDist; - U32 mDynamicObjectTypeMask; protected: @@ -78,9 +70,6 @@ protected: GFXTexHandle mDepthBuff; GFXTextureTargetRef mRenderTarget; -#ifdef INIT_HACK - bool mInit; -#endif }; #endif // CUBEMAPDATA