Merge pull request #635 from just-bank/engine-fixes

Various engine fixes
This commit is contained in:
Thomas Fischer 2014-05-23 14:09:00 +02:00
commit cd978039ac
37 changed files with 106 additions and 86 deletions

View file

@ -45,6 +45,7 @@ protected:
public: public:
CameraFX(); CameraFX();
virtual ~CameraFX() { }
MatrixF & getTrans(){ return mCamFXTrans; } MatrixF & getTrans(){ return mCamFXTrans; }
virtual bool isExpired(){ return mElapsedTime >= mDuration; } virtual bool isExpired(){ return mElapsedTime >= mDuration; }

View file

@ -749,9 +749,9 @@ bool ExplosionData::preload(bool server, String &errorStr)
if( !server ) if( !server )
{ {
String errorStr; String sfxErrorStr;
if( !sfxResolve( &soundProfile, errorStr ) ) if( !sfxResolve( &soundProfile, sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", sfxErrorStr.c_str());
if (!particleEmitter && particleEmitterId != 0) if (!particleEmitter && particleEmitterId != 0)
if (Sim::findObject(particleEmitterId, particleEmitter) == false) if (Sim::findObject(particleEmitterId, particleEmitter) == false)
Con::errorf(ConsoleLogEntry::General, "Error, unable to load particle emitter for explosion datablock"); Con::errorf(ConsoleLogEntry::General, "Error, unable to load particle emitter for explosion datablock");

View file

@ -287,14 +287,14 @@ bool LightningData::preload(bool server, String &errorStr)
if (server == false) if (server == false)
{ {
String errorStr; String sfxErrorStr;
for (U32 i = 0; i < MaxThunders; i++) { for (U32 i = 0; i < MaxThunders; i++) {
if( !sfxResolve( &thunderSounds[ i ], errorStr ) ) if( !sfxResolve( &thunderSounds[ i ], sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
} }
if( !sfxResolve( &strikeSound, errorStr ) ) if( !sfxResolve( &strikeSound, sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
for (U32 i = 0; i < MaxTextures; i++) for (U32 i = 0; i < MaxTextures; i++)
{ {

View file

@ -179,7 +179,7 @@ DefineEngineMethod( MissionArea, getArea, const char *, (),,
char* returnBuffer = Con::getReturnBuffer(48); char* returnBuffer = Con::getReturnBuffer(48);
RectI area = object->getArea(); RectI area = object->getArea();
dSprintf(returnBuffer, sizeof(returnBuffer), "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y); dSprintf(returnBuffer, 48, "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y);
return(returnBuffer); return(returnBuffer);
} }

View file

@ -427,9 +427,9 @@ bool PlayerData::preload(bool server, String &errorStr)
{ {
for( U32 i = 0; i < MaxSounds; ++ i ) for( U32 i = 0; i < MaxSounds; ++ i )
{ {
String errorStr; String sfxErrorStr;
if( !sfxResolve( &sound[ i ], errorStr ) ) if( !sfxResolve( &sound[ i ], sfxErrorStr ) )
Con::errorf( "PlayerData::preload: %s", errorStr.c_str() ); Con::errorf( "PlayerData::preload: %s", sfxErrorStr.c_str() );
} }
} }
@ -586,7 +586,10 @@ bool PlayerData::preload(bool server, String &errorStr)
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShapeFP[i].getPath()); Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShapeFP[i].getPath());
if (!fileRef) if (!fileRef)
{
errorStr = String::ToString("PlayerData: Mounted image %d loading failed, shape \"%s\" is not found.",i,mShapeFP[i].getPath().getFullPath().c_str());
return false; return false;
}
if(server) if(server)
mCRCFP[i] = fileRef->getChecksum(); mCRCFP[i] = fileRef->getChecksum();

View file

@ -320,9 +320,9 @@ bool ProjectileData::preload(bool server, String &errorStr)
if (Sim::findObject(decalId, decal) == false) if (Sim::findObject(decalId, decal) == false)
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
String errorStr; String sfxErrorStr;
if( !sfxResolve( &sound, errorStr ) ) if( !sfxResolve( &sound, sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", sfxErrorStr.c_str());
if (!lightDesc && lightDescId != 0) if (!lightDesc && lightDescId != 0)
if (Sim::findObject(lightDescId, lightDesc) == false) if (Sim::findObject(lightDescId, lightDesc) == false)

View file

@ -136,11 +136,11 @@ bool ProximityMineData::preload( bool server, String& errorStr )
if ( !server ) if ( !server )
{ {
// Resolve sounds // Resolve sounds
String errorStr; String sfxErrorStr;
if( !sfxResolve( &armingSound, errorStr ) ) if( !sfxResolve( &armingSound, sfxErrorStr ) )
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() ); Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
if( !sfxResolve( &triggerSound, errorStr ) ) if( !sfxResolve( &triggerSound, sfxErrorStr ) )
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() ); Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
} }
if ( mShape ) if ( mShape )

View file

@ -302,6 +302,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
if (!collisionDetails.size() || collisionDetails[0] == -1) if (!collisionDetails.size() || collisionDetails[0] == -1)
{ {
Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail"); Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail");
errorStr = String::ToString("RigidShapeData: Couldn't load shape \"%s\"",shapeName);
return false; return false;
} }

View file

@ -306,7 +306,10 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShape.getPath()); Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShape.getPath());
if (!fileRef) if (!fileRef)
{
errorStr = String::ToString("ShapeBaseData: Couldn't load shape \"%s\"",shapeName);
return false; return false;
}
if(server) if(server)
mCRC = fileRef->getChecksum(); mCRC = fileRef->getChecksum();

View file

@ -462,7 +462,10 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(shape[i].getPath()); Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(shape[i].getPath());
if (!fileRef) if (!fileRef)
{
errorStr = String::ToString("ShapeBaseImageData: Couldn't load shape \"%s\"",name);
return false; return false;
}
if(server) if(server)
{ {

View file

@ -218,6 +218,7 @@ bool VehicleData::preload(bool server, String &errorStr)
if (!collisionDetails.size() || collisionDetails[0] == -1) if (!collisionDetails.size() || collisionDetails[0] == -1)
{ {
Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail"); Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail");
errorStr = String::ToString("VehicleData: Couldn't load shape \"%s\"",shapeName);
return false; return false;
} }

View file

@ -222,7 +222,7 @@ extern "C" {
{ {
// maxArgs improper on a number of console function/methods // maxArgs improper on a number of console function/methods
if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs) if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs)
return ""; return false;
SimObject* o = NULL; SimObject* o = NULL;
@ -230,7 +230,7 @@ extern "C" {
{ {
o = Sim::findObject(dAtoi(argv[1])); o = Sim::findObject(dAtoi(argv[1]));
if (!o) if (!o)
return ""; return false;
} }
return entry->cb.mBoolCallbackFunc(o, argc, argv); return entry->cb.mBoolCallbackFunc(o, argc, argv);

View file

@ -303,7 +303,7 @@ extern "C" {
Namespace::Entry* entry = GetEntry(nameSpace, name); Namespace::Entry* entry = GetEntry(nameSpace, name);
if (!entry) if (!entry)
return ""; return false;
return entry->cb.mBoolCallbackFunc(NULL, argc, argv); return entry->cb.mBoolCallbackFunc(NULL, argc, argv);
} }

View file

@ -403,14 +403,14 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
for(U32 i = 0; i < size; i++) for(U32 i = 0; i < size; i++)
st.read(&functionFloats[i]); st.read(&functionFloats[i]);
} }
U32 codeSize; U32 codeLength;
st.read(&codeSize); st.read(&codeLength);
st.read(&lineBreakPairCount); st.read(&lineBreakPairCount);
U32 totSize = codeSize + lineBreakPairCount * 2; U32 totSize = codeLength + lineBreakPairCount * 2;
code = new U32[totSize]; code = new U32[totSize];
for(i = 0; i < codeSize; i++) for(i = 0; i < codeLength; i++)
{ {
U8 b; U8 b;
st.read(&b); st.read(&b);
@ -420,10 +420,10 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
code[i] = b; code[i] = b;
} }
for(i = codeSize; i < totSize; i++) for(i = codeLength; i < totSize; i++)
st.read(&code[i]); st.read(&code[i]);
lineBreakPairs = code + codeSize; lineBreakPairs = code + codeLength;
// StringTable-ize our identifiers. // StringTable-ize our identifiers.
U32 identCount; U32 identCount;

View file

@ -76,6 +76,7 @@
// Disable some VC warnings that are irrelevant to us. // Disable some VC warnings that are irrelevant to us.
#pragma warning( push )
#pragma warning( disable : 4510 ) // default constructor could not be generated; all the Args structures are never constructed by us #pragma warning( disable : 4510 ) // default constructor could not be generated; all the Args structures are never constructed by us
#pragma warning( disable : 4610 ) // can never be instantiated; again Args is never constructed by us #pragma warning( disable : 4610 ) // can never be instantiated; again Args is never constructed by us
@ -2788,7 +2789,6 @@ struct _EngineConsoleCallbackHelper
// Re-enable some VC warnings we disabled for this file. // Re-enable some VC warnings we disabled for this file.
#pragma warning( default : 4510 ) #pragma warning( pop ) // 4510 and 4610
#pragma warning( default : 4610 )
#endif // !_ENGINEAPI_H_ #endif // !_ENGINEAPI_H_

View file

@ -127,7 +127,7 @@ public:
void breakProcess(); void breakProcess();
virtual void executionStopped(CodeBlock *code, U32 lineNumber); void executionStopped(CodeBlock *code, U32 lineNumber);
void send(const char *s); void send(const char *s);
void setDebugParameters(S32 port, const char *password, bool waitForClient); void setDebugParameters(S32 port, const char *password, bool waitForClient);
void processConsoleLine(const char *consoleLine); void processConsoleLine(const char *consoleLine);

View file

@ -47,6 +47,7 @@ public:
: mHitCount( 0 ) : mHitCount( 0 )
#endif #endif
{ }; { };
virtual ~_TorqueThreadStatic() { }
static const U32 getListIndex(){ return mListIndex; } static const U32 getListIndex(){ return mListIndex; }

View file

@ -154,7 +154,7 @@ void MD5Final( unsigned char digest[16], MD5Context* ctx)
MD5Transform(ctx->buf, (int *) ctx->in); MD5Transform(ctx->buf, (int *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4); byteReverse((unsigned char *) ctx->buf, 4);
memcpy(digest, ctx->buf, 16); memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ memset(ctx, 0, sizeof(MD5Context)); /* In case it's sensitive */
} }

View file

@ -46,19 +46,19 @@ class FixedSizeVector
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; }
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ]; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ] = g; }
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ]; mArray[ 7 ] = h; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ] = g; mArray[ 7 ] = h; }
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ]; mArray[ 7 ] = h; mArray[ 8 ] = i; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ] = g; mArray[ 7 ] = h; mArray[ 8 ] = i; }
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ]; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ] = g; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; }
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ]; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; mArray[ 10 ] = k; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ] = g; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; mArray[ 10 ] = k; }
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ]; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; mArray[ 10 ] = k; mArray[ 11 ] = l; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ] = g; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; mArray[ 10 ] = k; mArray[ 11 ] = l; }
FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l, const T& m ) FixedSizeVector( const T& a, const T& b, const T& c, const T& d, const T& e, const T& f, const T& g, const T& h, const T& i, const T& j, const T& k, const T& l, const T& m )
{ mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ]; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; mArray[ 10 ] = k; mArray[ 11 ] = l; mArray[ 12 ] =m; } { mArray[ 0 ] = a; mArray[ 1 ] = b; mArray[ 2 ] = c; mArray[ 3 ] = d; mArray[ 4 ] = e; mArray[ 5 ] = f; mArray[ 6 ] = g; mArray[ 7 ] = h; mArray[ 8 ] = i; mArray[ 9 ] = j; mArray[ 10 ] = k; mArray[ 11 ] = l; mArray[ 12 ] =m; }
U32 size() const { return SIZE; } U32 size() const { return SIZE; }
bool empty() const { return ( SIZE == 0 ); } bool empty() const { return ( SIZE == 0 ); }

View file

@ -444,7 +444,7 @@ const String GFXD3D9ShaderConstBuffer::describeSelf() const
GenericConstBufferLayout::ParamDesc pd; GenericConstBufferLayout::ParamDesc pd;
mVertexConstBufferLayoutF->getDesc(i, pd); mVertexConstBufferLayoutF->getDesc(i, pd);
ret += String::ToString(" Constant name: %s", pd.name); ret += String::ToString(" Constant name: %s", pd.name.c_str());
} }
return ret; return ret;

View file

@ -236,7 +236,7 @@ void GFXD3D9TextureManager::_innerCreateTexture( GFXD3D9TextureObject *retTex,
// If this is a render target, and it wants AA or wants to match the backbuffer (for example, to share the z) // If this is a render target, and it wants AA or wants to match the backbuffer (for example, to share the z)
// Check the caps though, if we can't stretchrect between textures, use the old RT method. (Which hopefully means // Check the caps though, if we can't stretchrect between textures, use the old RT method. (Which hopefully means
// that they can't force AA on us as well.) // that they can't force AA on us as well.)
if (retTex->mProfile->isRenderTarget() && mslevel != 0 && (mDeviceCaps.Caps2 && D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES)) if (retTex->mProfile->isRenderTarget() && mslevel != 0 && (mDeviceCaps.Caps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES))
{ {
D3D9Assert(mD3DDevice->CreateRenderTarget(width, height, d3dTextureFormat, D3D9Assert(mD3DDevice->CreateRenderTarget(width, height, d3dTextureFormat,
mstype, mslevel, false, retTex->getSurfacePtr(), NULL), mstype, mslevel, false, retTex->getSurfacePtr(), NULL),

View file

@ -74,6 +74,7 @@ public:
/// Constructor. /// Constructor.
ScreenShot(); ScreenShot();
virtual ~ScreenShot() { }
/// Used to start the screenshot capture. /// Used to start the screenshot capture.
void setPending( const char *filename, bool writeJPG, S32 tiles, F32 overlap ); void setPending( const char *filename, bool writeJPG, S32 tiles, F32 overlap );

View file

@ -221,6 +221,8 @@ protected:
// List with bitmaps which are done encoding // List with bitmaps which are done encoding
ThreadSafeDeque< GBitmap* > mProcessedBitmaps; ThreadSafeDeque< GBitmap* > mProcessedBitmaps;
public: public:
virtual ~VideoEncoder() { }
// Stores an encoded bitmap to be dealt with later // Stores an encoded bitmap to be dealt with later
void pushProcessedBitmap( GBitmap* bitmap ); void pushProcessedBitmap( GBitmap* bitmap );

View file

@ -1011,8 +1011,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w; localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
} }
else else
{ {
@ -1024,8 +1024,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = (getWidth() - mBitmapBounds[2].extent.x - txt_w) / 2; localStart.x = (getWidth() - bitmapBounds[2].extent.x - txt_w) / 2;
} else } else
{ {
@ -1043,8 +1043,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w; localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
} }
else else
{ {
@ -1095,8 +1095,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - mBitmapBounds[2].extent.x, localStart.y ) ); Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else } else

View file

@ -1167,8 +1167,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w; localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
} }
else else
{ {
@ -1180,8 +1180,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = (getWidth() - mBitmapBounds[2].extent.x - txt_w) / 2; localStart.x = (getWidth() - bitmapBounds[2].extent.x - txt_w) / 2;
} else } else
{ {
@ -1199,8 +1199,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
localStart.x = getWidth() - mBitmapBounds[2].extent.x - txt_w; localStart.x = getWidth() - bitmapBounds[2].extent.x - txt_w;
} }
else else
{ {
@ -1251,8 +1251,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{ {
// We're making use of a bitmap border, so take into account the // We're making use of a bitmap border, so take into account the
// right cap of the border. // right cap of the border.
RectI* mBitmapBounds = mProfile->mBitmapArrayRects.address(); RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - mBitmapBounds[2].extent.x, localStart.y ) ); Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else } else

View file

@ -3583,7 +3583,7 @@ void GuiTreeViewCtrl::onMiddleMouseDown(const GuiEvent & event)
for (S32 j = 0; j < mSelected.size(); j++) { for (S32 j = 0; j < mSelected.size(); j++) {
Con::printf("%d", mSelected[j]); Con::printf("%d", mSelected[j]);
} }
S32 mCurrentDragCell = mMouseOverCell.y; mCurrentDragCell = mMouseOverCell.y;
S32 midpCell = (mCurrentDragCell) * mItemHeight + (mItemHeight/2); S32 midpCell = (mCurrentDragCell) * mItemHeight + (mItemHeight/2);
S32 currentY = pt.y; S32 currentY = pt.y;
S32 yDiff = currentY-midpCell; S32 yDiff = currentY-midpCell;
@ -3648,7 +3648,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
break; break;
} }
} }
S32 mCurrentDragCell = mMouseOverCell.y; mCurrentDragCell = mMouseOverCell.y;
if (mVisibleItems[firstSelectedIndex] != firstItem ) if (mVisibleItems[firstSelectedIndex] != firstItem )
{ {
/* /*

View file

@ -79,7 +79,7 @@ ConsoleMethod(DbgFileView, getCurrentLine, const char *, 2, 2, "()"
S32 lineNum; S32 lineNum;
const char *file = object->getCurrentLine(lineNum); const char *file = object->getCurrentLine(lineNum);
char* ret = Con::getReturnBuffer(256); char* ret = Con::getReturnBuffer(256);
dSprintf(ret, sizeof(ret), "%s\t%d", file, lineNum); dSprintf(ret, 256, "%s\t%d", file, lineNum);
return ret; return ret;
} }

View file

@ -333,7 +333,7 @@ Var* GBufferConditionerHLSL::_conditionOutput( Var *unconditionedOutput, MultiLi
// Encode depth into two channels // Encode depth into two channels
if(mNormalStorageType != CartesianXYZ) if(mNormalStorageType != CartesianXYZ)
{ {
const U64 maxValPerChannel = 1 << mBitsPerChannel; const U64 maxValPerChannel = (U64)1 << mBitsPerChannel;
meta->addStatement( new GenOp( " \r\n // Encode depth into hi/lo\r\n" ) ); meta->addStatement( new GenOp( " \r\n // Encode depth into hi/lo\r\n" ) );
meta->addStatement( new GenOp( avar( " float2 _tempDepth = frac(@.a * float2(1.0, %llu.0));\r\n", maxValPerChannel - 1 ), meta->addStatement( new GenOp( avar( " float2 _tempDepth = frac(@.a * float2(1.0, %llu.0));\r\n", maxValPerChannel - 1 ),
unconditionedOutput ) ); unconditionedOutput ) );
@ -391,7 +391,7 @@ Var* GBufferConditionerHLSL::_unconditionInput( Var *conditionedInput, MultiLine
// Recover depth from encoding // Recover depth from encoding
if(mNormalStorageType != CartesianXYZ) if(mNormalStorageType != CartesianXYZ)
{ {
const U64 maxValPerChannel = 1 << mBitsPerChannel; const U64 maxValPerChannel = (U64)1 << mBitsPerChannel;
meta->addStatement( new GenOp( " \r\n // Decode depth\r\n" ) ); meta->addStatement( new GenOp( " \r\n // Decode depth\r\n" ) );
meta->addStatement( new GenOp( avar( " @.w = dot( @.zw, float2(1.0, 1.0/%llu.0));\r\n", maxValPerChannel - 1 ), meta->addStatement( new GenOp( avar( " @.w = dot( @.zw, float2(1.0, 1.0/%llu.0));\r\n", maxValPerChannel - 1 ),
retVar, conditionedInput ) ); retVar, conditionedInput ) );

View file

@ -48,6 +48,8 @@ class ShaderFeatureConstHandles
{ {
public: public:
virtual ~ShaderFeatureConstHandles() { }
virtual void init( GFXShader *shader ) = 0; virtual void init( GFXShader *shader ) = 0;
virtual void setConsts( SceneRenderState *state, virtual void setConsts( SceneRenderState *state,

View file

@ -849,7 +849,7 @@ void TerrCell::_updateMaterials()
if ( index == U8_MAX || index > 63 ) if ( index == U8_MAX || index > 63 )
continue; continue;
mMaterials |= (U64)(1<<index); mMaterials |= (U64)((U64)1<<index);
} }
} }

View file

@ -623,7 +623,7 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry)
delete meshPrims[iPrim]; delete meshPrims[iPrim];
} }
void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const MatrixF& objectOffset, void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const MatrixF& objOffset,
Vector<Point3F>& v_points, Vector<Point3F>& v_points,
Vector<Point3F>& v_norms, Vector<Point3F>& v_norms,
Vector<ColorI>& v_colors, Vector<ColorI>& v_colors,
@ -693,7 +693,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const
if (appNode->invertMeshes) if (appNode->invertMeshes)
points_array[iVert].z = -points_array[iVert].z; points_array[iVert].z = -points_array[iVert].z;
objectOffset.mulP(points_array[iVert]); objOffset.mulP(points_array[iVert]);
} }
if (appendValues || ((tuple.uv >= 0) && (tuple.uv < streams.uvs.size()))) { if (appendValues || ((tuple.uv >= 0) && (tuple.uv < streams.uvs.size()))) {
@ -755,7 +755,7 @@ void ColladaAppMesh::getVertexData(const domGeometry* geometry, F32 time, const
delete meshPrims[iPrim]; delete meshPrims[iPrim];
} }
void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const MatrixF& objectOffset, void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const MatrixF& objOffset,
Vector<Point3F>& v_points, Vector<Point3F>& v_points,
Vector<Point3F>& v_norms, Vector<Point3F>& v_norms,
Vector<ColorI>& v_colors, Vector<ColorI>& v_colors,
@ -807,7 +807,7 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
return; return;
getPrimitives(baseGeometry); getPrimitives(baseGeometry);
getVertexData(baseGeometry, time, objectOffset, v_points, v_norms, v_colors, v_uvs, v_uv2s, true); getVertexData(baseGeometry, time, objOffset, v_points, v_norms, v_colors, v_uvs, v_uv2s, true);
// Get pointers to the arrays of base geometry data // Get pointers to the arrays of base geometry data
Point3F* points_array = &v_points[v_points.size() - vertTuples.size()]; Point3F* points_array = &v_points[v_points.size() - vertTuples.size()];
@ -863,7 +863,7 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
if (uv2s_array) if (uv2s_array)
targetUv2s.set(uv2s_array, vertTuples.size()); targetUv2s.set(uv2s_array, vertTuples.size());
getVertexData(targetGeoms[iTarget], time, objectOffset, targetPoints, targetNorms, targetColors, targetUvs, targetUv2s, false); getVertexData(targetGeoms[iTarget], time, objOffset, targetPoints, targetNorms, targetColors, targetUvs, targetUv2s, false);
// Combine with base geometry // Combine with base geometry
for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) { for (S32 iVert = 0; iVert < vertTuples.size(); iVert++) {
@ -883,7 +883,7 @@ void ColladaAppMesh::getMorphVertexData(const domMorph* morph, F32 time, const M
} }
} }
void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objectOffset) void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objOffset)
{ {
// Find the geometry element for this mesh. Could be one of 3 things: // Find the geometry element for this mesh. Could be one of 3 things:
// 1) a simple static mesh (Collada <geometry> element) // 1) a simple static mesh (Collada <geometry> element)
@ -923,10 +923,10 @@ void ColladaAppMesh::lockMesh(F32 t, const MatrixF& objectOffset)
// Now get the vertex data at the specified time // Now get the vertex data at the specified time
if (geometry->getElementType() == COLLADA_TYPE::GEOMETRY) { if (geometry->getElementType() == COLLADA_TYPE::GEOMETRY) {
getPrimitives(daeSafeCast<domGeometry>(geometry)); getPrimitives(daeSafeCast<domGeometry>(geometry));
getVertexData(daeSafeCast<domGeometry>(geometry), t, objectOffset, points, normals, colors, uvs, uv2s, true); getVertexData(daeSafeCast<domGeometry>(geometry), t, objOffset, points, normals, colors, uvs, uv2s, true);
} }
else if (geometry->getElementType() == COLLADA_TYPE::MORPH) { else if (geometry->getElementType() == COLLADA_TYPE::MORPH) {
getMorphVertexData(daeSafeCast<domMorph>(geometry), t, objectOffset, points, normals, colors, uvs, uv2s); getMorphVertexData(daeSafeCast<domMorph>(geometry), t, objOffset, points, normals, colors, uvs, uv2s);
} }
else { else {
daeErrorHandler::get()->handleWarning(avar("Unsupported geometry type " daeErrorHandler::get()->handleWarning(avar("Unsupported geometry type "

View file

@ -109,11 +109,11 @@ protected:
bool checkGeometryType(const daeElement* element); bool checkGeometryType(const daeElement* element);
void getPrimitives(const domGeometry* geometry); void getPrimitives(const domGeometry* geometry);
void getVertexData( const domGeometry* geometry, F32 time, const MatrixF& objectOffset, void getVertexData( const domGeometry* geometry, F32 time, const MatrixF& objOffset,
Vector<Point3F>& points, Vector<Point3F>& norms, Vector<ColorI>& colors, Vector<Point3F>& points, Vector<Point3F>& norms, Vector<ColorI>& colors,
Vector<Point2F>& uvs, Vector<Point2F>& uv2s, bool appendValues); Vector<Point2F>& uvs, Vector<Point2F>& uv2s, bool appendValues);
void getMorphVertexData( const domMorph* morph, F32 time, const MatrixF& objectOffset, void getMorphVertexData( const domMorph* morph, F32 time, const MatrixF& objOffset,
Vector<Point3F>& points, Vector<Point3F>& norms, Vector<ColorI>& colors, Vector<Point3F>& points, Vector<Point3F>& norms, Vector<ColorI>& colors,
Vector<Point2F>& uvs, Vector<Point2F>& uv2s ); Vector<Point2F>& uvs, Vector<Point2F>& uv2s );
@ -211,8 +211,8 @@ public:
/// Generate the vertex, normal and triangle data for the mesh. /// Generate the vertex, normal and triangle data for the mesh.
/// ///
/// @param time Time at which to generate the mesh data /// @param time Time at which to generate the mesh data
/// @param objectOffset Transform to apply to the generated data (bounds transform) /// @param objOffset Transform to apply to the generated data (bounds transform)
void lockMesh(F32 time, const MatrixF& objectOffset); void lockMesh(F32 time, const MatrixF& objOffset);
/// Get the transform of this mesh at a certain time /// Get the transform of this mesh at a certain time
/// ///

View file

@ -430,6 +430,8 @@ public:
class BasePrimitive class BasePrimitive
{ {
public: public:
virtual ~BasePrimitive() { }
/// Return true if the element is a geometric primitive type /// Return true if the element is a geometric primitive type
static bool isPrimitive(const daeElement* element) static bool isPrimitive(const daeElement* element)
{ {

View file

@ -1225,7 +1225,7 @@ void TSShape::assembleShape()
if (smReadVersion<23) if (smReadVersion<23)
{ {
// get detail information about skins... // get detail information about skins...
S32 * detailFirstSkin = tsalloc.getPointer32(numDetails); S32 * detFirstSkin = tsalloc.getPointer32(numDetails);
S32 * detailNumSkins = tsalloc.getPointer32(numDetails); S32 * detailNumSkins = tsalloc.getPointer32(numDetails);
tsalloc.checkGuard(); tsalloc.checkGuard();
@ -1257,7 +1257,7 @@ void TSShape::assembleShape()
ptr32 = tsalloc.allocShape32(numSkins); ptr32 = tsalloc.allocShape32(numSkins);
for (i=0; i<numSkins; i++) for (i=0; i<numSkins; i++)
{ {
bool skip = i<detailFirstSkin[skipDL]; bool skip = i<detFirstSkin[skipDL];
TSSkinMesh * skin = (TSSkinMesh*)TSMesh::assembleMesh(TSMesh::SkinMeshType,skip); TSSkinMesh * skin = (TSSkinMesh*)TSMesh::assembleMesh(TSMesh::SkinMeshType,skip);
if (meshes.address()) if (meshes.address())
{ {
@ -1286,7 +1286,7 @@ void TSShape::assembleShape()
tsalloc.checkGuard(); tsalloc.checkGuard();
// we now have skins in mesh list...add skin objects to object list and patch things up // we now have skins in mesh list...add skin objects to object list and patch things up
fixupOldSkins(numMeshes,numSkins,numDetails,detailFirstSkin,detailNumSkins); fixupOldSkins(numMeshes,numSkins,numDetails,detFirstSkin,detailNumSkins);
} }
// allocate storage space for some arrays (filled in during Shape::init)... // allocate storage space for some arrays (filled in during Shape::init)...

View file

@ -597,7 +597,7 @@ class TSShape
/// mem buffer transfer helper (indicate when we don't want to include a particular mesh/decal) /// mem buffer transfer helper (indicate when we don't want to include a particular mesh/decal)
bool checkSkip(S32 meshNum, S32 & curObject, S32 skipDL); bool checkSkip(S32 meshNum, S32 & curObject, S32 skipDL);
void fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * detailFirstSkin, S32 * detailNumSkins); void fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * detFirstSkin, S32 * detailNumSkins);
/// @name Shape Editing /// @name Shape Editing
/// @{ /// @{

View file

@ -485,8 +485,8 @@ protected:
/// @} /// @}
virtual void render( const TSRenderState &rdata ); void render( const TSRenderState &rdata );
virtual void render( const TSRenderState &rdata, S32 dl, F32 intraDL = 0.0f ); void render( const TSRenderState &rdata, S32 dl, F32 intraDL = 0.0f );
void animate() { animate( mCurrentDetailLevel ); } void animate() { animate( mCurrentDetailLevel ); }
void animate(S32 dl); void animate(S32 dl);

View file

@ -29,7 +29,7 @@
// put old skins into object list // put old skins into object list
//------------------------------------------------- //-------------------------------------------------
void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * detailFirstSkin, S32 * detailNumSkins) void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * detFirstSkin, S32 * detailNumSkins)
{ {
#if !defined(TORQUE_MAX_LIB) #if !defined(TORQUE_MAX_LIB)
// this method not necessary in exporter, and a couple lines won't compile for exporter // this method not necessary in exporter, and a couple lines won't compile for exporter
@ -63,9 +63,9 @@ void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * d
// find one mesh per detail to add to this object // find one mesh per detail to add to this object
// don't really need to be versions of the same object // don't really need to be versions of the same object
i = 0; i = 0;
while (i<detailFirstSkin[dl] || detailFirstSkin[dl]<0) while (i<detFirstSkin[dl] || detFirstSkin[dl]<0)
i++; i++;
for (; i<numSkins && i<detailFirstSkin[dl]+detailNumSkins[dl]; i++) for (; i<numSkins && i<detFirstSkin[dl]+detailNumSkins[dl]; i++)
{ {
if (skins[i]) if (skins[i])
{ {
@ -77,7 +77,7 @@ void TSShape::fixupOldSkins(S32 numMeshes, S32 numSkins, S32 numDetails, S32 * d
break; break;
} }
} }
if (i==numSkins || i==detailFirstSkin[dl]+detailNumSkins[dl]) if (i==numSkins || i==detFirstSkin[dl]+detailNumSkins[dl])
{ {
skinsCopy.push_back(NULL); skinsCopy.push_back(NULL);
object.numMeshes++; object.numMeshes++;