diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 8203915d..c07695f5 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -91,8 +91,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plStatGather/plProfileManagerFull.h" #include "plPipeline.h" +#include "plPipeDebugFlags.h" #include "plPipeline/plPipelineCreate.h" -#include "plPipeline/plPipeDebugFlags.h" #include "plPipeline/plTransitionMgr.h" #include "plPipeline/plCaptureRender.h" #include "plPipeline/plDynamicEnvMap.h" @@ -135,7 +135,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfAnimation/plAnimDebugList.h" #include "pfGameGUIMgr/pfGUICtrlGenerator.h" -#include "plGImage/plWinFontCache.h" #include "plGImage/plFontCache.h" #include "pfJournalBook/pfJournalBook.h" @@ -2202,7 +2201,6 @@ void plClient::IOnAsyncInitComplete () { // Load our custom fonts from our current dat directory fFontCache->LoadCustomFonts("dat"); - plWinFontCache::GetInstance().LoadCustomFonts("dat"); // We'd like to do a SetHoldLoadRequests here, but the GUI stuff doesn't draw right // if you try to delay the loading for it. To work around that, we allocate a diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp index 2f596bde..a46e7b6d 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeLoader/plAgeLoader.h" #include "plNetClient/plNetClientMgr.h" #include "plPipeline/plDebugText.h" -#include "plPipeline/plPipeDebugFlags.h" +#include "plPipeDebugFlags.h" #include "plMessage/plMovieMsg.h" #include "plDrawable/plDrawableSpans.h" #include "plPipeline.h" diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp index d9d34dfe..d624d87c 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp @@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plgDispatch.h" #include "plAgeLoader/plAgeLoader.h" -#include "plNetClient/plNetObjectDebugger.h" +#include "plNetCommon/plNetObjectDebugger.h" #include "plNetClient/plNetClientMgr.h" #include "plNetClient/plNetLinkingMgr.h" #include "plAgeLoader/plResPatcher.h" diff --git a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp index 48630a7f..e25f6fe4 100644 --- a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp +++ b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp @@ -67,7 +67,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfMessage/pfGUINotifyMsg.h" #include "plGImage/plMipmap.h" #include "plGImage/plDynamicTextMap.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plMessage/plAnimCmdMsg.h" #include "pnKeyedObject/plFixedKey.h" #include "pnMessage/plRefMsg.h" diff --git a/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp b/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp index 91c97a90..afabb63e 100644 --- a/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp +++ b/Sources/Plasma/FeatureLib/pfMoviePlayer/plMoviePlayer.cpp @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudio/plWin32VideoSound.h" #include "plGImage/plMipmap.h" #include "pnKeyedObject/plUoid.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plPipeline/plPlates.h" #include "plResMgr/plLocalization.h" #include "plStatusLog/plStatusLog.h" diff --git a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp index a5a4d00a..d7c1a9ee 100644 --- a/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp +++ b/Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp @@ -44,11 +44,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plLayerMovie.h" #include "hsStream.h" #include "hsResMgr.h" - +#include "hsGDeviceRef.h" #include "plMessage/plAnimCmdMsg.h" #include "plGImage/plMipmap.h" -#include "plPipeline/hsGDeviceRef.h" plLayerMovie::plLayerMovie() : fCurrentFrame(-1), diff --git a/Sources/Plasma/NucleusLib/inc/CMakeLists.txt b/Sources/Plasma/NucleusLib/inc/CMakeLists.txt index 741a0ac8..f9d175e6 100644 --- a/Sources/Plasma/NucleusLib/inc/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/inc/CMakeLists.txt @@ -3,6 +3,7 @@ include_directories("../../NucleusLib") include_directories("../../NucleusLib/inc") set(pnNucleusInc_HEADERS + hsGDeviceRef.h hsGMatState.h hsGMatState.inl hsResMgr.h @@ -16,6 +17,7 @@ set(pnNucleusInc_HEADERS plgDispatch.h plLoggable.h plPhysical.h + plPipeDebugFlags.h plPipeline.h plPipeResReq.h plProfile.h diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGDeviceRef.h b/Sources/Plasma/NucleusLib/inc/hsGDeviceRef.h similarity index 100% rename from Sources/Plasma/PubUtilLib/plPipeline/hsGDeviceRef.h rename to Sources/Plasma/NucleusLib/inc/hsGDeviceRef.h diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPipeDebugFlags.h b/Sources/Plasma/NucleusLib/inc/plPipeDebugFlags.h similarity index 100% rename from Sources/Plasma/PubUtilLib/plPipeline/plPipeDebugFlags.h rename to Sources/Plasma/NucleusLib/inc/plPipeDebugFlags.h diff --git a/Sources/Plasma/NucleusLib/inc/plPipeline.h b/Sources/Plasma/NucleusLib/inc/plPipeline.h index 6d09ee84..fa761264 100644 --- a/Sources/Plasma/NucleusLib/inc/plPipeline.h +++ b/Sources/Plasma/NucleusLib/inc/plPipeline.h @@ -228,9 +228,6 @@ public: virtual bool EndRender() = 0; virtual void RenderScreenElements( void ) = 0; - virtual bool BeginDrawable(plDrawable* d) = 0; - virtual bool EndDrawable(plDrawable* d) = 0; - virtual void BeginVisMgr(plVisMgr* visMgr) = 0; virtual void EndVisMgr(plVisMgr* visMgr) = 0; @@ -321,10 +318,6 @@ public: virtual void PopMaterialOverride(const hsGMatState& restore, bool on) = 0; virtual const hsGMatState& GetMaterialOverride(bool on) const = 0; - virtual hsColorOverride PushColorOverride(const hsColorOverride& over) = 0; - virtual void PopColorOverride(const hsColorOverride& restore) = 0; - virtual const hsColorOverride& GetColorOverride() const = 0; - virtual void SubmitShadowSlave(plShadowSlave* slave) = 0; virtual void SubmitClothingOutfit(plClothingOutfit* co) = 0; diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp index 418e6803..248d240a 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.cpp @@ -97,27 +97,3 @@ void LogMsgV (ELogSeverity severity, const wchar_t *format, va_list args) { plStatusLog::AddLineS("OLD_ASYNC_LOG.log", to_log); delete[] to_log; } - -//============================================================================ -#ifdef HS_DEBUGGING -void LogMsgDebug (const char *format, ...) { - ASSERT(format); - - va_list args; - va_start(args, format); - LogMsgV(kLogDebug, format, args); - va_end(args); -} -#endif - -//============================================================================ -#ifdef HS_DEBUGGING -void LogMsgDebug (const wchar_t *format, ...) { - ASSERT(format); - - va_list args; - va_start(args, format); - LogMsgV(kLogDebug, format, args); - va_end(args); -} -#endif diff --git a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h index 4a757780..cb72ba32 100644 --- a/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h +++ b/Sources/Plasma/NucleusLib/pnAsyncCore/Private/pnAcLog.h @@ -80,21 +80,3 @@ void LogMsg (ELogSeverity severity, const char *format, ...); void LogMsg (ELogSeverity severity, const wchar_t *format, ...); void LogMsgV (ELogSeverity severity, const char *format, va_list args); void LogMsgV (ELogSeverity severity, const wchar_t *format, va_list args); - -/**************************************************************************** -* -* Debugging API -* -***/ - -#ifdef HS_DEBUGGING - - void LogMsgDebug (const char *format, ...); - void LogMsgDebug (const wchar_t *format, ...); - -#else - - inline void LogMsgDebug (const char *, ...) { } - inline void LogMsgDebug (const wchar_t *, ...) { } - -#endif diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnNetCommon/CMakeLists.txt index c8695f43..adacb3be 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/pnNetCommon/CMakeLists.txt @@ -9,7 +9,6 @@ set(pnNetCommon_HEADERS plNetAddress.h plNetApp.h plNetGroup.h - plNetResManager.h plNetServers.h plNetSharedState.h plSDLTypes.h @@ -24,7 +23,6 @@ set(pnNetCommon_SOURCES plNetAddress.cpp plNetApp.cpp plNetGroup.cpp - plNetResManager.cpp plNetServers.cpp plNetSharedState.cpp plSDLTypes.cpp diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp b/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp deleted file mode 100644 index 8d5030bf..00000000 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -////////////////////////////////////////////////////////////////////////////// -// -// plNetResManager -// -//// Philosophy ////////////////////////////////////////////////////////////// -// -// "Cannot say. Saying, I would know. Do not know, so cannot say." -// -- Zathras, "Babylon 5" -// -// Normally, plResManager would be plenty for the servers and then some. -// However, the normal resManager tries to do things smart, such as read in -// keys from disk if they don't already exist and so forth. However, all the -// servers care about is reading in enough of a key to be able to turn around -// and write it back out to a stream. So, we overload ReadKeyAndReg() to just -// read in a new key and return it. Our new key reffing system will guarantee -// that the key eventually gets freed once we're done with it, and we don't -// care about sharing keys because all we're interested in is the uoid anyway, -// so no need to store the keys in the registry or anything. -// -////////////////////////////////////////////////////////////////////////////// - -#include "plNetResManager.h" -#include "pnKeyedObject/plKeyImp.h" -#include "pnKeyedObject/plUoid.h" -#include "pnKeyedObject/hsKeyedObject.h" -#include "pnFactory/plCreatable.h" -#include "pnNetCommon/plNetApp.h" -#include "hsStream.h" - -plNetResManager::plNetResManager() -{ -} - -plNetResManager::~plNetResManager() -{ -} - -plCreatable* plNetResManager::IReadCreatable(hsStream* s) const -{ - uint16_t hClass = s->ReadLE16(); - if (plFactory::CanCreate(hClass)) - { - plCreatable *pCre = plFactory::Create(hClass); - if (!pCre) - hsAssert(hClass == 0x8000, "Invalid creatable index"); - - return pCre; - } - - plNetApp::StaticWarningMsg(plFormat("NetResMgr::Can't create class {}", plFactory::GetNameOfClass(hClass))); - return nil; -} - -void plNetResManager::IKeyReffed(plKeyImp* key) -{ -} - -void plNetResManager::IKeyUnreffed(plKeyImp* key) -{ - delete key; -} diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.h b/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.h deleted file mode 100644 index 5d333426..00000000 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetResManager.h +++ /dev/null @@ -1,66 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -#ifndef plNetResMgr_h -#define plNetResMgr_h - -#include "plResMgr/plResManager.h" -#include "pnKeyedObject/plKey.h" - -// -// plNetResMgr - Keys? Disk? What? Nah, we'll just create new ones and give them to ya -// - -class hsStream; -class plNetResManager : public plResManager -{ -public: - plNetResManager(); - ~plNetResManager(); - -protected: - plCreatable* IReadCreatable(hsStream* s) const; - virtual void IKeyReffed(plKeyImp* key); - virtual void IKeyUnreffed(plKeyImp* key); -}; - - -#endif // plNetResMgr_h diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp index f78cc5b4..b8c99788 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfMessage/plClothingMsg.h" #include "plMessage/plRenderMsg.h" #include "plGImage/plMipmap.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plPipeline/plRenderTarget.h" #include "plPipeline.h" #include "plClothingLayout.h" diff --git a/Sources/Plasma/PubUtilLib/plDrawable/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plDrawable/CMakeLists.txt index 12c4c3da..f1d08337 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plDrawable/CMakeLists.txt @@ -26,6 +26,7 @@ set(plDrawable_SOURCES plDynaTorpedoVSMgr.cpp plDynaWakeMgr.cpp plFixedWaterState7.cpp + plGBufferGroup.cpp plGeometrySpan.cpp plGeoSpanDice.cpp plInstanceDrawInterface.cpp @@ -43,6 +44,7 @@ set(plDrawable_SOURCES plSpanInstance.cpp plSpanTemplate.cpp plSpanTypes.cpp + plVertCoder.cpp plVisLOSMgr.cpp plWaveSet7.cpp plWaveSetBase.cpp @@ -76,6 +78,7 @@ set(plDrawable_HEADERS plDynaTorpedoVSMgr.h plDynaWakeMgr.h plFixedWaterState7.h + plGBufferGroup.h plGeometrySpan.h plGeoSpanDice.h plInstanceDrawInterface.h @@ -95,6 +98,7 @@ set(plDrawable_HEADERS plSpanTemplate.h plSpanTypes.h plTimedInterp.h + plVertCoder.h plVisLOSMgr.h plWaveSet7.h plWaveSetBase.h diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp index ce9524d5..f5c1c97f 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAccessGeometry.cpp @@ -57,8 +57,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAccessSnapShot.h" // For dipping directly into device buffers. -#include "plPipeline/plGBufferGroup.h" -#include "plPipeline/hsGDeviceRef.h" +#include "plGBufferGroup.h" +#include "hsGDeviceRef.h" #include "plPipeline.h" #include "plTweak.h" diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h b/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h index e47f227e..69f2f6e8 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plAuxSpan.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTemplates.h" #include "plSpanTypes.h" -#include "plPipeline/plGBufferGroup.h" +#include "plGBufferGroup.h" class plDrawableSpans; class hsGMaterial; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp index 3fa2a28d..792ac2fe 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp @@ -63,6 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "hsResMgr.h" #include "plPipeline.h" +#include "plPipeDebugFlags.h" #include "plGeometrySpan.h" #include "plSpaceTree.h" #include "plParticleFiller.h" @@ -71,19 +72,18 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plClusterGroup.h" #include "plCluster.h" #include "plSpanTemplate.h" - +#include "plGBufferGroup.h" + #include "plMath/hsRadixSort.h" #include "plSurface/hsGMaterial.h" #include "plSurface/plLayerInterface.h" #include "plPipeline/plFogEnvironment.h" -#include "plPipeline/hsGDeviceRef.h" -#include "plPipeline/plPipeDebugFlags.h" +#include "hsGDeviceRef.h" #include "pnMessage/plRefMsg.h" #include "pnMessage/plNodeRefMsg.h" #include "pnMessage/plDISpansMsg.h" #include "plMessage/plDeviceRecreateMsg.h" #include "plMessage/plRenderMsg.h" -#include "plPipeline/plGBufferGroup.h" #include "pnSceneObject/plDrawInterface.h" #include "pnKeyedObject/plKey.h" #include "plParticleSystem/plParticleEmitter.h" diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp index 0abb0d8f..a7d7b232 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp @@ -55,6 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "plPipeline.h" #include "plGeometrySpan.h" +#include "plGBufferGroup.h" #include "plSpaceTree.h" #include "plSpaceTreeMaker.h" // This is fun and amusing and wonderful to have here. @@ -64,7 +65,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plRefMsg.h" #include "pnMessage/plNodeRefMsg.h" // for NodeRefMsg #include "plMessage/plDeviceRecreateMsg.h" -#include "plPipeline/plGBufferGroup.h" #include "plSurface/hsGMaterial.h" #include "plSurface/plLayerInterface.h" #include "plGImage/plBitmap.h" diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp index 20d10a96..6866a2c9 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp @@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAccessGeometry.h" #include "plAccessSpan.h" +#include "plGBufferGroup.h" #include "plDrawableSpans.h" #include "plAuxSpan.h" @@ -66,8 +67,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plSurface/plLayerInterface.h" #include "plScene/plPageTreeMgr.h" -#include "plPipeline/plGBufferGroup.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plMessage/plAgeLoadedMsg.h" #include "plMessage/plDynaDecalEnableMsg.h" diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plGBufferGroup.cpp similarity index 99% rename from Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp rename to Sources/Plasma/PubUtilLib/plDrawable/plGBufferGroup.cpp index f83c6ebc..3356ad2b 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plGBufferGroup.cpp @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "plSurface/hsGMaterial.h" -#include "plDrawable/plGeometrySpan.h" +#include "plGeometrySpan.h" #include "plPipeline.h" #include "hsGDeviceRef.h" #include "plProfile.h" diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h b/Sources/Plasma/PubUtilLib/plDrawable/plGBufferGroup.h similarity index 100% rename from Sources/Plasma/PubUtilLib/plPipeline/plGBufferGroup.h rename to Sources/Plasma/PubUtilLib/plDrawable/plGBufferGroup.h diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp index 0c113d94..258aaa31 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plParticleFiller.cpp @@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Getting at the destination data #include "pnSceneObject/plDrawInterface.h" #include "plDrawable/plDrawableSpans.h" -#include "plPipeline/plGBufferGroup.h" +#include "plGBufferGroup.h" // For shading #include "plGLight/plLightInfo.h" diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp index ce1f4e43..eb80321e 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plSpanTypes.cpp @@ -53,8 +53,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plSpanTypes.h" #include "hsStream.h" #include "pnKeyedObject/plKey.h" -#include "plPipeline/plGBufferGroup.h" -#include "plPipeline/hsGDeviceRef.h" +#include "plGBufferGroup.h" +#include "hsGDeviceRef.h" #include "plGLight/plLightInfo.h" #include "plDrawable.h" #include "plAuxSpan.h" diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plVertCoder.cpp similarity index 100% rename from Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.cpp rename to Sources/Plasma/PubUtilLib/plDrawable/plVertCoder.cpp diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h b/Sources/Plasma/PubUtilLib/plDrawable/plVertCoder.h similarity index 100% rename from Sources/Plasma/PubUtilLib/plPipeline/plVertCoder.h rename to Sources/Plasma/PubUtilLib/plDrawable/plVertCoder.h diff --git a/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt index 50f1babd..4290428e 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plGImage/CMakeLists.txt @@ -15,7 +15,6 @@ set(plGImage_SOURCES plBumpMapGen.cpp plCubicEnvironmap.cpp plDynamicTextMap.cpp - plDynSurfaceWriter.cpp plFont.cpp plFontCache.cpp plJPEG.cpp @@ -23,7 +22,6 @@ set(plGImage_SOURCES plMipmap.cpp plPNG.cpp plTGAWriter.cpp - plWinFontCache.cpp ) set(plGImage_HEADERS @@ -35,7 +33,6 @@ set(plGImage_HEADERS plBumpMapGen.h plCubicEnvironmap.h plDynamicTextMap.h - plDynSurfaceWriter.h plFont.h plFontCache.h plGImageCreatable.h @@ -44,7 +41,6 @@ set(plGImage_HEADERS plMipmap.h plPNG.h plTGAWriter.h - plWinFontCache.h ) add_library(plGImage STATIC ${plGImage_SOURCES} ${plGImage_HEADERS}) diff --git a/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp index a50d611c..d659cdb1 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plBitmap.cpp @@ -57,8 +57,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "hsStream.h" +#include "hsGDeviceRef.h" #include "pnKeyedObject/plKey.h" -#include "plPipeline/hsGDeviceRef.h" //// Static Members /////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp deleted file mode 100644 index cde40ce4..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.cpp +++ /dev/null @@ -1,1134 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/////////////////////////////////////////////////////////////////////////////// -// // -// plDynSurfaceWriter Class Header // -// Abstract class wrapping around Windows GDI functionality for writing to // -// a generic RGBA surface. Allows us to create one writer per DTMap or a // -// single shared writer to conserve OS resources on 98/ME. // -// // -// Cyan, Inc. // -// // -//// Version History ////////////////////////////////////////////////////////// -// // -// 10.28.2002 mcn - Created. // -// // -/////////////////////////////////////////////////////////////////////////////// - -#include "HeadSpin.h" - -#include "plDynSurfaceWriter.h" - -#include "plDynamicTextMap.h" -#include "hsExceptions.h" - -#include "hsMatrix44.h" -#include "plMessage/plDynamicTextMsg.h" -#include "pnKeyedObject/plKey.h" -#include "plProfile.h" -#include "plStatusLog/plStatusLog.h" -#include "plWinFontCache.h" - - -//// plWinSurface Helper Functions //////////////////////////////////////////// - -#if HS_BUILD_FOR_WIN32 - -static uint32_t sNumDCsAllocated; -static uint32_t sNumBitmapsAllocated; - -plDynSurfaceWriter::plWinSurface::plWinSurface() -{ - fDC = nil; - fBitmap = nil; - fFont = nil; - fBits = nil; - fTextColor = RGB( 255, 255, 255 ); - fWidth = fHeight = 0; - - fSaveNum = 0; - fFontSize = 0; - fFontFlags = 0; - fFontAntiAliasRGB = false; - fFontBlockedRGB = false; -} - -plDynSurfaceWriter::plWinSurface::~plWinSurface() -{ - Release(); -} - -void plDynSurfaceWriter::plWinSurface::Allocate( uint16_t w, uint16_t h ) -{ - int i; - BITMAPINFO *bmi; - - - Release(); - - fWidth = w; - fHeight = h; - - /// Initialize a bitmap info struct to describe our surface - if( IBitsPerPixel() == 8 ) - bmi = (BITMAPINFO *)( new uint8_t[ sizeof( BITMAPINFOHEADER ) + sizeof( RGBQUAD ) * 256 ] ); - else - bmi = new BITMAPINFO; - - memset( &bmi->bmiHeader, 0, sizeof( BITMAPINFOHEADER ) ); - bmi->bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); - bmi->bmiHeader.biWidth = (int)fWidth; - bmi->bmiHeader.biHeight = -(int)fHeight; - bmi->bmiHeader.biPlanes = 1; - bmi->bmiHeader.biCompression = BI_RGB; - bmi->bmiHeader.biBitCount = IBitsPerPixel(); - if( IBitsPerPixel() == 8 ) - { - // Set up map for grayscale bitmap - for( i = 0; i < 256; i++ ) - { - bmi->bmiColors[ i ].rgbRed = i; - bmi->bmiColors[ i ].rgbGreen = i; - bmi->bmiColors[ i ].rgbBlue = i; - bmi->bmiColors[ i ].rgbReserved = i; - } - } - - /// Create a screen-compatible DC - fDC = CreateCompatibleDC( nil ); - if( fDC == nil ) - { - char msg[ 256 ]; - FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nil, GetLastError(), MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), msg, sizeof( msg ), nil ); - char *ret = strrchr( msg, '\n' ); - if( ret != nil ) - *ret = 0; - - plStatusLog::AddLineS( "pipeline.log", 0xffff0000, "Unable to allocate DC for dynamic text map (%s, %d DCs allocated already)", msg, sNumDCsAllocated ); - if (IBitsPerPixel() == 8 ) - delete [] bmi; - else - delete bmi; - return; - } - sNumDCsAllocated++; - - /// Create a bitmap using the DC and the bitmapInfo struct we filled out - fBitmap = CreateDIBSection( fDC, bmi, DIB_RGB_COLORS, (void **)&fBits, nil, 0 ); - if( fBitmap == nil ) - { - char msg[ 256 ]; - FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nil, GetLastError(), MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), msg, sizeof( msg ), nil ); - char *ret = strrchr( msg, '\n' ); - if( ret != nil ) - *ret = 0; - - plStatusLog::AddLineS( "pipeline.log", 0xffff0000, "Unable to allocate RGB DIB section for dynamic text map (%s, %d bitmaps allocated already)", msg, sNumBitmapsAllocated ); - if (IBitsPerPixel() == 8 ) - delete [] bmi; - else - delete bmi; - return; - } - sNumBitmapsAllocated++; - - /// Set up some basic props - SetMapMode( fDC, MM_TEXT ); - SetBkMode( fDC, TRANSPARENT ); - SetTextAlign( fDC, TA_TOP | TA_LEFT ); - - fSaveNum = SaveDC( fDC ); - - SelectObject( fDC, fBitmap ); - - if (IBitsPerPixel() == 8 ) - delete [] bmi; - else - delete bmi; -} - -void plDynSurfaceWriter::plWinSurface::Release( void ) -{ - if( fBitmap != nil ) - sNumBitmapsAllocated--; - if( fDC != nil ) - sNumDCsAllocated--; - - if( fSaveNum != 0 ) - RestoreDC( fDC, fSaveNum ); - fSaveNum = 0; - - DeleteObject( fBitmap ); - DeleteDC( fDC ); - - fDC = nil; - fBitmap = nil; - fFont = nil; - fBits = nil; - fWidth = fHeight = 0; - - fFontFace = plString::Null; - fFontSize = 0; - fFontFlags = 0; - fFontAntiAliasRGB = false; - fFontBlockedRGB = false; -} - -bool plDynSurfaceWriter::plWinSurface::WillFit( uint16_t w, uint16_t h ) -{ - if( fWidth >= w && fHeight >= h ) - return true; - return false; -} - -static int SafeStrCmp( const char *str1, const char *str2 ) -{ - if( str1 == nil && str2 == nil ) - return -1; - if( str1 != nil && str2 != nil ) - return strcmp( str1, str2 ); - return -1; -} - -bool plDynSurfaceWriter::plWinSurface::FontMatches( const plString &face, uint16_t size, uint8_t flags, bool aaRGB ) -{ - if( face == fFontFace && fFontSize == size && - fFontFlags == flags && fFontAntiAliasRGB == aaRGB ) - return true; - - return false; -} - -void plDynSurfaceWriter::plWinSurface::SetFont( const plString &face, uint16_t size, uint8_t flags, bool aaRGB ) -{ - fFontFace = face; - fFontSize = size; - fFontFlags = flags; - fFontAntiAliasRGB = aaRGB; - - bool hadAFont = false; - if( fFont != nil ) - { - hadAFont = true; - plWinFontCache::GetInstance().FreeFont( fFont ); - fFont = nil; - } - - if (face.IsEmpty()) - return; - - bool bold = ( fFontFlags & plDynSurfaceWriter::kFontBold ) ? true : false; - bool italic = ( fFontFlags & plDynSurfaceWriter::kFontItalic ) ? true : false; - - int nHeight = -MulDiv( size, GetDeviceCaps( fDC, LOGPIXELSY ), 72 ); - fFont = plWinFontCache::GetInstance().GetMeAFont( face, nHeight, bold ? FW_BOLD : FW_NORMAL, italic, - fFontAntiAliasRGB ? ANTIALIASED_QUALITY : DEFAULT_QUALITY ); - if( fFont == nil && fFontAntiAliasRGB ) - { - static bool warnedCantAntiAlias = false; - - // Creation of font failed; could be that we can't do anti-aliasing? Try not doing it... - if( !warnedCantAntiAlias ) - { - plStatusLog::AddLineS( "pipeline.log", "WARNING: Cannot allocate anti-aliased font. Falling back to non-anti-aliased. This will be the only warning" ); - warnedCantAntiAlias = true; - } - - fFont = plWinFontCache::GetInstance().GetMeAFont( face, nHeight, bold ? FW_BOLD : FW_NORMAL, italic, - fFontAntiAliasRGB ? ANTIALIASED_QUALITY : DEFAULT_QUALITY ); - } - - if( fFont == nil ) - { - hsAssert( false, "Cannot create Windows font for plDynSurfaceWriter" ); - plStatusLog::AddLineS( "pipeline.log", "ERROR: Cannot allocate font for RGB surface! (face: %s, size: %d %s %s)", - face.c_str(), nHeight, bold ? "bold" : "", italic ? "italic" : "" ); - - fFontFace = plString::Null; - fFontSize = 0; - return; - } - - if( SelectObject( fDC, fFont ) == nil && hadAFont ) - { - char msg[ 256 ]; - FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nil, GetLastError(), MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), msg, sizeof( msg ), nil ); - char *ret = strrchr( msg, '\n' ); - if( ret != nil ) - *ret = 0; - - plStatusLog::AddLineS( "pipeline.log", 0xffff0000, "SelectObject() FAILED (%s)", msg ); - } - -} - -#endif // BUILD_FOR_WIN32 - -//// StupidStatic ///////////////////////////////////////////////////////////// - -bool plDynSurfaceWriter::fForceSharedSurfaces = false; -bool plDynSurfaceWriter::fOSDetected = false; -bool plDynSurfaceWriter::fOSCanShareSurfaces = false; - -bool plDynSurfaceWriter::CanHandleLotsOfThem( void ) -{ - if( fOSDetected ) - return fOSCanShareSurfaces; - - fOSDetected = true; - -#if HS_BUILD_FOR_WIN32 - OSVERSIONINFO versionInfo; - memset( &versionInfo, 0, sizeof( versionInfo ) ); - versionInfo.dwOSVersionInfoSize = sizeof( versionInfo ); - - if( GetVersionEx( &versionInfo ) ) - { - plStatusLog::AddLineS( "pipeline.log", "OS version detection results:" ); - plStatusLog::AddLineS( "pipeline.log", " Version: %d.%d", versionInfo.dwMajorVersion, versionInfo.dwMinorVersion ); - plStatusLog::AddLineS( "pipeline.log", " Build #: %d", versionInfo.dwBuildNumber ); - plStatusLog::AddLineS( "pipeline.log", " Platform ID: %d", versionInfo.dwPlatformId ); - - if( versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - if( fForceSharedSurfaces ) - { - plStatusLog::AddLineS( "pipeline.log", "Detected NT-based platform, but sharing surfaces due to override" ); - fOSCanShareSurfaces = false; - } - else - { - plStatusLog::AddLineS( "pipeline.log", "Detected NT-based platform, allowing separate surfaces" ); - fOSCanShareSurfaces = true; - } - } - else - { - plStatusLog::AddLineS( "pipeline.log", "Detected non-NT-based platform: sharing surfaces" ); - fOSCanShareSurfaces = false; - } - } - else - { - plStatusLog::AddLineS( "pipeline.log", "OS version detection failed" ); - fOSCanShareSurfaces = false; - } - -#endif - return fOSCanShareSurfaces; -} - -//// Constructor & Destructor ///////////////////////////////////////////////// - -plDynSurfaceWriter::plDynSurfaceWriter() -{ - IInit(); -} - -plDynSurfaceWriter::~plDynSurfaceWriter() -{ - Reset(); -} - -plDynSurfaceWriter::plDynSurfaceWriter( plDynamicTextMap *target, uint32_t flags ) -{ - IInit(); - fFlags = flags; - SwitchTarget( target ); -} - -void plDynSurfaceWriter::IInit( void ) -{ - fCurrTarget = 0; - fJustify = kLeftJustify; - fFlags = 0; - fFlushed = true; - fFontFace = plString::Null; - fFontSize = 0; - fFontBlockedRGB = false; -} - -//// Reset //////////////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::Reset( void ) -{ -#if HS_BUILD_FOR_WIN32 - fRGBSurface.Release(); - fAlphaSurface.Release(); -#endif - fCurrTarget = nil; - fFlushed = true; - - fFontFace = plString::Null; - fFontSize = 0; -} - - -/////////////////////////////////////////////////////////////////////////////// -//// Target Switching ///////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//// FlushToTarget //////////////////////////////////////////////////////////// -// Flushes all ops to the target. - -void plDynSurfaceWriter::FlushToTarget( void ) -{ - int x, y; - - - if( fCurrTarget != nil && !fFlushed ) - { -#if HS_BUILD_FOR_WIN32 - // Flush the GDI so we can grab the bits - GdiFlush(); - - uint32_t *destBits = (uint32_t *)fCurrTarget->GetImage(); - - // Are we merging in the alpha bits? - if( fFlags & kSupportAlpha ) - { - // Yup, munge 'em - uint32_t *srcRGBBits = fRGBSurface.GetBits(); - uint8_t *srcAlphaBits = fAlphaSurface.GetBits(); - uint32_t destWidth = fCurrTarget->GetWidth(); - - for( y = 0; y < fCurrTarget->GetHeight(); y++ ) - { - for( x = 0; x < destWidth; x++ ) - destBits[ x ] = ( srcRGBBits[ x ] & 0x00ffffff ) | ( (uint32_t)srcAlphaBits[ x ] << 24 ); - - destBits += destWidth; - srcRGBBits += fRGBSurface.fWidth; - srcAlphaBits += fAlphaSurface.fWidth; - } - } - else - { - // Nope, just a 24-bit copy and set alphas to ff - uint32_t *srcBits = fRGBSurface.GetBits(); - uint32_t destWidth = fCurrTarget->GetWidth(); - - for( y = 0; y < fCurrTarget->GetHeight(); y++ ) - { - memcpy( destBits, srcBits, destWidth * sizeof( uint32_t ) ); - - // Fill in 0xff - for( x = 0; x < destWidth; x++ ) - destBits[ x ] |= 0xff000000; - - destBits += destWidth; - srcBits += fRGBSurface.fWidth; - } - } -#endif - } - fFlushed = true; -} - -//// SwitchTarget ///////////////////////////////////////////////////////////// -// Switches targets. Will flush to old target before switching. Also, if -// kDiscard isn't specified, will copy contents of new target to working -// surface. - -void plDynSurfaceWriter::SwitchTarget( plDynamicTextMap *target ) -{ - if( target == fCurrTarget ) - return; - - if( !fFlushed ) - FlushToTarget(); - - fCurrTarget = target; - fFlushed = true; // Will force a copy next IEnsureSurfaceUpdated() - - // Make sure our surfaces fit - bool hadToAllocate = false; -#if HS_BUILD_FOR_WIN32 - if( target != nil ) - { - if( !fRGBSurface.WillFit( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ) ) - { - fRGBSurface.Allocate( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ); - hadToAllocate = true; - } - - if( fFlags & kSupportAlpha ) - { - if( !fAlphaSurface.WillFit( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ) ) - { - fAlphaSurface.Allocate( (uint16_t)(target->GetWidth()), (uint16_t)(target->GetHeight()) ); - hadToAllocate = true; - } - } - } - else - { - fRGBSurface.Release(); - fAlphaSurface.Release(); - hadToAllocate = true; - } -#endif - - if( hadToAllocate ) - { - fFontFace = plString::Null; - fFontSize = 0; - fFontFlags = 0; - } -} - -//// IEnsureSurfaceUpdated //////////////////////////////////////////////////// -// Makes sure our surfaces are ready to write to. - -void plDynSurfaceWriter::IEnsureSurfaceUpdated( void ) -{ - uint32_t x, y; - - - // If we're flushed, then we haven't drawn since the last flush, - // which means we want to copy from our target before we start drawing. - // If we've already drawn, then we won't be flushed and we don't want - // to be copying over what we've already drawn - if( fCurrTarget != nil && fFlushed ) - { - uint32_t *srcBits = (uint32_t *)fCurrTarget->GetImage(); - -#if HS_BUILD_FOR_WIN32 - // Are we merging in the alpha bits? - if( fFlags & kSupportAlpha ) - { - // Yup, de-munge 'em - uint32_t *destRGBBits = fRGBSurface.GetBits(); - uint8_t *destAlphaBits = fAlphaSurface.GetBits(); - uint32_t srcWidth = fCurrTarget->GetWidth(); - - for( y = 0; y < fCurrTarget->GetHeight(); y++ ) - { - for( x = 0; x < srcWidth; x++ ) - { - destRGBBits[ x ] = srcBits[ x ]; // Windows GDI probably doesn't care about the alpha bits here. Hopefully... - destAlphaBits[ x ] = (uint8_t)(srcBits[ x ] >> 24); - } - - srcBits += srcWidth; - destRGBBits += fRGBSurface.fWidth; - destAlphaBits += fAlphaSurface.fWidth; - } - } - else - { - // Nope, just do a straight memcopy - uint32_t *destBits = fRGBSurface.GetBits(); - uint32_t srcWidth = fCurrTarget->GetWidth(); - - for( y = 0; y < fCurrTarget->GetHeight(); y++ ) - { - memcpy( destBits, srcBits, srcWidth * sizeof( uint32_t ) ); - - srcBits += srcWidth; - destBits += fRGBSurface.fWidth; - } - } -#endif - - // ALSO, we need to re-update our settings, since different targets - // can have different fonts or justifications - ISetFont( fCurrTarget->GetFontFace(), fCurrTarget->GetFontSize(), 0/*fCurrTarget->GetWriterFontFlags()*/, fCurrTarget->GetFontAARGB() ); - SetJustify( (Justify)fCurrTarget->GetFontJustify() ); - hsColorRGBA col = fCurrTarget->GetFontColor(); - ISetTextColor( col, fCurrTarget->GetFontBlockRGB() ); - - fFlushed = false; - } -} - -bool plDynSurfaceWriter::IsValid( void ) const -{ - if( fCurrTarget == nil ) - return false; - -#if HS_BUILD_FOR_WIN32 - if( fRGBSurface.fDC == nil || fRGBSurface.fBitmap == nil ) - return false; - - if( ( fFlags & kSupportAlpha ) && ( fAlphaSurface.fDC == nil || fAlphaSurface.fBitmap == nil ) ) - return false; -#endif - - return true; -} - -/////////////////////////////////////////////////////////////////////////////// -//// Rendering Functions ////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//// SetBitsFromBuffer //////////////////////////////////////////////////////// - -/* -void plDynSurfaceWriter::SetBitsFromBuffer( uint32_t *clearBuffer, uint16_t width, uint16_t height ) -{ - int x, y; - uint32_t *data = (uint32_t *)fImage, *srcData = clearBuffer; - uint8_t *destAlpha = nil; - - - if( !IsValid() ) - return; - -#if HS_BUILD_FOR_WIN32 - GdiFlush(); -#endif - - // Clear *all* to zero - memset( data, 0, fWidth * fHeight * sizeof( uint32_t ) ); - if( fHasAlpha ) - { -#if HS_BUILD_FOR_WIN32 - memset( fWinAlphaBits, 0, fWidth * fHeight ); - destAlpha = fWinAlphaBits; -#endif - } - - // Buffer is of size fVisWidth x fVisHeight, so we need a bit of work to do this right - for( y = 0; y < fVisHeight; y++ ) - { - for( x = 0; x < fVisWidth; x++ ) - { - data[ x ] = srcData[ x ]; - } - - if( destAlpha != nil ) - { - for( x = 0; x < fVisWidth; x++ ) - destAlpha[ x ] = srcData[ x ] >> 24; - - destAlpha += fWidth; - } - - data += fWidth; - srcData += fVisWidth; - } -} -*/ - -//// ClearToColor ///////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::ClearToColor( hsColorRGBA &color ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - -#if HS_BUILD_FOR_WIN32 - - uint32_t i, hexColor = color.ToARGB32(); - - - // Flush the GDI first, so it doesn't decide to overwrite us later - GdiFlush(); - - uint32_t *rgbBits = fRGBSurface.GetBits(); - for( i = 0; i < fRGBSurface.fWidth * fRGBSurface.fHeight; i++ ) - rgbBits[ i ] = hexColor; - - if( fFlags & kSupportAlpha ) - { - uint8_t *alphaBits = fAlphaSurface.GetBits(), alpha = (uint8_t)(hexColor >> 24); - - for( i = 0; i < fAlphaSurface.fWidth * fAlphaSurface.fHeight; i++ ) - alphaBits[ i ] = alpha; - } -#endif -} - -//// SetFont ////////////////////////////////////////////////////////////////// -// OS-specific. Load the given font for drawing the text with. - -void plDynSurfaceWriter::SetFont( const char *face, uint16_t size, uint8_t fontFlags, bool antiAliasRGB ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - - ISetFont( face, size, fontFlags, antiAliasRGB ); -} - -//// ISetFont ///////////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::ISetFont( const plString &face, uint16_t size, uint8_t fontFlags, bool antiAliasRGB ) -{ - fFlags = ( fFlags & ~kFontShadowed ) | ( fontFlags & kFontShadowed ); - -#if HS_BUILD_FOR_WIN32 - if( !fRGBSurface.FontMatches( face, size, fontFlags, antiAliasRGB ) ) - fRGBSurface.SetFont( face, size, fontFlags, antiAliasRGB ); - - if( fFlags & kSupportAlpha ) - { - if( !fAlphaSurface.FontMatches( face, size, fontFlags, !antiAliasRGB ) ) - fAlphaSurface.SetFont( face, size, fontFlags, !antiAliasRGB ); - } -#endif -} - -//// SetTextColor ///////////////////////////////////////////////////////////// -// blockRGB basically forces the RGB channel to write in blocks instead of -// actual characters. This isn't useful unless you're relying on the alpha -// channel to do the text (opaque text and transparent background), in which -// case you want plenty of block color in your RGB channel because it'll get -// alpha-ed out by the alpha channel. - -void plDynSurfaceWriter::SetTextColor( hsColorRGBA &color, bool blockRGB ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - ISetTextColor( color, blockRGB ); -} - -//// IRefreshTextColor //////////////////////////////////////////////////////// - -void plDynSurfaceWriter::ISetTextColor( hsColorRGBA &color, bool blockRGB ) -{ -#if HS_BUILD_FOR_WIN32 - - int r = (int)(color.r * 255.f); - int g = (int)(color.g * 255.f); - int b = (int)(color.b * 255.f); - - fRGBSurface.fTextColor = RGB( r, g, b ); - if( fFlags & kSupportAlpha ) - { - int a = (int)(color.a * 255.f); - fAlphaSurface.fTextColor = RGB( a, a, a ); - } - - fFontBlockedRGB = blockRGB; - - if( fFontBlockedRGB && !( fFlags & kFontShadowed ) ) - { - ::SetBkColor( fRGBSurface.fDC, fRGBSurface.fTextColor ); - ::SetBkMode( fRGBSurface.fDC, OPAQUE ); - } - else - ::SetBkMode( fRGBSurface.fDC, TRANSPARENT ); - - ::SetTextColor( fRGBSurface.fDC, fRGBSurface.fTextColor ); - - if( fFlags & kSupportAlpha ) - ::SetTextColor( fAlphaSurface.fDC, fAlphaSurface.fTextColor ); -#endif -} - -//// SetJustify /////////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::SetJustify( Justify j ) -{ - fJustify = j; -} - -//// IRefreshOSJustify //////////////////////////////////////////////////////// - -void plDynSurfaceWriter::IRefreshOSJustify( void ) -{ - if( !IsValid() ) - return; - -#if HS_BUILD_FOR_WIN32 - uint32_t justMode; - switch( fJustify ) - { - case kLeftJustify: justMode = TA_LEFT; break; - case kCenter: justMode = TA_CENTER; break; - case kRightJustify: justMode = TA_RIGHT; break; - } - ::SetTextAlign( fRGBSurface.fDC, justMode ); - if( fFlags & kSupportAlpha ) - ::SetTextAlign( fAlphaSurface.fDC, justMode ); -#endif -} - -//// DrawString /////////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::DrawString( uint16_t x, uint16_t y, const char *text ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - - IRefreshOSJustify(); - -#if HS_BUILD_FOR_WIN32 - if( fFlags & kFontShadowed ) - { - ::SetTextColor( fRGBSurface.fDC, RGB( 0, 0, 0 ) ); - ::TextOut( fRGBSurface.fDC, x + 1, y + 1, text, strlen( text ) ); - - ::SetTextColor( fRGBSurface.fDC, fRGBSurface.fTextColor ); - ::TextOut( fRGBSurface.fDC, x, y, text, strlen( text ) ); - - if( fFlags & kSupportAlpha ) - { - ::TextOut( fAlphaSurface.fDC, x + 1, y + 1, text, strlen( text ) ); - ::TextOut( fAlphaSurface.fDC, x, y, text, strlen( text ) ); - } - } - else - { - ::TextOut( fRGBSurface.fDC, x, y, text, strlen( text ) ); - if( fFlags & kSupportAlpha ) - ::TextOut( fAlphaSurface.fDC, x, y, text, strlen( text ) ); - } - -#endif -} - -//// DrawClippedString //////////////////////////////////////////////////////// - -void plDynSurfaceWriter::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - - IRefreshOSJustify(); - -#if HS_BUILD_FOR_WIN32 - - RECT r; - ::SetRect( &r, x, y, x + width, y + height ); - - if( fJustify == kRightJustify ) - x += width - 1; - else if( fJustify == kCenter ) - x += width >> 1; - - if( fFlags & kFontShadowed ) - { - ::SetTextColor( fRGBSurface.fDC, RGB( 0, 0, 0 ) ); - - ::OffsetRect( &r, 1, 1 ); - ::ExtTextOut( fRGBSurface.fDC, x + 1, y + 1, ETO_CLIPPED, &r, text, strlen( text ), nil ); - if( fFlags & kSupportAlpha ) - ::ExtTextOut( fAlphaSurface.fDC, x + 1, y + 1, ETO_CLIPPED, &r, text, strlen( text ), nil ); - ::OffsetRect( &r, -1, -1 ); - - ::SetTextColor( fRGBSurface.fDC, fRGBSurface.fTextColor ); - } - - ::ExtTextOut( fRGBSurface.fDC, x, y, ETO_CLIPPED, &r, text, strlen( text ), nil ); - if( fFlags & kSupportAlpha ) - ::ExtTextOut( fAlphaSurface.fDC, x, y, ETO_CLIPPED, &r, text, strlen( text ), nil ); - -#endif -} - -//// DrawClippedString //////////////////////////////////////////////////////// - -void plDynSurfaceWriter::DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - - IRefreshOSJustify(); - -#if HS_BUILD_FOR_WIN32 - - RECT r; - ::SetRect( &r, clipX, clipY, clipX + width, clipY + height ); - - if( fFlags & kFontShadowed ) - { - ::SetTextColor( fRGBSurface.fDC, RGB( 0, 0, 0 ) ); - - ::OffsetRect( &r, 1, 1 ); - ::ExtTextOut( fRGBSurface.fDC, x + 1, y + 1, ETO_CLIPPED, &r, text, strlen( text ), nil ); - if( fFlags & kSupportAlpha ) - ::ExtTextOut( fAlphaSurface.fDC, x + 1, y + 1, ETO_CLIPPED, &r, text, strlen( text ), nil ); - ::OffsetRect( &r, -1, -1 ); - - ::SetTextColor( fRGBSurface.fDC, fRGBSurface.fTextColor ); - } - - ::ExtTextOut( fRGBSurface.fDC, x, y, ETO_CLIPPED, &r, text, strlen( text ), nil ); - if( fFlags & kSupportAlpha ) - ::ExtTextOut( fAlphaSurface.fDC, x, y, ETO_CLIPPED, &r, text, strlen( text ), nil ); - -#endif -} - -//// DrawWrappedString //////////////////////////////////////////////////////// - -void plDynSurfaceWriter::DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - -#if HS_BUILD_FOR_WIN32 - - RECT r; - ::SetRect( &r, x, y, x + width, y + height ); - - UINT format = DT_TOP | DT_NOPREFIX | DT_WORDBREAK; - switch( fJustify ) - { - case kLeftJustify: format |= DT_LEFT; break; - case kCenter: format |= DT_CENTER; break; - case kRightJustify: format |= DT_RIGHT; break; - } - - if( fFlags & kFontShadowed ) - { - ::SetTextColor( fRGBSurface.fDC, RGB( 0, 0, 0 ) ); - - ::OffsetRect( &r, 1, 1 ); - ::DrawText( fRGBSurface.fDC, text, strlen( text ), &r, format ); - if( fFlags & kSupportAlpha ) - ::DrawText( fAlphaSurface.fDC, text, strlen( text ), &r, format ); - ::OffsetRect( &r, -1, -1 ); - - ::SetTextColor( fRGBSurface.fDC, fRGBSurface.fTextColor ); - } - - ::DrawText( fRGBSurface.fDC, text, strlen( text ), &r, format ); - if( fFlags & kSupportAlpha ) - ::DrawText( fAlphaSurface.fDC, text, strlen( text ), &r, format ); - -#endif -} - -//// CalcStringWidth ////////////////////////////////////////////////////////// - -uint16_t plDynSurfaceWriter::CalcStringWidth( const char *text, uint16_t *height ) -{ - if( !IsValid() ) - return 0; - - IEnsureSurfaceUpdated(); - -#if HS_BUILD_FOR_WIN32 - SIZE size; - ::GetTextExtentPoint32( fRGBSurface.fDC, text, strlen( text ), &size ); - - if( height != nil ) - *height = (uint16_t)size.cy; - - return (uint16_t)size.cx; -#else - return 0; -#endif -} - -//// CalcWrappedStringSize //////////////////////////////////////////////////// - -void plDynSurfaceWriter::CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - -#if HS_BUILD_FOR_WIN32 - - RECT r; - ::SetRect( &r, 0, 0, *width, 0 ); - - UINT format = DT_TOP | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT; - switch( fJustify ) - { - case kLeftJustify: format |= DT_LEFT; break; - case kCenter: format |= DT_CENTER; break; - case kRightJustify: format |= DT_RIGHT; break; - } - - ::DrawText( fRGBSurface.fDC, text, strlen( text ), &r, format ); - - *width = (uint16_t)(r.right); - if( height != nil ) - *height = (uint16_t)r.bottom; -#endif -} - -//// FillRect ///////////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - -#if HS_BUILD_FOR_WIN32 - - RECT rc; - ::SetRect( &rc, x, y, x + width, y + height ); - - int r = (int)(color.r * 255.f); - int g = (int)(color.g * 255.f); - int b = (int)(color.b * 255.f); - int a = (int)(color.a * 255.f); - - HBRUSH brush = ::CreateSolidBrush( RGB( r, g, b ) ); - ::FillRect( fRGBSurface.fDC, &rc, brush ); - ::DeleteObject( brush ); - - if( fFlags & kSupportAlpha ) - { - brush = ::CreateSolidBrush( RGB( a, a, a ) ); - ::FillRect( fAlphaSurface.fDC, &rc, brush ); - ::DeleteObject( brush ); - } - -#endif -} - -//// FrameRect //////////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ) -{ - if( !IsValid() ) - return; - - IEnsureSurfaceUpdated(); - -#if HS_BUILD_FOR_WIN32 - - RECT rc; - ::SetRect( &rc, x, y, x + width, y + height ); - - int r = (int)(color.r * 255.f); - int g = (int)(color.g * 255.f); - int b = (int)(color.b * 255.f); - int a = (int)(color.a * 255.f); - - HBRUSH brush = ::CreateSolidBrush( RGB( r, g, b ) ); - ::FrameRect( fRGBSurface.fDC, &rc, brush ); - ::DeleteObject( brush ); - - if( fFlags & kSupportAlpha ) - { - brush = ::CreateSolidBrush( RGB( a, a, a ) ); - ::FrameRect( fAlphaSurface.fDC, &rc, brush ); - ::DeleteObject( brush ); - } - -#endif -} - -/* -//// DrawImage //////////////////////////////////////////////////////////////// - -void plDynSurfaceWriter::DrawImage( uint16_t x, uint16_t y, plMipmap *image, bool respectAlpha ) -{ - if( !IsValid() ) - return; - -#if HS_BUILD_FOR_WIN32 - // Flush the GDI first, to make sure it's done - GdiFlush(); -#endif - - plMipmap::CompositeOptions opts( respectAlpha ? 0 : plMipmap::kForceOpaque ); - if( !fHasAlpha ) - opts.fFlags = plMipmap::kCopySrcAlpha; // Don't care, this is fastest - - Composite( image, x, y, &opts ); - - /// HACK for now, since the alpha in the mipmap gets copied straight into the - /// 32-bit color buffer, but our separate hacked alpha buffer hasn't been updated - if( fHasAlpha && !respectAlpha ) - { - HBRUSH brush = ::CreateSolidBrush( RGB( 255, 255, 255 ) ); - RECT rc; - ::SetRect( &rc, x, y, x + image->GetWidth(), y + image->GetHeight() ); - ::FillRect( fWinAlphaDC, &rc, brush ); - ::DeleteObject( brush ); - } -} - -//// DrawClippedImage ///////////////////////////////////////////////////////// - -void plDynSurfaceWriter::DrawClippedImage( uint16_t x, uint16_t y, plMipmap *image, - uint16_t srcClipX, uint16_t srcClipY, - uint16_t srcClipWidth, uint16_t srcClipHeight, - bool respectAlpha ) -{ - if( !IsValid() ) - return; - -#if HS_BUILD_FOR_WIN32 - // Flush the GDI first, to make sure it's done - GdiFlush(); -#endif - - plMipmap::CompositeOptions opts( respectAlpha ? 0 : plMipmap::kForceOpaque ); - if( !fHasAlpha ) - opts.fFlags = plMipmap::kCopySrcAlpha; // Don't care, this is fastest - - opts.fSrcClipX = srcClipX; - opts.fSrcClipY = srcClipY; - opts.fSrcClipWidth = srcClipWidth; - opts.fSrcClipHeight = srcClipHeight; - Composite( image, x, y, &opts ); - - /// HACK for now, since the alpha in the mipmap gets copied straight into the - /// 32-bit color buffer, but our separate hacked alpha buffer hasn't been updated - if( fHasAlpha && !respectAlpha ) - { - HBRUSH brush = ::CreateSolidBrush( RGB( 255, 255, 255 ) ); - RECT rc; - ::SetRect( &rc, x, y, x + ( srcClipWidth > 0 ? srcClipWidth : image->GetWidth() ), - y + ( srcClipHeight > 0 ? srcClipHeight : image->GetHeight() ) ); - ::FillRect( fWinAlphaDC, &rc, brush ); - ::DeleteObject( brush ); - } -} -*/ diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.h b/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.h deleted file mode 100644 index b94c69a2..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynSurfaceWriter.h +++ /dev/null @@ -1,221 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/////////////////////////////////////////////////////////////////////////////// -// // -// plDynSurfaceWriter Class Header // -// Abstract class wrapping around Windows GDI functionality for writing to // -// a generic RGBA surface. Allows us to create one writer per DTMap or a // -// single shared writer to conserve OS resources on 98/ME. // -// // -// Cyan, Inc. // -// // -//// Version History ////////////////////////////////////////////////////////// -// // -// 10.28.2002 mcn - Created. // -// // -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _plDynSurfaceWriter_h -#define _plDynSurfaceWriter_h - -#include "hsColorRGBA.h" -#include "hsWindows.h" // FIXME: windows :( - -struct hsMatrix44; - -class plDynamicTextMap; - -//// Class Definition ///////////////////////////////////////////////////////// - -class plDynSurfaceWriter -{ - public: - - //// Public Flags //// - enum Justify - { - kLeftJustify = 0, - kCenter, - kRightJustify - }; - - enum Flags - { - kSupportAlpha = 0x00000001, - - kFontBold = 0x00000002, - kFontItalic = 0x00000004, - kFontShadowed = 0x00000008, - kFontMask = 0x0000000e, - - kDiscardOnFlush = 0x00000010 - }; - - //// Public Data ///// - - - //// Public Members //// - - - plDynSurfaceWriter(); - plDynSurfaceWriter( plDynamicTextMap *target, uint32_t flags = 0 ); - virtual ~plDynSurfaceWriter(); - - - /// Operations to perform on the text block - - void ClearToColor( hsColorRGBA &color ); - void SetFont( const char *face, uint16_t size, uint8_t fontFlags = 0, bool antiAliasRGB = true ); - void SetTextColor( hsColorRGBA &color, bool blockRGB = false ); - void SetJustify( Justify j ); - - void DrawString( uint16_t x, uint16_t y, const char *text ); - void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t width, uint16_t height ); - void DrawClippedString( int16_t x, int16_t y, const char *text, uint16_t clipX, uint16_t clipY, uint16_t width, uint16_t height ); - void DrawWrappedString( uint16_t x, uint16_t y, const char *text, uint16_t width, uint16_t height ); - uint16_t CalcStringWidth( const char *text, uint16_t *height = nil ); - void CalcWrappedStringSize( const char *text, uint16_t *width, uint16_t *height ); - void FillRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); - void FrameRect( uint16_t x, uint16_t y, uint16_t width, uint16_t height, hsColorRGBA &color ); - -// void DrawImage( uint16_t x, uint16_t y, plMipmap *image, bool respectAlpha = false ); -// void DrawClippedImage( uint16_t x, uint16_t y, plMipmap *image, uint16_t srcClipX, uint16_t srcClipY, -// uint16_t srcClipWidth, uint16_t srcClipHeight, bool respectAlpha = false ); - - // Copy the raw data from the given buffer. -// void SetBitsFromBuffer( uint32_t *clearBuffer, uint16_t width, uint16_t height ) - - /// Target switching operations - - // Flushes all ops to the target. - void FlushToTarget( void ); - - // Switches targets. Will flush to old target before switching. Also, if kDiscard isn't specified, will copy contents of new target to working surface - void SwitchTarget( plDynamicTextMap *target ); // Will force a flush - - // Clears and resets everything. Does NOT flush. - void Reset( void ); - - bool IsValid( void ) const; - - static bool CanHandleLotsOfThem( void ); - - protected: - - //// Protected Members //// - - void IInit( void ); - void IEnsureSurfaceUpdated( void ); - void IRefreshOSJustify( void ); - void ISetTextColor( hsColorRGBA &color, bool blockRGB ); - - void ISetFont( const plString &face, uint16_t size, uint8_t fontFlags = 0, bool antiAliasRGB = true ); - - plDynamicTextMap *fCurrTarget; - uint32_t fFlags; - Justify fJustify; - bool fFlushed; - - plString fFontFace; - uint16_t fFontSize; - uint8_t fFontFlags; - bool fFontAntiAliasRGB; - bool fFontBlockedRGB; - - static bool fForceSharedSurfaces; - static bool fOSDetected; - static bool fOSCanShareSurfaces; - -#if HS_BUILD_FOR_WIN32 - class plWinSurface - { - protected: - void *fBits; - - virtual uint8_t IBitsPerPixel( void ) const = 0; - - public: - HDC fDC; - HBITMAP fBitmap; - HFONT fFont; - COLORREF fTextColor; - int fSaveNum; - - uint16_t fWidth, fHeight; - - plString fFontFace; - uint16_t fFontSize; - uint8_t fFontFlags; - bool fFontAntiAliasRGB, fFontBlockedRGB; - - plWinSurface(); - ~plWinSurface(); - - void Allocate( uint16_t w, uint16_t h ); - void Release( void ); - - bool WillFit( uint16_t w, uint16_t h ); - bool FontMatches( const plString &face, uint16_t size, uint8_t flags, bool aaRGB ); - void SetFont( const plString &face, uint16_t size, uint8_t flags, bool aaRGB ); - }; - - class plWinRGBSurface : public plWinSurface - { - virtual uint8_t IBitsPerPixel( void ) const { return 32; } - public: - uint32_t *GetBits( void ) const { return (uint32_t *)fBits; } - }; - - class plWinAlphaSurface : public plWinSurface - { - virtual uint8_t IBitsPerPixel( void ) const { return 8; } - public: - uint8_t *GetBits( void ) const { return (uint8_t *)fBits; } - }; - - plWinRGBSurface fRGBSurface; - plWinAlphaSurface fAlphaSurface; -#endif -}; - - -#endif // _plDynSurfaceWriter_h diff --git a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp index 130936e9..ebe526cb 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plDynamicTextMap.cpp @@ -58,7 +58,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsExceptions.h" #include "hsMatrix44.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plMessage/plDynamicTextMsg.h" #include "pnKeyedObject/plKey.h" #include "plProfile.h" diff --git a/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp index c593fe01..34465a4c 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plLODMipmap.cpp @@ -44,12 +44,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plLODMipmap.h" #include "hsResMgr.h" +#include "hsGDeviceRef.h" #include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plUoid.h" #include "pnMessage/plRefMsg.h" -#include "plPipeline/hsGDeviceRef.h" - plLODMipmap::plLODMipmap() : fBase(nil), diff --git a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp index 10c6a442..2300efc9 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsExceptions.h" #include "hsColorRGBA.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plProfile.h" #include "plJPEG.h" #include diff --git a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp deleted file mode 100644 index 421121f3..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/////////////////////////////////////////////////////////////////////////////// -// // -// plWinFontCache Class Header // -// I've stopped keeping track, there are far too many reasons already to // -// hate Microsoft. Anyway, this class keeps track of various Win32 fonts we // -// allocate because Win98/ME seems to have problems re-allocating the exact // -// same freaking goddamn font over and over again. I mean, you'd think // -// there'd be a rule somewhere about deterministic behavior when calling // -// the exact same function with the exact same parameters over and over... // -// Oh, wait... // -// // -// Cyan, Inc. // -// // -//// Version History ////////////////////////////////////////////////////////// -// // -// 11.25.2002 mcn - Created. // -// // -/////////////////////////////////////////////////////////////////////////////// - -#include "HeadSpin.h" - -#include "plWinFontCache.h" - -#include "plStatusLog/plStatusLog.h" -#include "plGImage/plDynSurfaceWriter.h" - -#if HS_BUILD_FOR_WIN32 - -#include - - -const char* plWinFontCache::kCustFontExtension = ".prf"; - - -plWinFontCache::plWinFontCache() -{ - fInShutdown = false; - fCustFontDir = nil; -} - -plWinFontCache::~plWinFontCache() -{ - fInShutdown = true; - Clear(); - delete [] fCustFontDir; -} - -plWinFontCache &plWinFontCache::GetInstance( void ) -{ - static plWinFontCache cache; - return cache; -} - -HFONT plWinFontCache::IFindFont( const plString &face, int height, int weight, bool italic, uint32_t quality ) -{ - int i; - - - for( i = 0; i < fFontCache.GetCount(); i++ ) - { - // Do other tests first, since they're cheaper - if( fFontCache[ i ].fHeight == height && - fFontCache[ i ].fWeight == weight && - fFontCache[ i ].fItalic == italic && - fFontCache[ i ].fQuality == quality ) - { - if (fFontCache[i].fFace == face) - return fFontCache[ i ].fFont; - } - } - - return nil; -} - -HFONT plWinFontCache::IMakeFont( const plString &face, int height, int weight, bool italic, uint32_t quality ) -{ - plFontRecord myRec; - int i; - - - // Find a cached name for us - for( i = 0; i < fFontNameCache.GetCount(); i++ ) - { - if (face == fFontNameCache[i]) - break; - } - - if( i == fFontNameCache.GetCount() ) - fFontNameCache.Append(face); - - myRec.fFace = fFontNameCache[ i ]; - myRec.fHeight = height; - myRec.fWeight = weight; - myRec.fItalic = italic; - myRec.fQuality = quality; - - myRec.fFont = CreateFontW( height, 0, 0, 0, weight, italic ? TRUE : FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, VARIABLE_PITCH, face.ToWchar().GetData() ); - - if( myRec.fFont != nil ) - { -//#ifdef HS_DEBUGGING -#if 1 - LOGFONT fontInfo; - - if( GetObject( myRec.fFont, sizeof( fontInfo ), &fontInfo ) ) - { - const char *err = nil; - - if( fontInfo.lfQuality != quality ) - err = "Quality of created font does not match"; - if( fontInfo.lfHeight != height ) - err = "Height of created font does not match"; - if( fontInfo.lfWeight != weight ) - err = "Weight of created font does not match"; - if( static_cast(fontInfo.lfItalic) != italic ) - err = "Italic-ness of created font does not match"; - if( face.CompareI(fontInfo.lfFaceName) != 0 ) - err = "Face of created font does not match"; - - if( err != nil ) - { - static bool triedClearing = false; - - if( fontInfo.lfQuality != quality ) - { - plStatusLog::AddLineS( "pipeline.log", "ERROR: CreateFont() failed to return proper font (%s). Using what was given...", err ); - } - else - { - plStatusLog::AddLineS( "pipeline.log", "ERROR: CreateFont() failed to return proper font (%s). %s", err, triedClearing ? "" : "Clearing cache and retrying..." ); - if( !triedClearing ) - { - triedClearing = true; - - // Didn't work, so get rid of it - DeleteObject( myRec.fFont ); - - // Clear all fonts and try again - Clear(); - - // Make sure we reload our custom fonts tho - ILoadCustomFonts(); - - // Try again - HFONT font = IMakeFont( face, height, weight, italic, quality ); - - triedClearing = false; - - return font; - } - } - } - } -#endif - - fFontCache.Append( myRec ); - } - else - { - plStatusLog::AddLineS( "pipeline.log", "ERROR: CreateFont() call FAILED (face: %s, size: %d %s %s)", - face.c_str(), -height, weight == FW_BOLD ? "bold" : "", italic ? "italic" : "" ); - } - - return myRec.fFont; -} - -HFONT plWinFontCache::GetMeAFont( const plString &face, int height, int weight, bool italic, uint32_t quality ) -{ - HFONT font = IFindFont( face, height, weight, italic, quality ); - if( font == nil ) - font = IMakeFont( face, height, weight, italic, quality ); - - return font; -} - -void plWinFontCache::Clear( void ) -{ - int i; - - - if( !fInShutdown ) - plStatusLog::AddLineS( "pipeline.log", "** Clearing Win32 font cache **" ); - - for( i = 0; i < fFontCache.GetCount(); i++ ) - DeleteObject( fFontCache[ i ].fFont ); - fFontCache.Reset(); - - fFontNameCache.Reset(); - - for( i = 0; i < fCustFonts.GetCount(); i++ ) - { -#if (_WIN32_WINNT >= 0x0500) - if (plDynSurfaceWriter::CanHandleLotsOfThem()) - RemoveFontResourceExW(fCustFonts[i]->fFilename.AsString().ToWchar(), FR_PRIVATE, 0); - else -#endif - if (RemoveFontResourceW(fCustFonts[i]->fFilename.AsString().ToWchar()) == 0) - { - int q= 0; - DWORD e = GetLastError(); - } - delete fCustFonts[ i ]; - } - fCustFonts.Reset(); -} - -void plWinFontCache::FreeFont( HFONT font ) -{ - // Currently a no-op, but should do some sort of ref-counting -} - -void plWinFontCache::LoadCustomFonts( const char *dir ) -{ - delete [] fCustFontDir; - fCustFontDir = ( dir != nil ) ? hsStrcpy( dir ) : nil; - - ILoadCustomFonts(); -} - -void plWinFontCache::ILoadCustomFonts( void ) -{ - if( fCustFontDir == nil ) - return; - - // Iterate through all the custom fonts in our dir - int numAdded; - - std::vector fonts = plFileSystem::ListDir(fCustFontDir, kCustFontExtension); - for (auto iter = fonts.begin(); iter != fonts.end(); ++iter) - { - // Note that this call can be translated as "does my OS suck?" -#if (_WIN32_WINNT >= 0x0500) - if( plDynSurfaceWriter::CanHandleLotsOfThem() ) - numAdded = AddFontResourceExW(iter->AsString().ToWchar(), FR_PRIVATE, 0); - else -#endif - numAdded = AddFontResourceW(iter->AsString().ToWchar()); - - if( numAdded > 0 ) - { - plStatusLog::AddLineS( "pipeline.log", "WinFontCache: Added custom font %s, %d fonts", iter->GetFileName().c_str(), numAdded ); - fCustFonts.Append(new plCustFont(*iter)); - } - else - { - plStatusLog::AddLineS( "pipeline.log", "WinFontCache: Unable to load custom font %s", iter->GetFileName().c_str() ); - } - } -} - -#endif diff --git a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h deleted file mode 100644 index b990e07a..00000000 --- a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h +++ /dev/null @@ -1,130 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ -/////////////////////////////////////////////////////////////////////////////// -// // -// plWinFontCache Class Header // -// I've stopped keeping track, there are far too many reasons already to // -// hate Microsoft. Anyway, this class keeps track of various Win32 fonts we // -// allocate because Win98/ME seems to have problems re-allocating the exact // -// same freaking goddamn font over and over again. I mean, you'd think // -// there'd be a rule somewhere about deterministic behavior when calling // -// the exact same function with the exact same parameters over and over... // -// Oh, wait... // -// // -// Cyan, Inc. // -// // -//// Version History ////////////////////////////////////////////////////////// -// // -// 11.25.2002 mcn - Created. // -// // -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _plWinFontCache_h -#define _plWinFontCache_h - - -#include "hsColorRGBA.h" -#include "hsTemplates.h" -#include "hsWindows.h" // FIXME: Windows header level include :( - -#if HS_BUILD_FOR_WIN32 - - -//// Class Definition ///////////////////////////////////////////////////////// - -class plWinFontCache -{ - protected: - - class plFontRecord - { - public: - HFONT fFont; - - plString fFace; - int fHeight; - int fWeight; - bool fItalic; - uint32_t fQuality; - }; - - class plCustFont - { - public: - plFileName fFilename; - - plCustFont(const plFileName &c) { fFilename = c; } - }; - - bool fInShutdown; - - hsTArray fFontCache; - hsTArray fFontNameCache; - - char *fCustFontDir; - hsTArray fCustFonts; - - plWinFontCache(); - - HFONT IFindFont( const plString &face, int height, int weight, bool italic, uint32_t quality ); - HFONT IMakeFont( const plString &face, int height, int weight, bool italic, uint32_t quality ); - - void ILoadCustomFonts( void ); - - public: - - virtual ~plWinFontCache(); - static plWinFontCache &GetInstance( void ); - - HFONT GetMeAFont( const plString &face, int height, int weight, bool italic, uint32_t quality ); - void FreeFont( HFONT font ); - void Clear( void ); - - void LoadCustomFonts( const char *dir ); - - // Our custom font extension - static const char* kCustFontExtension; -}; - - -#endif // HS_BUILD_FOR_WIN32 -#endif // _plWinFontCache_h diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp index b22eb1ec..5199f159 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plDrawable/plSpaceTree.h" #include "plDrawable/plDrawableGenerator.h" #include "plDrawable/plDrawableSpans.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plPipeline/plRenderTarget.h" #include "hsFastMath.h" #include "pnSceneObject/plDrawInterface.h" @@ -65,7 +65,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plScene/plRenderRequest.h" #include "plPipeline.h" #include "plIntersect/plSoftVolume.h" -#include "plPipeline/plPipeDebugFlags.h" +#include "plPipeDebugFlags.h" #include "pnMessage/plPipeResMakeMsg.h" #include "plScene/plVisRegion.h" diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp index ba65e3a0..069de24f 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp @@ -46,10 +46,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnSceneObject/plSceneObject.h" #include "pnMessage/plSDLModifierMsg.h" +#include "plNetCommon/plNetObjectDebugger.h" #include "plNetMessage/plNetMessage.h" #include "plSDL/plSDL.h" -#include "plNetClient/plNetClientMgr.h" -#include "plNetClient/plNetObjectDebugger.h" plSDLModifier::plSDLModifier() : fStateCache(nil), fSentOrRecvdState(false) { @@ -92,15 +91,40 @@ void plSDLModifier::ISendNetMsg(plStateDataRecord*& state, plKey senderKey, uint bool dirtyOnly = (sendFlags & plSynchedObject::kForceFullSend) == 0; bool broadcast = (sendFlags & plSynchedObject::kBCastToClients) != 0; int writeOptions=0; + // if (dirtyOnly) writeOptions |= plSDL::kDirtyOnly; if (broadcast) writeOptions |= plSDL::kBroadcast; - + writeOptions |= plSDL::kTimeStampOnRead; - - plNetClientMgr::GetInstance()->StoreSDLState(state, senderKey->GetUoid(), sendFlags, writeOptions); - + + + // send to server + plNetMsgSDLState* msg = state->PrepNetMsg(0, writeOptions); + msg->SetNetProtocol(kNetProtocolCli2Game); + msg->ObjectInfo()->SetUoid(senderKey->GetUoid()); + + if (sendFlags & plSynchedObject::kNewState) + msg->SetBit(plNetMessage::kNewSDLState); + + if (sendFlags & plSynchedObject::kUseRelevanceRegions) + msg->SetBit(plNetMessage::kUseRelevanceRegions); + + if (sendFlags & plSynchedObject::kDontPersistOnServer) + msg->SetPersistOnServer(false); + + if (sendFlags & plSynchedObject::kIsAvatarState) + msg->SetIsAvatarState(true); + + if (broadcast && plNetClientApp::GetInstance()) + { + msg->SetPlayerID(plNetClientApp::GetInstance()->GetPlayerID()); + } + + plNetClientApp::GetInstance()->SendMsg(msg); + msg->UnRef(); + fSentOrRecvdState = true; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plNetClient/CMakeLists.txt index e7904cc0..78b8cb60 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plNetClient/CMakeLists.txt @@ -19,7 +19,6 @@ set(plNetClient_SOURCES plNetClientMsgHandler.cpp plNetClientMsgScreener.cpp plNetLinkingMgr.cpp - plNetObjectDebugger.cpp plNetVoiceList.cpp ) @@ -33,7 +32,6 @@ set(plNetClient_HEADERS plNetClientMsgHandler.h plNetClientMsgScreener.h plNetLinkingMgr.h - plNetObjectDebugger.h plNetVoiceList.h ) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp index 486d2021..a0eee4e9 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetCliAgeJoiner.h" #include "plNetClientMgr.h" #include "plNetLinkingMgr.h" -#include "plNetObjectDebugger.h" +#include "plNetCommon/plNetObjectDebugger.h" #include "pnSceneObject/plSceneObject.h" #include "pnSceneObject/plCoordinateInterface.h" diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index 388ceebb..63509817 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPhysical.h" #include "plNetClientMsgHandler.h" #include "plNetLinkingMgr.h" -#include "plNetObjectDebugger.h" +#include "plNetCommon/plNetObjectDebugger.h" #include "pnUtils/pnUtils.h" #include "plProduct.h" diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp index e81b1e48..affd3489 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsResMgr.h" #include "plNetClientMgr.h" #include "plCreatableIndex.h" -#include "plNetObjectDebugger.h" +#include "plNetCommon/plNetObjectDebugger.h" #include "pnNetCommon/plSynchedObject.h" #include "pnNetCommon/plSDLTypes.h" @@ -437,34 +437,3 @@ int plNetClientMgr::SendMsg(plNetMessage* msg) return ret; } - - -void plNetClientMgr::StoreSDLState(const plStateDataRecord* sdRec, const plUoid& uoid, - uint32_t sendFlags, uint32_t writeOptions) -{ - // send to server - plNetMsgSDLState* msg = sdRec->PrepNetMsg(0, writeOptions); - msg->SetNetProtocol(kNetProtocolCli2Game); - msg->ObjectInfo()->SetUoid(uoid); - - if (sendFlags & plSynchedObject::kNewState) - msg->SetBit(plNetMessage::kNewSDLState); - - if (sendFlags & plSynchedObject::kUseRelevanceRegions) - msg->SetBit(plNetMessage::kUseRelevanceRegions); - - if (sendFlags & plSynchedObject::kDontPersistOnServer) - msg->SetPersistOnServer(false); - - if (sendFlags & plSynchedObject::kIsAvatarState) - msg->SetIsAvatarState(true); - - bool broadcast = (sendFlags & plSynchedObject::kBCastToClients) != 0; - if (broadcast && plNetClientApp::GetInstance()) - { - msg->SetPlayerID(plNetClientApp::GetInstance()->GetPlayerID()); - } - - SendMsg(msg); - delete msg; -} diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plNetCommon/CMakeLists.txt index 4d561c3d..44d3eaba 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plNetCommon/CMakeLists.txt @@ -10,6 +10,7 @@ set(plNetCommon_SOURCES plNetCommonHelpers.cpp plNetMember.cpp plNetMsgScreener.cpp + plNetObjectDebugger.cpp plNetServerSessionInfo.cpp plSpawnPointInfo.cpp ) @@ -23,6 +24,7 @@ set(plNetCommon_HEADERS plNetMember.h plNetMsgHandler.h plNetMsgScreener.h + plNetObjectDebugger.h plNetServerSessionInfo.h plSpawnPointInfo.h ) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetObjectDebugger.cpp similarity index 97% rename from Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp rename to Sources/Plasma/PubUtilLib/plNetCommon/plNetObjectDebugger.cpp index 0231cc54..5f0a1582 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetObjectDebugger.cpp @@ -51,10 +51,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetClient/plNetClientMgr.h" #include "plAgeLoader/plAgeLoader.h" -plNetObjectDebugger::DebugObject::DebugObject(const char* objName, plLocation& loc, uint32_t flags) : -fLoc(loc), +plNetObjectDebugger::DebugObject::DebugObject(const char* objName, plLocation& loc, uint32_t flags) : +fLoc(loc), fFlags(flags) -{ +{ std::string tmp = objName; hsStrLower((char*)tmp.c_str()); fObjName = tmp; @@ -102,7 +102,7 @@ bool plNetObjectDebugger::DebugObject::StringMatches(const char* str) const // if both objName and pageName are provided, and this object has page info, // return true if object matches both string and location. // else just return true if object matches string -// +// bool plNetObjectDebugger::DebugObject::ObjectMatches(const char* objName, const char* pageName) { if (!objName) @@ -143,9 +143,9 @@ plNetObjectDebugger::plNetObjectDebugger() : fStatusLog(nil), fDebugging(false) { } -plNetObjectDebugger::~plNetObjectDebugger() -{ - ClearAllDebugObjects(); +plNetObjectDebugger::~plNetObjectDebugger() +{ + ClearAllDebugObjects(); delete fStatusLog; } @@ -155,8 +155,8 @@ plNetObjectDebugger::~plNetObjectDebugger() plNetObjectDebugger* plNetObjectDebugger::GetInstance() { static plNetObjectDebugger gNetObjectDebugger; - - if (plNetObjectDebuggerBase::GetInstance()==nil) + + if (plNetObjectDebuggerBase::GetInstance() == nullptr) plNetObjectDebuggerBase::SetInstance(&gNetObjectDebugger); return &gNetObjectDebugger; @@ -169,7 +169,7 @@ void plNetObjectDebugger::ICreateStatusLog() const { if (!fStatusLog) { - fStatusLog = plStatusLogMgr::GetInstance().CreateStatusLog(40, "NetObject.log", + fStatusLog = plStatusLogMgr::GetInstance().CreateStatusLog(40, "NetObject.log", plStatusLog::kFilledBackground | plStatusLog::kAlignToTop | plStatusLog::kTimestamp ); } } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetObjectDebugger.h similarity index 100% rename from Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.h rename to Sources/Plasma/PubUtilLib/plNetCommon/plNetObjectDebugger.h diff --git a/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt index 0712c060..7274cdc9 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plPipeline/CMakeLists.txt @@ -10,7 +10,6 @@ endif(WIN32) set(plPipeline_SOURCES hsG3DDeviceSelector.cpp - hsGColorizer.cpp plCaptureRender.cpp plCubicRenderTargetModifier.cpp plCullTree.cpp @@ -18,14 +17,12 @@ set(plPipeline_SOURCES plDTProgressMgr.cpp plDynamicEnvMap.cpp plFogEnvironment.cpp - plGBufferGroup.cpp plPlates.cpp plRenderTarget.cpp plStatusLogDrawer.cpp plTextFont.cpp plTextGenerator.cpp plTransitionMgr.cpp - plVertCoder.cpp ) set(plDXPipeline_SOURCES @@ -42,8 +39,6 @@ set(plDXPipeline_SOURCES set(plPipeline_HEADERS hsFogControl.h hsG3DDeviceSelector.h - hsGColorizer.h - hsGDeviceRef.h hsWinRef.h plCaptureRender.h plCubicRenderTarget.h @@ -55,8 +50,6 @@ set(plPipeline_HEADERS plDTProgressMgr.h plDynamicEnvMap.h plFogEnvironment.h - plGBufferGroup.h - plPipeDebugFlags.h plPipelineCreatable.h plPipelineCreate.h plPlates.h @@ -66,7 +59,6 @@ set(plPipeline_HEADERS plTextFont.h plTextGenerator.h plTransitionMgr.h - plVertCoder.h ) set(plDXPipeline_HEADERS diff --git a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRef.h b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRef.h index d907035b..18b9da96 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRef.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRef.h @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define _plDXDeviceRef_h #include "HeadSpin.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" //// Definition /////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRefs.cpp b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRefs.cpp index 63b3ab04..9f22a2f7 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRefs.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXDeviceRefs.cpp @@ -64,7 +64,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plDXLightRef.h" #include "plDXTextureRef.h" #include "plDXRenderTargetRef.h" -#include "plPipeline/plGBufferGroup.h" +#include "plDrawable/plGBufferGroup.h" #include "plDrawable/plGeometrySpan.h" #include "plDrawable/plDrawableSpans.h" #include "plGLight/plLightInfo.h" diff --git a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.cpp b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.cpp index 62813ae6..301ceb4f 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.cpp @@ -82,7 +82,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPipeline/plStatusLogDrawer.h" #include "plQuality.h" -#include "plPipeline/plPipeDebugFlags.h" +#include "plPipeDebugFlags.h" #include "hsTemplates.h" //#include "hsGEnviron.h" @@ -112,7 +112,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPipeline/plDebugText.h" #include "plPipeline/plFogEnvironment.h" #include "plDXTextFont.h" -#include "plPipeline/plGBufferGroup.h" +#include "plDrawable/plGBufferGroup.h" #include "hsTimer.h" #include "plgDispatch.h" #include "plScene/plRenderRequest.h" @@ -2884,21 +2884,6 @@ void plDXPipeline::Render( plDrawable *d, const hsTArray& visList ) } } -//// BeginDrawable //////////////////////////////////////////////////////////// -// Obsolete, should be removed -bool plDXPipeline::BeginDrawable( plDrawable *d ) -{ - return true; -} - -//// EndDrawable ////////////////////////////////////////////////////////////// -// Obsolete, should be removed - -bool plDXPipeline::EndDrawable( plDrawable *d ) -{ - return true; -} - // IMakeLightLists /////////////////////////////////////////////////////////// // Look through all the current lights, and fill out two lists. // Only active lights (not disabled, not exactly black, and not @@ -5202,9 +5187,7 @@ void plDXPipeline::ClearRenderTarget( plDrawable* d ) fView.fDrawableTypeMask = plDrawable::kNormal; fView.fSubDrawableTypeMask = uint32_t(-1); - BeginDrawable(d); Draw(d); - EndDrawable(d); fView.fSubDrawableTypeMask = sdtm; fView.fDrawableTypeMask = dtm; @@ -9132,25 +9115,6 @@ void plDXPipeline::SetDepth(float hither, float yon) IGetViewTransform().SetDepth(hither, yon); } -//// ISavageYonHack /////////////////////////////////////////////////////////// -// Corrects the yon for the *#(&$*#&$(*& Savage4 chipset (ex. Diamond Stealth -// III S540). Let's just say this card SUCKS. -// Obsolete since we don't support the Savage4 chipset any more. -void plDXPipeline::ISavageYonHack() -{ - float yon = GetViewTransform().GetYon(); - - - if( ( yon > 128.f - 5.0f ) && ( yon < 128.f + 1.01f ) ) - yon = 128.f + 1.01f; - else if( ( yon > 256.f - 10.0f ) && ( yon < 256.f + 1.02f ) ) - yon = 256.f + 1.02f; - else if( ( yon > 512.f - 35.0f ) && ( yon < 512.f + 1.02f ) ) - yon = 512.f + 1.02f; - else if( ( yon > 1024.f - 120.0f ) && ( yon < 1024.f + 1.f ) ) - yon = 1024.f + 1.f; -} - //// GetWorldToCamera ///////////////////////////////////////////////////////// // Return current world to camera transform. const hsMatrix44& plDXPipeline::GetWorldToCamera() const @@ -9557,49 +9521,6 @@ const hsGMatState& plDXPipeline::GetMaterialOverride(bool on) const return on ? fMatOverOn : fMatOverOff; } -//// PushColorOverride ////////////////////////////////////////////////// -// Obsolete and unused. -hsColorOverride plDXPipeline::PushColorOverride(const hsColorOverride& over) -{ - hsColorOverride ret = GetColorOverride(); - PopColorOverride( over ); - return ret; -} - -// PopColorOverride //////////////////////////////////////////////////////// -// Obsolete and unused. -void plDXPipeline::PopColorOverride(const hsColorOverride& restore) -{ - return; -/* - hsColorOverride cpy = restore; - if( !(cpy.fFlags & hsColorOverride::kModAlpha) ) - cpy.fColor.a = 1.f; - if( !(cpy.fFlags & (hsColorOverride::kModAlpha | hsColorOverride::kModColor)) ) - fDev->SetColorNormal(); - else - fDev->SetColorOverride(cpy.fColor, !(cpy.fFlags & hsColorOverride::kModColor)); -*/ -} - -//// GetColorOverride ///////////////////////////////////////////////////////// -// Obsolete and unused. -const hsColorOverride& plDXPipeline::GetColorOverride() const -{ - static hsColorOverride ret; - return ret; - -/* ret.fFlags = hsColorOverride::kNone; - if( fDev->GetDebugFlags() & hsG3DDevice::kDeviceColor ) - ret.fFlags |= hsColorOverride::kModColor; - if( fDev->GetDebugFlags() & hsG3DDevice::kDeviceAlpha ) - ret.fFlags |= hsColorOverride::kModAlpha; - - ret.fColor = fDev->GetColorOverride(); -*/ - return ret; -} - /////////////////////////////////////////////////////////////////////////////// //// Transforms /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -10316,123 +10237,6 @@ void plDXPipeline::IEndAllocUnManaged() fManagedSeen = 0; } -// ICheckTextureUsage //////////////////////////////////////////////////////////////////// -// Obsolete, unused. -// Deletes textures LRU to try to get around NVidia memory manager bug. Found a -// more robust/efficent way. Besides, it didn't help. See OSVERSION. -void plDXPipeline::ICheckTextureUsage() -{ - plProfile_IncCount(fTexUsed, fTexUsed); - plProfile_IncCount(fTexManaged, fTexManaged); - - plConst(uint32_t) kMinTexManaged(5000000); - if( fTexManaged < kMinTexManaged ) - return; - - plConst(uint32_t) kScale(2); - if( fTexUsed * kScale < fTexManaged ) - { - // Find the stalest - uint32_t stalest = fTextUseTime; - plDXTextureRef* ref = fTextureRefList; - while( ref ) - { - // I don't know if render targets even get put in this list. - if( !(ref->GetFlags() & plDXTextureRef::kRenderTarget) && (ref->fUseTime < stalest) ) - stalest = ref->fUseTime; - ref = ref->GetNext(); - } - stalest = fTextUseTime - stalest; - - // If the stalest is fresh, live with thrashing - plConst(uint32_t) kMinAge(60); - if( stalest < kMinAge ) - return; - - // Kill the stalest, and everything more than half as stale - stalest /= 2; - if( stalest < kMinAge ) - stalest = kMinAge; - - stalest = fTextUseTime - stalest; - - // Go through again slaughtering left and right - ref = fTextureRefList; - while( ref ) - { - if( !(ref->GetFlags() & plDXTextureRef::kRenderTarget) && (ref->fUseTime < stalest) ) - { - plDXTextureRef* nuke = ref; - ref = ref->GetNext(); - nuke->Release(); - nuke->Unlink(); - } - else - { - ref = ref->GetNext(); - } - } - } -} - -// ICheckVtxUsage //////////////////////////////////////////////////////////////////// -// Obsolete, unused. -// Deletes textures LRU to try to get around NVidia memory manager bug. Found a -// more robust/efficent way. Besides, it didn't help. See OSVERSION. -void plDXPipeline::ICheckVtxUsage() -{ - plProfile_IncCount(fVtxUsed, fVtxUsed); - plProfile_IncCount(fVtxManaged, fVtxManaged); - - plConst(uint32_t) kMinVtxManaged(5000000); - if( fVtxManaged < kMinVtxManaged ) - return; - - plConst(uint32_t) kScale(2); - if( fVtxUsed * kScale < fVtxManaged ) - { - // Find the stalest - uint32_t stalest = fTextUseTime; - plDXVertexBufferRef* ref = fVtxBuffRefList; - while( ref ) - { - if( !ref->Volatile() && (ref->fUseTime < stalest) ) - stalest = ref->fUseTime; - ref = ref->GetNext(); - } - stalest = fTextUseTime - stalest; - - // If the stalest is fresh, live with thrashing - plConst(uint32_t) kMinAge(60); - if( stalest < kMinAge ) - return; - - // Kill the stalest, and everything more than half as stale - stalest /= 2; - if( stalest < kMinAge ) - stalest = kMinAge; - - stalest = fTextUseTime - stalest; - - // Go through again slaughtering left and right - ref = fVtxBuffRefList; - while( ref ) - { - if( !ref->Volatile() && (ref->fUseTime < stalest) ) - { - plDXVertexBufferRef* nuke = ref; - ref = ref->GetNext(); - nuke->Release(); - nuke->Unlink(); - } - else - { - ref = ref->GetNext(); - } - } - } -} - bool plDXPipeline::CheckResources() { if ((fClothingOutfits.GetCount() <= 1 && fAvRTPool.GetCount() > 1) || @@ -11973,32 +11777,6 @@ const char *plDXPipeline::IGetDXFormatName( D3DFORMAT format ) } } -//// IFPUCheck //////////////////////////////////////////////////////////////// -// Checks the FPU to make sure it's in the right mode -// This should return wSave to allow it to be restored after rendering. -// This is obsolete as of DX8 -void plDXPipeline::IFPUCheck() -{ -#ifdef _MSC_VER - WORD wSave, wTemp; - __asm fstcw wSave - if (wSave & 0x300 || // Not single mode - 0x3f != (wSave & 0x3f) || // Exceptions enabled - wSave & 0xC00) // Not round to nearest mode - { - __asm - { - mov ax, wSave - and ax, not 0x300 ;; single mode - or ax, 0x3f ;; disable all exceptions - and ax, not 0xC00 ;; round to nearest mode - mov wTemp, ax - fldcw wTemp - } - } -#endif -} - // PushPiggyBackLayer ///////////////////////////////////////////////////// // Push a piggy back onto the stack. plLayerInterface* plDXPipeline::PushPiggyBackLayer(plLayerInterface* li) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.h b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.h index 4db91f59..06104e2a 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.h @@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsGeometry3.h" #include "hsTemplates.h" #include "hsColorRGBA.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "hsPoint2.h" class plAccessSpan; @@ -338,8 +338,6 @@ protected: void IBeginAllocUnManaged(); void IEndAllocUnManaged(); - void ICheckTextureUsage(); - void ICheckVtxUsage(); inline void ICheckVBUsage(plDXVertexBufferRef* vRef); bool IRefreshDynVertices(plGBufferGroup* group, plDXVertexBufferRef* vRef); @@ -480,9 +478,6 @@ protected: void IShowErrorMessage( char *errStr = nil ); bool ICreateFail( char *errStr ); - // FPU mode check - void IFPUCheck(); - // Device initialization void IInvalidateState(); void IInitDeviceState(); @@ -525,7 +520,6 @@ protected: void IProjectionMatrixToD3D(); void IWorldToCameraToD3D(); void ILocalToWorldToD3D(); - void ISavageYonHack(); void ISetLocalToWorld( const hsMatrix44& l2w, const hsMatrix44& w2l ); void ISetCullMode(bool flip=false); bool inline IIsViewLeftHanded(); @@ -645,9 +639,6 @@ public: virtual bool EndRender(); virtual void RenderScreenElements(); - virtual bool BeginDrawable(plDrawable* d); - virtual bool EndDrawable(plDrawable* d); - virtual void BeginVisMgr(plVisMgr* visMgr); virtual void EndVisMgr(plVisMgr* visMgr); @@ -770,10 +761,6 @@ public: virtual void PopMaterialOverride(const hsGMatState& restore, bool on); virtual const hsGMatState& GetMaterialOverride(bool on) const; - virtual hsColorOverride PushColorOverride(const hsColorOverride& over); - virtual void PopColorOverride(const hsColorOverride& restore); - virtual const hsColorOverride& GetColorOverride() const; - virtual void SubmitShadowSlave(plShadowSlave* slave); virtual void SubmitClothingOutfit(plClothingOutfit* co); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXVertexShader.cpp b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXVertexShader.cpp index a6f8df2e..dea69927 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXVertexShader.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/DX/plDXVertexShader.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plSurface/plShader.h" -#include "plPipeline/plGBufferGroup.h" +#include "plDrawable/plGBufferGroup.h" #include "plDXPipeline.h" plDXVertexShader::plDXVertexShader(plShader* owner) diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.cpp b/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.cpp deleted file mode 100644 index 119d06f9..00000000 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ - -#include "HeadSpin.h" -#include "plPipeline.h" -#include "hsGColorizer.h" - -bool hsGColorizer::Colorizing() -{ - return fPipeline ? 0 != (fPipeline->GetColorOverride().fFlags & hsColorOverride::kModColor) : false; -} - -bool hsGColorizer::Alpharizing() -{ - return fPipeline ? 0 != (fPipeline->GetColorOverride().fFlags & hsColorOverride::kModAlpha) : false; -} - -hsColorRGBA hsGColorizer::GetCurrentColor() -{ - return fPipeline ? fPipeline->GetColorOverride().fColor : hsColorRGBA().Set(1.f,1.f,1.f,1.f); -} - -void hsGColorizer::Init(plPipeline* pipe) -{ - fPipeline = pipe; -} - -void hsGColorizer::PushColorize(hsColorRGBA& col, bool alphaOnly) -{ - if( fPipeline ) - { - hsColorOverride colorOver; - colorOver.fFlags = alphaOnly ? hsColorOverride::kModAlpha : hsColorOverride::kModColor | hsColorOverride::kModAlpha; - colorOver.fColor = col; - fResetColor = fPipeline->PushColorOverride(colorOver); - } -} - -void hsGColorizer::PopColorize() -{ - if( fPipeline ) - { - fPipeline->PopColorOverride(fResetColor); - } -} - diff --git a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.h b/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.h deleted file mode 100644 index f1cb446b..00000000 --- a/Sources/Plasma/PubUtilLib/plPipeline/hsGColorizer.h +++ /dev/null @@ -1,66 +0,0 @@ -/*==LICENSE==* - -CyanWorlds.com Engine - MMOG client, server and tools -Copyright (C) 2011 Cyan Worlds, Inc. - -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 3 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, see . - -Additional permissions under GNU GPL version 3 section 7 - -If you modify this Program, or any covered work, by linking or -combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, -NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent -JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK -(or a modified version of those libraries), -containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, -PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG -JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the -licensors of this Program grant you additional -permission to convey the resulting work. Corresponding Source for a -non-source form of such a combination shall include the source code for -the parts of OpenSSL and IJG JPEG Library used as well as that of the covered -work. - -You can contact Cyan Worlds, Inc. by email legal@cyan.com - or by snail mail at: - Cyan Worlds, Inc. - 14617 N Newport Hwy - Mead, WA 99021 - -*==LICENSE==*/ - -#ifndef hsGColorizer_inc -#define hsGColorizer_inc - -#include "HeadSpin.h" -#include "hsColorRGBA.h" - -class plPipeline; - -class hsGColorizer { -protected: - hsColorOverride fResetColor; - plPipeline* fPipeline; - -public: - hsGColorizer() : fPipeline(nil) {} - bool Colorizing(); - bool Alpharizing(); - hsColorRGBA GetCurrentColor(); - void Init(plPipeline* pipe); - void PushColorize(hsColorRGBA& col, bool alphaOnly); - void PopColorize(); -}; - -#endif // hsGColorizer_inc diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp index d5780262..1d1f6021 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plTextGenerator.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/hsKeyedObject.h" #include "plTextGenerator.h" #include "plGImage/plMipmap.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "pnMessage/plRefMsg.h" #include "plgDispatch.h" diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp index 9a32682f..67f392bd 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayer.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsGMatState.inl" #include "plMessage/plLayRefMsg.h" #include "plGImage/plBitmap.h" -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" #include "plShader.h" #include "plPipeline.h" diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp index 26e4bc94..ce7c5f68 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp @@ -48,8 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "hsMatrix44.h" #include "hsColorRGBA.h" - -#include "plPipeline/hsGDeviceRef.h" +#include "hsGDeviceRef.h" // Little shader const helper diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp b/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp index 1eebd9ee..2d59262b 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plClientUnifiedTime.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plClientUnifiedTime.h" #if 0 -#include "plNetClient/plNetObjectDebugger.h" +#include "plNetCommon/plNetObjectDebugger.h" #include "plNetClient/plNetClientMgr.h" #endif diff --git a/Sources/Tools/MaxComponent/plParticleComponents.cpp b/Sources/Tools/MaxComponent/plParticleComponents.cpp index c94dbdc6..96f99b0c 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.cpp +++ b/Sources/Tools/MaxComponent/plParticleComponents.cpp @@ -80,7 +80,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/MaxCompat.h" #include "pnKeyedObject/plKey.h" #include "plSurface/hsGMaterial.h" -#include "plPipeline/plGBufferGroup.h" +#include "plDrawable/plGBufferGroup.h" #include "plParticleSystem/plParticleSystem.h" #include "plParticleSystem/plParticleEmitter.h" diff --git a/Sources/Tools/MaxConvert/plMeshConverter.cpp b/Sources/Tools/MaxConvert/plMeshConverter.cpp index abd503cd..fb37ab8f 100644 --- a/Sources/Tools/MaxConvert/plMeshConverter.cpp +++ b/Sources/Tools/MaxConvert/plMeshConverter.cpp @@ -78,7 +78,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxPlasmaMtls/Materials/plPassMtl.h" #include "MaxPlasmaMtls/Materials/plCompositeMtlPB.h" #include "MaxPlasmaMtls/Materials/plPassMtlBasicPB.h" -#include "plPipeline/plGBufferGroup.h" +#include "plDrawable/plGBufferGroup.h" #include "plParticleSystem/plConvexVolume.h" #include "plDrawable/plGeoSpanDice.h" @@ -2555,4 +2555,4 @@ void SetWaterColor(hsTArray& spans) int i; for( i = 0; i < spans.GetCount(); i++ ) SetWaterColor(spans[i]); -} \ No newline at end of file +}