This commit is contained in:
nephacks
2025-06-04 03:22:50 +02:00
parent f234f23848
commit f12416cffd
14243 changed files with 6446499 additions and 26 deletions

View File

@@ -0,0 +1,155 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef QCGENERATOR_H
#define QCGENERATOR_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/Frame.h"
#include "vgui_controls/Button.h"
#include "tier1/utlstring.h"
#include "vgui_controls/TextEntry.h"
class CQCGenerator;
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Panel;
}
class CBrowseButton : public vgui::Button
{
DECLARE_CLASS_SIMPLE( CBrowseButton, vgui::Button );
public:
CBrowseButton( vgui::Panel *pParent );
~CBrowseButton();
void InitBrowseInfo( int x, int y, char *pszName, const char *pszDir, char *pszFilter, char *pszField );
private:
char *pszStartingDirectory;
char *pszFileFilter;
char *pszTargetField;
char **GetStartingDirectory(){ return &pszStartingDirectory; }
char **GetFileFilter(){ return &pszFileFilter; }
char **GetTargetField(){ return &pszTargetField; }
void SetCharVar( char **pVar, const char *pszNewText );
void SetActionMessage();
};
struct LODInfo
{
char pszFilename[MAX_PATH];
int iLOD;
};
struct QCInfo
{
CQCGenerator *pQCGenerator;
char pszSMDPath[MAX_PATH];
char pszCollisionPath[MAX_PATH];
char pszSurfaceProperty[MAX_PATH];
char pszMaterialPath[MAX_PATH];
char pszSceneName[MAX_PATH];
bool bStaticProp;
bool bMostlyOpaque;
bool bDisableCollision;
bool bReferenceAsPhys;
bool bConcave;
bool bAutomass;
bool bNoAnimation;
CUtlVector<LODInfo> LODs;
float fScale;
float fMass;
void Init( CQCGenerator *pPanel )
{
pQCGenerator = pPanel;
Q_strcpy( pszSMDPath, "" );
Q_strcpy( pszCollisionPath, "" );
Q_strcpy( pszSurfaceProperty, "default" );
bStaticProp = false;
bMostlyOpaque = false;
bDisableCollision = false;
bReferenceAsPhys = false;
bConcave = false;
bAutomass = false;
bNoAnimation = true;
fScale = 1.0;
fMass = 10.0;
}
void SyncToControls();
void SyncFromControls();
};
//-----------------------------------------------------------------------------
// Purpose: Base class for generating QC files
//-----------------------------------------------------------------------------
class CQCGenerator : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CQCGenerator, vgui::EditablePanel );
public:
CQCGenerator( vgui::Panel *pParent, const char *pszPath, const char *pszScene );
~CQCGenerator();
// overridden frame functions
// virtual void Activate();
virtual void OnCommand( const char *command );
// Purpose:
// virtual void OnKeyCodeTyped( vgui::KeyCode code );
MESSAGE_FUNC( OnNewLODText, "TextNewLine" );
MESSAGE_FUNC_PARAMS( OnBrowse, "browse", data );
MESSAGE_FUNC_PARAMS( OnFileSelected, "FileSelected", data );
MESSAGE_FUNC_PARAMS( OnDirectorySelected, "DirectorySelected", data );
bool GenerateQCFile();
// void BrowseDirectory( KeyValues *data );
void BrowseFile( KeyValues *data );
void DeleteLOD( );
void EditLOD();
virtual void OnKeyCodeTyped( vgui::KeyCode code);
void InitializeSMDPaths( const char *pszPath, const char *pszScene );
protected:
// Creates standard controls. Allows the derived class to
// add these controls to various splitter windows
void CreateStandardControls( vgui::Panel *pParent );
private:
CBrowseButton *m_pCollisionBrowseButton;
char m_szTargetField[MAX_PATH];
vgui::ListPanel *m_pLODPanel;
vgui::TextEntry *m_pLODEdit;
int m_nSelectedSequence;
int m_nSelectedColumn;
QCInfo m_QCInfo_t;
};
#endif // QCGENERATOR_H

View File

@@ -0,0 +1,51 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef ASSETPICKER_H
#define ASSETPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/baseassetpicker.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Panel;
}
//-----------------------------------------------------------------------------
// Purpose: Base class for choosing raw assets
//-----------------------------------------------------------------------------
class CAssetPicker : public CBaseAssetPicker
{
DECLARE_CLASS_SIMPLE( CAssetPicker, CBaseAssetPicker );
public:
CAssetPicker( vgui::Panel *pParent, const char *pAssetType,
const char *pExt, const char *pSubDir, const char *pTextType );
};
//-----------------------------------------------------------------------------
// Purpose: Modal dialog for asset picker
//-----------------------------------------------------------------------------
class CAssetPickerFrame : public CBaseAssetPickerFrame
{
DECLARE_CLASS_SIMPLE( CAssetPickerFrame, CBaseAssetPickerFrame );
public:
CAssetPickerFrame( vgui::Panel *pParent, const char *pTitle,
const char *pAssetType, const char *pExt, const char *pSubDir, const char *pTextType );
};
#endif // ASSETPICKER_H

View File

@@ -0,0 +1,245 @@
//===================== Copyright (c) Valve Corporation. All Rights Reserved. ======================
//
//
//
//==================================================================================================
#ifndef BASEASSETPICKER_H
#define BASEASSETPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/Frame.h"
#include "tier1/utlstring.h"
#include "tier1/utllinkedlist.h"
#include "filesystem.h"
#include "assetpickerdefs.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CAssetTreeView;
namespace vgui
{
class Panel;
}
FORWARD_DECLARE_HANDLE( AssetList_t );
typedef unsigned short DirHandle_t;
struct CachedAssetInfo_t
{
CUtlString m_AssetName;
int m_nModIndex;
int m_nTimesUsed;
};
struct CacheModInfo_t
{
CUtlString m_ModName;
CUtlString m_Path;
};
//-----------------------------------------------------------------------------
// Purpose: Base class for choosing raw assets
//-----------------------------------------------------------------------------
class CBaseAssetPicker : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CBaseAssetPicker, vgui::EditablePanel );
public:
CBaseAssetPicker( vgui::Panel *pParent, const char *pAssetType,
const char *pExt, const char *pSubDir, const char *pTextType, const char *pSearchPath = "GAME" );
~CBaseAssetPicker();
// overridden frame functions
virtual void OnTick();
virtual bool HasUserConfigSettings();
virtual void ApplyUserConfigSettings( KeyValues *pUserConfig );
virtual void GetUserConfigSettings( KeyValues *pUserConfig );
virtual void OnCommand( const char *pCommand );
// Purpose:
virtual void OnKeyCodeTyped( vgui::KeyCode code );
// Returns the selected asset name
int GetSelectedAssetCount();
const char *GetSelectedAsset( int nSelectionIndex = -1 );
int GetSelectedAssetIndex( int nSelectionIndex );
// Is multiselect enabled?
bool IsMultiselectEnabled() const;
void SetAllowMultiselect( bool bAllowMultiselect );
// Sets the selected asset
void SetSelection( const char *pAssetName, bool bInitialSelection = false );
void SetInitialSelection( const char *pAssetName );
void SetUsedAssetList( CUtlVector<AssetUsageInfo_t> &usedAssets );
// Set/get the filter
void SetFilter( const char *pFilter );
const char *GetFilter();
// Purpose: refreshes the file tree
void RefreshFileTree();
virtual void Activate();
void CloseModal();
virtual void CustomizeSelectionMessage( KeyValues *pKeyValues ) {}
// asset cache interface
virtual int GetAssetCount();
virtual const char *GetAssetName( int nAssetIndex );
virtual const CachedAssetInfo_t& GetCachedAsset( int nAssetIndex );
virtual int GetCachedAssetCount();
virtual bool IncrementalCacheAssets( float flTimeAllowed ); // return true if finished
virtual bool BeginCacheAssets( bool bForceRecache ); // return true if finished
virtual CUtlString GetSelectedAssetFullPath( int nIndex );
int ModCount() const;
const CacheModInfo_t& ModInfo( int nIndex ) const;
protected:
// Creates standard controls. Allows the derived class to
// add these controls to various splitter windows
void CreateStandardControls( vgui::Panel *pParent, bool bAllowMultiselect = false );
void AutoLayoutStandardControls( );
// Allows the picker to browse multiple asset types
void AddExtension( const char *pExtension );
// Derived classes have this called when the previewed asset changes
virtual void OnSelectedAssetPicked( const char *pAssetName ) {}
// Derived classes have this called when the next selected asset is selected by default
virtual void OnNextSelectionIsDefault() {}
// Derived classes have this called when the filtered list changes
virtual void OnAssetListChanged( ) {}
// Request focus of the filter box
void RequestFilterFocus();
// Rescan assets
void RescanAssets();
bool DoIncrementalCache( );
// Is a particular asset visible?
bool IsAssetVisible( int nAssetIndex );
const char *GetModPath( int nModIndex );
MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv );
MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
MESSAGE_FUNC_PARAMS( OnItemDeselected, "ItemDeselected", kv );
MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", kv );
MESSAGE_FUNC( OnFileSelected, "TreeViewItemSelected" );
protected:
struct AssetInfo_t
{
int m_nAssetIndex;
int m_nItemId;
};
void BuildAssetNameList();
void RefreshAssetList( );
int GetSelectedAssetModIndex( );
// Recursively add all files matching the wildcard under this directory
void AddAssetToList( int nAssetIndex );
// Update column headers
void UpdateAssetColumnHeader( );
vgui::Splitter *m_pAssetSplitter;
CAssetTreeView* m_pFileTree;
vgui::CheckButton* m_pSubDirCheck;
vgui::TextEntry *m_pFilter;
vgui::ListPanel *m_pAssetBrowser;
vgui::TextEntry *m_pFullPath;
vgui::ComboBox *m_pModSelector;
vgui::Button *m_pRescanButton;
vgui::Button *m_pFindAssetButton;
KeyValues *m_pInsertHelper;
vgui::CheckButton *m_pOnlyUsedCheck;
AssetList_t m_hAssetList;
CUtlString m_FolderFilter;
CUtlString m_Filter;
CUtlString m_SelectedAsset;
CUtlVector< AssetInfo_t > m_AssetList;
const char *m_pAssetType;
const char *m_pAssetTextType;
const char *m_pAssetExt;
const char *m_pAssetSubDir;
const char *m_pAssetSearchPath;
CUtlVector< const char * > m_ExtraAssetExt;
bool m_bBuiltAssetList : 1;
bool m_bFirstAssetScan : 1;
bool m_bFinishedAssetListScan : 1;
bool m_bSubDirCheck : 1;
bool m_bOnlyUsedAssetsCheck : 1;
int m_nCurrentModFilter;
int m_nMatchingAssets;
CUtlVector<AssetUsageInfo_t> m_usedAssets;
friend class CBaseAssetPickerFrame;
};
//-----------------------------------------------------------------------------
// Purpose: Modal dialog for asset picker
//-----------------------------------------------------------------------------
class CBaseAssetPickerFrame : public vgui::Frame
{
DECLARE_CLASS_SIMPLE( CBaseAssetPickerFrame, vgui::Frame );
public:
CBaseAssetPickerFrame( vgui::Panel *pParent );
~CBaseAssetPickerFrame();
// Inherited from Frame
virtual void OnCommand( const char *pCommand );
// Purpose: Activate the dialog
// The message "AssetSelected" will be sent if an asset is picked
// Pass in optional keyvalues to add to the message
void DoModal( KeyValues *pContextKeyValues = NULL );
// Sets the initial selected asset
void SetInitialSelection( const char *pAssetName );
// Set/get the filter
void SetFilter( const char *pFilter );
const char *GetFilter();
void SetAllowMultiselect( bool bAllowMultiselect );
protected:
// Allows the derived class to create the picker
void SetAssetPicker( CBaseAssetPicker* pPicker );
CBaseAssetPicker* GetAssetPicker() { return m_pPicker; }
// Posts a message (passing the key values)
void PostMessageAndClose( KeyValues *pKeyValues );
virtual void CloseModal();
private:
void CleanUpMessage();
CBaseAssetPicker *m_pPicker;
vgui::Button *m_pOpenButton;
vgui::Button *m_pCancelButton;
KeyValues *m_pContextKeyValues;
};
#endif // BASEASSETPICKER_H

View File

@@ -0,0 +1,163 @@
//====== Copyright © 1996-2003, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef COLORPICKERPANEL_H
#define COLORPICKERPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/Frame.h"
#include "vgui_controls/Button.h"
#include "bitmap/imageformat.h"
#include "mathlib/vector.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CColorXYPreview;
class CColorZPreview;
namespace vgui
{
class RadioButton;
class TextEntry;
class IScheme;
}
//-----------------------------------------------------------------------------
//
// Color picker panel
//
//-----------------------------------------------------------------------------
class CColorPickerPanel : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CColorPickerPanel, vgui::EditablePanel );
public:
// constructor
CColorPickerPanel( vgui::Panel *pParent, const char *pName );
void SetInitialColor( Color initialColor );
void GetCurrentColor( Color *pColor );
void GetInitialColor( Color *pColor );
// Inherited from Panel
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void OnMousePressed( vgui::MouseCode code );
private:
MESSAGE_FUNC_PARAMS( OnRadioButtonChecked, "RadioButtonChecked", kv );
MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", data );
MESSAGE_FUNC_PARAMS( OnHSVSelected, "HSVSelected", data );
MESSAGE_FUNC_PARAMS( OnColorSelected, "ColorSelected", data );
// Called when the color changes
void OnColorChanged( vgui::TextEntry *pChanged = NULL );
// Updates the preview colors
void UpdatePreviewColors();
CColorXYPreview *m_pColorXYPreview;
CColorZPreview *m_pColorZPreview;
vgui::RadioButton* m_pHueRadio;
vgui::RadioButton* m_pSaturationRadio;
vgui::RadioButton* m_pValueRadio;
vgui::RadioButton* m_pRedRadio;
vgui::RadioButton* m_pGreenRadio;
vgui::RadioButton* m_pBlueRadio;
vgui::TextEntry* m_pHueText;
vgui::TextEntry* m_pSaturationText;
vgui::TextEntry* m_pValueText;
vgui::TextEntry* m_pRedText;
vgui::TextEntry* m_pGreenText;
vgui::TextEntry* m_pBlueText;
vgui::Panel* m_pInitialColor;
vgui::Panel* m_pCurrentColor;
vgui::TextEntry* m_pAlphaText;
RGB888_t m_InitialColor;
RGB888_t m_CurrentColor;
unsigned char m_InitialAlpha;
unsigned char m_CurrentAlpha;
Vector m_CurrentHSVColor;
};
//-----------------------------------------------------------------------------
// Purpose: Modal dialog for picker
//-----------------------------------------------------------------------------
class CColorPickerFrame : public vgui::Frame
{
DECLARE_CLASS_SIMPLE( CColorPickerFrame, vgui::Frame );
public:
CColorPickerFrame( vgui::Panel *pParent, const char *pTitle );
~CColorPickerFrame();
// Inherited from Frame
virtual void OnCommand( const char *pCommand );
// Purpose: Activate the dialog
// If a color is picked, the message 'ColorPickerPicked' is sent with the "color" field set to the color
// If cancel is hit, the message 'ColorPickerCancel' is sent
// If the color is changed in the preview, the message 'ColorPickerPreview' is sent with the "color" field set to the color
void DoModal( Color initialColor, KeyValues *pContextKeys = NULL );
// Gets the initial color
void GetInitialColor( Color *pColor );
private:
void CleanUpMessage();
CColorPickerPanel *m_pPicker;
vgui::Button *m_pOpenButton;
vgui::Button *m_pCancelButton;
KeyValues *m_pContextKeys;
};
//-----------------------------------------------------------------------------
// Purpose: A button which brings up the color picker
//-----------------------------------------------------------------------------
class CColorPickerButton : public vgui::Button
{
DECLARE_CLASS_SIMPLE( CColorPickerButton, vgui::Button );
/*
NOTE: Sends ColorPickerPicked message when a color is picked
color - picked color
Sends ColorPickerPreview message when a color is previewed
color - current preview color
Sends ColorPickerCancelled message when the cancel button was hit
startingColor - color before the picking occurred
*/
public:
CColorPickerButton( vgui::Panel *pParent, const char *pName, vgui::Panel *pActionSignalTarget = NULL );
~CColorPickerButton();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void DoClick();
void SetColor( const Color& clr );
void SetColor( int r, int g, int b, int a );
Color GetColor( void ) { return m_CurrentColor; }
private:
MESSAGE_FUNC_PARAMS( OnPicked, "ColorPickerPicked", data );
MESSAGE_FUNC_PARAMS( OnPreview, "ColorPickerPreview", data );
MESSAGE_FUNC( OnCancelled, "ColorPickerCancel" );
void UpdateButtonColor();
Color m_CurrentColor;
};
#endif // COLORPICKERPANEL_H

View File

@@ -0,0 +1,68 @@
//====== Copyright © 1996-2003, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef CURVEEDITORPANEL_H
#define CURVEEDITORPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/Panel.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
struct BGRA8888_t;
//-----------------------------------------------------------------------------
//
// Curve editor image panel
//
//-----------------------------------------------------------------------------
class CCurveEditorPanel : public vgui::Panel
{
DECLARE_CLASS_SIMPLE( CCurveEditorPanel, vgui::Panel );
public:
// constructor
CCurveEditorPanel( vgui::Panel *pParent, const char *pName );
~CCurveEditorPanel();
virtual void Paint( void );
virtual void PaintBackground( void );
virtual void OnCursorMoved( int x,int y );
virtual void OnMousePressed( vgui::MouseCode code );
virtual void OnMouseReleased( vgui::MouseCode code );
virtual void OnKeyCodePressed( vgui::KeyCode code );
protected:
// Control points + values...
virtual int FindOrAddControlPoint( float flIn, float flTolerance, float flOut ) = 0;
virtual int FindControlPoint( float flIn, float flTolerance ) = 0;
virtual int ModifyControlPoint( int nPoint, float flIn, float flOut ) = 0;
virtual void RemoveControlPoint( int nPoint ) = 0;
virtual float GetValue( float flIn ) = 0;
virtual int ControlPointCount() = 0;
virtual void GetControlPoint( int nPoint, float *pIn, float *pOut ) = 0;
// Converts screen location to normalized values and back
void ScreenToValue( int x, int y, float *pIn, float *pOut );
void ValueToScreen( float flIn, float flOut, int *x, int *y );
private:
int m_nSelectedPoint;
int m_nHighlightedPoint; // Used when not selecting
};
#endif // CURVEEDITORPANEL_H

View File

@@ -0,0 +1,81 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef GAMEFILETREEVIEW_H
#define GAMEFILETREEVIEW_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/utlstring.h"
#include "vgui_controls/TreeView.h"
#include "vgui_controls/ImageList.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class IScheme;
}
//-----------------------------------------------------------------------------
// Purpose: Handles file view for game files
//-----------------------------------------------------------------------------
class CGameFileTreeView : public vgui::TreeView
{
DECLARE_CLASS_SIMPLE( CGameFileTreeView, vgui::TreeView );
public:
CGameFileTreeView( vgui::Panel *parent, const char *name, const char *pRootFolderName, const char *pRootDir, const char *pExtension = NULL );
// Inherited from base classes
virtual void GenerateChildrenOfNode( int itemIndex );
virtual void GenerateContextMenu( int itemIndex, int x, int y );
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
// Purpose: Refreshes the active file list
void RefreshFileList();
// Sets an item to be colored as if its a menu
void SetItemColorForDirectories( int itemID );
// Gets the number of root directories
int GetRootDirectoryCount();
// Gets the ith root directory
const char *GetRootDirectory( int nIndex );
// Selects the root folder
void SelectRoot();
private:
// Populate the root node (necessary since tree view can't have multiple roots)
void PopulateRootNode( int itemIndex );
// Populate the root node with directories
void AddDirectoriesOfNode( int itemIndex, const char *pFilePath );
// Populate the root node with directories
bool DoesDirectoryHaveSubdirectories( const char *pFilePath );
// Populate the root node with files
void AddFilesOfNode( int itemIndex, const char *pFilePath, const char *pExt );
CUtlString m_RootDir;
CUtlString m_Ext;
CUtlString m_RootFolderName;
vgui::ImageList m_Images;
bool m_bUseExt; // To differentiate "" from NULL in m_Ext
};
#endif // GAMEFILETREEVIEW_H

View File

@@ -0,0 +1,128 @@
//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef MANIPULATOR_H
#define MANIPULATOR_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/Panel.h"
#include "mathlib/vector.h"
//-----------------------------------------------------------------------------
// Manipulator interface
//-----------------------------------------------------------------------------
class IManipulator
{
public:
virtual void OnBeginManipulation( void ) = 0;
virtual void OnAcceptManipulation( void ) = 0;
virtual void OnCancelManipulation( void ) = 0;
virtual void OnTick( void ) = 0;
virtual void OnCursorMoved( int x, int y ) = 0;
virtual void OnMousePressed( vgui::MouseCode code, int x, int y ) = 0;
virtual void OnMouseReleased( vgui::MouseCode code, int x, int y ) = 0;
virtual void OnMouseWheeled( int delta ) = 0;
virtual void SetViewportSize( int w, int h ) = 0;
};
//-----------------------------------------------------------------------------
// Base class helper for implementing manipulators
//-----------------------------------------------------------------------------
class CBaseManipulator : public IManipulator
{
public:
CBaseManipulator()
{
m_nViewport[ 0 ] = m_nViewport[ 1 ] = 0;
}
virtual void OnTick( void ) {};
virtual void OnBeginManipulation( void ) {}
virtual void OnAcceptManipulation( void ) {};
virtual void OnCancelManipulation( void ) {};
virtual void OnCursorMoved( int x, int y ) {};
virtual void OnMousePressed( vgui::MouseCode code, int x, int y ) {};
virtual void OnMouseReleased( vgui::MouseCode code, int x, int y ) {};
virtual void OnMouseWheeled( int delta ) {};
virtual void SetViewportSize( int w, int h )
{
m_nViewport[ 0 ] = w;
m_nViewport[ 1 ] = h;
}
protected:
int m_nViewport[ 2 ];
};
//-----------------------------------------------------------------------------
// Base class for manipulators which operate on transforms
//-----------------------------------------------------------------------------
class CTransformManipulator : public CBaseManipulator
{
public:
CTransformManipulator( matrix3x4_t *pTransform );
void SetTransform( matrix3x4_t *transform );
matrix3x4_t *GetTransform();
protected:
matrix3x4_t *m_pTransform;
};
//-----------------------------------------------------------------------------
// Standard maya-like transform manipulator
//-----------------------------------------------------------------------------
class CPotteryWheelManip : public CTransformManipulator
{
public:
CPotteryWheelManip( matrix3x4_t *pTransform );
virtual void OnBeginManipulation( void );
virtual void OnAcceptManipulation( void );
virtual void OnCancelManipulation( void );
virtual void OnTick( void );
virtual void OnCursorMoved( int x, int y );
virtual void OnMousePressed( vgui::MouseCode code, int x, int y );
virtual void OnMouseReleased( vgui::MouseCode code, int x, int y );
virtual void OnMouseWheeled( int delta );
// Sets the zoom level
void SetZoom( float flZoom );
protected:
int m_lastx, m_lasty;
float m_zoom;
float m_altitude, m_azimuth;
//vec3 m_lookat
float m_prevZoom;
float m_prevAltitude, m_prevAzimuth;
float m_flLastMouseTime;
float m_flLastTickTime;
float m_flSpin;
bool m_bSpin;
void UpdateTransform( void );
void UpdateZoom( float delta );
};
#endif // MANIPULATOR_H

View File

@@ -0,0 +1,72 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef MATSYSCONTROLS_H
#define MATSYSCONTROLS_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/interface.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class IMaterialSystem;
class IMaterialSystemHardwareConfig;
class IMDLCache;
class IMatSystemSurface;
class IStudioRender;
namespace vgui
{
//-----------------------------------------------------------------------------
// handles the initialization of the vgui interfaces.
// NOTE: Calls into VGui_InitInterfacesList
// interfaces (listed below) are first attempted to be loaded from primaryProvider, then secondaryProvider
// moduleName should be the name of the module that this instance of the vgui_controls has been compiled into
//-----------------------------------------------------------------------------
bool VGui_InitMatSysInterfacesList( const char *moduleName, CreateInterfaceFn *factoryList, int numFactories );
//-----------------------------------------------------------------------------
// set of accessor functions to matsys interfaces
// the appropriate header file for each is listed above the item
//-----------------------------------------------------------------------------
// #include <materialsystem/imaterialsystem.h>
IMaterialSystem *MaterialSystem();
// #include <datacache/imdlcache.h>
IMDLCache *MDLCache();
// #include <VGuiMatSurface/IMatSystemSurface.h>
IMatSystemSurface *MatSystemSurface();
// #include <istudiorender.h"
IStudioRender *StudioRender();
// #include <materialsystem/IMaterialSystemHardwareConfig.h>
IMaterialSystemHardwareConfig *MaterialSystemHardwareConfig();
} // end namespace vgui
//-----------------------------------------------------------------------------
// predeclare all the matsys control class names
//-----------------------------------------------------------------------------
class CMDLPanel;
class CMDLSequencePicker;
class CMDLPicker;
class CSequencePicker;
class CGameFileTreeView;
#endif // MATSYSCONTROLS_H

View File

@@ -0,0 +1,106 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef MDLPANEL_H
#define MDLPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/Panel.h"
#include "datacache/imdlcache.h"
#include "materialsystem/MaterialSystemUtil.h"
#include "matsys_controls/potterywheelpanel.h"
#include "tier3/mdlutils.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class IScheme;
}
//-----------------------------------------------------------------------------
// MDL Viewer Panel
//-----------------------------------------------------------------------------
class CMDLPanel : public CMergedMDL, public CPotteryWheelPanel
{
DECLARE_CLASS_SIMPLE( CMDLPanel, CPotteryWheelPanel );
public:
// constructor, destructor
CMDLPanel( vgui::Panel *pParent, const char *pName );
virtual ~CMDLPanel();
// Overriden methods of vgui::Panel
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void OnTick();
// Sets the camera to look at the model
void LookAtMDL( );
void SetCollsionModel( bool bVisible );
void SetGroundGrid( bool bVisible );
void SetWireFrame( bool bVisible );
void SetLockView( bool bLocked );
void SetLookAtCamera( bool bLookAtCamera );
// Lock the camera position and angles to an attachment point
void SetCameraAttachment( const char *pszAttachment );
void SetRenderCaptureCameraAttachment( const char *pszAttachment );
void SetDirectionalLightAttachment( int idx, const char *pszAttachment );
void PauseAnimation( bool bState ) { m_bAnimationPause = bState; }
bool IsAnimationPaused() { return m_bAnimationPause; }
void SetCameraOrientOverride( Vector vecNew ) { m_vecCameraOrientOverride = vecNew; }
void SetCameraOrientOverrideEnabled( bool bEnabled ) { m_bCameraOrientOverrideEnabled = bEnabled; }
bool IsCameraOrientOverrideEnabled( void ) { return m_bCameraOrientOverrideEnabled; }
void SetCameraPositionOverride(Vector vecNew) { m_vecCameraPositionOverride = vecNew; }
void SetCameraPositionOverrideEnabled(bool bEnabled) { m_bCameraPositionOverrideEnabled = bEnabled; }
bool IsCameraPositionOverrideEnabled(void) { return m_bCameraPositionOverrideEnabled; }
protected:
virtual void OnPostSetUpBonesPreDraw() OVERRIDE;
virtual void OnModelDrawPassStart( int iPass, CStudioHdr *pStudioHdr, int &nFlags ) OVERRIDE;
virtual void OnModelDrawPassFinished( int iPass, CStudioHdr *pStudioHdr, int &nFlags ) OVERRIDE;
private:
// paint it!
void OnPaint3D();
void OnMouseDoublePressed( vgui::MouseCode code );
void DrawCollisionModel();
void UpdateStudioRenderConfig( void );
int m_iCameraAttachment;
int m_iRenderCaptureCameraAttachment;
int m_iDirectionalLightAttachments[ MATERIAL_MAX_LIGHT_COUNT ];
float m_flAutoPlayTimeBase;
bool m_bDrawCollisionModel : 1;
bool m_bGroundGrid : 1;
bool m_bLockView : 1;
bool m_bWireFrame : 1;
bool m_bLookAtCamera : 1;
bool m_bAnimationPause : 1;
bool m_bCameraOrientOverrideEnabled;
Vector m_vecCameraOrientOverride;
bool m_bCameraPositionOverrideEnabled;
Vector m_vecCameraPositionOverride;
};
#endif // MDLPANEL_H

View File

@@ -0,0 +1,139 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef MDLPICKER_H
#define MDLPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/utlstring.h"
#include "vgui_controls/Frame.h"
#include "matsys_controls/baseassetpicker.h"
#include "datacache/imdlcache.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Splitter;
}
class CMDLPanel;
//-----------------------------------------------------------------------------
// Purpose: Main app window
//-----------------------------------------------------------------------------
class CMDLPicker : public CBaseAssetPicker
{
DECLARE_CLASS_SIMPLE( CMDLPicker, CBaseAssetPicker );
public:
enum PageType_t
{
PAGE_NONE = 0,
PAGE_RENDER = 0x1,
PAGE_SEQUENCES = 0x2,
PAGE_ACTIVITIES = 0x4,
PAGE_SKINS = 0x8,
PAGE_INFO = 0x10,
PAGE_ALL = 0xFFFFFFFF,
};
CMDLPicker( vgui::Panel *pParent, int nFlags = PAGE_ALL );
~CMDLPicker();
// overridden frame functions
virtual void PerformLayout();
virtual void OnCommand( const char *pCommand );
// Get current model
void GetSelectedMDLName( char *pBuffer, int nMaxLen );
// get current selected options page
int GetSelectedPage();
// Allows external apps to select a MDL
void SelectMDL( const char *pRelativePath );
// Set/Get Sequence
void SelectSequence( const char *pSequenceName );
const char *GetSelectedSequenceName();
// Set/Get Activity
void SelectActivity( const char *pActivityName );
const char *GetSelectedActivityName();
void SelectSkin( int nSkin );
int GetSelectedSkin();
private:
MESSAGE_FUNC_PARAMS( OnAssetSelected, "AssetSelected", params );
virtual void OnSelectedAssetPicked( const char *pMDLName );
void RefreshActivitiesAndSequencesList();
void RefreshRenderSettings();
int UpdateSkinsList();
void UpdateInfoTab();
int UpdatePropDataList( KeyValues *pkvPropData, bool &bIsStatic );
// Plays the selected activity
void PlaySelectedActivity( );
// Plays the selected sequence
void PlaySelectedSequence( );
MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", kv );
MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
MESSAGE_FUNC( OnPageChanged, "PageChanged" );
CMDLPanel *m_pMDLPreview;
vgui::Splitter* m_pFileBrowserSplitter;
vgui::Splitter* m_pPreviewSplitter;
vgui::PropertySheet *m_pViewsSheet;
vgui::PropertyPage *m_pRenderPage;
vgui::PropertyPage *m_pSequencesPage;
vgui::PropertyPage *m_pActivitiesPage;
vgui::PropertyPage *m_pSkinsPage;
vgui::PropertyPage *m_pInfoPage;
vgui::ListPanel *m_pSequencesList;
vgui::ListPanel *m_pActivitiesList;
vgui::ListPanel *m_pSkinsList;
vgui::ListPanel *m_pPropDataList;
MDLHandle_t m_hSelectedMDL;
int m_nFlags;
friend class CMDLPickerFrame;
};
//-----------------------------------------------------------------------------
// Purpose: Main app window
//-----------------------------------------------------------------------------
class CMDLPickerFrame : public CBaseAssetPickerFrame
{
DECLARE_CLASS_SIMPLE( CMDLPickerFrame, CBaseAssetPickerFrame );
public:
CMDLPickerFrame( vgui::Panel *pParent, const char *pTitle, int nFlags = CMDLPicker::PAGE_ALL );
virtual ~CMDLPickerFrame();
// Allows external apps to select a MDL
void SelectMDL( const char *pRelativePath );
};
#endif // MDLPICKER_H

View File

@@ -0,0 +1,116 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef MDLSEQUENCEPICKER_H
#define MDLSEQUENCEPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/ImageList.h"
#include "vgui_controls/Frame.h"
#include "datacache/imdlcache.h"
#include "matsys_controls/mdlpanel.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Splitter;
class Button;
}
class CGameFileTreeView;
//-----------------------------------------------------------------------------
// Purpose: Main app window
//-----------------------------------------------------------------------------
class CMDLSequencePicker : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CMDLSequencePicker, vgui::EditablePanel );
public:
CMDLSequencePicker( vgui::Panel *pParent );
virtual ~CMDLSequencePicker();
// overridden frame functions
virtual void Activate();
virtual void OnClose();
virtual void PerformLayout();
virtual void OnTick();
char const *GetModelName();
char const *GetSequenceName();
int GetSequenceNumber();
private:
void SelectMDL( const char *pMDLName );
void RefreshFileList();
void RefreshActivitiesAndSequencesList();
// Plays the selected activity
void PlaySelectedActivity( );
// Plays the selected sequence
void PlaySelectedSequence( );
MESSAGE_FUNC( OnFileSelected, "TreeViewItemSelected" );
MESSAGE_FUNC_PTR_CHARPTR( OnTextChanged, "TextChanged", Panel, text );
MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
MESSAGE_FUNC( OnPageChanged, "PageChanged" );
// changes
// MESSAGE_FUNC_INT( CloakFolder, "CloakFolder", item );
// MESSAGE_FUNC_INT( OpenFileForEdit, "EditFile", item );
// MESSAGE_FUNC_INT( OpenFileForDelete, "DeleteFile", item );
CMDLPanel *m_pMDLPreview;
vgui::ComboBox *m_pFilterList;
CGameFileTreeView *m_pFileTree;
vgui::ImageList m_Images;
vgui::Splitter* m_pMDLSplitter;
vgui::Splitter* m_pSequenceSplitter;
vgui::PropertySheet *m_pViewsSheet;
vgui::PropertyPage *m_pSequencesPage;
vgui::PropertyPage *m_pActivitiesPage;
vgui::ListPanel *m_pSequencesList;
vgui::ListPanel *m_pActivitiesList;
MDLHandle_t m_hSelectedMDL;
friend class CMDLSequencePickerFrame;
};
//-----------------------------------------------------------------------------
// Model sequence picker frame
//-----------------------------------------------------------------------------
class CMDLSequencePickerFrame : public vgui::Frame
{
DECLARE_CLASS_SIMPLE( CMDLSequencePickerFrame, vgui::Frame );
public:
CMDLSequencePickerFrame( vgui::Panel *parent, char const *title );
virtual ~CMDLSequencePickerFrame();
virtual void PerformLayout();
protected:
virtual void OnTick();
MESSAGE_FUNC( OnOK, "OnOK" );
MESSAGE_FUNC( OnCancel, "OnCancel" );
private:
CMDLSequencePicker *m_pMDLSequencePicker;
vgui::Button *m_pOK;
vgui::Button *m_pCancel;
};
#endif // MDLSEQUENCEPICKER_H

View File

@@ -0,0 +1,187 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PARTICLEPICKER_H
#define PARTICLEPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/utlstring.h"
#include "vgui_controls/Frame.h"
#include "matsys_controls/baseassetpicker.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Splitter;
class EditablePanel;
class ScrollBar;
class IScheme;
class IImage;
}
class CParticleSystemPanel;
class CParticleSnapshotPanel;
class CParticleCollection;
//-----------------------------------------------------------------------------
// Purpose: Grid of particle snapshots
//-----------------------------------------------------------------------------
class CParticleSnapshotGrid: public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CParticleSnapshotGrid, vgui::EditablePanel );
public:
CParticleSnapshotGrid( vgui::Panel *pParent, const char *pName );
virtual void PerformLayout();
virtual void OnTick();
virtual void OnMousePressed(vgui::MouseCode code);
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
virtual void OnMouseWheeled(int delta);
virtual void OnKeyCodeTyped( vgui::KeyCode code );
/*
Since the grid can be re-ordered:
- "index" is the location of a preview panel in m_Panels, which determines physical placement
- "id" is the location of the system in the original SetParticleList() array that was handed in (useful for clients)
*/
void SetParticleList( const CUtlVector<const char *>& ParticleNames );
void LayoutScrolled();
const char *GetSystemName( int nId );
int GetSelectedSystemId( int nSelectionIndex );
int GetSelectedSystemCount( );
void SelectId( int nId, bool bAddToSelection, bool bToggle );
void SelectSystem( const char *pSystemName, bool bAddToSelection, bool bToggle );
void DeselectAll();
MESSAGE_FUNC_CHARPTR( OnParticleSystemSelected, "ParticleSystemSelected", SystemName );
MESSAGE_FUNC_CHARPTR( OnParticleSystemCtrlSelected, "ParticleSystemCtrlSelected", SystemName );
MESSAGE_FUNC_CHARPTR( OnParticleSystemShiftSelected, "ParticleSystemShiftSelected", SystemName );
MESSAGE_FUNC_CHARPTR( OnParticleSystemPicked, "ParticleSystemPicked", SystemName );
MESSAGE_FUNC( OnScrollBarSliderMoved, "ScrollBarSliderMoved" );
MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", kv );
struct PSysRelativeInfo_t
{
CUtlString relName;
bool bVisibleInCurrentView;
};
private:
void SelectIndex( int nIndex, bool bAddToSelection, bool bToggle );
int IdToIndex( int nId );
int InternalFindSystemIndexByName( const char *pSystemName );
bool IsSystemVisible( int nInternalIndex );
void UpdatePanelRelatives( int nInternalIndex );
void MapSystemRelatives( );
void UpdateAllRelatives( );
void SetAllPreviewEnabled( bool bEnabled );
int GetPanelWide();
int GetPanelTall();
vgui::Panel *m_pScrollPanel;
vgui::Panel *m_pToolPanel;
vgui::ScrollBar *m_pScrollBar;
vgui::Label *m_pNoSystemsLabel;
vgui::CheckButton *m_pPreviewCheckbox;
CUtlVector<CParticleSnapshotPanel*> m_Panels;
int m_nCurrentColCount;
bool m_bAllowMultipleSelection;
int m_nMostRecentSelectedIndex;
vgui::IImage *m_pRelativesImgNeither;
vgui::IImage *m_pRelativesImgPOnly;
vgui::IImage *m_pRelativesImgCOnly;
vgui::IImage *m_pRelativesImgBoth;
CUtlVector< CUtlVector<PSysRelativeInfo_t> > m_ParentsMap;
CUtlVector< CUtlVector<PSysRelativeInfo_t> > m_ChildrenMap;
};
//-----------------------------------------------------------------------------
// Particle picker panel
//-----------------------------------------------------------------------------
class CParticlePicker : public CBaseAssetPicker
{
DECLARE_CLASS_SIMPLE( CParticlePicker, CBaseAssetPicker );
public:
CParticlePicker( vgui::Panel *pParent );
~CParticlePicker();
virtual void PerformLayout();
virtual void OnMousePressed(vgui::MouseCode code);
void GetSelectedParticleSysName( char *pBuffer, int nMaxLen );
void SelectParticleSys( const char *pRelativePath );
// asset cache interface
virtual int GetAssetCount();
virtual const char *GetAssetName( int nAssetIndex );
virtual const CachedAssetInfo_t& GetCachedAsset( int nAssetIndex );
virtual int GetCachedAssetCount();
virtual bool IncrementalCacheAssets( float flTimeAllowed ); // return true if finished
virtual bool BeginCacheAssets( bool bForceRecache ); // return true if finished
virtual CUtlString GetSelectedAssetFullPath( int nIndex );
protected:
virtual void OnAssetListChanged( );
private:
MESSAGE_FUNC_PARAMS( OnAssetSelected, "AssetSelected", params );
MESSAGE_FUNC( OnParticleSystemSelectionChanged, "ParticleSystemSelectionChanged" );
MESSAGE_FUNC_CHARPTR( OnParticleSystemPicked, "ParticleSystemPicked", SystemName );
virtual void OnSelectedAssetPicked( const char *pParticleSysName );
void CachePCFInfo( int nModIndex, const char *pFileName );
void HandleModParticles( int nModIndex );
vgui::Splitter* m_pFileBrowserSplitter;
CParticleSnapshotGrid *m_pSnapshotGrid;
friend class CParticlePickerFrame;
};
//-----------------------------------------------------------------------------
// Purpose: Main app window
//-----------------------------------------------------------------------------
class CParticlePickerFrame : public CBaseAssetPickerFrame
{
DECLARE_CLASS_SIMPLE( CParticlePickerFrame, CBaseAssetPickerFrame );
public:
CParticlePickerFrame( vgui::Panel *pParent, const char *pTitle );
virtual ~CParticlePickerFrame();
// Allows external apps to select a MDL
void SelectParticleSys( const char *pRelativePath );
};
#endif // MDLPICKER_H

View File

@@ -0,0 +1,133 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose: An arbitrary picker
//
//=============================================================================
#ifndef PICKER_H
#define PICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/Frame.h"
#include "tier1/utlstring.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Panel;
}
//-----------------------------------------------------------------------------
// List of strings to appear in the picker
//-----------------------------------------------------------------------------
enum PickerChoiceType_t
{
PICKER_CHOICE_STRING = 0,
PICKER_CHOICE_PTR,
};
struct PickerInfo_t
{
const char *m_pChoiceString; // This is what displays in the dialog
union
{
const char *m_pChoiceValue;
void *m_pChoiceValuePtr;
};
};
struct PickerList_t
{
PickerList_t() : m_Type( PICKER_CHOICE_STRING ) {}
PickerList_t( int nGrowSize, int nInitSize ) : m_Choices( nGrowSize, nInitSize ), m_Type( PICKER_CHOICE_STRING ) {}
int Count() const { return m_Choices.Count(); }
PickerInfo_t& operator[]( int i ) { return m_Choices[i]; }
const PickerInfo_t& operator[]( int i ) const { return m_Choices[i]; }
int AddToTail() { return m_Choices.AddToTail(); }
void RemoveAll() { return m_Choices.RemoveAll(); }
PickerChoiceType_t m_Type;
CUtlVector< PickerInfo_t > m_Choices;
};
//-----------------------------------------------------------------------------
// Purpose: Base class for choosing raw assets
//-----------------------------------------------------------------------------
class CPicker : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CPicker, vgui::EditablePanel );
public:
CPicker( vgui::Panel *pParent, const char *pColumnHeader, const char *pTextType );
~CPicker();
// Sets the list of strings to display
void SetStringList( const PickerList_t &list );
// Purpose:
virtual void OnKeyCodeTyped( vgui::KeyCode code );
// Returns the selected string
PickerChoiceType_t GetSelectionType() const;
const char *GetSelectedString( ) const;
void *GetSelectedPtr( ) const;
// Returns the index of the selected string
int GetSelectedIndex();
private:
void RefreshChoiceList( );
MESSAGE_FUNC( OnTextChanged, "TextChanged" );
vgui::TextEntry *m_pFilterList;
vgui::ListPanel *m_pPickerBrowser;
CUtlString m_Filter;
const char *m_pPickerType;
const char *m_pPickerTextType;
const char *m_pPickerExt;
const char *m_pPickerSubDir;
PickerChoiceType_t m_Type;
friend class CPickerFrame;
};
//-----------------------------------------------------------------------------
// Purpose: Modal dialog for picker
//-----------------------------------------------------------------------------
class CPickerFrame : public vgui::Frame
{
DECLARE_CLASS_SIMPLE( CPickerFrame, vgui::Frame );
public:
CPickerFrame( vgui::Panel *pParent, const char *pTitle, const char *pColumnHeader, const char *pTextType );
~CPickerFrame();
// Inherited from Frame
virtual void OnCommand( const char *pCommand );
// Purpose: Activate the dialog
// The message "Picked" will be sent if something is picked.
// You can pass in keyvalues to get added to the message also.
void DoModal( const PickerList_t &list, KeyValues *pContextKeyValues = NULL );
private:
void CleanUpMessage();
CPicker *m_pPicker;
vgui::Button *m_pOpenButton;
vgui::Button *m_pCancelButton;
KeyValues *m_pContextKeyValues;
};
#endif // PICKER_H

View File

@@ -0,0 +1,187 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef POTTERYWHEELPANEL_H
#define POTTERYWHEELPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/EditablePanel.h"
#include "materialsystem/MaterialSystemUtil.h"
#include "mathlib/camera.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class IManipulator;
class CPotteryWheelManip;
class CBaseManipulator;
class CTransformManipulator;
class CRotationManipulator;
class CTranslationManipulator;
class CZoomManipulator;
class CDmxElement;
namespace vgui
{
class IScheme;
}
//-----------------------------------------------------------------------------
// Pottery wheel Panel
//-----------------------------------------------------------------------------
class CPotteryWheelPanel : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CPotteryWheelPanel, vgui::EditablePanel );
public:
// constructor, destructor
CPotteryWheelPanel( vgui::Panel *pParent, const char *pName );
virtual ~CPotteryWheelPanel();
// Overriden methods of vgui::Panel
virtual void Paint();
virtual void RenderCapture();
virtual void OnKeyCodePressed ( vgui::KeyCode code );
virtual void OnKeyCodeReleased( vgui::KeyCode code );
virtual void OnMousePressed ( vgui::MouseCode code );
virtual void OnMouseDoublePressed( vgui::MouseCode code );
virtual void OnMouseReleased( vgui::MouseCode code );
virtual void OnCursorMoved( int x, int y );
virtual void OnMouseWheeled( int delta );
virtual void OnTick();
virtual void OnMouseCaptureLost();
// Sets the camera to look at the the thing we're spinning around
void LookAt( const Vector &vecCenter, float flRadius );
void LookAt( float flRadius );
void ComputePanelPosition( const Vector &vecPosition, Vector2D *pPanelPos );
void SetBackgroundColor( int r, int g, int b );
void SetBackgroundColor( const Color& c );
const Color& GetBackgroundColor() const;
void SetGridColor( int r, int g, int b );
// Light probe
void SetLightProbe( CDmxElement *pLightProbe );
// Simple light controls
void ClearDirectionalLights();
void AddDirectionalLight( const Color& color, const Vector& direction );
void UpdateDirectionalLight( int idx, const Color& color, const Vector& direction );
void SetLightAmbient( const Vector& ambient );
// Camera.
int GetCameraFOV( void );
void SetCameraFOV( float flFOV );
void SetCameraPositionAndAngles( const Vector &vecPos, const QAngle &angDir );
void GetCameraPositionAndAngles( Vector &vecPos, QAngle &angDir );
void SetCameraOffset( const Vector &vecOffset );
void GetCameraOffset( Vector &vecOffset );
void ResetCameraPivot( void );
void ComputeCameraTransform( matrix3x4_t *pWorldToCamera );
void UpdateCameraTransform();
virtual void ResetView();
// Allow the parent to be notified of mouse actions
void SetParentMouseNotify( bool bParentMouseNotify );
void EnableRenderingWithFlashlight( void *pvConfiguration );
void * GetRenderingWithFlashlightConfiguration() const { return m_pvRenderingWithFlashlightConfiguration; }
void SetSetupRenderStateDelayed( bool bDeferred ) { m_bSetupRenderStateDelayed = bDeferred; }
void SetupRenderStateDelayed( ) { if ( m_bSetupRenderStateDelayed ) SetupRenderState( m_nRenderWidth, m_nRenderHeight ); }
void SetRender3DSupersampled( bool bSupersampled ) { m_bRender3DSupersampled = bSupersampled; }
protected:
// Inherited classes must implement this
virtual void OnPaint3D() = 0;
bool IsPaint3dForRenderCapture() const { return m_bInRender3dForRenderCapture; }
protected:
enum ManipulationMode_t
{
CAMERA_ROTATE,
CAMERA_TRANSLATE,
CAMERA_ZOOM,
LIGHT_MODE,
};
virtual void EnterManipulationMode( ManipulationMode_t manipMode, bool bMouseCapture = true, vgui::MouseCode mouseCode = vgui::MouseCode( -1 ) );
void Select();
void AcceptManipulation( bool bReleaseMouseCapture = true );
void CancelManipulation();
void EnableMouseCapture( bool enable, vgui::MouseCode code = vgui::MouseCode( -1 ) );
bool WarpMouse( int &x, int &y );
void CreateDefaultLights();
MaterialLightingState_t m_LightingState;
matrix3x4_t m_LightToWorld[MATERIAL_MAX_LIGHT_COUNT];
IManipulator *m_pCurrentManip;
int m_nManipStartX, m_nManipStartY;
bool HasLightProbe() const;
ITexture *GetLightProbeCubemap( bool bHDR );
void DrawGrid();
IMaterial *GetWireframeMaterial();
Camera_t & GetCameraSettings() { return m_Camera; }
private:
void SetupRenderState( int nDisplayWidth, int nDisplayHeight );
void DestroyLights();
CMaterialReference m_Wireframe;
CMaterialReference m_LightProbeBackground;
CMaterialReference m_LightProbeHDRBackground;
CTextureReference m_LightProbeCubemap;
CTextureReference m_LightProbeHDRCubemap;
Camera_t m_Camera;
matrix3x4_t m_CameraPivot;
Color m_ClearColor;
Color m_GridColor;
Vector m_vecCameraOffset;
CRotationManipulator *m_pCameraRotate;
CTranslationManipulator *m_pCameraTranslate;
CZoomManipulator *m_pCameraZoom;
CPotteryWheelManip *m_pLightManip;
vgui::MouseCode m_nCaptureMouseCode;
int m_xoffset, m_yoffset;
bool m_bHasLightProbe : 1;
bool m_bParentMouseNotify : 1;
bool m_bSetupRenderStateDelayed : 1;
bool m_bRender3DSupersampled : 1;
bool m_bInRender3dForRenderCapture : 1;
void * m_pvRenderingWithFlashlightConfiguration;
int m_nRenderWidth, m_nRenderHeight;
CPanelAnimationVar( bool, m_bUseParentBG, "useparentbg", "0" );
};
#endif // SIMPLEPOTTERYWHEELPANEL_H

View File

@@ -0,0 +1,92 @@
//====== Copyright © 1996-2003, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef PROCEDURALTEXTUREPANEL_H
#define PROCEDURALTEXTUREPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "materialsystem/itexture.h"
#include "materialsystem/MaterialSystemUtil.h"
#include "vgui_controls/EditablePanel.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
struct BGRA8888_t;
//-----------------------------------------------------------------------------
//
// Procedural texture image panel
//
//-----------------------------------------------------------------------------
class CProceduralTexturePanel : public vgui::EditablePanel, public ITextureRegenerator
{
DECLARE_CLASS_SIMPLE( CProceduralTexturePanel, vgui::EditablePanel );
public:
// constructor
CProceduralTexturePanel( vgui::Panel *pParent, const char *pName );
~CProceduralTexturePanel();
// Methods of ITextureRegenerator
virtual void Release() {}
virtual void RegenerateTextureBits( ITexture *pTexture, IVTFTexture *pVTFTexture, Rect_t *pRect );
// initialization, shutdown
virtual bool Init( int nWidth, int nHeight, bool bAllocateImageBuffer );
virtual void Shutdown();
// Returns the image buffer + dimensions
BGRA8888_t *GetImageBuffer();
int GetImageWidth() const;
int GetImageHeight() const;
// Redownloads the procedural texture
void DownloadTexture();
// Sets the rectangle to paint. Use null to fill the entire panel
void SetPaintRect( const Rect_t *pPaintRect = NULL );
// Sets the texcoords to use with the procedural texture
void SetTextureSubRect( const Rect_t &subRect );
// Maintain proportions when drawing
void MaintainProportions( bool bEnable );
virtual void Paint( void );
virtual void PaintBackground( void ) {}
private:
void CleanUp();
protected:
// Image buffer
BGRA8888_t *m_pImageBuffer;
int m_nWidth;
int m_nHeight;
// Paint rectangle
Rect_t m_PaintRect;
// Texture coordinate rectangle
Rect_t m_TextureSubRect;
CTextureReference m_ProceduralTexture;
CMaterialReference m_ProceduralMaterial;
int m_nTextureID;
bool m_bMaintainProportions;
bool m_bUsePaintRect;
};
#endif // PROCEDURALTEXTUREPANEL_H

View File

@@ -0,0 +1,178 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef SEQUENCEPICKER_H
#define SEQUENCEPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/utlstring.h"
#include "vgui_controls/Frame.h"
#include "vgui_controls/EditablePanel.h"
#include "vgui_controls/ImageList.h"
#include "datacache/imdlcache.h"
#include "matsys_controls/mdlpanel.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
namespace vgui
{
class Splitter;
}
//-----------------------------------------------------------------------------
// Purpose: Sequence picker panel
//-----------------------------------------------------------------------------
class CSequencePicker : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CSequencePicker, vgui::EditablePanel );
public:
enum PickType_t
{
PICK_NONE = 0,
PICK_SEQUENCES = 0x1,
PICK_ACTIVITIES = 0x2,
PICK_ALL = PICK_SEQUENCES | PICK_ACTIVITIES,
PICK_SEQUENCE_PARAMETERS = 0x10,
};
static const int NUM_POSE_CONTROLS = 6;
static const int NUM_SEQUENCE_LAYERS = 4;
// Flags come from PickType_t
CSequencePicker( vgui::Panel *pParent, int nFlags = PICK_ALL );
~CSequencePicker();
// overridden frame functions
virtual void PerformLayout();
// Process command messages
virtual void OnCommand( const char *pCommand );
// Sets the MDL to preview sequences for
void SetMDL( const char *pMDLName );
// Gets the selected activity/sequence
PickType_t GetSelectedSequenceType();
const char *GetSelectedSequenceName( );
// Get the array of pose parameter values
void GetPoseParameters( CUtlVector< float > &poseParameters ) const;
// Get the array of sequence layers
void GetSeqenceLayers( CUtlVector< MDLSquenceLayer_t > &sequenceLayers ) const;
// Get the root motion generation state
bool GetGenerateRootMotion() const;
private:
MESSAGE_FUNC_PARAMS( OnSliderMoved, "SliderMoved", pData );
MESSAGE_FUNC_PARAMS( OnTextKillFocus, "TextKillFocus", pData );
MESSAGE_FUNC_PARAMS( OnTextNewLine, "TextNewLine", pData );
MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", pData );
MESSAGE_FUNC_PARAMS( OnItemSelected, "ItemSelected", kv );
MESSAGE_FUNC( OnPageChanged, "PageChanged" );
void RefreshActivitiesAndSequencesList();
// Plays the selected activity
void PlayActivity( const char *pActivityName );
// Update the controls and plays the selected sequence
void UpdateActiveSequence( const char *pSequenceName );
// Find the index of the sequence with the specified name
int FindSequence( const char *pSequenceName ) const;
// Update the set of available pose parameters
void UpdateAvailablePoseParmeters();
// Update the value of the specified control control group
void SetPoseParameterValue( float flPoseParameterValue, int nParameterIndex );
// Set all pose parameters to their default values
void ResetPoseParametersToDefault();
// Update the pose parameter controls using the stored pose parameter values
void UpdatePoseControlsFromParameters();
// Update the pose parameter controls to match the set of pose parameters for the current mdl
void UpdatePoseParameterControlsForMdl();
// Update the sequence and weighting of the specified layer
void SetSequenceLayer( int nLayerIndex, int nSequenceIndex, float flWeight );
// Update the sequence layer controls to match the current layer data set
void UpdateLayerControls();
// Clear all the layer information and update the controls
void ResetLayers();
CMDLPanel *m_pMDLPreview;
vgui::Splitter *m_pPreviewSplitter;
vgui::PropertySheet *m_pViewsSheet;
vgui::PropertyPage *m_pSequencesPage;
vgui::PropertyPage *m_pActivitiesPage;
vgui::ListPanel *m_pSequencesList;
vgui::ListPanel *m_pActivitiesList;
vgui::ComboBox *m_pLayerSequenceSelectors[ NUM_SEQUENCE_LAYERS ];
vgui::Slider *m_pLayerSequenceSliders[ NUM_SEQUENCE_LAYERS ];
vgui::CheckButton *m_pRootMotionCheckBox;
vgui::Button *m_pPoseDefaultButton;
vgui::Slider *m_pPoseValueSliders[ NUM_POSE_CONTROLS ];
vgui::TextEntry *m_pPoseValueEntries[ NUM_POSE_CONTROLS ];
vgui::ComboBox *m_pPoseParameterName[ NUM_POSE_CONTROLS ];
MDLSquenceLayer_t m_SequenceLayers[ NUM_SEQUENCE_LAYERS ];
int m_PoseControlMap[ NUM_POSE_CONTROLS ]; // Provides index of pose parameter driven by each control
float m_PoseParameters[ MAXSTUDIOPOSEPARAM ]; // Array of pose parameter values to be used when rendering the mdl
bool m_bSequenceParams;
MDLHandle_t m_hSelectedMDL;
CUtlString m_Filter;
friend class CSequencePickerFrame;
};
//-----------------------------------------------------------------------------
// Purpose: Main app window
//-----------------------------------------------------------------------------
class CSequencePickerFrame : public vgui::Frame
{
DECLARE_CLASS_SIMPLE( CSequencePickerFrame, vgui::Frame );
public:
CSequencePickerFrame( vgui::Panel *pParent, int nFlags );
// Inherited from Frame
virtual void OnCommand( const char *pCommand );
// Purpose: Activate the dialog
void DoModal( const char *pMDLName );
private:
MESSAGE_FUNC_PARAMS( OnSequencePreviewChanged, "SequencePreviewChanged", kv );
CSequencePicker *m_pPicker;
vgui::Button *m_pOpenButton;
vgui::Button *m_pCancelButton;
};
#endif // SEQUENCEPICKER_H

View File

@@ -0,0 +1,66 @@
//======= Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ======
//
// CSheetSequencePanel - Panel for selecting one sequence from a sprite sheet
//
//===============================================================================
#ifndef SHEETSEQUENCEPANEL_H
#define SHEETSEQUENCEPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui/MouseCode.h"
#include "vgui_controls/Menu.h"
#include "materialsystem/MaterialSystemUtil.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CSheetExtended;
namespace vgui
{
class Menu;
}
//-----------------------------------------------------------------------------
class CSheetSequencePanel : public vgui::Menu
{
DECLARE_CLASS_SIMPLE( CSheetSequencePanel, vgui::Menu );
public:
CSheetSequencePanel( vgui::Panel *parent, const char *panelName );
virtual ~CSheetSequencePanel();
virtual void Paint();
virtual void PerformLayout();
virtual void OnCursorMoved(int x, int y);
virtual void OnCursorExited();
virtual void OnMouseReleased( vgui::MouseCode mouseCode );
void SetFromMaterial( IMaterial* pMaterial );
void SetFromMaterialName( const char* pMaterialName );
void SetSecondSequenceView( bool bIsSecondSequenceView );
private:
int SequenceGridCount();
int SequenceGridRows();
int SequenceGridSquareSize();
void PrepareMaterials();
CSheetExtended* m_pSheet;
CMaterialReference m_Material;
int m_nHighlightedSequence;
bool m_bSeparateAlphaColorMaterial;
bool m_bIsSecondSequenceView;
static void EnsureMaterialsExist();
static bool m_sMaterialsInitialized;
static CMaterialReference m_sColorMat;
static CMaterialReference m_sAlphaMat;
};
#endif // VMTPICKER_H

View File

@@ -0,0 +1,59 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef TGAPICKER_H
#define TGAPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/baseassetpicker.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CTGAPreviewPanel;
namespace vgui
{
class Splitter;
}
//-----------------------------------------------------------------------------
// Purpose: Base class for choosing raw assets
//-----------------------------------------------------------------------------
class CTGAPicker : public CBaseAssetPicker
{
DECLARE_CLASS_SIMPLE( CTGAPicker, CBaseAssetPicker );
public:
CTGAPicker( vgui::Panel *pParent );
virtual ~CTGAPicker();
private:
// Derived classes have this called when the previewed asset changes
virtual void OnSelectedAssetPicked( const char *pAssetName );
CTGAPreviewPanel *m_pTGAPreview;
vgui::Splitter *m_pPreviewSplitter;
};
//-----------------------------------------------------------------------------
// Purpose: Modal dialog for asset picker
//-----------------------------------------------------------------------------
class CTGAPickerFrame : public CBaseAssetPickerFrame
{
DECLARE_CLASS_SIMPLE( CTGAPickerFrame, CBaseAssetPickerFrame );
public:
CTGAPickerFrame( vgui::Panel *pParent, const char *pTitle );
};
#endif // TGAPICKER_H

View File

@@ -0,0 +1,41 @@
//====== Copyright © 1996-2003, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef TGAPREVIEWPANEL_H
#define TGAPREVIEWPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/proceduraltexturepanel.h"
#include "tier1/utlstring.h"
//-----------------------------------------------------------------------------
//
// TGA Preview panel
//
//-----------------------------------------------------------------------------
class CTGAPreviewPanel : public CProceduralTexturePanel
{
DECLARE_CLASS_SIMPLE( CTGAPreviewPanel, CProceduralTexturePanel );
public:
// constructor
CTGAPreviewPanel( vgui::Panel *pParent, const char *pName );
void SetTGA( const char *pFullPath );
const char *GetTGA() const;
virtual void PerformLayout();
private:
CUtlString m_TGAName;
};
#endif // TGAPREVIEWPANEL_H

View File

@@ -0,0 +1,91 @@
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $NoKeywords: $
//===========================================================================//
#ifndef VMTPANEL_H
#define VMTPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/potterywheelpanel.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class IMaterial;
class CMeshBuilder;
class Vector;
namespace vgui
{
class ScrollBar;
class IScheme;
}
//-----------------------------------------------------------------------------
// Material Viewer Panel
//-----------------------------------------------------------------------------
class CVMTPanel : public CPotteryWheelPanel
{
DECLARE_CLASS_SIMPLE( CVMTPanel, CPotteryWheelPanel );
public:
// constructor, destructor
CVMTPanel( vgui::Panel *pParent, const char *pName );
virtual ~CVMTPanel();
// Set the material to draw
void SetMaterial( IMaterial *pMaterial );
// Set rendering mode (stretch to full screen, or use actual size)
void RenderUsingActualSize( bool bEnable );
// performs the layout
virtual void PerformLayout();
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
private:
// paint it stretched to the window size
void DrawStretchedToPanel( CMeshBuilder &meshBuilder );
// paint it actual size
void DrawActualSize( CMeshBuilder &meshBuilder );
// Draw it on a sphere
void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi );
// paint it!
virtual void OnPaint3D();
private:
// The material to draw
IMaterial *m_pMaterial;
// A texture to use for a lightmap
CTextureReference m_pLightmapTexture;
// The default env_cubemap
CTextureReference m_DefaultEnvCubemap;
// Are we using actual size or not?
bool m_bUseActualSize;
// Scroll bars
vgui::ScrollBar *m_pHorizontalBar;
vgui::ScrollBar *m_pVerticalBar;
// The viewable size
int m_iViewableWidth;
int m_iViewableHeight;
};
#endif // VMTPANEL_H

View File

@@ -0,0 +1,116 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef VMTPICKER_H
#define VMTPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/baseassetpicker.h"
#include "materialsystem/MaterialSystemUtil.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CVMTPreviewPanel;
class CSheetExtended;
class CVMTSequenceMenuButton;
class CVMTPicker;
class CVMTPreviewToolbar;
class CSheetSequencePanel;
namespace vgui
{
class Splitter;
class CheckButton;
class Slider;
class Panel;
}
//-----------------------------------------------------------------------------
class CVMTPreviewToolbar : public vgui::EditablePanel
{
DECLARE_CLASS_SIMPLE( CVMTPreviewToolbar, EditablePanel );
public:
CVMTPreviewToolbar( vgui::Panel *parent, const char *panelName, CVMTPicker *parentpicker );
void PopulateSequenceMenu( vgui::Menu *menu );
int GetSequenceMenuItemCount( );
void UpdateToolbarGUI();
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
MESSAGE_FUNC_PARAMS( OnSliderMoved, "SliderMoved", pData );
MESSAGE_FUNC_INT( OnSelectSequence, "OnSelectSequence", nSequenceNumber );
MESSAGE_FUNC( OnNextSequence, "OnNextSequence" );
MESSAGE_FUNC( OnPrevSequence, "OnPrevSequence" );
MESSAGE_FUNC_PARAMS( OnSheetSequenceSelected, "SheetSequenceSelected", pData );
private:
vgui::Slider *m_pSheetPreviewSpeed;
CVMTPicker *m_pParentPicker;
vgui::Button *m_pNextSeqButton;
vgui::Button *m_pPrevSeqButton;
vgui::MenuButton *m_pSequenceSelection;
vgui::MenuButton *m_pSequenceSelection_Second;
CSheetSequencePanel *m_pSheetPanel;
CSheetSequencePanel *m_pSheetPanel_Second;
};
//-----------------------------------------------------------------------------
// Purpose: Base class for choosing raw assets
//-----------------------------------------------------------------------------
class CVMTPicker : public CBaseAssetPicker
{
DECLARE_CLASS_SIMPLE( CVMTPicker, CBaseAssetPicker );
public:
CVMTPicker( vgui::Panel *pParent, bool bAllowMultiselect = false );
virtual ~CVMTPicker();
virtual void CustomizeSelectionMessage( KeyValues *pKeyValues );
void SetSheetPreviewSpeed( float flPreviewSpeed );
void SetSelectedSequence( int nSequence );
void SetSelectedSecondarySequence( int nSequence );
int GetSheetSequenceCount();
int GetCurrentSequence();
int GetCurrentSecondarySequence();
int GetRealSequenceNumber();
CSheetExtended* GetSheet();
IMaterial* GetMaterial();
private:
// Derived classes have this called when the previewed asset changes
virtual void OnSelectedAssetPicked( const char *pAssetName );
CVMTPreviewPanel *m_pVMTPreview2D;
CVMTPreviewPanel *m_pVMTPreview3D;
vgui::Splitter *m_p2D3DSplitter;
vgui::Splitter *m_pPreviewSplitter;
CVMTPreviewToolbar *m_pVMTPreviewToolbar;
};
//-----------------------------------------------------------------------------
// Purpose: Modal dialog for asset picker
//-----------------------------------------------------------------------------
class CVMTPickerFrame : public CBaseAssetPickerFrame
{
DECLARE_CLASS_SIMPLE( CVMTPickerFrame, CBaseAssetPickerFrame );
public:
CVMTPickerFrame( vgui::Panel *pParent, const char *pTitle, bool bAllowMultiselect = false );
};
#endif // VMTPICKER_H

View File

@@ -0,0 +1,101 @@
//====== Copyright © 1996-2003, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef VMTPREVIEWPANEL_H
#define VMTPREVIEWPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/Panel.h"
#include "tier1/utlstring.h"
#include "materialsystem/MaterialSystemUtil.h"
#include "mathlib/vector.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CSheetExtended;
//-----------------------------------------------------------------------------
//
// VMT Preview panel
//
//-----------------------------------------------------------------------------
class CVMTPreviewPanel : public vgui::Panel
{
DECLARE_CLASS_SIMPLE( CVMTPreviewPanel, vgui::Panel );
public:
// constructor
CVMTPreviewPanel( vgui::Panel *pParent, const char *pName );
void SetVMT( const char *pMaterialName );
const char *GetVMT() const;
CSheetExtended* GetSheet();
IMaterial* GetMaterial();
bool VMTUsesSheets();
int GetSheetSequenceCount();
int GetCurrentSequence();
int GetCurrentSecondarySequence();
int GetRealSequenceNumber();
void SetSheetSequence( int nSequence );
void SetSecondarySheetSequence( int nSequence );
// Paints the texture
virtual void Paint( void );
// View it in 3D or 2D mode
void DrawIn3DMode( bool b3DMode );
void SetSheetPreviewSpeed( float flPreviewSpeed );
private:
// Two different preview methods
void DrawSphere( void );
void DrawRectangle( void );
// Set up a projection matrix for a 90 degree fov
void SetupProjectionMatrix( int nWidth, int nHeight );
void SetupOrthoMatrix( int nWidth, int nHeight );
// Sets the camera to look at the the thing we're spinning around
void LookAt( const Vector &vecLookAt, float flRadius );
// Sets up lighting state
void SetupLightingState();
// Draw a sphere
void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi );
// Draw sprite-card based materials
void RenderSheet( const Vector &vCenter, float flRadius );
CUtlString m_VMTName;
CMaterialReference m_Material;
CSheetExtended* m_pMaterialSheet;
CTextureReference m_pLightmapTexture;
CTextureReference m_DefaultEnvCubemap;
Vector m_LightDirection;
Color m_LightColor;
float m_flLightIntensity;
Vector m_vecCameraDirection;
float m_flLastRotationTime;
bool m_bDrawIn3DMode;
float m_flLastSwitchTime;
float m_flSheetPreviewSpeed;
int m_nCurrentSheetSequence;
int m_nCurrentSecondarySheetSequence;
};
#endif // VMTPREVIEWPANEL_H

View File

@@ -0,0 +1,59 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef VTFPICKER_H
#define VTFPICKER_H
#ifdef _WIN32
#pragma once
#endif
#include "matsys_controls/baseassetpicker.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CVTFPreviewPanel;
namespace vgui
{
class Splitter;
}
//-----------------------------------------------------------------------------
// Purpose: Base class for choosing raw assets
//-----------------------------------------------------------------------------
class CVTFPicker : public CBaseAssetPicker
{
DECLARE_CLASS_SIMPLE( CVTFPicker, CBaseAssetPicker );
public:
CVTFPicker( vgui::Panel *pParent );
virtual ~CVTFPicker();
private:
// Derived classes have this called when the previewed asset changes
virtual void OnSelectedAssetPicked( const char *pAssetName );
CVTFPreviewPanel *m_pVTFPreview;
vgui::Splitter *m_pPreviewSplitter;
};
//-----------------------------------------------------------------------------
// Purpose: Modal dialog for asset picker
//-----------------------------------------------------------------------------
class CVTFPickerFrame : public CBaseAssetPickerFrame
{
DECLARE_CLASS_SIMPLE( CVTFPickerFrame, CBaseAssetPickerFrame );
public:
CVTFPickerFrame( vgui::Panel *pParent, const char *pTitle );
};
#endif // VTFPICKER_H

View File

@@ -0,0 +1,72 @@
//====== Copyright © 1996-2003, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef VTFPREVIEWPANEL_H
#define VTFPREVIEWPANEL_H
#ifdef _WIN32
#pragma once
#endif
#include "vgui_controls/Panel.h"
#include "tier1/utlstring.h"
#include "materialsystem/MaterialSystemUtil.h"
#include "mathlib/vector.h"
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//
// VTF Preview panel
//
//-----------------------------------------------------------------------------
class CVTFPreviewPanel : public vgui::Panel
{
DECLARE_CLASS_SIMPLE( CVTFPreviewPanel, vgui::Panel );
public:
// constructor
CVTFPreviewPanel( vgui::Panel *pParent, const char *pName );
void SetVTF( const char *pFullPath, bool bLoadImmediately = true );
void SetTwoVTFs( const char *pFullPath, const char *pSecondFullPath );
const char *GetVTF() const;
const char *GetSecondVTF() const;
// Paints the texture
virtual void Paint( void );
private:
void PaintNormalMapTexture( void );
void PaintCubeTexture( void );
void PaintStandardTexture( void );
void PaintVolumeTexture( void );
// Set up a projection matrix for a 90 degree fov
void SetupProjectionMatrix( int nWidth, int nHeight );
// Sets the camera to look at the the thing we're spinning around
void LookAt( const Vector &vecLookAt, float flRadius );
// Draw a sphere
void RenderSphere( const Vector &vCenter, float flRadius, int nTheta, int nPhi );
CUtlString m_VTFName;
CUtlString m_SecondVTFName;
CTextureReference m_PreviewTexture;
CTextureReference m_SecondPreviewTexture;
CMaterialReference m_PreviewMaterial;
int m_nTextureID;
Vector m_vecCameraDirection;
float m_flLastRotationTime;
};
#endif // VTFPREVIEWPANEL_H