mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into alpha41/cmake_adjustments
This commit is contained in:
commit
52093cbde5
25 changed files with 530 additions and 266 deletions
|
|
@ -58,7 +58,7 @@ NvRemoveTjunctions.cpp : A code snippet to remove tjunctions from a triangle mes
|
||||||
#pragma warning(disable:4702)
|
#pragma warning(disable:4702)
|
||||||
#pragma warning(disable:4127) //conditional expression is constant (because _HAS_EXCEPTIONS=0)
|
#pragma warning(disable:4127) //conditional expression is constant (because _HAS_EXCEPTIONS=0)
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#ifdef __APPLE__
|
#if defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
#include <ext/hash_map>
|
#include <ext/hash_map>
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
#include <hash_map>
|
#include <hash_map>
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,16 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
|
#else
|
||||||
|
#if defined( __FreeBSD__)
|
||||||
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__CELLOS_LV2__) || defined(LINUX)
|
#if defined(__APPLE__) || defined(__CELLOS_LV2__) || defined(LINUX)
|
||||||
|
|
@ -73,7 +78,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32)
|
||||||
typedef __int64 NxI64;
|
typedef __int64 NxI64;
|
||||||
typedef signed int NxI32;
|
typedef signed int NxI32;
|
||||||
typedef signed short NxI16;
|
typedef signed short NxI16;
|
||||||
|
|
@ -115,6 +120,20 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
||||||
typedef float NxF32;
|
typedef float NxF32;
|
||||||
typedef double NxF64;
|
typedef double NxF64;
|
||||||
|
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
typedef long long NxI64;
|
||||||
|
typedef signed int NxI32;
|
||||||
|
typedef signed short NxI16;
|
||||||
|
typedef signed char NxI8;
|
||||||
|
|
||||||
|
typedef unsigned long long NxU64;
|
||||||
|
typedef unsigned int NxU32;
|
||||||
|
typedef unsigned short NxU16;
|
||||||
|
typedef unsigned char NxU8;
|
||||||
|
|
||||||
|
typedef float NxF32;
|
||||||
|
typedef double NxF64;
|
||||||
|
|
||||||
#elif defined(__CELLOS_LV2__)
|
#elif defined(__CELLOS_LV2__)
|
||||||
typedef long long NxI64;
|
typedef long long NxI64;
|
||||||
typedef signed int NxI32;
|
typedef signed int NxI32;
|
||||||
|
|
|
||||||
|
|
@ -2656,7 +2656,7 @@ static NxI32 overhull(Plane *planes,NxI32 planes_count,float3 *verts, NxI32 vert
|
||||||
float3 *&verts_out, NxI32 &verts_count_out, NxI32 *&faces_out, NxI32 &faces_count_out ,NxF32 inflate)
|
float3 *&verts_out, NxI32 &verts_count_out, NxI32 *&faces_out, NxI32 &faces_count_out ,NxF32 inflate)
|
||||||
{
|
{
|
||||||
NxI32 i,j;
|
NxI32 i,j;
|
||||||
if(verts_count <4) return NULL;
|
if (verts_count < 4) return 0;
|
||||||
maxplanes = Min(maxplanes,planes_count);
|
maxplanes = Min(maxplanes,planes_count);
|
||||||
float3 bmin(verts[0]),bmax(verts[0]);
|
float3 bmin(verts[0]),bmax(verts[0]);
|
||||||
for(i=0;i<verts_count;i++)
|
for(i=0;i<verts_count;i++)
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ NvThreadConfig.cpp : A simple wrapper class to define threading and mutex locks.
|
||||||
#include <xtl.h>
|
#include <xtl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) || defined( __APPLE__ )
|
#if defined(__linux__) || defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
//#include <sys/time.h>
|
//#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -79,15 +79,18 @@ NvThreadConfig.cpp : A simple wrapper class to define threading and mutex locks.
|
||||||
#define __stdcall
|
#define __stdcall
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( __APPLE__ )
|
#if defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__linux__)
|
#if defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( __APPLE__ )
|
#if defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
|
|
||||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -107,7 +110,8 @@ NxU32 tc_timeGetTime(void)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_REALTIME, &ts);
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||||
#elif defined( __APPLE__ )
|
#elif defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
|
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
gettimeofday(&tp, (struct timezone *)0);
|
gettimeofday(&tp, (struct timezone *)0);
|
||||||
return tp.tv_sec * 1000 + tp.tv_usec / 1000;
|
return tp.tv_sec * 1000 + tp.tv_usec / 1000;
|
||||||
|
|
@ -120,7 +124,7 @@ NxU32 tc_timeGetTime(void)
|
||||||
|
|
||||||
void tc_sleep(NxU32 ms)
|
void tc_sleep(NxU32 ms)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined( __APPLE__ )
|
#if defined(__linux__) || defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
usleep(ms * 1000);
|
usleep(ms * 1000);
|
||||||
#else
|
#else
|
||||||
Sleep(ms);
|
Sleep(ms);
|
||||||
|
|
@ -129,13 +133,14 @@ void tc_sleep(NxU32 ms)
|
||||||
|
|
||||||
void tc_spinloop()
|
void tc_spinloop()
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined( _XBOX )
|
#if defined( _XBOX )
|
||||||
// Pause would do nothing on the Xbox. Threads are not scheduled.
|
// Pause would do nothing on the Xbox. Threads are not scheduled.
|
||||||
#elif defined( _WIN64 )
|
#elif defined( _WIN64 )
|
||||||
YieldProcessor( );
|
YieldProcessor( );
|
||||||
#elif defined( __APPLE__ )
|
#elif defined( __APPLE__ )
|
||||||
pthread_yield_np();
|
pthread_yield_np();
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__) || defined(__FreeBSD__)
|
||||||
#if defined(_POSIX_PRIORITY_SCHEDULING)
|
#if defined(_POSIX_PRIORITY_SCHEDULING)
|
||||||
sched_yield();
|
sched_yield();
|
||||||
#else
|
#else
|
||||||
|
|
@ -148,7 +153,8 @@ void tc_spinloop()
|
||||||
|
|
||||||
void tc_interlockedExchange(void *dest, const int64_t exchange)
|
void tc_interlockedExchange(void *dest, const int64_t exchange)
|
||||||
{
|
{
|
||||||
#if defined( __linux__ ) || defined( __APPLE__ )
|
#if defined( __linux__ ) || defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
|
|
||||||
// not working
|
// not working
|
||||||
assert(false);
|
assert(false);
|
||||||
//__sync_lock_test_and_set((int64_t*)dest, exchange);
|
//__sync_lock_test_and_set((int64_t*)dest, exchange);
|
||||||
|
|
@ -174,7 +180,8 @@ void tc_interlockedExchange(void *dest, const int64_t exchange)
|
||||||
|
|
||||||
NxI32 tc_interlockedCompareExchange(void *dest, NxI32 exchange, NxI32 compare)
|
NxI32 tc_interlockedCompareExchange(void *dest, NxI32 exchange, NxI32 compare)
|
||||||
{
|
{
|
||||||
#if defined( __linux__ ) || defined( __APPLE__ )
|
#if defined( __linux__ ) || defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
|
|
||||||
// not working
|
// not working
|
||||||
assert(false);
|
assert(false);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -203,7 +210,7 @@ NxI32 tc_interlockedCompareExchange(void *dest, NxI32 exchange, NxI32 compare)
|
||||||
|
|
||||||
NxI32 tc_interlockedCompareExchange(void *dest, const NxI32 exchange1, const NxI32 exchange2, const NxI32 compare1, const NxI32 compare2)
|
NxI32 tc_interlockedCompareExchange(void *dest, const NxI32 exchange1, const NxI32 exchange2, const NxI32 compare1, const NxI32 compare2)
|
||||||
{
|
{
|
||||||
#if defined( __linux__ ) || defined( __APPLE__ )
|
#if defined( __linux__ ) || defined( __APPLE__ ) || defined( __FreeBSD__)
|
||||||
// not working
|
// not working
|
||||||
assert(false);
|
assert(false);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -239,7 +246,8 @@ public:
|
||||||
{
|
{
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
InitializeCriticalSection(&m_Mutex);
|
InitializeCriticalSection(&m_Mutex);
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
pthread_mutexattr_t mutexAttr; // Mutex Attribute
|
pthread_mutexattr_t mutexAttr; // Mutex Attribute
|
||||||
VERIFY( pthread_mutexattr_init(&mutexAttr) == 0 );
|
VERIFY( pthread_mutexattr_init(&mutexAttr) == 0 );
|
||||||
VERIFY( pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_RECURSIVE_NP) == 0 );
|
VERIFY( pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_RECURSIVE_NP) == 0 );
|
||||||
|
|
@ -252,7 +260,8 @@ public:
|
||||||
{
|
{
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
DeleteCriticalSection(&m_Mutex);
|
DeleteCriticalSection(&m_Mutex);
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
VERIFY( pthread_mutex_destroy(&m_Mutex) == 0 );
|
VERIFY( pthread_mutex_destroy(&m_Mutex) == 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -261,7 +270,8 @@ public:
|
||||||
{
|
{
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
EnterCriticalSection(&m_Mutex);
|
EnterCriticalSection(&m_Mutex);
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
VERIFY( pthread_mutex_lock(&m_Mutex) == 0 );
|
VERIFY( pthread_mutex_lock(&m_Mutex) == 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -273,7 +283,8 @@ public:
|
||||||
//assert(("TryEnterCriticalSection seems to not work on XP???", 0));
|
//assert(("TryEnterCriticalSection seems to not work on XP???", 0));
|
||||||
bRet = TryEnterCriticalSection(&m_Mutex) ? true : false;
|
bRet = TryEnterCriticalSection(&m_Mutex) ? true : false;
|
||||||
return bRet;
|
return bRet;
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
NxI32 result = pthread_mutex_trylock(&m_Mutex);
|
NxI32 result = pthread_mutex_trylock(&m_Mutex);
|
||||||
return (result == 0);
|
return (result == 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -283,7 +294,8 @@ public:
|
||||||
{
|
{
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
LeaveCriticalSection(&m_Mutex);
|
LeaveCriticalSection(&m_Mutex);
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
VERIFY( pthread_mutex_unlock(&m_Mutex) == 0 );
|
VERIFY( pthread_mutex_unlock(&m_Mutex) == 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -291,7 +303,8 @@ public:
|
||||||
private:
|
private:
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
CRITICAL_SECTION m_Mutex;
|
CRITICAL_SECTION m_Mutex;
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
pthread_mutex_t m_Mutex;
|
pthread_mutex_t m_Mutex;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
@ -310,7 +323,8 @@ void tc_releaseThreadMutex(ThreadMutex *tm)
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
static unsigned long __stdcall _ThreadWorkerFunc(LPVOID arg);
|
static unsigned long __stdcall _ThreadWorkerFunc(LPVOID arg);
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
static void* _ThreadWorkerFunc(void* arg);
|
static void* _ThreadWorkerFunc(void* arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -322,7 +336,8 @@ public:
|
||||||
mInterface = iface;
|
mInterface = iface;
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
mThread = CreateThread(0, 0, _ThreadWorkerFunc, this, 0, 0);
|
mThread = CreateThread(0, 0, _ThreadWorkerFunc, this, 0, 0);
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
VERIFY( pthread_create(&mThread, NULL, _ThreadWorkerFunc, this) == 0 );
|
VERIFY( pthread_create(&mThread, NULL, _ThreadWorkerFunc, this) == 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +362,8 @@ private:
|
||||||
ThreadInterface *mInterface;
|
ThreadInterface *mInterface;
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
HANDLE mThread;
|
HANDLE mThread;
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
pthread_t mThread;
|
pthread_t mThread;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
@ -367,7 +383,8 @@ void tc_releaseThread(Thread *t)
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
static unsigned long __stdcall _ThreadWorkerFunc(LPVOID arg)
|
static unsigned long __stdcall _ThreadWorkerFunc(LPVOID arg)
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
static void* _ThreadWorkerFunc(void* arg)
|
static void* _ThreadWorkerFunc(void* arg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
@ -384,7 +401,8 @@ public:
|
||||||
{
|
{
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
mEvent = ::CreateEventA(NULL,TRUE,TRUE,"ThreadEvent");
|
mEvent = ::CreateEventA(NULL,TRUE,TRUE,"ThreadEvent");
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
pthread_mutexattr_t mutexAttr; // Mutex Attribute
|
pthread_mutexattr_t mutexAttr; // Mutex Attribute
|
||||||
VERIFY( pthread_mutexattr_init(&mutexAttr) == 0 );
|
VERIFY( pthread_mutexattr_init(&mutexAttr) == 0 );
|
||||||
VERIFY( pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_RECURSIVE_NP) == 0 );
|
VERIFY( pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_RECURSIVE_NP) == 0 );
|
||||||
|
|
@ -401,7 +419,8 @@ public:
|
||||||
{
|
{
|
||||||
::CloseHandle(mEvent);
|
::CloseHandle(mEvent);
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
VERIFY( pthread_cond_destroy(&mEvent) == 0 );
|
VERIFY( pthread_cond_destroy(&mEvent) == 0 );
|
||||||
VERIFY( pthread_mutex_destroy(&mEventMutex) == 0 );
|
VERIFY( pthread_mutex_destroy(&mEventMutex) == 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -414,7 +433,8 @@ public:
|
||||||
{
|
{
|
||||||
::SetEvent(mEvent);
|
::SetEvent(mEvent);
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
VERIFY( pthread_mutex_lock(&mEventMutex) == 0 );
|
VERIFY( pthread_mutex_lock(&mEventMutex) == 0 );
|
||||||
VERIFY( pthread_cond_signal(&mEvent) == 0 );
|
VERIFY( pthread_cond_signal(&mEvent) == 0 );
|
||||||
VERIFY( pthread_mutex_unlock(&mEventMutex) == 0 );
|
VERIFY( pthread_mutex_unlock(&mEventMutex) == 0 );
|
||||||
|
|
@ -438,7 +458,8 @@ public:
|
||||||
{
|
{
|
||||||
::WaitForSingleObject(mEvent,ms);
|
::WaitForSingleObject(mEvent,ms);
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
VERIFY( pthread_mutex_lock(&mEventMutex) == 0 );
|
VERIFY( pthread_mutex_lock(&mEventMutex) == 0 );
|
||||||
if (ms == 0xffffffff)
|
if (ms == 0xffffffff)
|
||||||
{
|
{
|
||||||
|
|
@ -468,7 +489,8 @@ public:
|
||||||
private:
|
private:
|
||||||
#if defined(WIN32) || defined(_XBOX)
|
#if defined(WIN32) || defined(_XBOX)
|
||||||
HANDLE mEvent;
|
HANDLE mEvent;
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__) || defined( __FreeBSD__)
|
||||||
|
|
||||||
pthread_mutex_t mEventMutex;
|
pthread_mutex_t mEventMutex;
|
||||||
pthread_cond_t mEvent;
|
pthread_cond_t mEvent;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
#include <iosfwd> // for ostream forward-declaration
|
#include <iosfwd> // for ostream forward-declaration
|
||||||
|
|
||||||
// Don't use bits/type_traits.h on Linux - Andrew Galante, GG 8/2/2009
|
// Don't use bits/type_traits.h on Linux - Andrew Galante, GG 8/2/2009
|
||||||
#if !defined(_MSC_VER) && !defined(__CELLOS_LV2__) && !defined(__APPLE__) && !defined(__linux__)
|
#if !defined(_MSC_VER) && !defined(__CELLOS_LV2__) && !defined(__APPLE__) && !defined(__linux__) && !defined( __FreeBSD__)
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#define HAVE_TYPE_TRAITS
|
#define HAVE_TYPE_TRAITS
|
||||||
#include <bits/type_traits.h>
|
#include <bits/type_traits.h>
|
||||||
|
|
|
||||||
|
|
@ -275,6 +275,8 @@ public:
|
||||||
/// Returns the datablock for this object.
|
/// Returns the datablock for this object.
|
||||||
GameBaseData* getDataBlock() { return mDataBlock; }
|
GameBaseData* getDataBlock() { return mDataBlock; }
|
||||||
|
|
||||||
|
/// returns the datablock name for this object
|
||||||
|
StringTableEntry getTypeHint() const override { return (mDataBlock) ? mDataBlock->getName() : StringTable->EmptyString(); };
|
||||||
/// Called when a new datablock is set. This allows subclasses to
|
/// Called when a new datablock is set. This allows subclasses to
|
||||||
/// appropriately handle new datablocks.
|
/// appropriately handle new datablocks.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,8 @@ class SpawnSphere : public MissionMarker
|
||||||
bool mAutoSpawn;
|
bool mAutoSpawn;
|
||||||
bool mSpawnTransform;
|
bool mSpawnTransform;
|
||||||
|
|
||||||
|
/// returns the datablock spawned for this object
|
||||||
|
StringTableEntry getTypeHint() const override { return (mSpawnDataBlock.isNotEmpty()) ? mSpawnDataBlock.c_str() : StringTable->EmptyString(); };
|
||||||
// Radius/weight info
|
// Radius/weight info
|
||||||
F32 mRadius;
|
F32 mRadius;
|
||||||
F32 mSphereWeight;
|
F32 mSphereWeight;
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,10 @@ void Prefab::initPersistFields()
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringTableEntry Prefab::getTypeHint() const
|
||||||
|
{
|
||||||
|
return (mFilename != StringTable->EmptyString()) ? StringTable->insert(Torque::Path(mFilename).getFileName().c_str()) : StringTable->EmptyString();
|
||||||
|
}
|
||||||
extern bool gEditingMission;
|
extern bool gEditingMission;
|
||||||
|
|
||||||
bool Prefab::onAdd()
|
bool Prefab::onAdd()
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,9 @@ public:
|
||||||
|
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
|
|
||||||
|
/// returns the filename for this object
|
||||||
|
StringTableEntry getTypeHint() const override;
|
||||||
|
|
||||||
// SimObject
|
// SimObject
|
||||||
virtual bool onAdd();
|
virtual bool onAdd();
|
||||||
virtual void onRemove();
|
virtual void onRemove();
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,8 @@ class SFXEmitter : public SceneObject
|
||||||
|
|
||||||
DECLARE_SOUNDASSET(SFXEmitter, Sound);
|
DECLARE_SOUNDASSET(SFXEmitter, Sound);
|
||||||
DECLARE_ASSET_NET_SETGET(SFXEmitter, Sound, DirtyUpdateMask);
|
DECLARE_ASSET_NET_SETGET(SFXEmitter, Sound, DirtyUpdateMask);
|
||||||
|
/// returns the shape asset used for this object
|
||||||
|
StringTableEntry getTypeHint() const override { return (getSoundAsset()) ? getSoundAsset()->getAssetName() : StringTable->EmptyString(); }
|
||||||
|
|
||||||
/// The sound source for the emitter.
|
/// The sound source for the emitter.
|
||||||
SFXSource *mSource;
|
SFXSource *mSource;
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,8 @@ public:
|
||||||
|
|
||||||
DECLARE_CONOBJECT(TSStatic);
|
DECLARE_CONOBJECT(TSStatic);
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
|
/// returns the shape asset used for this object
|
||||||
|
StringTableEntry getTypeHint() const override { return (getShapeAsset()) ? getShapeAsset()->getAssetName(): StringTable->EmptyString(); }
|
||||||
static void consoleInit();
|
static void consoleInit();
|
||||||
static bool _setFieldSkin(void* object, const char* index, const char* data);
|
static bool _setFieldSkin(void* object, const char* index, const char* data);
|
||||||
static const char* _getFieldSkin(void* object, const char* data);
|
static const char* _getFieldSkin(void* object, const char* data);
|
||||||
|
|
|
||||||
|
|
@ -738,7 +738,7 @@ DefineEngineFunction( strrepeat, const char*, ( const char* str, S32 numTimes, c
|
||||||
{
|
{
|
||||||
StringBuilder result;
|
StringBuilder result;
|
||||||
bool isFirst = false;
|
bool isFirst = false;
|
||||||
for( U32 i = 0; i < numTimes; ++ i )
|
for( S32 i = 0; i < numTimes; ++ i )
|
||||||
{
|
{
|
||||||
if( !isFirst )
|
if( !isFirst )
|
||||||
result.append( delimiter );
|
result.append( delimiter );
|
||||||
|
|
|
||||||
|
|
@ -549,6 +549,9 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
||||||
/// Get the internal name of this control
|
/// Get the internal name of this control
|
||||||
StringTableEntry getInternalName() const { return mInternalName; }
|
StringTableEntry getInternalName() const { return mInternalName; }
|
||||||
|
|
||||||
|
/// type-specified slot for returning hints for the main difference between object instances
|
||||||
|
virtual StringTableEntry getTypeHint() const { return StringTable->EmptyString(); }
|
||||||
|
|
||||||
/// Set the original name of this control
|
/// Set the original name of this control
|
||||||
void setOriginalName(const char* originalName);
|
void setOriginalName(const char* originalName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ bool GFXGLTextureObject::copyToBmp(GBitmap * bmp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glBindTexture(mBinding, NULL);
|
glBindTexture(mBinding, 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -425,6 +425,7 @@ U32 GuiTreeViewCtrl::Item::getDisplayTextLength()
|
||||||
|
|
||||||
StringTableEntry name = obj->getName();
|
StringTableEntry name = obj->getName();
|
||||||
StringTableEntry internalName = obj->getInternalName();
|
StringTableEntry internalName = obj->getInternalName();
|
||||||
|
StringTableEntry typeHint = obj->getTypeHint();
|
||||||
StringTableEntry className = obj->getClassName();
|
StringTableEntry className = obj->getClassName();
|
||||||
|
|
||||||
if( showInternalNameOnly() )
|
if( showInternalNameOnly() )
|
||||||
|
|
@ -466,6 +467,11 @@ U32 GuiTreeViewCtrl::Item::getDisplayTextLength()
|
||||||
if( internalName && internalName[ 0 ] )
|
if( internalName && internalName[ 0 ] )
|
||||||
len += dStrlen( internalName ) + 3; // ' [<internalname>]'
|
len += dStrlen( internalName ) + 3; // ' [<internalname>]'
|
||||||
}
|
}
|
||||||
|
if ( mState.test(ShowTypeHint) )
|
||||||
|
{
|
||||||
|
if (typeHint && typeHint[0])
|
||||||
|
len += dStrlen(typeHint) + 3;
|
||||||
|
}
|
||||||
if( mState.test( Marked ) )
|
if( mState.test( Marked ) )
|
||||||
{
|
{
|
||||||
len += 1; // '*<name>'
|
len += 1; // '*<name>'
|
||||||
|
|
@ -502,8 +508,10 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
|
||||||
{
|
{
|
||||||
const char* pObjName = pObject->getName();
|
const char* pObjName = pObject->getName();
|
||||||
const char* pInternalName = pObject->getInternalName();
|
const char* pInternalName = pObject->getInternalName();
|
||||||
|
const char* pTypeHint = pObject->getTypeHint();
|
||||||
|
|
||||||
bool hasInternalName = pInternalName && pInternalName[0];
|
bool hasInternalName = pInternalName && pInternalName[0];
|
||||||
|
bool hasTypeHint = pTypeHint && pTypeHint[0];
|
||||||
bool hasObjectName = pObjName && pObjName[0];
|
bool hasObjectName = pObjName && pObjName[0];
|
||||||
|
|
||||||
const char* pClassName = pObject->getClassName();
|
const char* pClassName = pObject->getClassName();
|
||||||
|
|
@ -566,6 +574,14 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
|
||||||
else
|
else
|
||||||
dSprintf(ptr, len, " [%s]", pInternalName);
|
dSprintf(ptr, len, " [%s]", pInternalName);
|
||||||
}
|
}
|
||||||
|
if (hasTypeHint && mState.test(ShowTypeHint))
|
||||||
|
{
|
||||||
|
if (mState.test(Item::Marked))
|
||||||
|
dSprintf(ptr, len, " *<%s>", pTypeHint);
|
||||||
|
else
|
||||||
|
dSprintf(ptr, len, " <%s>", pTypeHint);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -835,6 +851,7 @@ GuiTreeViewCtrl::GuiTreeViewCtrl()
|
||||||
mShowClassNames = true;
|
mShowClassNames = true;
|
||||||
mShowObjectNames = true;
|
mShowObjectNames = true;
|
||||||
mShowInternalNames = true;
|
mShowInternalNames = true;
|
||||||
|
mShowTypeHints = false;
|
||||||
mShowClassNameForUnnamedObjects = false;
|
mShowClassNameForUnnamedObjects = false;
|
||||||
mFlags.set(RebuildVisible);
|
mFlags.set(RebuildVisible);
|
||||||
|
|
||||||
|
|
@ -895,6 +912,9 @@ void GuiTreeViewCtrl::initPersistFields()
|
||||||
"If true, item text labels for objects will include object names." );
|
"If true, item text labels for objects will include object names." );
|
||||||
addField( "showInternalNames", TypeBool, Offset( mShowInternalNames, GuiTreeViewCtrl ),
|
addField( "showInternalNames", TypeBool, Offset( mShowInternalNames, GuiTreeViewCtrl ),
|
||||||
"If true, item text labels for objets will include internal names." );
|
"If true, item text labels for objets will include internal names." );
|
||||||
|
addField("showTypeHints", TypeBool, Offset(mShowTypeHints, GuiTreeViewCtrl),
|
||||||
|
"If true, item text labels for objets will include TypeHints.");
|
||||||
|
|
||||||
addField( "showClassNameForUnnamedObjects", TypeBool, Offset( mShowClassNameForUnnamedObjects, GuiTreeViewCtrl ),
|
addField( "showClassNameForUnnamedObjects", TypeBool, Offset( mShowClassNameForUnnamedObjects, GuiTreeViewCtrl ),
|
||||||
"If true, class names will be used as object names for unnamed objects." );
|
"If true, class names will be used as object names for unnamed objects." );
|
||||||
addField( "compareToObjectID", TypeBool, Offset(mCompareToObjectID, GuiTreeViewCtrl));
|
addField( "compareToObjectID", TypeBool, Offset(mCompareToObjectID, GuiTreeViewCtrl));
|
||||||
|
|
@ -1794,6 +1814,7 @@ bool GuiTreeViewCtrl::onAdd()
|
||||||
mShowClassNames = false;
|
mShowClassNames = false;
|
||||||
mShowObjectNames = false;
|
mShowObjectNames = false;
|
||||||
mShowInternalNames = true;
|
mShowInternalNames = true;
|
||||||
|
mShowTypeHints = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* objectNamesOnly = getDataField( sObjectNamesOnly, NULL );
|
const char* objectNamesOnly = getDataField( sObjectNamesOnly, NULL );
|
||||||
|
|
@ -1803,6 +1824,7 @@ bool GuiTreeViewCtrl::onAdd()
|
||||||
mShowClassNames = false;
|
mShowClassNames = false;
|
||||||
mShowObjectNames = true;
|
mShowObjectNames = true;
|
||||||
mShowInternalNames = false;
|
mShowInternalNames = false;
|
||||||
|
mShowTypeHints = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4109,6 +4131,10 @@ GuiTreeViewCtrl::Item* GuiTreeViewCtrl::addInspectorDataItem(Item *parent, SimOb
|
||||||
item->mState.clear( Item::ShowInternalName );
|
item->mState.clear( Item::ShowInternalName );
|
||||||
else
|
else
|
||||||
item->mState.set( Item::ShowInternalName );
|
item->mState.set( Item::ShowInternalName );
|
||||||
|
if (!mShowTypeHints)
|
||||||
|
item->mState.clear(Item::ShowTypeHint);
|
||||||
|
else
|
||||||
|
item->mState.set(Item::ShowTypeHint);
|
||||||
if( mShowClassNameForUnnamedObjects )
|
if( mShowClassNameForUnnamedObjects )
|
||||||
item->mState.set( Item::ShowClassNameForUnnamed );
|
item->mState.set( Item::ShowClassNameForUnnamed );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
||||||
ForceItemName = BIT(15),
|
ForceItemName = BIT(15),
|
||||||
ForceDragTarget = BIT(16),
|
ForceDragTarget = BIT(16),
|
||||||
DenyDrag = BIT(17),
|
DenyDrag = BIT(17),
|
||||||
|
ShowTypeHint = BIT(18),
|
||||||
};
|
};
|
||||||
|
|
||||||
GuiTreeViewCtrl* mParentControl;
|
GuiTreeViewCtrl* mParentControl;
|
||||||
|
|
@ -395,6 +396,9 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
||||||
/// If true, internal names will be included in inspector tree item labels.
|
/// If true, internal names will be included in inspector tree item labels.
|
||||||
bool mShowInternalNames;
|
bool mShowInternalNames;
|
||||||
|
|
||||||
|
/// If true, TypeHints will be included in inspector tree item labels.
|
||||||
|
bool mShowTypeHints;
|
||||||
|
|
||||||
/// If true, class names will be used as object names for unnamed objects.
|
/// If true, class names will be used as object names for unnamed objects.
|
||||||
bool mShowClassNameForUnnamedObjects;
|
bool mShowClassNameForUnnamedObjects;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
PopupMenu::PopupMenu()
|
PopupMenu::PopupMenu()
|
||||||
{
|
{
|
||||||
mMenuItems = NULL;
|
mMenuItems = 0;
|
||||||
mMenuBarCtrl = nullptr;
|
mMenuBarCtrl = nullptr;
|
||||||
|
|
||||||
mBarTitle = StringTable->EmptyString();
|
mBarTitle = StringTable->EmptyString();
|
||||||
|
|
|
||||||
|
|
@ -353,6 +353,17 @@ DefineEngineFunction( mLerp, F32, ( F32 v1, F32 v2, F32 time ),,
|
||||||
return mLerp( v1, v2, time );
|
return mLerp( v1, v2, time );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineFunction(mInvLerp, F32, (F32 v1, F32 v2, F32 point), ,
|
||||||
|
"Calculate the percentage of a point along a line.\n"
|
||||||
|
"@param v1 Interpolate From Input value."
|
||||||
|
"@param v2 Interpolate To Input value."
|
||||||
|
"@param point Point along range."
|
||||||
|
"@returns normalized time used to interpolate values"
|
||||||
|
"@ingroup Math")
|
||||||
|
{
|
||||||
|
return mInvLerp(v1, v2, point);
|
||||||
|
}
|
||||||
|
|
||||||
DefineEngineFunction( mPi, F32, (),,
|
DefineEngineFunction( mPi, F32, (),,
|
||||||
"Return the value of PI (half-circle in radians).\n"
|
"Return the value of PI (half-circle in radians).\n"
|
||||||
"@returns The value of PI."
|
"@returns The value of PI."
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,14 @@ inline T mLerp( const T &v1, const T &v2, F32 factor )
|
||||||
return ( v1 * ( 1.0f - factor ) ) + ( v2 * factor );
|
return ( v1 * ( 1.0f - factor ) ) + ( v2 * factor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Template function for determining a percentage of interpolation between any two
|
||||||
|
/// types which implement operators for scalar multiply and addition.
|
||||||
|
template <typename T>
|
||||||
|
inline T mInvLerp(const T& v1, const T& v2, F32 point)
|
||||||
|
{
|
||||||
|
return (point - v1) / (v2 - v1);
|
||||||
|
}
|
||||||
|
|
||||||
inline S32 mMulDiv(S32 a, S32 b, S32 c)
|
inline S32 mMulDiv(S32 a, S32 b, S32 c)
|
||||||
{
|
{
|
||||||
return m_mulDivS32(a, b, c);
|
return m_mulDivS32(a, b, c);
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ EulerF MatrixF::toEuler() const
|
||||||
|
|
||||||
void MatrixF::dumpMatrix(const char *caption /* =NULL */) const
|
void MatrixF::dumpMatrix(const char *caption /* =NULL */) const
|
||||||
{
|
{
|
||||||
U32 size = dStrlen(caption);
|
U32 size = (caption == NULL)? 0 : dStrlen(caption);
|
||||||
FrameTemp<char> spacer(size+1);
|
FrameTemp<char> spacer(size+1);
|
||||||
char *spacerRef = spacer;
|
char *spacerRef = spacer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#if !defined( __APPLE__ ) && !defined( __FreeBSD__ )
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -38,14 +38,18 @@
|
||||||
|
|
||||||
Platform::SystemInfo_struct Platform::SystemInfo;
|
Platform::SystemInfo_struct Platform::SystemInfo;
|
||||||
|
|
||||||
static inline void rtrim(std::string &s)
|
// trim from start (in place)
|
||||||
{
|
static inline void ltrim(std::string &s) {
|
||||||
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
|
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
|
||||||
|
return !std::isspace(ch);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ltrim(std::string &s)
|
// trim from end (in place)
|
||||||
{
|
static inline void rtrim(std::string &s) {
|
||||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||||
|
return !std::isspace(ch);
|
||||||
|
}).base(), s.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getCPUInformation()
|
static void getCPUInformation()
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
|
#include "core/util/journal/process.h"
|
||||||
#ifndef TORQUE_DEDICATED
|
#ifndef TORQUE_DEDICATED
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -147,6 +148,7 @@ void ProcessControlInit()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Platform::postQuitMessage(const S32 in_quitVal)
|
void Platform::postQuitMessage(const S32 in_quitVal)
|
||||||
{
|
{
|
||||||
|
|
||||||
// if we have a window send a quit event, otherwise just force shutdown
|
// if we have a window send a quit event, otherwise just force shutdown
|
||||||
#if 0
|
#if 0
|
||||||
if (x86UNIXState->windowCreated())
|
if (x86UNIXState->windowCreated())
|
||||||
|
|
@ -155,10 +157,11 @@ void Platform::postQuitMessage(const S32 in_quitVal)
|
||||||
SendQuitEvent();
|
SendQuitEvent();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
forceShutdown(in_quitVal);
|
forceShutdown(in_quitVal);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
Process::requestShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
148
Engine/source/platformSDL/sdlCPUInfo.cpp
Normal file
148
Engine/source/platformSDL/sdlCPUInfo.cpp
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2012 GarageGames, LLC
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to
|
||||||
|
// deal in the Software without restriction, including without limitation the
|
||||||
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// XXTH used for FreeBSD
|
||||||
|
// Note: SDL_cpuinfo have not all information, but better than using
|
||||||
|
// "sysctl hw"
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#if defined( __FreeBSD__ )
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
|
#include "platform/platformCPUCount.h"
|
||||||
|
#include "console/console.h"
|
||||||
|
#include <math/mMathFn.h>
|
||||||
|
|
||||||
|
Platform::SystemInfo_struct Platform::SystemInfo;
|
||||||
|
|
||||||
|
void Processor::init()
|
||||||
|
{
|
||||||
|
|
||||||
|
S32 lCpuCount = SDL_GetCPUCount();
|
||||||
|
Platform::SystemInfo.processor.numLogicalProcessors = lCpuCount;
|
||||||
|
//sdl dont have logical/physical CPU count so ... time to guess
|
||||||
|
if (lCpuCount > 1)
|
||||||
|
{
|
||||||
|
Platform::SystemInfo.processor.numPhysicalProcessors = mFloor(lCpuCount / 2); // guessing ;
|
||||||
|
Platform::SystemInfo.processor.isMultiCore = true;
|
||||||
|
//modern CPU should have isHyperThreaded
|
||||||
|
Platform::SystemInfo.processor.isHyperThreaded = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Platform::SystemInfo.processor.numPhysicalProcessors = lCpuCount; // guessing ;
|
||||||
|
Platform::SystemInfo.processor.isMultiCore = false;
|
||||||
|
Platform::SystemInfo.processor.isHyperThreaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//hackfest
|
||||||
|
Platform::SystemInfo.processor.mhz = 2666;
|
||||||
|
#if defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_X32)
|
||||||
|
// Set sane default information
|
||||||
|
Platform::SystemInfo.processor.name = StringTable->insert("Unknown Processor");
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_C | CPU_PROP_FPU | CPU_PROP_LE ;
|
||||||
|
Platform::SystemInfo.processor.type = CPU_X86Compatible;
|
||||||
|
|
||||||
|
#elif defined(TORQUE_CPU_ARM32) || defined(TORQUE_CPU_ARM64)
|
||||||
|
Platform::SystemInfo.processor.type = CPU_ArmCompatible;
|
||||||
|
Platform::SystemInfo.processor.name = StringTable->insert("Unknown ARM Processor");
|
||||||
|
Platform::SystemInfo.processor.properties = CPU_PROP_C;
|
||||||
|
#else
|
||||||
|
#warning Unsupported CPU
|
||||||
|
#endif
|
||||||
|
// Set 64bit flag
|
||||||
|
#if defined(TORQUE_CPU_X64) || defined(TORQUE_CPU_ARM64)
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_64bit;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Con::printf("Processor Init:");
|
||||||
|
Con::printf(" CPU count: %d", lCpuCount);
|
||||||
|
Con::printf(" CacheLine size: %d", SDL_GetCPUCacheLineSize());
|
||||||
|
if (lCpuCount > 1) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_MP;
|
||||||
|
Con::printf(" MultiCore CPU detected" );
|
||||||
|
}
|
||||||
|
Con::printf(" RAM: %d MB", SDL_GetSystemRAM());
|
||||||
|
if (SDL_HasMMX()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_MMX;
|
||||||
|
Con::printf(" MMX detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasSSE()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_SSE;
|
||||||
|
Con::printf(" SSE detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasSSE2()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_SSE2;
|
||||||
|
Con::printf(" SSE2 detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasSSE3()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_SSE3;
|
||||||
|
Con::printf(" SSE3 detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasSSE41()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_SSE4_1;
|
||||||
|
Con::printf(" SSE4.1 detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasSSE42()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_SSE4_2;
|
||||||
|
Con::printf(" SSE4.2 detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasSSE42()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_SSE4_2;
|
||||||
|
Con::printf(" SSE4.2 detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasAVX() || SDL_HasAVX2()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_AVX;
|
||||||
|
Con::printf(" AVX detected" );
|
||||||
|
}
|
||||||
|
if (SDL_HasNEON()) {
|
||||||
|
Platform::SystemInfo.processor.properties |= CPU_PROP_NEON;
|
||||||
|
Con::printf(" NEON detected" );
|
||||||
|
}
|
||||||
|
|
||||||
|
Con::printf(" ");
|
||||||
|
|
||||||
|
SetProcessorInfo(Platform::SystemInfo.processor, "Unknown", "Unknown");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace CPUInfo
|
||||||
|
{
|
||||||
|
EConfig CPUCount(U32 &logical, U32 &physical)
|
||||||
|
{
|
||||||
|
// We don't set logical or physical here because it's already been determined by this point
|
||||||
|
if (Platform::SystemInfo.processor.isHyperThreaded && Platform::SystemInfo.processor.numPhysicalProcessors == 1)
|
||||||
|
{
|
||||||
|
return CONFIG_SingleCoreHTEnabled;
|
||||||
|
}
|
||||||
|
else if (!Platform::SystemInfo.processor.isHyperThreaded && Platform::SystemInfo.processor.numPhysicalProcessors > 1)
|
||||||
|
{
|
||||||
|
return CONFIG_MultiCoreAndHTNotCapable;
|
||||||
|
}
|
||||||
|
else if (!Platform::SystemInfo.processor.isHyperThreaded && Platform::SystemInfo.processor.numPhysicalProcessors == 1)
|
||||||
|
{
|
||||||
|
return CONFIG_SingleCoreAndHTNotCapable;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CONFIG_MultiCoreAndHTEnabled;
|
||||||
|
}
|
||||||
|
}; // namespace CPUInfo
|
||||||
|
|
||||||
|
#endif // defined( __FreeBSD__ )
|
||||||
|
|
@ -788,7 +788,7 @@ class TSThread
|
||||||
keyPos = 0;
|
keyPos = 0;
|
||||||
mSeqPos = 0;
|
mSeqPos = 0;
|
||||||
mShapeInstance = NULL;
|
mShapeInstance = NULL;
|
||||||
makePath = NULL;
|
makePath = false;
|
||||||
priority = 0;
|
priority = 0;
|
||||||
sequence = 0;
|
sequence = 0;
|
||||||
timeScale = 1.0f;
|
timeScale = 1.0f;
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,7 @@ $guiContent = new GuiControl() {
|
||||||
showClassNames = "0";
|
showClassNames = "0";
|
||||||
showObjectNames = "1";
|
showObjectNames = "1";
|
||||||
showInternalNames = "1";
|
showInternalNames = "1";
|
||||||
|
showTypeHints = "1";
|
||||||
showClassNameForUnnamedObjects = "1";
|
showClassNameForUnnamedObjects = "1";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue