diff options
| author | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
|---|---|---|
| committer | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
| commit | 55ed12f8d1eb6887d348be03aee5573d44177ffb (patch) | |
| tree | 3686f7ca78c780cd9a3d367b79a9d9250c1be7c0 /mp/src/public/materialsystem | |
| parent | * Added support for Visual C++ 2013 Express to VPC (diff) | |
| download | source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.tar.xz source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.zip | |
Updated the SDK with the latest code from the TF and HL2 branches.
Diffstat (limited to 'mp/src/public/materialsystem')
| -rw-r--r-- | mp/src/public/materialsystem/hardwaretexels.h | 87 | ||||
| -rw-r--r-- | mp/src/public/materialsystem/imaterialsystem.h | 4 | ||||
| -rw-r--r-- | mp/src/public/materialsystem/imesh.h | 2 |
3 files changed, 93 insertions, 0 deletions
diff --git a/mp/src/public/materialsystem/hardwaretexels.h b/mp/src/public/materialsystem/hardwaretexels.h new file mode 100644 index 00000000..0821b41b --- /dev/null +++ b/mp/src/public/materialsystem/hardwaretexels.h @@ -0,0 +1,87 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Hardware Texels +// +// Contains texture data that was encoded with the map. The initial use case +// is for per-texel lightmaps to allow static props to match the lighting +// of the surrounding BSP geometry. +// +//=============================================================================// + +#ifndef HARDWARETEXELS_H +#define HARDWARETEXELS_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "bitmap/imageformat.h" +#include "datamap.h" + +// valve hardware texels +#define VHT_VERSION 0 + +namespace HardwareTexels +{ +#pragma pack(1) + +// ------------------------------------------------------------------------------------------------ +struct MeshHeader_t +{ + DECLARE_BYTESWAP_DATADESC(); + + // this mesh is part of this lod + unsigned int m_nLod; + + // starting at this offset + unsigned int m_nOffset; + + // this mesh consumes this many bytes + unsigned int m_nBytes; + + // with this width and height + unsigned int m_nWidth; + unsigned int m_nHeight; + + unsigned int m_nUnused[3]; +}; + +// ------------------------------------------------------------------------------------------------ +struct FileHeader_t +{ + DECLARE_BYTESWAP_DATADESC(); + + // file version as defined by VHV_VERSION + int m_nVersion; + + // must match checkSum in the .mdl header + unsigned int m_nChecksum; + + // all texels are encoded in the same format + // This is a value from ImageFormat. + unsigned int m_nTexelFormat; + + // Number of meshes + int m_nMeshes; + + inline MeshHeader_t *pMesh( int nMesh ) const + { + Assert(nMesh < m_nMeshes); + + return (MeshHeader_t *)(((byte *)this) + sizeof(FileHeader_t)) + nMesh; + }; + + inline void *pTexelBase( int nMesh ) const + { + return (void *)((byte *)this + pMesh( nMesh )->m_nOffset); + }; + + unsigned int m_nUnused[4]; +}; + +#pragma pack() + +}; // end namespace + +#endif // HARDWARETEXELS_H + diff --git a/mp/src/public/materialsystem/imaterialsystem.h b/mp/src/public/materialsystem/imaterialsystem.h index 812eb262..3f3563b6 100644 --- a/mp/src/public/materialsystem/imaterialsystem.h +++ b/mp/src/public/materialsystem/imaterialsystem.h @@ -1039,6 +1039,10 @@ public: // returns the display device name that matches the adapter index we were started with virtual char *GetDisplayDeviceName() const = 0; + + // creates a texture suitable for use with materials from a raw stream of bits. + // The bits will be retained by the material system and can be freed upon return. + virtual ITexture* CreateTextureFromBits(int w, int h, int mips, ImageFormat fmt, int srcBufferSize, byte* srcBits) = 0; }; diff --git a/mp/src/public/materialsystem/imesh.h b/mp/src/public/materialsystem/imesh.h index b71be4d9..3da443b4 100644 --- a/mp/src/public/materialsystem/imesh.h +++ b/mp/src/public/materialsystem/imesh.h @@ -3329,6 +3329,8 @@ inline void CMeshBuilder::ComputeNumVertsAndIndices( int *pMaxVertices, int *pMa break; default: + *pMaxVertices = 0; + *pMaxIndices = 0; Assert(0); } |