mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
Merge branch 'development' into gtest-tests
This commit is contained in:
commit
7555f1d2cc
30 changed files with 330 additions and 64 deletions
|
|
@ -1168,9 +1168,7 @@ void Precipitation::destroySplash(Raindrop *drop)
|
|||
PROFILE_START(PrecipDestroySplash);
|
||||
if (drop == mSplashHead)
|
||||
{
|
||||
mSplashHead = NULL;
|
||||
PROFILE_END();
|
||||
return;
|
||||
mSplashHead = mSplashHead->nextSplashDrop;
|
||||
}
|
||||
|
||||
if (drop->nextSplashDrop)
|
||||
|
|
|
|||
|
|
@ -2955,7 +2955,7 @@ void Player::updateMove(const Move* move)
|
|||
|
||||
// Clamp acceleration.
|
||||
F32 maxAcc = (mDataBlock->swimForce / getMass()) * TickSec;
|
||||
if ( false && swimSpeed > maxAcc )
|
||||
if ( swimSpeed > maxAcc )
|
||||
swimAcc *= maxAcc / swimSpeed;
|
||||
|
||||
acc += swimAcc;
|
||||
|
|
|
|||
|
|
@ -1141,11 +1141,11 @@ void RigidShape::updatePos(F32 dt)
|
|||
|
||||
void RigidShape::updateForces(F32 /*dt*/)
|
||||
{
|
||||
if (mDisableMove) return;
|
||||
Point3F gravForce(0, 0, sRigidShapeGravity * mRigid.mass * mGravityMod);
|
||||
|
||||
MatrixF currTransform;
|
||||
mRigid.getTransform(&currTransform);
|
||||
mRigid.atRest = false;
|
||||
|
||||
Point3F torque(0, 0, 0);
|
||||
Point3F force(0, 0, 0);
|
||||
|
|
|
|||
|
|
@ -532,3 +532,32 @@ const char* dStristr( const char* str1, const char* str2 )
|
|||
{
|
||||
return dStristr( const_cast< char* >( str1 ), str2 );
|
||||
}
|
||||
|
||||
int dStrrev(char* str)
|
||||
{
|
||||
int l=dStrlen(str)-1; //get the string length
|
||||
for(int x=0;x < l;x++,l--)
|
||||
{
|
||||
str[x]^=str[l]; //triple XOR Trick
|
||||
str[l]^=str[x]; //for not using a temp
|
||||
str[x]^=str[l];
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
int dItoa(int n, char s[])
|
||||
{
|
||||
int i, sign;
|
||||
|
||||
if ((sign = n) < 0) /* record sign */
|
||||
n = -n; /* make n positive */
|
||||
i = 0;
|
||||
do { /* generate digits in reverse order */
|
||||
s[i++] = n % 10 + '0'; /* get next digit */
|
||||
} while ((n /= 10) > 0); /* delete it */
|
||||
if (sign < 0)
|
||||
s[i++] = '-';
|
||||
s[i] = '\0';
|
||||
dStrrev(s);
|
||||
return dStrlen(s);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,6 +217,9 @@ bool dStrEndsWith(const char* str1, const char* str2);
|
|||
|
||||
char* dStripPath(const char* filename);
|
||||
|
||||
int dStrrev(char* str);
|
||||
int dItoa(int n, char s[]);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// standard I/O functions [defined in platformString.cpp]
|
||||
|
||||
|
|
|
|||
|
|
@ -558,7 +558,12 @@ void GFXDrawUtil::draw2DSquare( const Point2F &screenPoint, F32 width, F32 spinA
|
|||
|
||||
verts[0].color = verts[1].color = verts[2].color = verts[3].color = mBitmapModulation;
|
||||
|
||||
if(spinAngle != 0.f)
|
||||
if (spinAngle == 0.0f)
|
||||
{
|
||||
for( S32 i = 0; i < 4; i++ )
|
||||
verts[i].point += offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixF rotMatrix( EulerF( 0.0, 0.0, spinAngle ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
void drawRectFill( const Point2I &upperLeft, const Point2I &lowerRight, const ColorI &color );
|
||||
void drawRectFill( const RectI &rect, const ColorI &color );
|
||||
|
||||
void draw2DSquare( const Point2F &screenPoint, F32 width, F32 spinAngle );
|
||||
void draw2DSquare( const Point2F &screenPoint, F32 width, F32 spinAngle = 0.0f );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Draw Lines
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ bool GuiGameListMenuProfile::onAdd()
|
|||
// We can't call enforceConstraints() here because incRefCount initializes
|
||||
// some of the things to enforce. Do a basic sanity check here instead.
|
||||
|
||||
if( !dStrlen(mBitmapName) )
|
||||
if( !mBitmapName || !dStrlen(mBitmapName) )
|
||||
{
|
||||
Con::errorf( "GuiGameListMenuProfile: %s can't be created without a bitmap. Please add a 'Bitmap' property to the object definition.", getName() );
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -764,8 +764,7 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
|
|||
|
||||
// Change filespec
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, sizeof(szBuffer), "getLoadFilename(\"%s\", \"%d.apply\", %d.getData());",
|
||||
"DTS Files (*.dts)|*.dts|COLLADA Files (*.dae)|*.dae|(All Files (*.*)|*.*|", getId(), getId() );
|
||||
dSprintf( szBuffer, sizeof(szBuffer), "getLoadFormatFilename(\"%d.apply\", %d.getData());", getId(), getId() );
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
|
||||
// Create "Open in ShapeEditor" button
|
||||
|
|
|
|||
|
|
@ -32,29 +32,49 @@ extern "C"
|
|||
int (*torque_winmain)( HINSTANCE hInstance, HINSTANCE h, LPSTR lpszCmdLine, int nShow) = NULL;
|
||||
};
|
||||
|
||||
bool getDllName(std::wstring& dllName)
|
||||
bool getDllName(std::wstring& dllName, const std::wstring suffix)
|
||||
{
|
||||
wchar_t filenameBuf[MAX_PATH];
|
||||
DWORD length = GetModuleFileNameW( NULL, filenameBuf, MAX_PATH );
|
||||
if(length == 0) return false;
|
||||
dllName = std::wstring(filenameBuf);
|
||||
size_t dotPos = dllName.find_last_of(L".");
|
||||
if(dotPos == std::wstring::npos) return false;
|
||||
if(dotPos == std::wstring::npos)
|
||||
{
|
||||
dllName.clear();
|
||||
return false;
|
||||
}
|
||||
dllName.erase(dotPos);
|
||||
dllName += L".dll";
|
||||
dllName += suffix + L".dll";
|
||||
return true;
|
||||
}
|
||||
|
||||
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCommandShow)
|
||||
{
|
||||
// Try to find the game DLL, which may have one of several file names.
|
||||
HMODULE hGame = NULL;
|
||||
std::wstring dllName = std::wstring();
|
||||
if(!getDllName(dllName))
|
||||
// The file name is the same as this executable's name, plus a suffix.
|
||||
const std::wstring dllSuffices[] = {L"", L" DLL"};
|
||||
const unsigned int numSuffices = sizeof(dllSuffices) / sizeof(std::wstring);
|
||||
|
||||
for (unsigned int i = 0; i < numSuffices; i++)
|
||||
{
|
||||
// Attempt to glue the suffix onto the current filename.
|
||||
if(!getDllName(dllName, dllSuffices[i]))
|
||||
continue;
|
||||
// Load the DLL at that address.
|
||||
hGame = LoadLibraryW(dllName.c_str());
|
||||
if (hGame)
|
||||
break;
|
||||
}
|
||||
|
||||
if(!dllName.length())
|
||||
{
|
||||
MessageBoxW(NULL, L"Unable to find game dll", L"Error", MB_OK|MB_ICONWARNING);
|
||||
return -1;
|
||||
}
|
||||
|
||||
HMODULE hGame = LoadLibraryW(dllName.c_str());
|
||||
if (!hGame)
|
||||
{
|
||||
wchar_t error[4096];
|
||||
|
|
|
|||
|
|
@ -35,27 +35,27 @@ QuatF& QuatF::set( const EulerF & e )
|
|||
F32 cx, sx;
|
||||
F32 cy, sy;
|
||||
F32 cz, sz;
|
||||
mSinCos( -e.x * 0.5f, sx, cx );
|
||||
mSinCos( -e.y * 0.5f, sy, cy );
|
||||
mSinCos( -e.z * 0.5f, sz, cz );
|
||||
mSinCos( e.x * 0.5f, sx, cx );
|
||||
mSinCos( e.y * 0.5f, sy, cy );
|
||||
mSinCos( e.z * 0.5f, sz, cz );
|
||||
|
||||
// Qyaw(z) = [ (0, 0, sin z/2), cos z/2 ]
|
||||
// Qyaw(z) = [ (0, 0, sin z/2), cos z/2 ]
|
||||
// Qpitch(x) = [ (sin x/2, 0, 0), cos x/2 ]
|
||||
// Qroll(y) = [ (0, sin y/2, 0), cos y/2 ]
|
||||
// this = Qresult = Qyaw*Qpitch*Qroll ZXY
|
||||
// Qroll(y) = [ (0, sin y/2, 0), cos y/2 ]
|
||||
// this = Qresult = Qyaw*Qpitch*Qroll ZXY
|
||||
//
|
||||
// The code that folows is a simplification of:
|
||||
// roll*=pitch;
|
||||
// roll*=yaw;
|
||||
// *this = roll;
|
||||
// roll*=pitch;
|
||||
// roll*=yaw;
|
||||
// *this = roll;
|
||||
F32 cycz, sysz, sycz, cysz;
|
||||
cycz = cy*cz;
|
||||
sysz = sy*sz;
|
||||
sycz = sy*cz;
|
||||
cysz = cy*sz;
|
||||
w = cycz*cx + sysz*sx;
|
||||
w = cycz*cx - sysz*sx;
|
||||
x = cycz*sx + sysz*cx;
|
||||
y = sycz*cx - cysz*sx;
|
||||
y = sycz*cx + cysz*sx;
|
||||
z = cysz*cx - sycz*sx;
|
||||
|
||||
return *this;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<?php
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 GarageGames, LLC
|
||||
//
|
||||
|
|
@ -21,14 +20,44 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
beginLibConfig( 'libgtest', '{F2C0209B-1B90-4F73-816A-A0920FF8B107}' );
|
||||
#ifdef TORQUE_TESTS_ENABLED
|
||||
#include "testing/unitTesting.h"
|
||||
#include "math/mQuat.h"
|
||||
#include "math/mAngAxis.h"
|
||||
#include "math/mMatrix.h"
|
||||
|
||||
// Source
|
||||
addSrcDir( T3D_Generator::getLibSrcDir() . 'gtest/fused-src/gtest', true );
|
||||
/// For testing things that should be close to 0, but accounting for floating-
|
||||
/// point inaccuracy.
|
||||
static const F32 epsilon = 1e-3f;
|
||||
|
||||
// Additional includes
|
||||
addLibIncludePath( 'gtest/fused-src/' );
|
||||
/// Test quaternions for equality by expecting the angle between them to be
|
||||
/// close to 0.
|
||||
#define EXPECT_QUAT_EQ(q1, q2) EXPECT_LT(q1.angleBetween(q2), epsilon)
|
||||
|
||||
endLibConfig();
|
||||
TEST(QuatF, AngleBetween)
|
||||
{
|
||||
QuatF p(QuatF::Identity), q(QuatF::Identity);
|
||||
EXPECT_LT(p.angleBetween(q), epsilon)
|
||||
<< "Angle between identity quaternions should be ~0.";
|
||||
|
||||
?>
|
||||
p.set(EulerF(0.1, 0.15, -0.2));
|
||||
q = p;
|
||||
EXPECT_LT(p.angleBetween(q), epsilon)
|
||||
<< "Angle between identical quaternions should be ~0.";
|
||||
}
|
||||
|
||||
/// Test conversion from EulerF.
|
||||
TEST(QuatF, Construction)
|
||||
{
|
||||
EulerF eId(0, 0, 0);
|
||||
EXPECT_QUAT_EQ(QuatF(eId), QuatF::Identity)
|
||||
<< "Quaternions constructed from identity EulerF and QuatF::Identity not equal.";
|
||||
|
||||
EulerF eRot(0.0f, -0.0f, 1.5707963267948966f);
|
||||
MatrixF mat(eRot);
|
||||
AngAxisF aaRot(mat);
|
||||
EXPECT_QUAT_EQ(QuatF(eRot), QuatF(aaRot))
|
||||
<< "Quaternions constructed from EulerF and AngAxisF not equal.";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -50,6 +50,15 @@
|
|||
#include "core/util/zip/zipVolume.h"
|
||||
#include "gfx/bitmap/gBitmap.h"
|
||||
|
||||
MODULE_BEGIN( ColladaShapeLoader )
|
||||
MODULE_INIT_AFTER( ShapeLoader )
|
||||
MODULE_INIT
|
||||
{
|
||||
TSShapeLoader::addFormat("Collada", "dae");
|
||||
TSShapeLoader::addFormat("Google Earth", "kmz");
|
||||
}
|
||||
MODULE_END;
|
||||
|
||||
//
|
||||
static DAE sDAE; // Collada model database (holds the last loaded file)
|
||||
static Torque::Path sLastPath; // Path of the last loaded Collada file
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "ts/loader/tsShapeLoader.h"
|
||||
|
||||
#include "core/volume.h"
|
||||
|
|
@ -30,6 +31,14 @@
|
|||
#include "ts/tsShapeInstance.h"
|
||||
#include "ts/tsMaterialList.h"
|
||||
|
||||
MODULE_BEGIN( ShapeLoader )
|
||||
MODULE_INIT_AFTER( GFX )
|
||||
MODULE_INIT
|
||||
{
|
||||
TSShapeLoader::addFormat("Torque DTS", "dts");
|
||||
TSShapeLoader::addFormat("Torque DSQ", "dsq");
|
||||
}
|
||||
MODULE_END;
|
||||
|
||||
const F32 TSShapeLoader::DefaultTime = -1.0f;
|
||||
const F64 TSShapeLoader::MinFrameRate = 15.0f;
|
||||
|
|
@ -37,6 +46,8 @@ const F64 TSShapeLoader::MaxFrameRate = 60.0f;
|
|||
const F64 TSShapeLoader::AppGroundFrameRate = 10.0f;
|
||||
Torque::Path TSShapeLoader::shapePath;
|
||||
|
||||
Vector<TSShapeLoader::ShapeFormat> TSShapeLoader::smFormats;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Utility functions
|
||||
|
||||
|
|
@ -1270,3 +1281,53 @@ TSShapeLoader::~TSShapeLoader()
|
|||
delete appSequences[iSeq];
|
||||
appSequences.clear();
|
||||
}
|
||||
|
||||
// Static functions to handle supported formats for shape loader.
|
||||
void TSShapeLoader::addFormat(String name, String extension)
|
||||
{
|
||||
ShapeFormat newFormat;
|
||||
newFormat.mName = name;
|
||||
newFormat.mExtension = extension;
|
||||
smFormats.push_back(newFormat);
|
||||
}
|
||||
|
||||
String TSShapeLoader::getFormatExtensions()
|
||||
{
|
||||
// "*.dsq TAB *.dae TAB
|
||||
StringBuilder output;
|
||||
for(U32 n = 0; n < smFormats.size(); ++n)
|
||||
{
|
||||
output.append("*.");
|
||||
output.append(smFormats[n].mExtension);
|
||||
output.append("\t");
|
||||
}
|
||||
return output.end();
|
||||
}
|
||||
|
||||
String TSShapeLoader::getFormatFilters()
|
||||
{
|
||||
// "DSQ Files|*.dsq|COLLADA Files|*.dae|"
|
||||
StringBuilder output;
|
||||
for(U32 n = 0; n < smFormats.size(); ++n)
|
||||
{
|
||||
output.append(smFormats[n].mName);
|
||||
output.append("|*.");
|
||||
output.append(smFormats[n].mExtension);
|
||||
output.append("|");
|
||||
}
|
||||
return output.end();
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getFormatExtensions, const char*, ( ),,
|
||||
"Returns a list of supported shape format extensions separated by tabs."
|
||||
"Example output: *.dsq TAB *.dae TAB")
|
||||
{
|
||||
return Con::getReturnBuffer(TSShapeLoader::getFormatExtensions());
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getFormatFilters, const char*, ( ),,
|
||||
"Returns a list of supported shape formats in filter form.\n"
|
||||
"Example output: DSQ Files|*.dsq|COLLADA Files|*.dae|")
|
||||
{
|
||||
return Con::getReturnBuffer(TSShapeLoader::getFormatFilters());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,19 @@
|
|||
class TSShapeLoader
|
||||
{
|
||||
|
||||
// Supported Format List
|
||||
protected:
|
||||
struct ShapeFormat
|
||||
{
|
||||
String mName;
|
||||
String mExtension;
|
||||
};
|
||||
static Vector<ShapeFormat> smFormats;
|
||||
public:
|
||||
static void addFormat(String name, String extension);
|
||||
static String getFormatExtensions();
|
||||
static String getFormatFilters();
|
||||
|
||||
public:
|
||||
enum eLoadPhases
|
||||
{
|
||||
|
|
|
|||
13
Templates/Empty/game/runTests.cs
Normal file
13
Templates/Empty/game/runTests.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
new GuiControlProfile(GuiDefaultProfile);
|
||||
new GuiControlProfile(GuiToolTipProfile);
|
||||
new GuiCanvas(Canvas);
|
||||
function onLightManagerActivate() {}
|
||||
function onLightManagerDeactivate() {}
|
||||
Canvas.setWindowTitle("Torque 3D Unit Tests");
|
||||
new RenderPassManager(DiffuseRenderPassManager);
|
||||
setLightManager("Basic Lighting");
|
||||
setLogMode(2);
|
||||
$Con::LogBufferEnabled = false;
|
||||
$Testing::checkMemoryLeaks = false;
|
||||
runAllUnitTests();
|
||||
quit();
|
||||
|
|
@ -42,3 +42,29 @@ function getLoadFilename(%filespec, %callback, %currentFile)
|
|||
|
||||
%dlg.delete();
|
||||
}
|
||||
|
||||
// Opens a choose file dialog with format filters already loaded
|
||||
// in. This avoids the issue of passing a massive list of format
|
||||
// filters into a function as an arguement.
|
||||
function getLoadFormatFilename(%callback, %currentFile)
|
||||
{
|
||||
%dlg = new OpenFileDialog()
|
||||
{
|
||||
Filters = getFormatFilters() @ "(All Files (*.*)|*.*|";
|
||||
DefaultFile = %currentFile;
|
||||
ChangePath = false;
|
||||
MustExist = true;
|
||||
MultipleFiles = false;
|
||||
};
|
||||
|
||||
if ( filePath( %currentFile ) !$= "" )
|
||||
%dlg.DefaultPath = filePath(%currentFile);
|
||||
|
||||
if ( %dlg.Execute() )
|
||||
{
|
||||
eval(%callback @ "(\"" @ %dlg.FileName @ "\");");
|
||||
$Tools::FileDialogs::LastFilePath = filePath( %dlg.FileName );
|
||||
}
|
||||
|
||||
%dlg.delete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ function PE_EmitterEditor::guiSync( %this )
|
|||
PE_EmitterEditor-->PEE_ejectionOffset_slider.setValue( %data.ejectionOffset );
|
||||
PE_EmitterEditor-->PEE_ejectionOffset_textEdit.setText( %data.ejectionOffset );
|
||||
|
||||
PE_EmitterEditor-->PEE_ejectionOffsetVariance_slider.setValue( %data.ejectionOffsetVariance );
|
||||
PE_EmitterEditor-->PEE_ejectionOffsetVariance_textEdit.setText( %data.ejectionOffsetVariance );
|
||||
|
||||
%blendTypeId = PE_EmitterEditor-->PEE_blendType.findText( %data.blendStyle );
|
||||
PE_EmitterEditor-->PEE_blendType.setSelected( %blendTypeId, false );
|
||||
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ function ShapeEdSelectWindow::navigate( %this, %address )
|
|||
%this-->shapeLibrary.clear();
|
||||
ShapeEdSelectMenu.clear();
|
||||
|
||||
%filePatterns = "*.dts" TAB "*.dae" TAB "*.kmz";
|
||||
%filePatterns = getFormatExtensions();
|
||||
%fullPath = findFirstFileMultiExpr( %filePatterns );
|
||||
|
||||
while ( %fullPath !$= "" )
|
||||
|
|
@ -1632,7 +1632,7 @@ function ShapeEdSequences::onAddSequence( %this, %name )
|
|||
if ( %from $= "" )
|
||||
{
|
||||
// No sequence selected => open dialog to browse for one
|
||||
getLoadFilename( "DSQ Files|*.dsq|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onAddSequenceFromBrowse", ShapeEdFromMenu.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onAddSequenceFromBrowse", ShapeEdFromMenu.lastPath );
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
@ -1740,7 +1740,7 @@ function ShapeEdSeqFromMenu::onSelect( %this, %id, %text )
|
|||
%this.setText( %seqFrom );
|
||||
|
||||
// Allow the user to browse for an external source of animation data
|
||||
getLoadFilename( "DSQ Files|*.dsq|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onBrowseSelect", %this.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2862,7 +2862,7 @@ function ShapeEdDetails::onAddMeshFromFile( %this, %path )
|
|||
{
|
||||
if ( %path $= "" )
|
||||
{
|
||||
getLoadFilename( "DTS Files|*.dts|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onAddMeshFromFile", %this.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onAddMeshFromFile", %this.lastPath );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3291,7 +3291,7 @@ function ShapeEdMountShapeMenu::onSelect( %this, %id, %text )
|
|||
if ( %text $= "Browse..." )
|
||||
{
|
||||
// Allow the user to browse for an external model file
|
||||
getLoadFilename( "DTS Files|*.dts|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onBrowseSelect", %this.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -324,13 +324,13 @@ function EWCreatorWindow::navigate( %this, %address )
|
|||
|
||||
if ( %this.tab $= "Meshes" )
|
||||
{
|
||||
%fullPath = findFirstFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findFirstFileMultiExpr( getFormatExtensions() );
|
||||
|
||||
while ( %fullPath !$= "" )
|
||||
{
|
||||
if (strstr(%fullPath, "cached.dts") != -1)
|
||||
{
|
||||
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ function EWCreatorWindow::navigate( %this, %address )
|
|||
%splitPath = strreplace( %fullPath, "/", " " );
|
||||
if( getWord(%splitPath, 0) $= "tools" )
|
||||
{
|
||||
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -396,7 +396,7 @@ function EWCreatorWindow::navigate( %this, %address )
|
|||
}
|
||||
}
|
||||
|
||||
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
13
Templates/Full/game/runTests.cs
Normal file
13
Templates/Full/game/runTests.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
new GuiControlProfile(GuiDefaultProfile);
|
||||
new GuiControlProfile(GuiToolTipProfile);
|
||||
new GuiCanvas(Canvas);
|
||||
function onLightManagerActivate() {}
|
||||
function onLightManagerDeactivate() {}
|
||||
Canvas.setWindowTitle("Torque 3D Unit Tests");
|
||||
new RenderPassManager(DiffuseRenderPassManager);
|
||||
setLightManager("Basic Lighting");
|
||||
setLogMode(2);
|
||||
$Con::LogBufferEnabled = false;
|
||||
$Testing::checkMemoryLeaks = false;
|
||||
runAllUnitTests();
|
||||
quit();
|
||||
|
|
@ -42,3 +42,29 @@ function getLoadFilename(%filespec, %callback, %currentFile)
|
|||
|
||||
%dlg.delete();
|
||||
}
|
||||
|
||||
// Opens a choose file dialog with format filters already loaded
|
||||
// in. This avoids the issue of passing a massive list of format
|
||||
// filters into a function as an arguement.
|
||||
function getLoadFormatFilename(%callback, %currentFile)
|
||||
{
|
||||
%dlg = new OpenFileDialog()
|
||||
{
|
||||
Filters = getFormatFilters() @ "(All Files (*.*)|*.*|";
|
||||
DefaultFile = %currentFile;
|
||||
ChangePath = false;
|
||||
MustExist = true;
|
||||
MultipleFiles = false;
|
||||
};
|
||||
|
||||
if ( filePath( %currentFile ) !$= "" )
|
||||
%dlg.DefaultPath = filePath(%currentFile);
|
||||
|
||||
if ( %dlg.Execute() )
|
||||
{
|
||||
eval(%callback @ "(\"" @ %dlg.FileName @ "\");");
|
||||
$Tools::FileDialogs::LastFilePath = filePath( %dlg.FileName );
|
||||
}
|
||||
|
||||
%dlg.delete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ function PE_EmitterEditor::guiSync( %this )
|
|||
PE_EmitterEditor-->PEE_ejectionOffset_slider.setValue( %data.ejectionOffset );
|
||||
PE_EmitterEditor-->PEE_ejectionOffset_textEdit.setText( %data.ejectionOffset );
|
||||
|
||||
PE_EmitterEditor-->PEE_ejectionOffsetVariance_slider.setValue( %data.ejectionOffsetVariance );
|
||||
PE_EmitterEditor-->PEE_ejectionOffsetVariance_textEdit.setText( %data.ejectionOffsetVariance );
|
||||
|
||||
%blendTypeId = PE_EmitterEditor-->PEE_blendType.findText( %data.blendStyle );
|
||||
PE_EmitterEditor-->PEE_blendType.setSelected( %blendTypeId, false );
|
||||
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ function ShapeEdSelectWindow::navigate( %this, %address )
|
|||
%this-->shapeLibrary.clear();
|
||||
ShapeEdSelectMenu.clear();
|
||||
|
||||
%filePatterns = "*.dts" TAB "*.dae" TAB "*.kmz";
|
||||
%filePatterns = getFormatExtensions();
|
||||
%fullPath = findFirstFileMultiExpr( %filePatterns );
|
||||
|
||||
while ( %fullPath !$= "" )
|
||||
|
|
@ -1632,7 +1632,7 @@ function ShapeEdSequences::onAddSequence( %this, %name )
|
|||
if ( %from $= "" )
|
||||
{
|
||||
// No sequence selected => open dialog to browse for one
|
||||
getLoadFilename( "DSQ Files|*.dsq|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onAddSequenceFromBrowse", ShapeEdFromMenu.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onAddSequenceFromBrowse", ShapeEdFromMenu.lastPath );
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
@ -1740,7 +1740,7 @@ function ShapeEdSeqFromMenu::onSelect( %this, %id, %text )
|
|||
%this.setText( %seqFrom );
|
||||
|
||||
// Allow the user to browse for an external source of animation data
|
||||
getLoadFilename( "DSQ Files|*.dsq|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onBrowseSelect", %this.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2862,7 +2862,7 @@ function ShapeEdDetails::onAddMeshFromFile( %this, %path )
|
|||
{
|
||||
if ( %path $= "" )
|
||||
{
|
||||
getLoadFilename( "DTS Files|*.dts|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onAddMeshFromFile", %this.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onAddMeshFromFile", %this.lastPath );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3291,7 +3291,7 @@ function ShapeEdMountShapeMenu::onSelect( %this, %id, %text )
|
|||
if ( %text $= "Browse..." )
|
||||
{
|
||||
// Allow the user to browse for an external model file
|
||||
getLoadFilename( "DTS Files|*.dts|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onBrowseSelect", %this.lastPath );
|
||||
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -324,13 +324,13 @@ function EWCreatorWindow::navigate( %this, %address )
|
|||
|
||||
if ( %this.tab $= "Meshes" )
|
||||
{
|
||||
%fullPath = findFirstFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findFirstFileMultiExpr( getFormatExtensions() );
|
||||
|
||||
while ( %fullPath !$= "" )
|
||||
{
|
||||
if (strstr(%fullPath, "cached.dts") != -1)
|
||||
{
|
||||
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ function EWCreatorWindow::navigate( %this, %address )
|
|||
%splitPath = strreplace( %fullPath, "/", " " );
|
||||
if( getWord(%splitPath, 0) $= "tools" )
|
||||
{
|
||||
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -396,7 +396,7 @@ function EWCreatorWindow::navigate( %this, %address )
|
|||
}
|
||||
}
|
||||
|
||||
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
|
||||
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
15
Tools/CMake/modules/module_testing.cmake
Normal file
15
Tools/CMake/modules/module_testing.cmake
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
option(TORQUE_TESTS_ENABLED "TORQUE_TESTS_ENABLED" OFF)
|
||||
|
||||
if(TORQUE_TESTS_ENABLED)
|
||||
|
||||
# Project defines
|
||||
addDef( "TORQUE_TESTS_ENABLED" )
|
||||
addDef( "_VARIADIC_MAX" 10 )
|
||||
|
||||
# Add source files
|
||||
addPathRec( "${srcDir}/testing" )
|
||||
|
||||
# Add include paths
|
||||
addInclude( "${libDir}/gtest/fused-src/" )
|
||||
|
||||
endif()
|
||||
|
|
@ -325,6 +325,8 @@ if(TORQUE_DEDICATED)
|
|||
addDef(TORQUE_DEDICATED)
|
||||
endif()
|
||||
|
||||
include( "modules/module_testing.cmake" )
|
||||
|
||||
|
||||
###############################################################################
|
||||
# platform specific things
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ beginModule( 'testing' );
|
|||
addProjectDefine( '_VARIADIC_MAX', 10 );
|
||||
addSrcDir(getEngineSrcDir() . 'testing', true);
|
||||
|
||||
includeLib( 'libgtest' );
|
||||
addLibIncludePath( 'gtest/fused-src/' );
|
||||
|
||||
endModule();
|
||||
|
|
|
|||
|
|
@ -50,15 +50,15 @@
|
|||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projOutName}_DEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">{$projOutName}_DEBUG DLL</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projOutName}_OPTIMIZEDDEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Optimized Debug|Win32'">{$projOutName}_OPTIMIZEDDEBUG DLL</TargetName>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../../{$gameFolder}/</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName)/$(ProjectName)/</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projOutName}</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">{$projOutName} DLL</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>{foreach item=def from=$projLibsDebug}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir){$projOutName}_DEBUG.dll</OutputFile>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
|
|
@ -148,7 +148,7 @@
|
|||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>{foreach item=def from=$projLibsDebug}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir){$projOutName}_OPTIMIZEDDEBUG.dll</OutputFile>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>{foreach item=def from=$projLibs}{$def};{/foreach}%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir){$projOutName}.dll</OutputFile>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2010.$(Configuration).$(PlatformName);$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;{foreach item=def from=$projLibsIgnore}{$def};{/foreach}%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@
|
|||
AdditionalDependencies="{foreach item=def from=$projLibsDebug}{$def} {/foreach}"
|
||||
|
||||
{if $uniformOutputFile eq 1}
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}.dll"
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName} DLL.dll"
|
||||
{else}
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_DEBUG.dll"
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_DEBUG DLL.dll"
|
||||
{/if}
|
||||
|
||||
LinkIncremental="2"
|
||||
|
|
@ -191,9 +191,9 @@
|
|||
AdditionalDependencies="{foreach item=def from=$projLibsDebug}{$def} {/foreach}"
|
||||
|
||||
{if $uniformOutputFile eq 1}
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}.dll"
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName} DLL.dll"
|
||||
{else}
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_OPTIMIZEDDEBUG.dll"
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}_OPTIMIZEDDEBUG DLL.dll"
|
||||
{/if}
|
||||
|
||||
LinkIncremental="1"
|
||||
|
|
@ -299,7 +299,7 @@
|
|||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="{foreach item=def from=$projLibs}{$def} {/foreach}"
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName}.dll"
|
||||
OutputFile="{$projectOffset}../../{$gameFolder}/{$projOutName} DLL.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="{foreach item=def from=$projLibDirs}{$def};{/foreach}{$projectOffset}../Link/VC2k8.$(ConfigurationName).$(PlatformName);"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue