diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/vbsp/normals.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/vbsp/normals.cpp')
| -rw-r--r-- | utils/vbsp/normals.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/utils/vbsp/normals.cpp b/utils/vbsp/normals.cpp new file mode 100644 index 0000000..3a910cb --- /dev/null +++ b/utils/vbsp/normals.cpp @@ -0,0 +1,50 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#include "bsplib.h" +#include "vbsp.h" + + +void SaveVertexNormals( void ) +{ + int i, j; + dface_t *f; + texinfo_t *tex; + + + g_numvertnormalindices = 0; + g_numvertnormals = 0; + + for( i = 0 ;i<numfaces ; i++ ) + { + f = &dfaces[i]; + tex = &texinfo[f->texinfo]; + + for( j = 0; j < f->numedges; j++ ) + { + if( g_numvertnormalindices == MAX_MAP_VERTNORMALINDICES ) + { + Error( "g_numvertnormalindices == MAX_MAP_VERTNORMALINDICES (%d)", MAX_MAP_VERTNORMALINDICES ); + } + + g_vertnormalindices[g_numvertnormalindices] = g_numvertnormals; + g_numvertnormalindices++; + } + + // Add this face plane's normal. + // Note: this doesn't do an exhaustive vertex normal match because the vrad does it. + // The result is that a little extra memory is wasted coming out of vbsp, but it + // goes away after vrad. + if( g_numvertnormals == MAX_MAP_VERTNORMALS ) + { + Error( "g_numvertnormals == MAX_MAP_VERTNORMALS (%d)", MAX_MAP_VERTNORMALS ); + } + + g_vertnormals[g_numvertnormals] = dplanes[f->planenum].normal; + g_numvertnormals++; + } +} |