summaryrefslogtreecommitdiff
path: root/game/client/econ/tool_items/custom_texture_cache.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/econ/tool_items/custom_texture_cache.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/econ/tool_items/custom_texture_cache.h')
-rw-r--r--game/client/econ/tool_items/custom_texture_cache.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/game/client/econ/tool_items/custom_texture_cache.h b/game/client/econ/tool_items/custom_texture_cache.h
new file mode 100644
index 0000000..c26b94e
--- /dev/null
+++ b/game/client/econ/tool_items/custom_texture_cache.h
@@ -0,0 +1,83 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef CUSTOM_TEXTURE_CACHE_H
+#define CUSTOM_TEXTURE_CACHE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#ifndef GC_CLIENTSYSTEM_H
+ #include "gc_clientsystem.h"
+#endif
+
+class IGameSystem;
+class ITexture;
+class CEconItemView;
+
+/// Given a UGC cloud ID of a custom image, return a VGUI texture handle
+/// that can be used for drawing. Returns 0 on failure
+int GetCustomTextureGuiHandle( uint64 hCloudId );
+
+//-----------------------------------------------------------------------------
+// Purpose: Job to do the async work of uploading the file to the CDN (if
+// necessary) and sending the tool request message
+//-----------------------------------------------------------------------------
+class CApplyCustomTextureJob : public GCSDK::CGCClientJob
+{
+public:
+
+ CApplyCustomTextureJob( itemid_t nToolItemID, itemid_t nSubjectItemID, const void *pPNGData, int nPNGDataBytes );
+
+protected:
+ char m_chRemoteStorageName[ MAX_PATH ];
+
+ virtual bool BYieldingRunGCJob();
+ virtual EResult YieldingRunJob();
+ virtual EResult YieldingFindFileIncacheOrUploadFileToCDN();
+ virtual EResult YieldingApplyTool();
+
+ /// The file data, in PNG format
+ CUtlBuffer m_bufPNGData;
+
+ /// Item that we are applying the texture onto
+ itemid_t m_nSubjectItemID;
+
+ /// Tool that is being applied and will be consumed
+ itemid_t m_nToolItemID;
+
+ /// Cloud file ID
+ uint64 m_hCloudID;
+
+private:
+ void CleanUp();
+};
+
+/// get interface to the game system responsible for managing the custom texture cache
+IGameSystem *CustomTextureToolCacheGameSystem();
+
+/// A few internal things that really shouldn't be public
+namespace CustomTextureSystem
+{
+
+/// If we're auditioning (while selecting a file to apply on a model),
+/// what texture should we display?
+extern ITexture *g_pPreviewCustomTexture;
+
+/// What is the econ item that is being auditioned and so should
+/// use the preview texture
+extern CEconItemView *g_pPreviewEconItem;
+
+/// Do we need to update the bits in the rendering system?
+extern bool g_pPreviewCustomTextureDirty;
+
+extern const char k_rchCustomTextureFilterPreviewImageName[];
+extern const char k_rchCustomTextureFilterPreviewTextureName[];
+
+}
+
+#endif // CUSTOM_TEXTURE_CACHE_H