You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(140) |
Feb
(98) |
Mar
(152) |
Apr
(104) |
May
(71) |
Jun
(94) |
Jul
(169) |
Aug
(83) |
Sep
(47) |
Oct
(134) |
Nov
(7) |
Dec
(20) |
2004 |
Jan
(41) |
Feb
(14) |
Mar
(42) |
Apr
(47) |
May
(68) |
Jun
(143) |
Jul
(65) |
Aug
(29) |
Sep
(40) |
Oct
(34) |
Nov
(33) |
Dec
(97) |
2005 |
Jan
(29) |
Feb
(30) |
Mar
(9) |
Apr
(37) |
May
(13) |
Jun
(31) |
Jul
(22) |
Aug
(23) |
Sep
|
Oct
(37) |
Nov
(34) |
Dec
(117) |
2006 |
Jan
(48) |
Feb
(6) |
Mar
(2) |
Apr
(71) |
May
(10) |
Jun
(16) |
Jul
(7) |
Aug
(1) |
Sep
(14) |
Oct
(17) |
Nov
(25) |
Dec
(26) |
2007 |
Jan
(8) |
Feb
(2) |
Mar
(7) |
Apr
(26) |
May
|
Jun
(12) |
Jul
(30) |
Aug
(14) |
Sep
(9) |
Oct
(4) |
Nov
(7) |
Dec
(6) |
2008 |
Jan
(10) |
Feb
(10) |
Mar
(6) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(18) |
Aug
(15) |
Sep
(16) |
Oct
(5) |
Nov
(3) |
Dec
(10) |
2009 |
Jan
(11) |
Feb
(2) |
Mar
|
Apr
(15) |
May
(31) |
Jun
(18) |
Jul
(11) |
Aug
(26) |
Sep
(52) |
Oct
(17) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ww...> - 2005-11-19 21:47:30
|
Author: mkrose Date: 2005-11-19 13:47:20 -0800 (Sat, 19 Nov 2005) New Revision: 1678 Modified: trunk/CSP/CSPSim/Bin/CSPSim.py Log: Fix CSPSim.py to work with the recent logging changes (forgot to include this file in a previous checkin). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1678 Modified: trunk/CSP/CSPSim/Bin/CSPSim.py =================================================================== --- trunk/CSP/CSPSim/Bin/CSPSim.py 2005-11-19 19:29:23 UTC (rev 1677) +++ trunk/CSP/CSPSim/Bin/CSPSim.py 2005-11-19 21:47:20 UTC (rev 1678) @@ -102,14 +102,13 @@ flags = flags | class_flag except: print "Unrecognized log class:", class_name - cCSP.csplog().setLogCategory(flags) + cCSP.csplog().setCategories(flags) def setLogPriority(): - cCSP.csplog().setTimeLogging(1) if log_priority is None: return - cCSP.csplog().setLogPriority(log_priority) - SimData.log().setLogPriority(log_priority) + cCSP.csplog().setPriority(log_priority) + SimData.log().setPriority(log_priority) def parseLogPriority(priority): @@ -176,8 +175,8 @@ cachepath = cCSP.getCachePath() dar = os.path.join(cachepath, "sim.dar") XML = os.path.join(datapath, "XML") - cCSP.csplog().setLogCategory(cCSP.CSP_ALL) - cCSP.csplog().setLogPriority(SimData.LOG_ALERT) + cCSP.csplog().setCategories(cCSP.CSP_ALL) + cCSP.csplog().setPriority(SimData.LOG_ERROR) #print "compile %s %s" % (XML, dar) try: from CSP.SimData.Compile import Compiler, CompilerUsageError @@ -346,8 +345,8 @@ print "Invalid logging priority, using .ini setting." # capture Object class registration and other errors when CSP loads - SimData.log().setLogCategory(SimData.LOG_ALL) - SimData.log().setLogPriority(SimData.LOG_DEBUG) + SimData.log().setCategories(SimData.LOG_ALL) + SimData.log().setPriority(SimData.LOG_DEBUG) loadCSP() |
From: <sv...@ww...> - 2005-11-19 19:29:32
|
Author: mkrose Date: 2005-11-19 11:29:23 -0800 (Sat, 19 Nov 2005) New Revision: 1677 Modified: trunk/CSP/tools/build.py Log: Update build.py to work with SCons 0.96.91 (and 0.96.1). Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1677 Diff omitted (10145 bytes). |
From: <sv...@ww...> - 2005-11-19 19:26:13
|
Author: mkrose Date: 2005-11-19 11:26:01 -0800 (Sat, 19 Nov 2005) New Revision: 1676 Modified: trunk/CSP/SimData/SimData/Tests/SConscript trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp Log: Fix SimData tests which were broken by the recent changes to Trace.{h,cpp}. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1676 Modified: trunk/CSP/SimData/SimData/Tests/SConscript =================================================================== --- trunk/CSP/SimData/SimData/Tests/SConscript 2005-11-16 07:21:11 UTC (rev 1675) +++ trunk/CSP/SimData/SimData/Tests/SConscript 2005-11-19 19:26:01 UTC (rev 1676) @@ -18,7 +18,7 @@ Import('env build') -testenv = env.Copy(LIBS=["SimData", "pthread"], LIBPATH=["#/SimData/SimData"]) +testenv = env.Copy(LIBS=["SimData", "pthread", "dl"], LIBPATH=["#/SimData/SimData"]) import glob import os.path Modified: trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp =================================================================== --- trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp 2005-11-16 07:21:11 UTC (rev 1675) +++ trunk/CSP/SimData/SimData/Tests/test_CircularBuffer.cpp 2005-11-19 19:26:01 UTC (rev 1676) @@ -104,7 +104,7 @@ int main() { - Trace::install(); + AutoTrace::install(); test(); return 0; } |
From: <sv...@ww...> - 2005-11-16 07:21:18
|
Author: stormbringer Date: 2005-11-15 23:21:11 -0800 (Tue, 15 Nov 2005) New Revision: 1675 Modified: trunk/CSP/SimData/Include/SimData/LogStream.h trunk/CSP/SimData/Include/SimData/Trace.h Log: Minor changes to make the code compile on Windows Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1675 Modified: trunk/CSP/SimData/Include/SimData/LogStream.h =================================================================== --- trunk/CSP/SimData/Include/SimData/LogStream.h 2005-11-15 08:42:19 UTC (rev 1674) +++ trunk/CSP/SimData/Include/SimData/LogStream.h 2005-11-16 07:21:11 UTC (rev 1675) @@ -177,7 +177,7 @@ * file name and line number to be automatically recorded in the log. * See the various SIMDATA_LOG macros for more information. */ -class LogStream::LogEntry { +class SIMDATA_EXPORT LogStream::LogEntry { public: /** Create a new log entry in the specified log stream. * Modified: trunk/CSP/SimData/Include/SimData/Trace.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Trace.h 2005-11-15 08:42:19 UTC (rev 1674) +++ trunk/CSP/SimData/Include/SimData/Trace.h 2005-11-16 07:21:11 UTC (rev 1675) @@ -81,22 +81,22 @@ SIMDATA_EXPORT class AutoTrace { public: // install sigv and abort handlers. - static bool install(); - static void setLog(LogStream &log); - static void inhibitAbortHandler() { _abort = false; } + static SIMDATA_EXPORT bool install(); + static SIMDATA_EXPORT void setLog(LogStream &log); + static SIMDATA_EXPORT void inhibitAbortHandler() { _abort = false; } private: // signal handlers. - static void __sigterm(int /*sig_n*/); - static void __sigsegv(int /*sig_n*/); - static void __sigabort(int /*sig_n*/); + static SIMDATA_EXPORT void __sigterm(int /*sig_n*/); + static SIMDATA_EXPORT void __sigsegv(int /*sig_n*/); + static SIMDATA_EXPORT void __sigabort(int /*sig_n*/); - static LogStream *log(); + static SIMDATA_EXPORT LogStream *log(); - static StackTrace _trace; - static LogStream *_log; - static char *_reserve; - static bool _abort; + static SIMDATA_EXPORT StackTrace _trace; + static SIMDATA_EXPORT LogStream *_log; + static SIMDATA_EXPORT char *_reserve; + static SIMDATA_EXPORT bool _abort; }; |
From: <sv...@ww...> - 2005-11-15 08:42:29
|
Author: mkrose Date: 2005-11-15 00:42:19 -0800 (Tue, 15 Nov 2005) New Revision: 1674 Modified: trunk/CSP/SimData/VisualStudio/SimData.vcproj Log: Add trace.{h,cpp} to the visual studio project. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1674 Modified: trunk/CSP/SimData/VisualStudio/SimData.vcproj =================================================================== --- trunk/CSP/SimData/VisualStudio/SimData.vcproj 2005-11-13 22:41:39 UTC (rev 1673) +++ trunk/CSP/SimData/VisualStudio/SimData.vcproj 2005-11-15 08:42:19 UTC (rev 1674) @@ -217,6 +217,9 @@ RelativePath="..\Source\Real.cpp"> </File> <File + RelativePath="..\Source\Trace.cpp"> + </File> + <File RelativePath="..\Source\TypeAdapter.cpp"> </File> <File @@ -335,6 +338,9 @@ RelativePath="..\Include\SimData\Referenced.h"> </File> <File + RelativePath="..\Include\SimData\Trace.h"> + </File> + <File RelativePath="..\Include\SimData\TypeAdapter.h"> </File> <File |
From: <sv...@ww...> - 2005-11-13 22:41:46
|
Author: mkrose Date: 2005-11-13 14:41:39 -0800 (Sun, 13 Nov 2005) New Revision: 1673 Modified: trunk/CSP/SimData/Include/SimData/LogStream.h trunk/CSP/SimData/Source/ExceptionBase.cpp trunk/CSP/SimData/Source/LogStream.cpp trunk/CSP/SimData/Source/Trace.cpp Log: More logging fixes. Change priority and formatting constants to avoid collisions with macro names under windows. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1673 Modified: trunk/CSP/SimData/Include/SimData/LogStream.h =================================================================== --- trunk/CSP/SimData/Include/SimData/LogStream.h 2005-11-13 20:41:44 UTC (rev 1672) +++ trunk/CSP/SimData/Include/SimData/LogStream.h 2005-11-13 22:41:39 UTC (rev 1673) @@ -50,8 +50,8 @@ class SIMDATA_EXPORT LogStream { public: /// Flags controlling log metadata. - enum { TERSE=0, PRIORITY=1, DATESTAMP=2, TIMESTAMP=4, LINESTAMP=8, FULLPATH=16, THREAD=32, VERBOSE=~0 }; - enum { DEBUG=0, INFO=1, WARNING=2, ERROR=3, FATAL=4 }; + enum { cTerse=0, cPriority=1, cDatestamp=2, cTimestamp=4, cLinestamp=8, cFullPath=16, cThread=32, cVerbose=~0 }; + enum { cDebug=0, cInfo=1, cWarning=2, cError=3, cFatal=4 }; /** Create a new log stream that defaults to stderr. */ @@ -183,7 +183,7 @@ * * @param stream the logstream to write to. * @param priority priority of this message. - * If non-negative and the logstream's flags include PRIORITY, this + * If non-negative and the logstream's flags include cPriority, this * priority will be recorded in the message. Note that this is only * an advisory value; it is up to the creator of the LogEntry to * filter messages based on priority. @@ -196,7 +196,7 @@ * * @param stream the logstream to write to. * @param priority priority of this message. - * If non-negative and the logstream's flags includes PRIORITY, this + * If non-negative and the logstream's flags includes cPriority, this * priority will be recorded in the message. Note that this is only * an advisory value; it is up to the creator of the LogEntry to * filter messages based on priority. @@ -209,14 +209,14 @@ /** Write the buffered log entry to the logstream. Locks the stream during the * write operation if running in a multithreaded environment. If the priority - * is FATAL, records a stack trace and aborts the program. + * is cFatal, records a stack trace and aborts the program. */ ~LogEntry() { m_stream.lock(); m_stream.getStream() << m_buffer.get() << "\n"; - if (m_priority >= LogStream::WARNING) m_stream.flush(); + if (m_priority >= LogStream::cWarning) m_stream.flush(); m_stream.unlock(); - if (m_priority == LogStream::FATAL) die(); + if (m_priority == LogStream::cFatal) die(); } /** Stream operator for recording messages in the log entry. Modified: trunk/CSP/SimData/Source/ExceptionBase.cpp =================================================================== --- trunk/CSP/SimData/Source/ExceptionBase.cpp 2005-11-13 20:41:44 UTC (rev 1672) +++ trunk/CSP/SimData/Source/ExceptionBase.cpp 2005-11-13 22:41:39 UTC (rev 1673) @@ -102,7 +102,7 @@ void ExceptionBase::logAndClear(int category) const { if (SIMDATA_NOTEWORTHY(LOG_ERROR, category)) { - LogStream::LogEntry(SIMDATA_LOG_, LogStream::ERROR) << *this; + LogStream::LogEntry(SIMDATA_LOG_, LogStream::cError) << *this; } } Modified: trunk/CSP/SimData/Source/LogStream.cpp =================================================================== --- trunk/CSP/SimData/Source/LogStream.cpp 2005-11-13 20:41:44 UTC (rev 1672) +++ trunk/CSP/SimData/Source/LogStream.cpp 2005-11-13 22:41:39 UTC (rev 1673) @@ -63,7 +63,7 @@ if (env_priority && *env_priority) { int priority = atoi(env_priority); if (priority < 0) priority = 0; - if (priority > FATAL) priority = FATAL; + if (priority > cFatal) priority = cFatal; setPriority(priority); } } @@ -78,18 +78,18 @@ void LogStream::LogEntry::prefix(const char *filename, int linenum) { const int flags = m_stream.getFlags(); - if (flags & LogStream::PRIORITY) { + if (flags & LogStream::cPriority) { m_buffer << ((m_priority >= 0 && m_priority <= 4) ? "DIWEF"[m_priority] : '?') << " "; } - if (flags & (LogStream::TIMESTAMP|LogStream::DATESTAMP)) { + if (flags & (LogStream::cTimestamp|LogStream::cDatestamp)) { const time_t now = time(0); struct tm gmt; gmtime_r(&now, &gmt); char time_stamp[32]; - switch (flags & (LogStream::TIMESTAMP|LogStream::DATESTAMP)) { - case LogStream::TIMESTAMP: + switch (flags & (LogStream::cTimestamp|LogStream::cDatestamp)) { + case LogStream::cTimestamp: strftime(time_stamp, 32, "%H%M%S", &gmt); break; - case LogStream::DATESTAMP: + case LogStream::cDatestamp: strftime(time_stamp, 32, "%Y%m%d", &gmt); break; default: strftime(time_stamp, 32, "%Y%m%d %H%M%S", &gmt); @@ -97,7 +97,7 @@ m_buffer << time_stamp << ' '; } #ifndef SIMDATA_NOTHREADS - if (flags & LogStream::THREAD) { + if (flags & LogStream::cThread) { pthread_t thread_id = thread::id(); if (!pthread_equal(thread_id, m_stream.initialThread())) { // compress the low 32 or 36 bits of thread id into 6 characters. note that this is *not* @@ -113,9 +113,9 @@ } } #endif - if (filename && (flags & LogStream::LINESTAMP)) { + if (filename && (flags & LogStream::cLinestamp)) { const char *basename = filename; - if ((flags & LogStream::FULLPATH) == 0) { + if ((flags & LogStream::cFullPath) == 0) { for (const char *scanner = filename; *scanner; ++scanner) { if (*scanner == ospath::DIR_SEPARATOR) basename = scanner + 1; } @@ -149,8 +149,8 @@ } LogStream::LogStream(): - m_flags(PRIORITY|TIMESTAMP|LINESTAMP|THREAD), - m_priority(INFO), + m_flags(cPriority|cTimestamp|cLinestamp|cThread), + m_priority(cInfo), m_categories(~0), m_stream(&std::cerr), m_fstream(0) { @@ -158,8 +158,8 @@ } LogStream::LogStream(std::ostream& stream): - m_flags(PRIORITY|TIMESTAMP|LINESTAMP|THREAD), - m_priority(INFO), + m_flags(cPriority|cTimestamp|cLinestamp|cThread), + m_priority(cInfo), m_categories(~0), m_stream(&stream), m_fstream(0) { Modified: trunk/CSP/SimData/Source/Trace.cpp =================================================================== --- trunk/CSP/SimData/Source/Trace.cpp 2005-11-13 20:41:44 UTC (rev 1672) +++ trunk/CSP/SimData/Source/Trace.cpp 2005-11-13 22:41:39 UTC (rev 1673) @@ -182,7 +182,7 @@ _trace.acquire(/*skip=*/3); LogStream *logstream = log(); // don't log at FATAL priority since that allocates another stack trace. - LogStream::LogEntry(*logstream, LogStream::ERROR) << "FATAL ERROR: segmentation fault"; + LogStream::LogEntry(*logstream, LogStream::cError) << "FATAL ERROR: segmentation fault"; logstream->trace(&_trace); _abort = false; // prevent the abort handler from also logging a trace abort(); @@ -194,7 +194,7 @@ if (_reserve) free(_reserve); _reserve = 0; // free some memory! _trace.acquire(/*skip=*/3); LogStream *logstream = log(); - LogStream::LogEntry(*logstream, LogStream::FATAL) << "ABORT"; + LogStream::LogEntry(*logstream, LogStream::cFatal) << "ABORT"; } } @@ -202,7 +202,7 @@ _trace.acquire(/*skip=*/3); LogStream *logstream = log(); _abort = false; - LogStream::LogEntry(*logstream, LogStream::FATAL) << "TERMINATED"; + LogStream::LogEntry(*logstream, LogStream::cFatal) << "TERMINATED"; } LogStream *AutoTrace::log() { |
From: <sv...@ww...> - 2005-11-13 20:41:50
|
Author: mkrose Date: 2005-11-13 12:41:44 -0800 (Sun, 13 Nov 2005) New Revision: 1672 Modified: trunk/CSP/SimData/Source/LogStream.cpp Log: Add missing ~LogStream implementation. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1672 Modified: trunk/CSP/SimData/Source/LogStream.cpp =================================================================== --- trunk/CSP/SimData/Source/LogStream.cpp 2005-11-13 20:37:18 UTC (rev 1671) +++ trunk/CSP/SimData/Source/LogStream.cpp 2005-11-13 20:41:44 UTC (rev 1672) @@ -166,6 +166,10 @@ init(); } +LogStream::~LogStream() { + close(); +} + void LogStream::setStream(std::ostream &stream) { if (&stream != m_stream) { close(); |
From: <sv...@ww...> - 2005-11-13 20:37:25
|
Author: mkrose Date: 2005-11-13 12:37:18 -0800 (Sun, 13 Nov 2005) New Revision: 1671 Modified: trunk/CSP/SimData/Source/ThreadUtil.cpp Log: More pthread_t tweaks for windows. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1671 Modified: trunk/CSP/SimData/Source/ThreadUtil.cpp =================================================================== --- trunk/CSP/SimData/Source/ThreadUtil.cpp 2005-11-13 18:01:44 UTC (rev 1670) +++ trunk/CSP/SimData/Source/ThreadUtil.cpp 2005-11-13 20:37:18 UTC (rev 1671) @@ -72,18 +72,19 @@ unsigned long pthread_t_to_ulong(pthread_t const &id) { #ifdef PTW32_VERSION // pthreads-win32 - return static_cast<unsigned long>(id.p); // pointer to the thread object + // treat the pointer to the thread object as an integer id + if (sizeof(unsigned long) == sizeof(void*)) return *reinterpret_cast<const unsigned long*>(id.p); #else // if pthread_t is small, assume it is a simple numeric id. if (sizeof(pthread_t) == sizeof(unsigned long)) return *reinterpret_cast<const unsigned long*>(&id); if (sizeof(pthread_t) == sizeof(unsigned)) return *reinterpret_cast<const unsigned*>(&id); +#endif // for other implementations that define pthread_t as a struct, return a 32-bit hash of // the pthread_t structure. this is dangerous, since the structure may contain mutable // data that is unrelated to the thread identity (e.g., a reference count). the posix // standard doesn't provide any good options in this case. feel free to special case // specific pthread libraries using more #ifdef branches above if necessary. return hash_uint32(reinterpret_cast<const char*>(&id), sizeof(pthread_t)); -#endif } NAMESPACE_SIMDATA_END |
From: <sv...@ww...> - 2005-11-13 18:01:54
|
Author: mkrose Date: 2005-11-13 10:01:44 -0800 (Sun, 13 Nov 2005) New Revision: 1670 Modified: trunk/CSP/SimData/Include/SimData/LogStream.h trunk/CSP/SimData/Include/SimData/Thread.h trunk/CSP/SimData/Include/SimData/ThreadUtil.h trunk/CSP/SimData/Source/LogStream.cpp trunk/CSP/SimData/Source/ThreadUtil.cpp Log: Fix compile errors under windows related to pthread_t. Provide a somewhat more robust way of dealing with these objects. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1670 Modified: trunk/CSP/SimData/Include/SimData/LogStream.h =================================================================== --- trunk/CSP/SimData/Include/SimData/LogStream.h 2005-11-13 16:25:27 UTC (rev 1669) +++ trunk/CSP/SimData/Include/SimData/LogStream.h 2005-11-13 18:01:44 UTC (rev 1670) @@ -105,7 +105,7 @@ void setLocking(bool thread_safe=true) { m_threadsafe = thread_safe; } void lock() { if (m_threadsafe) m_mutex.lock(); } void unlock() { if (m_threadsafe) m_mutex.unlock(); } - uint32 initialThreadId() const { return m_initial_thread_id; } + pthread_t initialThread() const { return m_initial_thread; } #endif // SIMDATA_NOTHREADS /** Test if a given priority and category should be logged. @@ -145,7 +145,7 @@ #ifndef SIMDATA_NOTHREADS ThreadMutex m_mutex; bool m_threadsafe; - uint32 m_initial_thread_id; + pthread_t m_initial_thread; #endif }; Modified: trunk/CSP/SimData/Include/SimData/Thread.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Thread.h 2005-11-13 16:25:27 UTC (rev 1669) +++ trunk/CSP/SimData/Include/SimData/Thread.h 2005-11-13 18:01:44 UTC (rev 1670) @@ -64,7 +64,7 @@ /** Return the id of the current thread. */ - static inline unsigned long id() { return pthread_self(); } + static inline pthread_t id() { return pthread_self(); } /** Terminate the currently executing thread. */ @@ -147,31 +147,6 @@ public: typedef simdata::Ref<Task> Ref; -#ifndef PTHREADS_WIN - typedef pthread_t ThreadId; -#else - // small wrapper for pthreads win dated 11-22-2004 - struct ThreadId: public pthread_t { - ThreadId(unsigned int i) {x = i;} - ThreadId& operator=(const pthread_t& other) { - if (this != &other) { - x = other.x; - p = other.p; - } - return *this; - } - bool operator==(unsigned int i) const { - return x == i; - } - bool operator!=(unsigned int i) const { - return !(*this == i); - } - bool operator&&(bool other) const { - return (*this != 0) && other; - } - }; -#endif - /** Test if a request to abort the task has been made. * * @return true if abort() has been called, false otherwise. @@ -214,7 +189,7 @@ /** Initialize the task state. */ - Task(): m_running(false), m_detached(false), m_complete(false), m_abort(false), m_thread_id(0) { + Task(): m_running(false), m_detached(false), m_complete(false), m_abort(false) { } virtual ~Task() { } @@ -247,7 +222,6 @@ */ void _execute() { m_running = true; - m_thread_id = pthread_self(); try { run(); } catch (Exception &e) { @@ -283,15 +257,9 @@ bool m_detached; bool m_complete; bool m_abort; - ThreadId m_thread_id; ThreadCondition m_exit; }; -#ifdef PTHREADS_WIN -inline bool operator&&(bool lhs,const Task::ThreadId& rhs) { - return rhs.operator&&(lhs); -} -#endif /** Base class for wrapping a Posix thread. * @@ -310,7 +278,7 @@ * @param task a non-null Task pointer to bind to this thread. * @param name a unique string identifier for this thread. */ - BaseThread(Task *task, std::string const &name): m_task(task), m_thread_id(0), m_cancelled(false) { + BaseThread(Task *task, std::string const &name): m_task(task), m_started(false), m_cancelled(false) { assert(task); if (name.size()) { task->setName(name); @@ -409,6 +377,7 @@ // is called. _start takes care of deleting the reference. int result = pthread_create(&m_thread_id, 0, &Task::_start, new Ref<Task>(m_task)); ThreadException::checkThrow(result); + m_started = true; } /** Start the thread running and detach it. @@ -421,13 +390,13 @@ /** Returns true if this thread has been started successfully via start(). */ bool isStarted() const { - return m_thread_id != 0; + return m_started; } /** Test if this thread has been started but has not yet finished. */ bool isActive() const { - return m_task.valid() && m_thread_id && !m_task->isComplete(); + return m_task.valid() && isStarted() && !m_task->isComplete(); } /** Test if this thread has been detached. @@ -443,7 +412,8 @@ private: Ref<Task> m_task; - Task::ThreadId m_thread_id; + pthread_t m_thread_id; + bool m_started; bool m_cancelled; }; Modified: trunk/CSP/SimData/Include/SimData/ThreadUtil.h =================================================================== --- trunk/CSP/SimData/Include/SimData/ThreadUtil.h 2005-11-13 16:25:27 UTC (rev 1669) +++ trunk/CSP/SimData/Include/SimData/ThreadUtil.h 2005-11-13 18:01:44 UTC (rev 1670) @@ -24,6 +24,7 @@ * @brief Thread utility classes. */ +#ifndef SIMDATA_NOTHREADS #ifndef __SIMDATA_THREADUTIL_H__ #define __SIMDATA_THREADUTIL_H__ @@ -31,6 +32,7 @@ #include <SimData/Namespace.h> #include <SimData/Properties.h> #include <SimData/ExceptionBase.h> +#include <pthread.h> NAMESPACE_SIMDATA @@ -62,8 +64,15 @@ inline void unlock() { } }; +/** Convert an (opaque) pthread_t to an unsigned long. The value + * is intended for diagnostic logging only. Use pthread_equal to + * compare thread ids. + */ +unsigned long pthread_t_to_ulong(pthread_t const &id); + NAMESPACE_SIMDATA_END #endif // __SIMDATA_THREADUTIL_H__ +#endif // SIMDATA_NOTHREADS Modified: trunk/CSP/SimData/Source/LogStream.cpp =================================================================== --- trunk/CSP/SimData/Source/LogStream.cpp 2005-11-13 16:25:27 UTC (rev 1669) +++ trunk/CSP/SimData/Source/LogStream.cpp 2005-11-13 18:01:44 UTC (rev 1670) @@ -29,6 +29,7 @@ #include <SimData/FileUtility.h> #include <SimData/Trace.h> #include <SimData/Thread.h> +#include <SimData/ThreadUtil.h> #include <iostream> #include <iomanip> @@ -97,12 +98,13 @@ } #ifndef SIMDATA_NOTHREADS if (flags & LogStream::THREAD) { - // compress the 32-bit thread id into 6 characters. note that this is *not* the standard - // base64 encoding. the numbers are in front to make it more likely that the final output - // resembles a numeric value. - const char *encode64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; - uint32 id = static_cast<uint32>(thread::id()); - if (id != m_stream.initialThreadId()) { + pthread_t thread_id = thread::id(); + if (!pthread_equal(thread_id, m_stream.initialThread())) { + // compress the low 32 or 36 bits of thread id into 6 characters. note that this is *not* + // the standard base64 encoding. the numbers are in front to make it more likely that the + // final output resembles a numeric value. + const char *encode64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; + unsigned long id = pthread_t_to_ulong(thread_id); char id_buffer[8]; id_buffer[6] = ' '; id_buffer[7] = 0; @@ -142,7 +144,7 @@ void LogStream::init() { #ifndef SIMDATA_NOTHREADS m_threadsafe = true; - m_initial_thread_id = static_cast<uint32>(thread::id()); + m_initial_thread = thread::id(); #endif } Modified: trunk/CSP/SimData/Source/ThreadUtil.cpp =================================================================== --- trunk/CSP/SimData/Source/ThreadUtil.cpp 2005-11-13 16:25:27 UTC (rev 1669) +++ trunk/CSP/SimData/Source/ThreadUtil.cpp 2005-11-13 18:01:44 UTC (rev 1670) @@ -27,8 +27,10 @@ #ifndef SIMDATA_NOTHREADS #include <SimData/ThreadUtil.h> +#include <SimData/HashUtility.h> #include <SimData/Log.h> +#include <pthread.h> #include <string> #include <sstream> @@ -68,6 +70,21 @@ addMessage(msg.str()); } +unsigned long pthread_t_to_ulong(pthread_t const &id) { +#ifdef PTW32_VERSION // pthreads-win32 + return static_cast<unsigned long>(id.p); // pointer to the thread object +#else + // if pthread_t is small, assume it is a simple numeric id. + if (sizeof(pthread_t) == sizeof(unsigned long)) return *reinterpret_cast<const unsigned long*>(&id); + if (sizeof(pthread_t) == sizeof(unsigned)) return *reinterpret_cast<const unsigned*>(&id); + // for other implementations that define pthread_t as a struct, return a 32-bit hash of + // the pthread_t structure. this is dangerous, since the structure may contain mutable + // data that is unrelated to the thread identity (e.g., a reference count). the posix + // standard doesn't provide any good options in this case. feel free to special case + // specific pthread libraries using more #ifdef branches above if necessary. + return hash_uint32(reinterpret_cast<const char*>(&id), sizeof(pthread_t)); +#endif +} NAMESPACE_SIMDATA_END |
From: <sv...@ww...> - 2005-11-13 16:25:36
|
Author: mkrose Date: 2005-11-13 08:25:27 -0800 (Sun, 13 Nov 2005) New Revision: 1669 Modified: trunk/CSP/SimData/Source/Timing.cpp Log: Fix a compile error under windows. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1669 Modified: trunk/CSP/SimData/Source/Timing.cpp =================================================================== --- trunk/CSP/SimData/Source/Timing.cpp 2005-11-13 01:08:39 UTC (rev 1668) +++ trunk/CSP/SimData/Source/Timing.cpp 2005-11-13 16:25:27 UTC (rev 1669) @@ -148,7 +148,7 @@ if (calibrations == 0) { throw TimerError("Unable to calibrate high resolution timer using system time"); } - SIMDATA_LOG(LOG_TIME, LOG_ERROR, "High resolution timer calibration failed"); + SIMDATA_LOG(ERROR, TIME) << "High resolution timer calibration failed"; } else { if (calibrations++ == 0) { first_counter = counter; |
From: <sv...@ww...> - 2005-11-13 01:08:48
|
Author: mkrose Date: 2005-11-12 17:08:39 -0800 (Sat, 12 Nov 2005) New Revision: 1668 Added: trunk/CSP/SimCore/Util/LocalUpdate.cpp trunk/CSP/SimCore/Util/LocalUpdate.h Log: Add a helper class for dispatching occasional update callbacks from an UpdateTarget handler. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1668 Added: trunk/CSP/SimCore/Util/LocalUpdate.cpp =================================================================== --- trunk/CSP/SimCore/Util/LocalUpdate.cpp 2005-11-12 20:22:53 UTC (rev 1667) +++ trunk/CSP/SimCore/Util/LocalUpdate.cpp 2005-11-13 01:08:39 UTC (rev 1668) @@ -0,0 +1,94 @@ +// Combat Simulator Project - CSPSim +// Copyright (C) 2005 The Combat Simulator Project +// http://csp.sourceforge.net +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file LocalUpdate.cpp + * + **/ + +#include <SimCore/Util/LocalUpdate.h> +#include <algorithm> +#include <cassert> + + +namespace simcore { + +/** Internal helper class for managing update callbacks. Stores the callback + * and tracks update intervals. + */ +class LocalUpdate::PriorityHandler { +public: + PriorityHandler(Callback const &handler, double interval): m_Handler(handler), m_Next(-1), m_Last(-1), m_Interval(interval) { + assert(interval > 0.0); + if (m_Interval <= 0) m_Interval = 0.001; + } + + bool update(double t) { + bool remove = false; + double delay = m_Interval; + if (m_Next >= 0) { + const double elapsed_time = t - m_Last; + const double delta = m_Handler(elapsed_time); + if (delta > 0) delay = delta; else if (delta < 0) remove = true; + } + m_Last = t; + m_Next = t + delay; + return !remove; + } + + double next() const { return m_Next; } + double interval() const { return m_Interval; } + + struct Order { + inline bool operator()(PriorityHandler const *lhs, PriorityHandler const *rhs) { return lhs->next() > rhs->next(); } + }; + +private: + Callback m_Handler; + double m_Next; + double m_Last; + double m_Interval; +}; + + +LocalUpdate::~LocalUpdate() { + for (unsigned i = 0; i < m_Queue.size(); ++i) delete m_Queue[i]; +} + +void LocalUpdate::_addHandler(Callback const &handler, double interval) { + m_Queue.push_back(new PriorityHandler(handler, interval)); + std::push_heap(m_Queue.begin(), m_Queue.end(), PriorityHandler::Order()); +} + +void LocalUpdate::dispatch() { + assert(!m_Queue.empty()); + while (m_Queue.front()->next() <= m_Time) { + std::pop_heap(m_Queue.begin(), m_Queue.end(), PriorityHandler::Order()); + if (!m_Queue.back()->update(m_Time)) { + delete m_Queue.back(); + m_Queue.pop_back(); + } else { + std::push_heap(m_Queue.begin(), m_Queue.end(), PriorityHandler::Order()); + } + } + if (!m_Queue.empty()) m_Next = m_Queue.front()->next(); +} + +} // namespace + Added: trunk/CSP/SimCore/Util/LocalUpdate.h =================================================================== --- trunk/CSP/SimCore/Util/LocalUpdate.h 2005-11-12 20:22:53 UTC (rev 1667) +++ trunk/CSP/SimCore/Util/LocalUpdate.h 2005-11-13 01:08:39 UTC (rev 1668) @@ -0,0 +1,121 @@ +// Combat Simulator Project - CSPSim +// Copyright (C) 2005 The Combat Simulator Project +// http://csp.sourceforge.net +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file LocalUpdate.h + * + **/ + +#ifndef __SIMCORE_UTIL_LOCALUPDATE_H__ +#define __SIMCORE_UTIL_LOCALUPDATE_H__ + +#include <vector> +#include <sigc++/slot.h> + + +namespace simcore { + +/** A utility class for coordinating infrequest events within a SynchronousUpdate + * handler. An UpdateTarget can register to receive updates at a given interval, + * but often the handler needs to perform multiple tasks, each at different + * intervals. This class allows the UpdateTarget handler to efficiently dispatch + * updates to multiple subhandlers on independent schedules. + * + * Note that LocalUpdate retains pointers to the handler class. The safest use + * is to make LocalUpdate a member variable, and only add handlers in the same + * instance. + * + * Example: + * + * @code + * class AircraftConsole: public UpdateTarget { + * public: + * + * Aircraft() { + * // update warning lights every 0.5 seconds, and displays every 0.05 seconds. + * m_UpdateDispatch.addHandler(this, &AircraftConsole::updateWarningLights, 0.5); + * m_UpdateDispatch.addHandler(this, &AircraftConsole::updateDisplays, 0.05); + * } + * + * private: + * + * // normal UpdateTarget handler. + * virtual double update(double dt) { + * // optional: other update code here. + * + * // return the interval to the next scheduled event so that the UpdateMaster + * // won't call this method unnecessarily. note that if update() does high- + * // priority work as well it might be appropriate to return 0 instead. + * return m_UpdateDispatch(dt); + * } + * + * // local update handlers. + * // note that the return value of the handler has the following meaning: + * // < 0: disable this handler. no further calls will be made to the handler + * // unless addHandler is called again. + * // = 0: run again after the default handler interval has expired. + * // > 0: run again after this time interval has expired. + * + * double updateWarningLights(double dt); + * double updateDisplays(double dt); + * + * LocalUpdate m_UpdateDispatch; + * }; + * @endcode + */ +class LocalUpdate { +public: + LocalUpdate(): m_Time(0), m_Next(0) { } + ~LocalUpdate(); + + /** Register a handler to receive updates at the specified interval, in seconds. + * The interval must be greater than zero. + */ + template <class C> void addHandler(C *target, double (C::*method)(double), double interval) { + _addHandler(sigc::mem_fun(target, method), interval); + } + + /** Dispatch updates to all handlers that are ready. Returns the time interval + * to the next waiting handler. + */ + double operator()(double dt) { + m_Time += dt; + if (m_Time > m_Next && !m_Queue.empty()) dispatch(); + // note: returns negative values if the queue is empty, which if returned directly + // by the UpdateTarget will disconnect it from the UpdateMaster. this may or may + // not be what is intended, but there's no obviously better thing to do here. + return m_Next - m_Time; + } + +private: + typedef sigc::slot<double, double> Callback; + class PriorityHandler; + + double m_Time; // internal time (not absolute) + double m_Next; // time of the next handler call + std::vector<PriorityHandler*> m_Queue; + + void _addHandler(Callback const &cb, double interval); + void dispatch(); +}; + +} // namespace + +#endif // __SIMCORE_UTIL_LOCALUPDATE_H__ + |
Author: mkrose Date: 2005-11-12 12:22:53 -0800 (Sat, 12 Nov 2005) New Revision: 1667 Added: trunk/CSP/SimData/Include/SimData/ScopedLock.h trunk/CSP/SimData/Include/SimData/Synchronization.h trunk/CSP/SimData/Include/SimData/ThreadSpecific.h trunk/CSP/SimData/Source/Synchronization.cpp trunk/CSP/SimData/Source/ThreadSpecific.cpp trunk/CSP/SimData/Source/ThreadUtil.cpp Removed: trunk/CSP/SimData/Source/ThreadBase.cpp Modified: trunk/CSP/CSPSim/Source/CSPSim.cpp trunk/CSP/CSPSim/Source/glDiagnostics.cpp trunk/CSP/IndexServer/IndexServer.cpp trunk/CSP/SimCore/Battlefield/Battlefield.cpp trunk/CSP/SimCore/Battlefield/LocalBattlefield.cpp trunk/CSP/SimCore/Util/Log.h trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/Composite.h trunk/CSP/SimData/Include/SimData/ExceptionBase.h trunk/CSP/SimData/Include/SimData/HashUtility.h trunk/CSP/SimData/Include/SimData/Log.h trunk/CSP/SimData/Include/SimData/Log.i trunk/CSP/SimData/Include/SimData/LogConstants.h trunk/CSP/SimData/Include/SimData/LogStream.h trunk/CSP/SimData/Include/SimData/Referenced.h trunk/CSP/SimData/Include/SimData/ScopedPointer.h trunk/CSP/SimData/Include/SimData/Singleton.h trunk/CSP/SimData/Include/SimData/Thread.h trunk/CSP/SimData/Include/SimData/ThreadQueue.h trunk/CSP/SimData/Include/SimData/ThreadUtil.h trunk/CSP/SimData/Include/SimData/Trace.h trunk/CSP/SimData/Include/SimData/Verify.h trunk/CSP/SimData/Source/DataArchive.cpp trunk/CSP/SimData/Source/DataManager.cpp trunk/CSP/SimData/Source/ExceptionBase.cpp trunk/CSP/SimData/Source/InterfaceRegistry.cpp trunk/CSP/SimData/Source/Link.cpp trunk/CSP/SimData/Source/LogStream.cpp trunk/CSP/SimData/Source/SConscript trunk/CSP/SimData/Source/TaggedRecordRegistry.cpp trunk/CSP/SimData/Source/Trace.cpp trunk/CSP/SimData/Source/Version.cpp trunk/CSP/SimData/VisualStudio2003/SimData.vcproj trunk/CSP/SimNet/ClientServer.cpp trunk/CSP/SimNet/DispatchHandler.cpp trunk/CSP/SimNet/DispatchManager.cpp trunk/CSP/SimNet/MessageQueue.h trunk/CSP/SimNet/NetLog.h trunk/CSP/SimNet/NetworkInterface.cpp trunk/CSP/SimNet/PeerInfo.cpp trunk/CSP/SimNet/PeerInfo.h trunk/CSP/SimNet/RecordCodec.cpp trunk/CSP/SimNet/ReliablePacket.h trunk/CSP/SimNet/StopWatch.h trunk/CSP/tools/trace Log: Refactor SimData logging, threading, and stack trace code. Details: * Yet another update to the logging system. - Simplified the code by eliminating ThreadLog. - Eliminated TRACE and ALERT priority levels, added FATAL. - Added priorities to LogStream as enums (in addition to macros). - Added LogStream enums for log format options. - Added thread id and short filename formatting options. - Added a LogStream method to log a stack trace. - Reordered priority and category in the SIMDATA_LOG macro. - Created a LogEntry helper class that buffers each log line and atomically writes the full line to the stream. This class automatically adds a newline. - Changed the SIMDATA_LOG macro so that the message is streamed after the macro rather than as the third argument. - Removed SIMDATA_{PRIORITY} macros; use SIMDATA_LOG instead. - Added debug, info, warning, error, and fatal helpers to the swig interface to LogStream. This take a string argument and log to all categories. * Reorganized the thread-related headers, eliminating ThreadBase.h and creating ScopedLock.h, Synchronization.h, and ThreadSpecific.h. * Added a thread::id() helper function. * Made isAborted, isDetached, isRunning, and isComplete public methods of Task to improve flexibility. * Removed iostream include from Log.h. * Improved the stack trace handling in Exception, reducing the time and space overhead. * Simplified and improved stack trace handling under Linux. - Replaced TraceBase with the StackTrace class. - Replaced Trace with AutoTrace. - Removed pre/post-trace callbacks. - Added writeToStream and operator<< helper methods. - Moved specialized code to Trace.cpp. - Added a sigterm handler to AutoTrace. * Added a boolean operator! method to ScopedPointer to test for NULL. * Changed DataArchive to immediately take a reference to newly created Objects. This prevents reference counting problems that can occur in non-trivial postCreate callbacks. * Updated logging in SimNet, and modified SimCore logging to be forward compatible (temporarily). * Added a new trace tool for decoding stack traces under Linux. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1667 Diff omitted (159004 bytes). |
From: <sv...@ww...> - 2005-11-12 19:26:59
|
Author: mkrose Date: 2005-11-12 11:26:51 -0800 (Sat, 12 Nov 2005) New Revision: 1666 Modified: trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable Log: One more osg 0.9.9 fix. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1666 Modified: trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable =================================================================== --- trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable 2005-11-12 08:54:12 UTC (rev 1665) +++ trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable 2005-11-12 19:26:51 UTC (rev 1666) @@ -24,6 +24,7 @@ #include <osg/Drawable> #include <osg/Timer> +#include <osg/Version> #include <osgChunkLod/Export> #include <osgChunkLod/ChunkLod> |
From: <sv...@ww...> - 2005-11-12 08:54:20
|
Author: mkrose Date: 2005-11-12 00:54:12 -0800 (Sat, 12 Nov 2005) New Revision: 1665 Modified: trunk/CSP/CSPSim/Include/VirtualScene.h trunk/CSP/CSPSim/Source/Animation.cpp trunk/CSP/CSPSim/Source/F16/SpecialFonts.h trunk/CSP/CSPSim/Source/Sky.cpp trunk/CSP/CSPSim/Source/Theater/ElevationCorrection.cpp trunk/CSP/CSPSim/Source/VirtualScene.cpp Log: Patch CSPSim to work with osg 0.9.9 while maintaining backwards compatability with 0.9.8. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1665 Modified: trunk/CSP/CSPSim/Include/VirtualScene.h =================================================================== --- trunk/CSP/CSPSim/Include/VirtualScene.h 2005-11-12 08:54:05 UTC (rev 1664) +++ trunk/CSP/CSPSim/Include/VirtualScene.h 2005-11-12 08:54:12 UTC (rev 1665) @@ -169,7 +169,6 @@ int _getFeatureTileIndex(simdata::Ref<FeatureGroup> feature) const; void _updateOrigin(simdata::Vector3 const &origin); - std::string logLookAt(); osgUtil::SceneView *makeSceneView(); Modified: trunk/CSP/CSPSim/Source/Animation.cpp =================================================================== --- trunk/CSP/CSPSim/Source/Animation.cpp 2005-11-12 08:54:05 UTC (rev 1664) +++ trunk/CSP/CSPSim/Source/Animation.cpp 2005-11-12 08:54:12 UTC (rev 1665) @@ -31,6 +31,7 @@ #include <osg/PositionAttitudeTransform> #include <osg/ref_ptr> #include <osg/Switch> +#include <osg/Version> #include <SimCore/Util/Log.h> #include <SimData/Enum.h> @@ -40,6 +41,9 @@ #include <SimData/Vector3.h> #include <SimData/ObjectInterface.h> +#ifndef OSG_VERSION_MAJOR +#define OSG_OLD_CONTROL_POINT_INTERFACE +#endif SIMDATA_XML_BEGIN(Animation) SIMDATA_DEF("model_id", m_NodeLabel, true) @@ -68,13 +72,24 @@ osg::Matrix matrix; _cp.getInverse(matrix); pat.setPosition(matrix.getTrans()); +#ifdef OSG_OLD_CONTROL_POINT_INTERFACE pat.setAttitude(_cp._rotation.inverse()); pat.setScale(osg::Vec3(1.0f/_cp._scale.x(),1.0f/_cp._scale.y(),1.0f/_cp._scale.z())); +#else + pat.setAttitude(_cp.getRotation().inverse()); + pat.setScale(osg::Vec3(1.0f/_cp.getScale().x(),1.0f/_cp.getScale().y(),1.0f/_cp.getScale().z())); +#endif pat.setPivotPoint(_pivotPoint); } else { +#ifdef OSG_OLD_CONTROL_POINT_INTERFACE pat.setPosition(_cp._position); pat.setAttitude(_cp._rotation); pat.setScale(_cp._scale); +#else + pat.setPosition(_cp.getPosition()); + pat.setAttitude(_cp.getRotation()); + pat.setScale(_cp.getScale()); +#endif pat.setPivotPoint(_pivotPoint); } } Modified: trunk/CSP/CSPSim/Source/F16/SpecialFonts.h =================================================================== --- trunk/CSP/CSPSim/Source/F16/SpecialFonts.h 2005-11-12 08:54:05 UTC (rev 1664) +++ trunk/CSP/CSPSim/Source/F16/SpecialFonts.h 2005-11-12 08:54:12 UTC (rev 1665) @@ -31,10 +31,15 @@ #ifndef __SPECIAL_FONTS__ #define __SPECIAL_FONTS__ +#include <osg/Version> #include <osgText/Font> #include <string> #include <algorithm> +// first defined in osg 0.9.9 +#ifndef OSG_VERSION_MAJOR +#define OSG_OLD_FONT_INTERFACE +#endif /** A specialized font for rendering normal and reverse video text. Character * codes 128-255 are reverse video representations of the glyphs for glyphs @@ -151,7 +156,11 @@ reverse->setVerticalAdvance(reference->getVerticalAdvance()); // finally add the new glyph so we don't repeat all this work! +#ifdef OSG_OLD_FONT_INTERFACE addGlyph(getWidth(), getHeight(), charcode, reverse); +#else + addGlyph(getFontWidth(), getFontHeight(), charcode, reverse); +#endif return reverse; } else { return _implementation->getGlyph(charcode); @@ -200,14 +209,22 @@ unsigned int original_height = _height; unsigned int new_width = static_cast<unsigned int>(_width * m_Scale); unsigned int new_height = static_cast<unsigned int>(_height * m_Scale); +#ifdef OSG_OLD_FONT_INTERFACE setSize(new_width, new_height); +#else + setFontResolution(new_width, new_height); +#endif Glyph *scaled_glyph = _implementation->getGlyph(normal_code); if (m_VCenter) { osg::Vec2 hbearing = scaled_glyph->getHorizontalBearing(); hbearing.y() += 0.5f * (normal_glyph->t() - scaled_glyph->t()); scaled_glyph->setHorizontalBearing(hbearing); } +#ifdef OSG_OLD_FONT_INTERFACE setSize(original_width, original_height); +#else + setFontResolution(original_width, original_height); +#endif _sizeGlyphMap[SizePair(_width, _height)][charcode] = scaled_glyph; return scaled_glyph; } else { Modified: trunk/CSP/CSPSim/Source/Sky.cpp =================================================================== --- trunk/CSP/CSPSim/Source/Sky.cpp 2005-11-12 08:54:05 UTC (rev 1664) +++ trunk/CSP/CSPSim/Source/Sky.cpp 2005-11-12 08:54:12 UTC (rev 1665) @@ -56,7 +56,11 @@ #include <osg/AlphaFunc> #include <osg/Billboard> #include <osg/MatrixTransform> +#include <osg/Version> +#ifndef OSG_VERSION_MAJOR +# define OSG_OLD_COMPUTE_BOUND +#endif using namespace osg; using simdata::toRadians; @@ -241,11 +245,20 @@ StarSystem(const StarSystem ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY): osg::Drawable(copy, copyop) { } +#ifdef OSG_OLD_COMPUTE_BOUND bool computeBound() const { _bbox._min = Vec3(-1000100.0, -1000100.0, 0.0); _bbox._max = Vec3( 1000100.0, 1000100.0, 1000100.0); return true; } +#else + BoundingBox computeBound() const { + BoundingBox bbox; + bbox._min = Vec3(-1000100.0, -1000100.0, 0.0); + bbox._max = Vec3( 1000100.0, 1000100.0, 1000100.0); + return bbox; + } +#endif //const bool computeBound() const { return true; } virtual void drawImplementation(osg::State &/*state*/) const { Modified: trunk/CSP/CSPSim/Source/Theater/ElevationCorrection.cpp =================================================================== --- trunk/CSP/CSPSim/Source/Theater/ElevationCorrection.cpp 2005-11-12 08:54:05 UTC (rev 1664) +++ trunk/CSP/CSPSim/Source/Theater/ElevationCorrection.cpp 2005-11-12 08:54:12 UTC (rev 1665) @@ -26,8 +26,14 @@ #include "Theater/ElevationCorrection.h" #include "TerrainObject.h" #include <SimCore/Util/Log.h> +#include <osg/Version> +// stream ops for vec3/matrix were moved to io_utils in osg 0.9.9 +#ifdef OSG_VERSION_MAJOR +#include <osg/io_utils> +#endif + ElevationCorrection::ElevationCorrection(TerrainObject *terrain, float x, float y, float angle): LayoutTransform(x, y, angle) { m_Terrain = terrain; } Modified: trunk/CSP/CSPSim/Source/VirtualScene.cpp =================================================================== --- trunk/CSP/CSPSim/Source/VirtualScene.cpp 2005-11-12 08:54:05 UTC (rev 1664) +++ trunk/CSP/CSPSim/Source/VirtualScene.cpp 2005-11-12 08:54:12 UTC (rev 1665) @@ -42,10 +42,11 @@ #include <SimData/FileUtility.h> #include <SimData/osg.h> -#include <osg/Fog> +#include <osg/AlphaFunc> #include <osg/BlendColor> #include <osg/BlendFunc> #include <osg/ColorMatrix> +#include <osg/Fog> #include <osg/LightSource> #include <osg/Material> #include <osg/Node> @@ -53,6 +54,7 @@ #include <osg/PolygonMode> #include <osg/PositionAttitudeTransform> #include <osg/StateSet> +#include <osg/TexEnv> #include <osgUtil/CullVisitor> #include <osgUtil/IntersectVisitor> #include <osgUtil/Optimizer> @@ -537,17 +539,6 @@ void VirtualScene::setCameraNode(osg::Node *) { } -std::string VirtualScene::logLookAt() { - osg::Vec3 _camEyePos; - osg::Vec3 _camLookPos; - osg::Vec3 _camUpVec; - m_FarView->getViewMatrixAsLookAt(_camEyePos, _camLookPos, _camUpVec); - - std::ostringstream os("VirtualScene::_setLookAt - eye: "); - os << _camEyePos << ", look: " << _camLookPos << ", up: " << _camUpVec; - return os.str(); -} - void VirtualScene::_setLookAt(const simdata::Vector3& eyePos, const simdata::Vector3& lookPos, const simdata::Vector3& upVec) { CSP_LOG(APP, DEBUG, "VirtualScene::setLookAt - eye: " << eyePos << ", look: " << lookPos << ", up: " << upVec); @@ -568,8 +559,6 @@ simdata::Vector3 tpos = m_Terrain->getOrigin(eyePos) - eyePos; m_TerrainGroup->setPosition(simdata::toOSG(tpos)); } - - CSP_LOG(APP, DEBUG, logLookAt()); } // TODO externalize a couple fixed parameters |
From: <sv...@ww...> - 2005-11-12 08:54:15
|
Author: mkrose Date: 2005-11-12 00:54:05 -0800 (Sat, 12 Nov 2005) New Revision: 1664 Modified: trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLod trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLod.cpp trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLodDrawable.cpp Log: Patch CSPChunkLod to work with osg 0.9.9 while maintaining backwards compatability with 0.9.8. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1664 Modified: trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLod =================================================================== --- trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLod 2005-11-12 08:53:58 UTC (rev 1663) +++ trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLod 2005-11-12 08:54:05 UTC (rev 1664) @@ -408,11 +408,11 @@ // extensions class Extensions:public osg::Referenced { public: - Extensions(); + Extensions(unsigned int contextID); Extensions(const Extensions & rhs); void lowestCommonDenominator(const Extensions & rhs); - void setupGLExtensions(); + void setupGLExtensions(unsigned int contextID); // ATI_vertex_array_object bool isVertexArrayObjectSupported() const { Modified: trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable =================================================================== --- trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable 2005-11-12 08:53:58 UTC (rev 1663) +++ trunk/CSP/CSPChunkLod/include/osgChunkLod/ChunkLodDrawable 2005-11-12 08:54:05 UTC (rev 1664) @@ -28,6 +28,12 @@ #include <osgChunkLod/Export> #include <osgChunkLod/ChunkLod> +// OSG_VERSION_MAJOR first defined in OSG 0.9.9 +#ifndef OSG_VERSION_MAJOR +// The interface to Drawable::computeBound changed in 0.9.9. +# define OSG_OLD_COMPUTE_BOUND +#endif + namespace osgChunkLod { @@ -61,7 +67,11 @@ virtual void drawImplementation (osg::State &) const; protected: +#ifdef OSG_OLD_COMPUTE_BOUND virtual bool computeBound() const; +#else + virtual osg::BoundingBox computeBound() const; +#endif ChunkLodTree* _tree; mutable osg::Timer_t _last_tick; mutable int _triangles_rendered; Modified: trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLod.cpp =================================================================== --- trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLod.cpp 2005-11-12 08:53:58 UTC (rev 1663) +++ trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLod.cpp 2005-11-12 08:54:05 UTC (rev 1664) @@ -49,6 +49,7 @@ #include <osg/State> #include <osg/AlphaFunc> #include <osg/GLExtensions> +#include <osg/Version> #include <osgChunkLod/ChunkLod> #include <osgChunkLod/ChunkLodLoader> @@ -67,6 +68,12 @@ #include <osgNV/StateMatrixParameterValue> #endif +// OSG_VERSION_MAJOR first defined in OSG 0.9.9 +#ifdef OSG_VERSION_MAJOR +// The stream operators for Vec and Matrix were moved to a new header in OSG 0.9.9. +# include <osg/io_utils> +# define OSG_GL_EXTENSION_REQUIRES_CONTEXT +#endif #include <osg/buffered_value> @@ -1377,7 +1384,7 @@ const ChunkLodTree::Extensions* ChunkLodTree::getExtensions (unsigned int contextID, bool createIfNotInitialized) { - if (!s_extensions[contextID] && createIfNotInitialized) s_extensions[contextID] = new Extensions; + if (!s_extensions[contextID] && createIfNotInitialized) s_extensions[contextID] = new Extensions(contextID); return s_extensions[contextID].get(); } @@ -1387,9 +1394,9 @@ s_extensions[contextID] = extensions; } -ChunkLodTree::Extensions::Extensions () +ChunkLodTree::Extensions::Extensions (unsigned int contextID) { - setupGLExtensions(); + setupGLExtensions(contextID); } ChunkLodTree::Extensions::Extensions (const ChunkLodTree::Extensions& rhs) : @@ -1411,12 +1418,18 @@ } void -ChunkLodTree::Extensions::setupGLExtensions () +ChunkLodTree::Extensions::setupGLExtensions (unsigned int contextID) { - _vertexArrayObjectSupported = osg::isGLExtensionSupported ("GL_ATI_vertex_array_object"); +#ifdef OSG_GL_EXTENSION_REQUIRES_CONTEXT +# define IS_GL_EXTENSION_SUPPORTED(f) osg::isGLExtensionSupported(contextID, f) +#else +# define IS_GL_EXTENSION_SUPPORTED(f) osg::isGLExtensionSupported(f) +#endif + _vertexArrayObjectSupported = IS_GL_EXTENSION_SUPPORTED("GL_ATI_vertex_array_object"); - std::cout << "NV VAR = " << osg::isGLExtensionSupported ("GL_NV_vertex_array_range") << "\n";; - std::cout << "NV VAR2 = " << osg::isGLExtensionSupported ("GL_NV_vertex_array_range2") << "\n";; + std::cout << "NV VAR = " << IS_GL_EXTENSION_SUPPORTED("GL_NV_vertex_array_range") << "\n";; + std::cout << "NV VAR2 = " << IS_GL_EXTENSION_SUPPORTED("GL_NV_vertex_array_range2") << "\n";; +#undef IS_GL_EXTENSION_SUPPORTED #define GET_FUNC(f) _##f = osg::getGLExtensionFuncPtr (#f) GET_FUNC (glNewObjectBufferATI); Modified: trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLodDrawable.cpp =================================================================== --- trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLodDrawable.cpp 2005-11-12 08:53:58 UTC (rev 1663) +++ trunk/CSP/CSPChunkLod/src/osgChunkLod/ChunkLodDrawable.cpp 2005-11-12 08:54:05 UTC (rev 1664) @@ -181,6 +181,7 @@ } } +#ifdef OSG_OLD_COMPUTE_BOUND bool ChunkLodDrawable::computeBound() const { @@ -197,7 +198,19 @@ return true; } +#else +osg::BoundingBox ChunkLodDrawable::computeBound() const { + osg::BoundingBox bbox; + if (_tree != NULL) { + osg::Vec3 center, extent; + ChunkLodTree *t = const_cast<ChunkLodTree*>(_tree); + t->getBoundingBox(¢er, &extent); + bbox._min = center - extent; + bbox._max = center + extent; + } + return bbox; +} +#endif - } |
From: <sv...@ww...> - 2005-11-12 08:54:09
|
Author: mkrose Date: 2005-11-12 00:53:58 -0800 (Sat, 12 Nov 2005) New Revision: 1663 Modified: trunk/CSP/Demeter/DemeterDrawable.cpp trunk/CSP/Demeter/DemeterDrawable.h Log: Fix Demeter to work with OSG 0.9.9. It should still work with 0.9.8 too. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1663 Modified: trunk/CSP/Demeter/DemeterDrawable.cpp =================================================================== --- trunk/CSP/Demeter/DemeterDrawable.cpp 2005-11-09 07:37:43 UTC (rev 1662) +++ trunk/CSP/Demeter/DemeterDrawable.cpp 2005-11-12 08:53:58 UTC (rev 1663) @@ -98,11 +98,9 @@ } } -bool DemeterDrawable::computeBound() const -{ - if (m_RefTerrain.valid()) - { - +#ifdef OSG_OLD_COMPUTE_BOUND +bool DemeterDrawable::computeBound() const { + if (m_RefTerrain.valid()) { float width = m_RefTerrain->GetWidth(); float height = m_RefTerrain->GetHeight(); int latticeX, latticeY; @@ -117,6 +115,24 @@ } return true; } +#else +osg::BoundingBox DemeterDrawable::computeBound() const { + osg::BoundingBox bbox; + if (m_RefTerrain.valid()) { + float width = m_RefTerrain->GetWidth(); + float height = m_RefTerrain->GetHeight(); + int latticeX, latticeY; + m_RefTerrain->GetLatticePosition(latticeX, latticeY); + bbox._min.x() = width*latticeX; + bbox._min.y() = height*latticeY; + bbox._min.z() = 0.0f; + bbox._max.x() = width*(latticeX+1); + bbox._max.y() = height*(latticeY+1); + bbox._max.z() = m_RefTerrain->GetMaxElevation(); + } + return bbox; +} +#endif // DemeterLatticeDrawable @@ -226,6 +242,7 @@ } +#ifdef OSG_OLD_COMPUTE_BOUND bool DemeterLatticeDrawable::computeBound() const { if (m_RefTerrainLattice.valid()) @@ -244,5 +261,17 @@ } return true; } +#else +osg::BoundingBox DemeterLatticeDrawable::computeBound() const { + osg::BoundingBox bbox(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + if (m_RefTerrainLattice.valid()) { + bbox._min.x() = bbox._min.y() = bbox._min.z() = 0.0f; + bbox._max.x() = 1000000; + bbox._max.y() = 1000000; + bbox._max.z() = 10000; + } + return bbox; +} +#endif }; Modified: trunk/CSP/Demeter/DemeterDrawable.h =================================================================== --- trunk/CSP/Demeter/DemeterDrawable.h 2005-11-09 07:37:43 UTC (rev 1662) +++ trunk/CSP/Demeter/DemeterDrawable.h 2005-11-12 08:53:58 UTC (rev 1663) @@ -24,7 +24,14 @@ #include <osg/Drawable> +#include <osg/Version> +// OSG_VERSION_MAJOR was first defined in 0.9.9. +#ifndef OSG_VERSION_MAJOR +// The interface to Drawable::computeBound changed in 0.9.9. +# define OSG_OLD_COMPUTE_BOUND +#endif + #include "Terrain.h" namespace Demeter @@ -54,7 +61,11 @@ protected: - virtual bool computeBound() const; +#ifdef OSG_OLD_COMPUTE_BOUND + virtual bool computeBound() const; +#else + virtual osg::BoundingBox computeBound() const; +#endif mutable osg::ref_ptr<Terrain> m_RefTerrain; }; @@ -97,7 +108,11 @@ protected: - virtual bool computeBound() const; +#ifdef OSG_OLD_COMPUTE_BOUND + virtual bool computeBound() const; +#else + virtual osg::BoundingBox computeBound() const; +#endif mutable osg::ref_ptr<TerrainLattice> m_RefTerrainLattice; DemeterLatticeDrawableLoadListener * m_pLatticeLoadListener; |
From: <sv...@ww...> - 2005-11-09 07:37:49
|
Author: mkrose Date: 2005-11-08 23:37:43 -0800 (Tue, 08 Nov 2005) New Revision: 1662 Modified: trunk/CSP/CSPSim/Data/CSPSim.ini trunk/CSP/IndexServer/IndexServer.ini Log: Restore .ini files that were accidentally updated in the last checkin. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1662 Modified: trunk/CSP/CSPSim/Data/CSPSim.ini =================================================================== --- trunk/CSP/CSPSim/Data/CSPSim.ini 2005-11-09 07:23:30 UTC (rev 1661) +++ trunk/CSP/CSPSim/Data/CSPSim.ini 2005-11-09 07:37:43 UTC (rev 1662) @@ -5,7 +5,6 @@ Battlefield = 1 Demeter = true LogFile = CSPSim.log -NetLogFile = SimNet.log [Screen] Width = 1024 @@ -51,12 +50,11 @@ [Networking] -UseNetworking = true -LocalIp = 192.168.1.1 +UseNetworking = false +ExternalIp = 127.0.0.1 +LocalIp = 127.0.0.1 LocalPort = 3161 -ServerIp = 192.168.1.1 +ServerIp = 127.0.0.1 ServerPort = 3160 IncomingBandwidth = 20000 OutgoingBandwidth = 20000 -UserName = anonymous -;ExternalIp = 127.0.0.1 Modified: trunk/CSP/IndexServer/IndexServer.ini =================================================================== --- trunk/CSP/IndexServer/IndexServer.ini 2005-11-09 07:23:30 UTC (rev 1661) +++ trunk/CSP/IndexServer/IndexServer.ini 2005-11-09 07:37:43 UTC (rev 1662) @@ -1,9 +1,2 @@ [Network] -;Bind = 127.0.0.1:3160 -Bind = 192.168.1.1:3160 -IncomingBandwidth = 12000 -OutgoingBandwidth = 12000 - -[Debug] -CspLoggingThreshold = 3 -NetLoggingThreshold = 3 +Bind = 127.0.0.1:3160 |
Author: mkrose Date: 2005-11-08 23:23:30 -0800 (Tue, 08 Nov 2005) New Revision: 1661 Modified: trunk/CSP/CSPChunkLod/include/osgChunkLod/MultiTextureDetails trunk/CSP/CSPSim/Data/CSPSim.ini trunk/CSP/CSPSim/Include/Bus.h trunk/CSP/CSPSim/Include/ChannelMirror.h trunk/CSP/CSPSim/Include/InputInterface.h trunk/CSP/CSPSim/Include/Views/CameraAgent.h trunk/CSP/CSPSim/Source/Colorspace.cpp trunk/CSP/CSPSim/Source/F16/DataEntry.h trunk/CSP/CSPSim/Source/GameScreen.cpp trunk/CSP/CSPSim/Source/InputInterface.cpp trunk/CSP/CSPSim/Source/Sky.cpp trunk/CSP/CSPSim/Source/Station.cpp trunk/CSP/CSPSim/Source/Stores/Stores.cpp trunk/CSP/Demeter/Terrain.h trunk/CSP/Demeter/TerrainTextureFactory.h trunk/CSP/IndexServer/IndexServer.ini trunk/CSP/SimData/Include/SimData/InterfaceProxy.h trunk/CSP/SimData/Include/SimData/TaggedRecord.h trunk/CSP/SimData/Include/SimData/Trace.h trunk/CSP/SimData/Include/SimData/hash_map.h trunk/CSP/SimData/Source/FileUtility.cpp trunk/CSP/SimNet/DispatchTarget.h trunk/CSP/SimNet/PacketSource.h Log: Fix numerous warnings and errors under gcc-4.0. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1661 Diff omitted (15298 bytes). |
From: <sv...@ww...> - 2005-10-17 06:14:01
|
Author: stormbringer Date: 2005-10-16 23:13:49 -0700 (Sun, 16 Oct 2005) New Revision: 1660 Modified: trunk/CSP/CSPSim/Source/F16/F16Engine.cpp Log: Fixed a syntax error in F16Engine::updatePrestart Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1660 Modified: trunk/CSP/CSPSim/Source/F16/F16Engine.cpp =================================================================== --- trunk/CSP/CSPSim/Source/F16/F16Engine.cpp 2005-10-16 23:28:01 UTC (rev 1659) +++ trunk/CSP/CSPSim/Source/F16/F16Engine.cpp 2005-10-17 06:13:49 UTC (rev 1660) @@ -295,7 +295,7 @@ const double drive = m_Drive * rpm_factor * getAltitudeFactor(); driveEngine(drive, dt); // TODO jfs - if (m_StartElapsedTime > m_HangTime and m_NormalStart) { + if (m_StartElapsedTime > m_HangTime && m_NormalStart) { m_NormalStart = false; m_Drive /= (1.0 + 0.40 * std::max(0.1, rpm)); // ad-hoc drive reduction to prevent rpm increase if (randomUnit() < m_HotStartBranch) { |
From: <sv...@ww...> - 2005-10-16 23:28:08
|
Author: mkrose Date: 2005-10-16 16:28:01 -0700 (Sun, 16 Oct 2005) New Revision: 1659 Modified: trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map Log: Fix typo in input mapping. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1659 Modified: trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map =================================================================== --- trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map 2005-10-16 23:21:08 UTC (rev 1658) +++ trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map 2005-10-16 23:28:01 UTC (rev 1659) @@ -84,6 +84,6 @@ map key:SHIFT-CTRL-o press EXT_FUEL_TRANS_TOGGLE map key:CTRL-e press ENGINE_FEED_CYCLE_NEXT -map x36:SHIFT-q press EJECT_WING_TANKS -map x36:CTRL-q press EJECT_CENTER_TANK +map key:SHIFT-q press EJECT_WING_TANKS +map key:CTRL-q press EJECT_CENTER_TANK |
From: <sv...@ww...> - 2005-10-16 23:21:16
|
Author: mkrose Date: 2005-10-16 16:21:08 -0700 (Sun, 16 Oct 2005) New Revision: 1658 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Source/F16/F16System.cpp trunk/CSP/CSPSim/Source/F16/F16System.h trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map Log: * Add events to test releasing the fuel tanks. These are mapped to SHIFT-q and CTRL-q. (Delete Data/Inputs/aircraft.hid to pick up the keymap changes.) Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1658 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2005-10-16 23:13:43 UTC (rev 1657) +++ trunk/CSP/CSPSim/CHANGES.current 2005-10-16 23:21:08 UTC (rev 1658) @@ -60,6 +60,10 @@ * Update f-16dj model to include nozzle animation. + * Add events to test releasing the fuel tanks. These are mapped to + SHIFT-q and CTRL-q. (Delete Data/Inputs/aircraft.hid to pick up + the keymap changes.) + 2005-10-15: onsight * Refactor rotation animation classes, moving some common operations to the base class. Add an optional non-linear gain to the rotation Modified: trunk/CSP/CSPSim/Source/F16/F16System.cpp =================================================================== --- trunk/CSP/CSPSim/Source/F16/F16System.cpp 2005-10-16 23:13:43 UTC (rev 1657) +++ trunk/CSP/CSPSim/Source/F16/F16System.cpp 2005-10-16 23:21:08 UTC (rev 1658) @@ -157,6 +157,25 @@ } } +void F16System::onEjectCenterTank() { + // test jettison + StoresManagementSystem *sms = getModel()->getStoresManagementSystem().get(); // TODO should return a raw ptr + if (sms) { + sms->releaseStore(sms->getHardpointByName("HP5").child(0)); + // testing asymmetric loadouts + sms->releaseStore(sms->getHardpointByName("HP4").child(0)); + } +} + +void F16System::onEjectWingTanks() { + // test jettison + StoresManagementSystem *sms = getModel()->getStoresManagementSystem().get(); // TODO should return a raw ptr + if (sms) { + //sms->releaseStore(sms->getHardpointByName("HP4").child(0)); + sms->releaseStore(sms->getHardpointByName("HP6").child(0)); + } +} + void F16System::canopyToggle() { if (m_CanopySequence.valid()) { m_CanopySequence->play(); Modified: trunk/CSP/CSPSim/Source/F16/F16System.h =================================================================== --- trunk/CSP/CSPSim/Source/F16/F16System.h 2005-10-16 23:13:43 UTC (rev 1657) +++ trunk/CSP/CSPSim/Source/F16/F16System.h 2005-10-16 23:21:08 UTC (rev 1658) @@ -52,6 +52,8 @@ BIND_ACTION("FLAPS_UP", flapsUp); BIND_ACTION("FLAPS_TOGGLE", flapsToggle); BIND_ACTION("CANOPY_TOGGLE", canopyToggle); + BIND_ACTION("EJECT_WING_TANKS", onEjectWingTanks); + BIND_ACTION("EJECT_CENTER_TANK", onEjectCenterTank); END_INPUT_INTERFACE // protected: public: @@ -113,6 +115,10 @@ //std::vector<Steerpoint::Ref> m_Steerpoints; void onAirRefuelSwitch(); + // for testing only + void onEjectWingTanks(); + void onEjectCenterTank(); + void engageMPO(); void disengageMPO(); }; Modified: trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map =================================================================== --- trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map 2005-10-16 23:13:43 UTC (rev 1657) +++ trunk/CSP/CSPSim/Tools/HID/Maps/aircraft-core.map 2005-10-16 23:21:08 UTC (rev 1658) @@ -83,3 +83,7 @@ map key:SHIFT-CTRL-e press FUEL_QTY_SEL_CYCLE_NEXT map key:SHIFT-CTRL-o press EXT_FUEL_TRANS_TOGGLE map key:CTRL-e press ENGINE_FEED_CYCLE_NEXT + +map x36:SHIFT-q press EJECT_WING_TANKS +map x36:CTRL-q press EJECT_CENTER_TANK + |
From: <sv...@ww...> - 2005-10-16 23:13:53
|
Author: mkrose Date: 2005-10-16 16:13:43 -0700 (Sun, 16 Oct 2005) New Revision: 1657 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Data/Models/F16/DJ/F16DJ.osg Log: * Update f-16dj model to include nozzle animation. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1657 Diff omitted (182720 bytes). |
From: <sv...@ww...> - 2005-10-16 22:53:05
|
Author: mkrose Date: 2005-10-16 15:52:58 -0700 (Sun, 16 Oct 2005) New Revision: 1656 Added: trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/F16/DJ/fuel.xml trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/F16/DJ/sms.xml Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/F16/DJ/systems.xml Log: * Add f-16 fuel system, sms, and engine definitions. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1656 Diff omitted (10515 bytes). |
From: <sv...@ww...> - 2005-10-16 22:38:13
|
Author: mkrose Date: 2005-10-16 15:38:07 -0700 (Sun, 16 Oct 2005) New Revision: 1655 Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/F16DJ.xml Log: * Move the nominal center of mass toward the back of the aircraft. The new position corresponds to the nominal center of lift at subsonic speeds, which can be thought of as the reference cg offset. CM(alpha) incorporates the negative static margin features at this cg position, and additional shifts (due to loadout and fuel) will increase or decrease the static margin. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1655 Modified: trunk/CSP/CSPSim/CHANGES.current =================================================================== --- trunk/CSP/CSPSim/CHANGES.current 2005-10-16 22:25:10 UTC (rev 1654) +++ trunk/CSP/CSPSim/CHANGES.current 2005-10-16 22:38:07 UTC (rev 1655) @@ -49,6 +49,13 @@ the model remain to be implemented, and many existing parts need tweaking. + * Move the nominal center of mass toward the back of the aircraft. + The new position corresponds to the nominal center of lift at + subsonic speeds, which can be thought of as the reference cg + offset. CM(alpha) incorporates the negative static margin features + at this cg position, and additional shifts (due to loadout and fuel) + will increase or decrease the static margin. + 2005-10-15: onsight * Refactor rotation animation classes, moving some common operations to the base class. Add an optional non-linear gain to the rotation Modified: trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/F16DJ.xml =================================================================== --- trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/F16DJ.xml 2005-10-16 22:25:10 UTC (rev 1654) +++ trunk/CSP/CSPSim/Data/XML/vehicles/aircraft/F16DJ.xml 2005-10-16 22:38:07 UTC (rev 1655) @@ -19,7 +19,8 @@ </Matrix> <!-- initial cm offset relative to the 3d model origin --> - <Vector name="reference_center_of_mass_offset">0.0 0.3 -0.07</Vector> + <!--Vector name="reference_center_of_mass_offset">0.0 -0.1 -0.07</Vector--> + <Vector name="reference_center_of_mass_offset">0.0 -0.1 -0.17</Vector> <Path name="human_systems">F16.DJ.systems</Path> <Path name="remote_systems">F16.DJ.remote</Path> |
From: <sv...@ww...> - 2005-10-16 22:25:17
|
Author: mkrose Date: 2005-10-16 15:25:10 -0700 (Sun, 16 Oct 2005) New Revision: 1654 Added: trunk/CSP/CSPSim/Source/F16/F16Engine.cpp trunk/CSP/CSPSim/Source/F16/F16Engine.h Modified: trunk/CSP/CSPSim/CHANGES.current trunk/CSP/CSPSim/Source/SConscript trunk/CSP/CSPSim/VisualStudio/CSPSimDLL/CSPSimDLL.vcproj Log: * Add f-16 engine simulation. This is a partial port of a python program that implements a quasi-ad-hoc model of the engine dynamics for startup, stalls/stagnations, air restarts, etc. It also incorporates the spooling model from NASA 79 paper. Many parts of the model remain to be implemented, and many existing parts need tweaking. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1654 Diff omitted (22311 bytes). |